ISSUE: Level-1 Ansible Task-1

ISSUE: Level-1 Ansible Task-1.

even after giving the correct inventory, the task is still shows below error

  • host ‘stapp01’ is not added correctly in ‘/home/thor/ansible/inventory’ file on Jump Server

Please provide the ansible inventory file.

Hi @al1, Did you get the solution for this issue and were you able to complete the task.
I am in the same boat and not able to complete the task, tried multiple times and same issue.
Here is my work, please let me know if this is working for you. I am not able to Submit for Review the task.

My Solution:

vi inventory

stapp01 ansible_host=172.16.238.10 ansible_user=tony ansible_ssh_pass=Ir0nM@n ansible_ssh_common_args=‘-o StrictHostKeyChecking=no’

vi 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] *********************************************************
ok: [stapp01]

TASK [file] ********************************************************************
changed: [stapp01]

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

thor@jumphost ~/ansible$ ansible all -i inventory -m shell -a ‘ls -lrta /tmp/’
stapp01 | CHANGED | rc=0 >>
total 36
drwxr-xr-x 1 root root 4096 Aug 27 13:30 …
drwxrwxrwt 2 root root 4096 Aug 27 13:30 .font-unix
drwxrwxrwt 2 root root 4096 Aug 27 13:30 .XIM-unix
drwxrwxrwt 2 root root 4096 Aug 27 13:30 .X11-unix
drwxrwxrwt 2 root root 4096 Aug 27 13:30 .ICE-unix
drwx------ 3 root root 4096 Aug 27 13:30 systemd-private-217e4c503c23458c80725d6897d79668-systemd-logind.service-rsXqho
drwx------ 3 root root 4096 Aug 27 13:30 systemd-private-217e4c503c23458c80725d6897d79668-dbus-broker.service-XbTbHX
-rw-r–r-- 1 root root 0 Aug 27 13:34 file.txt
drwx------ 2 tony tony 4096 Aug 27 13:34 ansible_ansible.legacy.command_payload_ld2oeotv
drwxrwxrwt 1 root root 4096 Aug 27 13:34 .

After Submitting, I got the status as

  • host ‘stapp01’ is not added correctly in ‘/home/thor/ansible/inventory’ file on Jump Server