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
ec2_ports:
- { proto: "tcp", from: "80", to: "80" }
- { proto: "tcp", from: "22", to: "22" }
- { proto: "tcp", from: "8080", to: "8080" }
- { proto: "tcp", from: "8081", to: "8081" }
You need to loop over this list:
- name: modify ec2 rules to allow incoming traffic from My IP address
ec2_group:
...
...
rules:
- proto: "{{ item.proto }}"
from_port: "{{ item.from }}"
to_port: "{{ item.to }}"
with_items: ec2_ports
This might throw an error as follows:
"the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible.vars.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'to'\n\nThe error appears to have been in '/work/ansible-roles/ec2-create-group/tasks/main.yml': line 13, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: modify ec2 rules to allow incoming traffic from My IP address\n ^ here\n"
What went wrong?
Replace:
with_items: ec2_ports
With:
with_items: "{{ec2_ports}}"
Troubleshooting
Error connecting to remote hosts: too long for Unix domain socket
Symptom: Ansible errors out when connecting to remote hosts and throws an SSH error. This error message has the line too long for Unix domain socket.
A file was supposed to be changed by Ansible, but did not change
Typical Symptom: You change a file (say a templated properties file) in your playbook directory and expect Ansible to deploy the file and report a "Changed" status for that file. Instead, the file isn't deployed and the status is "OK" i.e no changes.
Possible Causes:
Check whether your control_path is set properly - reference
timeout (12s) waiting for privilege escalation prompt
Sometimes, a certain step fails with the error message above. This is a sporadic error, isn't reproduced 100% of the time on successive reruns of playbook.
When Ansible runs modules, it essentially creates temporary python scripts and runs them. For example, you might see output such as the following when you run Ansible Playbooks:
Ansible on Windows, via WinRM, fails with a mysterious message winrm_connection_timeout and winrm_send_input_failed, if you use Linux-specific modules on Windows.
For example the output below was from using get_file module instead of win_get_file for Windows hosts.
TASK [prereqs : download MSI] ********************************************************************************************************************************
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/net_tools/basics/get_url.py
<XXXX> ESTABLISH WINRM CONNECTION FOR USER: azureuser on PORT 5986 TO XXXX
checking if winrm_host XXXX is an IPv6 address
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/net_tools/basics/get_url.py
<XXXX> ESTABLISH WINRM CONNECTION FOR USER: azureuser on PORT 5986 TO XXXX
checking if winrm_host XXXX is an IPv6 address
EXEC (via pipeline wrapper)
EXEC (via pipeline wrapper)
[WARNING]: FATAL ERROR DURING FILE TRANSFER: Traceback (most recent call last): File "/usr/lib/python2.7/dist-
packages/ansible/plugins/connection/winrm.py", line 294, in _winrm_exec self._winrm_send_input(self.protocol, self.shell_id, command_id, data,
eof=is_last) File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/winrm.py", line 274, in _winrm_send_input
protocol.send_message(xmltodict.unparse(rq)) File "/usr/local/lib/python2.7/dist-packages/winrm/protocol.py", line 256, in send_message raise
WinRMOperationTimeoutError() WinRMOperationTimeoutError
fatal: [AZRSPPOCAPPVM1]: FAILED! => {
"msg": "winrm send_input failed"
}
[WARNING]: FATAL ERROR DURING FILE TRANSFER: Traceback (most recent call last): File "/usr/lib/python2.7/dist-
packages/ansible/plugins/connection/winrm.py", line 294, in _winrm_exec self._winrm_send_input(self.protocol, self.shell_id, command_id, data,
eof=is_last) File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/winrm.py", line 274, in _winrm_send_input
protocol.send_message(xmltodict.unparse(rq)) File "/usr/local/lib/python2.7/dist-packages/winrm/protocol.py", line 256, in send_message raise
WinRMOperationTimeoutError() WinRMOperationTimeoutError
fatal: [XXXXXXXX]: FAILED! => {
"msg": "winrm send_input failed"
}