devops-exercises/topics/ansible/solutions/my_first_playbook.md
Anas TAYAA 2325b67a97
add file to 'Create the file /tmp/some_file' task (#272)
Co-authored-by: Anas Tayaa <SESA646124@se.com>
2022-08-10 18:17:51 +03:00

517 B

My first playbook - Solution

  1. vi first_playbook.yml
- name: Install zlib and create a file
  hosts: some_remote_host
  tasks:
    - name: Install zlib
      package:
        name: zlib
        state: present
      become: yes
    - name: Create the file /tmp/some_file
      file:
        path: '/tmp/some_file'
        state: touch
  1. First, edit the inventory file: vi /etc/ansible/hosts
[some_remote_host]
some.remoted.host.com

Run the playbook

ansible-playbook first_playbook.yml