You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I've been running ansible on the CLI for a few months and was able to run the playbook and connect to the hosts without any issues.
here's the inventory file in /etc/ansible/hosts
`[all:vars]
ansible_user='pi'
ansible_become=yes
ansible_become_method=sudo
[xfs001_autodoser_outdoor]
xfs001-autodoser01.xfscloud.com ansible_connection=ssh ansible_ssh_user=pi
`
However, when I tried to run the task template in semaphore, I can't seem to connect to the host:
12:09:03 PM Task 8 added to queue 12:09:03 PM Preparing: 8 12:09:03 PM Prepare TaskRunner with template: Test 12:09:03 PM installing static inventory 12:09:03 PM No collections/requirements.yml file found. Skip galaxy install process. 12:09:03 PM No roles/requirements.yml file found. Skip galaxy install process. 12:09:08 PM Started: 8 12:09:08 PM Run TaskRunner with template: Test 12:09:08 PM /usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated 12:09:08 PM "class": algorithms.Blowfish, 12:09:08 PM ansible-playbook 2.9.6 12:09:08 PM config file = /home/ubuntu/ansible/ansible.cfg 12:09:08 PM configured module search path = ['/home/ubuntu/ansible/playbook/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] 12:09:08 PM ansible python module location = /usr/lib/python3/dist-packages/ansible 12:09:08 PM executable location = /usr/bin/ansible-playbook 12:09:08 PM python version = 3.8.10 (default, Mar 13 2023, 10:26:41) [GCC 9.4.0] 12:09:08 PM Using /home/ubuntu/ansible/ansible.cfg as config file 12:09:08 PM setting up inventory plugins 12:09:08 PM host_list declined parsing /home/ubuntu/ansible/playbook/inventory_8 as it did not pass its verify_file() method 12:09:08 PM script declined parsing /home/ubuntu/ansible/playbook/inventory_8 as it did not pass its verify_file() method 12:09:08 PM auto declined parsing /home/ubuntu/ansible/playbook/inventory_8 as it did not pass its verify_file() method 12:09:08 PM Parsed /home/ubuntu/ansible/playbook/inventory_8 inventory source with ini plugin 12:09:09 PM Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3/dist-packages/ansible/plugins/callback/default.py 12:09:09 PM 12:09:09 PM PLAYBOOK: autodoser_clone_git.yaml ********************************************* 12:09:09 PM Positional arguments: autodoser_clone_git.yaml 12:09:09 PM verbosity: 4 12:09:09 PM private_key_file: /home/ubuntu/ansible/playbook/access_key_937151126 12:09:09 PM connection: smart 12:09:09 PM timeout: 10 12:09:09 PM become_method: sudo 12:09:09 PM tags: ('all',) 12:09:09 PM check: True 12:09:09 PM inventory: ('/home/ubuntu/ansible/playbook/inventory_8',) 12:09:09 PM extra_vars: ('{"semaphore_vars":{"task_details":{"username":"ubuntu"}}}',) 12:09:09 PM forks: 5 12:09:09 PM 1 plays in autodoser_clone_git.yaml 12:09:09 PM 12:09:09 PM PLAY [all] ********************************************************************* 12:09:09 PM META: ran handlers 12:09:09 PM 12:09:09 PM TASK [ping] ******************************************************************** 12:09:09 PM task path: /home/ubuntu/ansible/autodoser_clone_git.yaml:5 12:09:09 PM ESTABLISH SSH CONNECTION FOR USER: pi 12:09:09 PM SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ubuntu/.ssh/xfarms_ansible"' -o 'User="pi"' -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/ansible/playbook/.ansible/cp/5e73357488 xfs001-autodoser01.xfscloud.com '/bin/sh -c '"'"'echo ~pi && sleep 0'"'"'' 12:09:29 PM (255, b'', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/home/ubuntu/ansible/playbook/.ansible/cp/5e73357488" does not exist\r\ndebug2: resolving "xfs001-autodoser01.xfscloud.com" port 22\r\ndebug2: ssh_connect_direct\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [172.67.185.231] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 172.67.185.231 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [104.21.43.213] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 104.21.43.213 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3033::6815:2bd5] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3033::6815:2bd5 port 22: Network is unreachable\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3036::ac43:b9e7] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3036::ac43:b9e7 port 22: Network is unreachable\r\nssh: connect to host xfs001-autodoser01.xfscloud.com port 22: Network is unreachable\r\n') 12:09:29 PM fatal: [xfs001-autodoser01.xfscloud.com]: UNREACHABLE! => { 12:09:29 PM "changed": false, 12:09:29 PM "msg": "Failed to connect to the host via ssh: OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket \"/home/ubuntu/ansible/playbook/.ansible/cp/5e73357488\" does not exist\r\ndebug2: resolving \"xfs001-autodoser01.xfscloud.com\" port 22\r\ndebug2: ssh_connect_direct\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [172.67.185.231] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 172.67.185.231 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [104.21.43.213] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 104.21.43.213 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3033::6815:2bd5] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3033::6815:2bd5 port 22: Network is unreachable\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3036::ac43:b9e7] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3036::ac43:b9e7 port 22: Network is unreachable\r\nssh: connect to host xfs001-autodoser01.xfscloud.com port 22: Network is unreachable", 12:09:29 PM "unreachable": true 12:09:29 PM } 12:09:29 PM 12:09:29 PM PLAY RECAP ********************************************************************* 12:09:29 PM xfs001-autodoser01.xfscloud.com : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 12:09:29 PM 12:09:29 PM Running playbook failed: exit status 4
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi. I've been running ansible on the CLI for a few months and was able to run the playbook and connect to the hosts without any issues.
here's the inventory file in /etc/ansible/hosts
`[all:vars]
ansible_user='pi'
ansible_become=yes
ansible_become_method=sudo
[xfs001_autodoser_outdoor]
xfs001-autodoser01.xfscloud.com ansible_connection=ssh ansible_ssh_user=pi
`
However, when I tried to run the task template in semaphore, I can't seem to connect to the host:
12:09:03 PM Task 8 added to queue 12:09:03 PM Preparing: 8 12:09:03 PM Prepare TaskRunner with template: Test 12:09:03 PM installing static inventory 12:09:03 PM No collections/requirements.yml file found. Skip galaxy install process. 12:09:03 PM No roles/requirements.yml file found. Skip galaxy install process. 12:09:08 PM Started: 8 12:09:08 PM Run TaskRunner with template: Test 12:09:08 PM /usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated 12:09:08 PM "class": algorithms.Blowfish, 12:09:08 PM ansible-playbook 2.9.6 12:09:08 PM config file = /home/ubuntu/ansible/ansible.cfg 12:09:08 PM configured module search path = ['/home/ubuntu/ansible/playbook/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] 12:09:08 PM ansible python module location = /usr/lib/python3/dist-packages/ansible 12:09:08 PM executable location = /usr/bin/ansible-playbook 12:09:08 PM python version = 3.8.10 (default, Mar 13 2023, 10:26:41) [GCC 9.4.0] 12:09:08 PM Using /home/ubuntu/ansible/ansible.cfg as config file 12:09:08 PM setting up inventory plugins 12:09:08 PM host_list declined parsing /home/ubuntu/ansible/playbook/inventory_8 as it did not pass its verify_file() method 12:09:08 PM script declined parsing /home/ubuntu/ansible/playbook/inventory_8 as it did not pass its verify_file() method 12:09:08 PM auto declined parsing /home/ubuntu/ansible/playbook/inventory_8 as it did not pass its verify_file() method 12:09:08 PM Parsed /home/ubuntu/ansible/playbook/inventory_8 inventory source with ini plugin 12:09:09 PM Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3/dist-packages/ansible/plugins/callback/default.py 12:09:09 PM 12:09:09 PM PLAYBOOK: autodoser_clone_git.yaml ********************************************* 12:09:09 PM Positional arguments: autodoser_clone_git.yaml 12:09:09 PM verbosity: 4 12:09:09 PM private_key_file: /home/ubuntu/ansible/playbook/access_key_937151126 12:09:09 PM connection: smart 12:09:09 PM timeout: 10 12:09:09 PM become_method: sudo 12:09:09 PM tags: ('all',) 12:09:09 PM check: True 12:09:09 PM inventory: ('/home/ubuntu/ansible/playbook/inventory_8',) 12:09:09 PM extra_vars: ('{"semaphore_vars":{"task_details":{"username":"ubuntu"}}}',) 12:09:09 PM forks: 5 12:09:09 PM 1 plays in autodoser_clone_git.yaml 12:09:09 PM 12:09:09 PM PLAY [all] ********************************************************************* 12:09:09 PM META: ran handlers 12:09:09 PM 12:09:09 PM TASK [ping] ******************************************************************** 12:09:09 PM task path: /home/ubuntu/ansible/autodoser_clone_git.yaml:5 12:09:09 PM ESTABLISH SSH CONNECTION FOR USER: pi 12:09:09 PM SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/home/ubuntu/.ssh/xfarms_ansible"' -o 'User="pi"' -o ConnectTimeout=10 -o ControlPath=/home/ubuntu/ansible/playbook/.ansible/cp/5e73357488 xfs001-autodoser01.xfscloud.com '/bin/sh -c '"'"'echo ~pi && sleep 0'"'"'' 12:09:29 PM (255, b'', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/home/ubuntu/ansible/playbook/.ansible/cp/5e73357488" does not exist\r\ndebug2: resolving "xfs001-autodoser01.xfscloud.com" port 22\r\ndebug2: ssh_connect_direct\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [172.67.185.231] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 172.67.185.231 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [104.21.43.213] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 104.21.43.213 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3033::6815:2bd5] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3033::6815:2bd5 port 22: Network is unreachable\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3036::ac43:b9e7] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3036::ac43:b9e7 port 22: Network is unreachable\r\nssh: connect to host xfs001-autodoser01.xfscloud.com port 22: Network is unreachable\r\n') 12:09:29 PM fatal: [xfs001-autodoser01.xfscloud.com]: UNREACHABLE! => { 12:09:29 PM "changed": false, 12:09:29 PM "msg": "Failed to connect to the host via ssh: OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket \"/home/ubuntu/ansible/playbook/.ansible/cp/5e73357488\" does not exist\r\ndebug2: resolving \"xfs001-autodoser01.xfscloud.com\" port 22\r\ndebug2: ssh_connect_direct\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [172.67.185.231] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 172.67.185.231 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [104.21.43.213] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 104.21.43.213 port 22: Connection timed out\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3033::6815:2bd5] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3033::6815:2bd5 port 22: Network is unreachable\r\ndebug1: Connecting to xfs001-autodoser01.xfscloud.com [2606:4700:3036::ac43:b9e7] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 2606:4700:3036::ac43:b9e7 port 22: Network is unreachable\r\nssh: connect to host xfs001-autodoser01.xfscloud.com port 22: Network is unreachable", 12:09:29 PM "unreachable": true 12:09:29 PM } 12:09:29 PM 12:09:29 PM PLAY RECAP ********************************************************************* 12:09:29 PM xfs001-autodoser01.xfscloud.com : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 12:09:29 PM 12:09:29 PM Running playbook failed: exit status 4
How do I fix this?
Beta Was this translation helpful? Give feedback.
All reactions