I'm new to Ansible and trying to run a local script on a remote node using the script module. My task is defined as follows:
- name: Initial setup
script: ../../../initial_setup.sh
become: yes
When I run the playbook I get the error below but I'm not clear on what the actual problem is. Does this indicate a problem connecting to the node or a problem transferring the script?
fatal: [default]: FAILED! => {
"changed": true,
"failed": true,
"invocation": {
"module_args": {
"_raw_params": "../../../initial_setup.sh"
},
"module_name": "script"
},
"rc": 127,
"stderr": "Control socket connect(/tmp): Permission denied\r\nControlSocket /tmp already exists, disabling multiplexing\r\nConnection to 127.0.0.1 closed.\r\n",
"stdout": "/bin/sh: 1: /home/ubuntu/.ansible/tmp/ansible-tmp-1482161914.64-107588947758469/initial_setup.sh: not found\r\n",
"stdout_lines": [
"/bin/sh: 1: /home/ubuntu/.ansible/tmp/ansible-tmp-1482161914.64-107588947758469/initial_setup.sh: not found"
]
}
tl;dr
Ensure -o ControlMaster=auto is defined in ssh_args in Ansible in ansible.cfg:
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
The following error is related to SSH connection multiplexing:
Control socket connect(/tmp): Permission denied
ControlSocket /tmp already exists, disabling multiplexing
Connection to 127.0.0.1 closed
It tried to create a socket directly at /tmp, not inside /tmp... Some other parameter defined somewhere for SSH could play role here.
Setting the value of ControlMaster to auto causes SSH to create a new master connection should the existing one not exist (or have problems, as here?).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With