Having ansible error Level 1

Each time i run a playbook, it keeps telling me it cant connect to the server using the ssh.
View the print screen please.

I think you have the IP wrong. Which server are you meant to be connecting to?

Hello,
i have this inventory file:
stapp02 ansible_host=172.238.16.204
but the infrastructure detail says:
stapp02 172.16.238.11
but each time i try to ping it, its not available and my playbook cant run.
What am i missing here please?

Hi @ngodson,

The app servers IP address are wrong.

Please check the link below:

I still have the same issues.
The IP there is the same i used previously.
App Server 1 in Stratos DC
has:
stapp01 172.16.238.10 stapp01.stratos.xfusioncorp.com tony Ir0nM@n Nautilus App 1
but connection to host ip fails at every attempt

Please share your inventory file.

Playbook.yml…

name: Create file
hosts: server3

tasks:
- name: Creating a file.txt
file:
path: /tmp/file.txt
state: touch

Inventory file:

[server3]
stapp03 ansible_host=172.238.16.12 ansible_user=banner ansible_ssh_common_args=‘-o StrictHostKeyChecking=no’

I have also taken out all the variables and just used the IP alone but still cant connect.

Hi @ngodson,

The correct IP address for the app03 server is 172.16.238.12, not 172.238.16.12.

Regards,

Also, I checked the task, and didn’t find any issues.

Hello Tej,
This is really frustrating, i’ve ran the same commands in Digital ocean and it works fine but I seem to have a problem with the ssh connection. Everything in the .ssh directory seems fine but its does not connect.
My plabook is correct as well as the inventory, which I have corrected but something seems to be wrong.

Hi @ngodson,

Kindly share your failed task under the ‘Task Review’ page so we can see your work and the task description.

Regards,

Give me 2 minutes to start a new tasks.

Output:
thor@jumphost ~/ansible$ ansible-playbook -i inventory playbook.yml -v
Using /etc/ansible/ansible.cfg as config file

PLAY [Steps for creating file] **********************************************************************************

TASK [Gathering Facts] ******************************************************************************************
fatal: [stapp01]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: Warning: Permanently added ‘172.16.238.10’ (ED25519) to the list of known hosts.\r\[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).”, “unreachable”: true}

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

Inventory file:
[webserver]
stapp01 ansible_host=172.16.238.10 ansible_user=tony ansible_ssh_common_args=‘-o StrictHostKeyChecking=no’


playbook:

  • name: Steps for creating file
    hosts: webserver

    tasks:

    • name: Create a file
      file:
      path: /tmp/file.txt
      state: touch

You need to add the password of tony’s user in the inventory file.

This is the result:
PLAY [Steps for creating file] **********************************************************************************

TASK [Gathering Facts] ******************************************************************************************
fatal: [stapp01]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: ssh: Could not resolve hostname \342\200\230-o: Name or service not known”, “unreachable”: true}

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

Please share the inventory file.

[webserver]
stapp01 ansible_host=172.16.238.10 ansible_user=tony ansible_password=Ir0nM@n ansible_ssh_common_args=‘-o StrictHostKeyChecking=no’

Please share the playbook again.

  • name: Steps for creating file
    hosts: webserver

    tasks:

    • name: Create a file
      file:
      path: /tmp/file.txt
      state: touch
stapp01 ansible_host=172.16.238.10 ansible_user=tony ansible_password=Ir0nM@n ansible_ssh_common_args='-o StrictHostKeyChecking=no'