Ansible Playbook running locally but unable to ssh to host via AWXHow do you manage ssh keys to add a second user?ssh_exchange_identification: Connection closed by remote hostSSH accepts publickey authetication but won't connect with an identify file?OpenSSH disable ControlMaster for given hostnameAnsible Fails to Authenticate Sudo Even When Sudo Pass is GivenAnsible with Github: Permission denied (Publickey)Ansible can't git clone from enterprise git serverAd-hoc ansible command with vaultAnsible AWX playbooks pulled from github do not show in playbook drop-down box
Why doesn't a particle exert force on itself?
Can you turn a recording upside-down?
My parents are Afghan
What are my options legally if NYC company is not paying salary?
Why does this pattern in powers happen?
Do oversize pulley wheels increase derailleur capacity?
Is there an application which does HTTP PUT?
Capturing the entire webpage with WebExecute's CaptureImage
Are there vaccine ingredients which may not be disclosed ("hidden", "trade secret", or similar)?
Why doesn't increasing the temperature of something like wood or paper set them on fire?
Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?
Opposite party turned away from voting when ballot is all opposing party
why it is 2>&1 and not 2>>&1 to append to a log file
How can it be that ssh somename works, while nslookup somename does not?
Steganography in Latex
Can the president of the United States be guilty of insider trading?
Program for finding longest run of zeros from a list of 100 random integers which are either 0 or 1
Should one save up to purchase a house/condo or maximize their 401(k) first?
My perfect evil overlord plan... or is it?
Was Mohammed the most popular first name for boys born in Berlin in 2018?
Gift for mentor after his thesis defense?
Why is it wrong to *implement* myself a known, published, widely believed to be secure crypto algorithm?
Names of the Six Tastes
Add elements inside Array conditionally in JavaScript
Ansible Playbook running locally but unable to ssh to host via AWX
How do you manage ssh keys to add a second user?ssh_exchange_identification: Connection closed by remote hostSSH accepts publickey authetication but won't connect with an identify file?OpenSSH disable ControlMaster for given hostnameAnsible Fails to Authenticate Sudo Even When Sudo Pass is GivenAnsible with Github: Permission denied (Publickey)Ansible can't git clone from enterprise git serverAd-hoc ansible command with vaultAnsible AWX playbooks pulled from github do not show in playbook drop-down box
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
SUMMARY
I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX
- AWX inventory has just that host added along with ansible_user :
xxxxx which is the user I want to deploy with - Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)
- I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host
Running the ssh command AWS runs while gathering information fails
ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
Output:
debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
bind: No such file or directory
unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -
ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname
Questions
- Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission
- Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck
- Why it is not working with Control Params
Additional Information
Ansible Version
ansible 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Configuration
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C
OS / ENVIRONMENT
Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)
Target host OS -> CentOS Linux release 7.5.1804 (Core)
AWX Version: 2.1.0
AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose
STEPS TO REPRODUCE
1) Created Project in AWX with SCM type git.
2) Created inventory in AWX adding the host with variable ansible_user: xxxxx
3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook
PlayBook
https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml
ACTUAL RESULTS while running the job template
ansible-playbook 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
1 plays in installnodejs.yml
PLAY [all] *********************************************************************
META: ran handlers
TASK [Created new build directory] *********************************************
task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
<hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
<hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
<hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
fatal: [hostname]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
PLAY RECAP *********************************************************************
hostname : ok=0 changed=0 unreachable=1 failed=0
ssh ansible ansible-tower
add a comment |
SUMMARY
I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX
- AWX inventory has just that host added along with ansible_user :
xxxxx which is the user I want to deploy with - Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)
- I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host
Running the ssh command AWS runs while gathering information fails
ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
Output:
debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
bind: No such file or directory
unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -
ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname
Questions
- Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission
- Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck
- Why it is not working with Control Params
Additional Information
Ansible Version
ansible 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Configuration
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C
OS / ENVIRONMENT
Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)
Target host OS -> CentOS Linux release 7.5.1804 (Core)
AWX Version: 2.1.0
AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose
STEPS TO REPRODUCE
1) Created Project in AWX with SCM type git.
2) Created inventory in AWX adding the host with variable ansible_user: xxxxx
3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook
PlayBook
https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml
ACTUAL RESULTS while running the job template
ansible-playbook 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
1 plays in installnodejs.yml
PLAY [all] *********************************************************************
META: ran handlers
TASK [Created new build directory] *********************************************
task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
<hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
<hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
<hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
fatal: [hostname]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
PLAY RECAP *********************************************************************
hostname : ok=0 changed=0 unreachable=1 failed=0
ssh ansible ansible-tower
add a comment |
SUMMARY
I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX
- AWX inventory has just that host added along with ansible_user :
xxxxx which is the user I want to deploy with - Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)
- I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host
Running the ssh command AWS runs while gathering information fails
ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
Output:
debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
bind: No such file or directory
unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -
ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname
Questions
- Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission
- Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck
- Why it is not working with Control Params
Additional Information
Ansible Version
ansible 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Configuration
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C
OS / ENVIRONMENT
Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)
Target host OS -> CentOS Linux release 7.5.1804 (Core)
AWX Version: 2.1.0
AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose
STEPS TO REPRODUCE
1) Created Project in AWX with SCM type git.
2) Created inventory in AWX adding the host with variable ansible_user: xxxxx
3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook
PlayBook
https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml
ACTUAL RESULTS while running the job template
ansible-playbook 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
1 plays in installnodejs.yml
PLAY [all] *********************************************************************
META: ran handlers
TASK [Created new build directory] *********************************************
task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
<hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
<hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
<hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
fatal: [hostname]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
PLAY RECAP *********************************************************************
hostname : ok=0 changed=0 unreachable=1 failed=0
ssh ansible ansible-tower
SUMMARY
I have ansible and ansible AWX installed on same AWS EC2 instance and I am trying to deploy build on another app AWS EC2 instance. I am able to run the playbook via ansible-playbook command,however, get Failed to connect to the host via ssh when using AWX
- AWX inventory has just that host added along with ansible_user :
xxxxx which is the user I want to deploy with - Ansible/AWX host has the xxxxx user setup with password less access to the target host which also has the same user (public keys copied)
- I also tried creating this user in aws_task and aws_web containers and copied the public keys to target host
Running the ssh command AWS runs while gathering information fails
ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
Output:
debug3: muxserver_listen: temporary control path /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
bind: No such file or directory
unix_listener: cannot bind to path: /tmp/awx_72_VGFOPt/cp/61735cd9d3.16cjnTwr0hSE1mXc
Running the command after leaving some configuration options - ControlPersist,ControlMaster,ssh works -
ssh -vvv -C -o StrictHostKeyChecking=no -o 'IdentityFile="/home/xxxxx/.ssh/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 hostname
Questions
- Is this a permission issue while creating the ControlPath? The aws_web and aws_task container both have /tmp folder with 777 permission
- Which configuration (ansible.cfg) does AWX pick - from the aws_task/aws_web containers or from the host on which it is deployed. I have also tried to set ssh_args = -C (removing the ControlMaster and ControlPersist) at all the three places in ansible.cfg and restarted the AWS containers, without any luck
- Why it is not working with Control Params
Additional Information
Ansible Version
ansible 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Configuration
ANSIBLE_SSH_ARGS(/etc/ansible/ansible.cfg) = -C
OS / ENVIRONMENT
Ansible and AWX host OS -> CentOS Linux release 7.5.1804 (Core)
Target host OS -> CentOS Linux release 7.5.1804 (Core)
AWX Version: 2.1.0
AWX installed via -> https://github.com/ansible/awx/blob/devel/INSTALL.md#docker-or-docker-compose
STEPS TO REPRODUCE
1) Created Project in AWX with SCM type git.
2) Created inventory in AWX adding the host with variable ansible_user: xxxxx
3) Created job template specifying job type run and selecting project and inventory created in 1 and 2. Provided the extra variable build: in the template as required in the playbook
PlayBook
https://github.com/sandeepdharembra/playbooks/blob/master/installnodejs.yml
ACTUAL RESULTS while running the job template
ansible-playbook 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /tmp/awx_108_dKOwxm/tmpo_yCMg inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
1 plays in installnodejs.yml
PLAY [all] *********************************************************************
META: ran handlers
TASK [Created new build directory] *********************************************
task path: /var/lib/awx/projects/_6__festaging/installnodejs.yml:10
<hostname> ESTABLISH SSH CONNECTION FOR USER: xxxxx
<hostname> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=xxxxx -o ConnectTimeout=10 -o ControlPath=/tmp/awx_108_dKOwxm/cp/61735cd9d3 hostname '/bin/sh -c '"'"'echo ~xxxxx && sleep 0'"'"''
<hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [hostname] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_dsa type -1rndeb…
fatal: [hostname]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017rndebug1: Reading configuration data /etc/ssh/ssh_configrndebug1: /etc/ssh/ssh_config line 58: Applying options for *rndebug1: auto-mux: Trying existing masterrndebug1: Control socket "/tmp/awx_108_dKOwxm/cp/61735cd9d3" does not existrndebug2: resolving "hostname" port 22rndebug2: ssh_connect_direct: needpriv 0rndebug1: Connecting to hostname [172.16.5.91] port 22.rndebug2: fd 3 setting O_NONBLOCKrndebug1: fd 3 clearing O_NONBLOCKrndebug1: Connection established.rndebug3: timeout: 9997 ms remain after connectrndebug1: permanently_set_uid: 0/0rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa type -1rndebug1: key_load_public: No such file or directoryrndebug1: identity file /root/.ssh/id_rsa-cert ty…
PLAY RECAP *********************************************************************
hostname : ok=0 changed=0 unreachable=1 failed=0
ssh ansible ansible-tower
ssh ansible ansible-tower
edited Nov 29 '18 at 6:13
Sandeep Dharembra
asked Nov 29 '18 at 3:36
Sandeep DharembraSandeep Dharembra
365
365
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I was finally able to find a solution to this issue -
The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
Job was now able to run (ssh on the remote host)
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f942092%2fansible-playbook-running-locally-but-unable-to-ssh-to-host-via-awx%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I was finally able to find a solution to this issue -
The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
Job was now able to run (ssh on the remote host)
add a comment |
I was finally able to find a solution to this issue -
The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
Job was now able to run (ssh on the remote host)
add a comment |
I was finally able to find a solution to this issue -
The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
Job was now able to run (ssh on the remote host)
I was finally able to find a solution to this issue -
The job template I created had the credentials not assigned. I created the credentials with which I wanted to access the target host (user present on target host), assigned the private key and added these credentials to the job template.
Job was now able to run (ssh on the remote host)
answered Nov 30 '18 at 6:50
Sandeep DharembraSandeep Dharembra
365
365
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f942092%2fansible-playbook-running-locally-but-unable-to-ssh-to-host-via-awx%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown