---
# System prepended metadata

title: Ansible tasks

---

# Ansible tasks

```python
---
- name: Ansible usage exaple
  hosts: all
  become: yes
  tasks:
  
    - name: install packages
      become_user: root
      apt:
         name: accountsservice
         update_cache: yes
         
    - name: change localhost ip address alias
      replace:
        path: /etc/hosts
        regexp: 'localhost'
        replace: "localpc"
        
    - name: adding a line to the document
      lineinfile:
        path: /etc/hosts
        line: 192.168.1.99 remotehost
```