Ansible L1 Task1 : Troubleshoot and Create Ansible Playbook

thor@jumphost ~/ansible$ cat inventory
stapp03 ansible_host=172.16.238.12 ansible_user=banner ansible_ssh_common_args=‘-o StrictHostKeyChecking=no’
thor@jumphost ~/ansible$ cat playbook.yaml

  • name: Create empty file
    hosts: all
    become: yes
    tasks:
    • file:
      path: /tmp/file.txt
      state: touch

thor@jumphost ~/ansible$ ansible-playbook -i inventory playbook.yaml

PLAY [Create empty file] ****************************************************************

TASK [Gathering Facts] ******************************************************************
fatal: [stapp03]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: [email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).”, “unreachable”: true}

PLAY RECAP ******************************************************************************
stapp03 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

When I did it, it asked for App Server 3. Inventory looked like this:

stapp03 ansible_host=172.16.238.12 ansible_user=banner ansible_ssh_pass=BigGr33n  ansible_ssh_common_args='-o StrictHostKeyChecking=no'

To confirm this works, I did ansible -m ping stapp03; it pinged happily. The playbook then looks like this, similar to yours:

---

- hosts: stapp03
  tasks:
  - name: Creating an empty file
    file:
      path: "/tmp/file.txt"
      state: touch

This ran happily:

thor@jumphost ~/ansible$ ansible-playbook -i inventory playbook.yml

PLAY [stapp03] *****************************************************************

TASK [Gathering Facts] *********************************************************
ok: [stapp03]

TASK [Creating an empty file] **************************************************
changed: [stapp03]

PLAY RECAP *********************************************************************
stapp03                    : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Thanks. I think i know which step i was missing.