0
- hosts: "tag_deployment_group_{{ env }}_{{ app }}"
gather_facts: false
remote_user: root
tasks:
- name: "wait for instances to boot up"
wait_for: port=22 delay=30 connect_timeout=300 search_regex=OpenSSH state=started
- name: "copy cron script"
hosts: "tag_deployment_group_{{ env }}_{{ app }}"
copy: src=/etc/ansible/files/script.sh dest=/root/scripts/script.sh
<10.0.0.1> SSH: EXEC ssh -C -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-
keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o
ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/c7f4018000 -tt
10.0.0.1> '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-
tmp-1511255180.71-122270830456576/wait_for.py; rm -rf
"/root/.ansible/tmp/ansible-tmp-1511255180.71-122270830456576/" >
/dev/null 2>&1 && sleep 0'"'"''
<10.0.0.2> (255, '', 'ssh: connect to host 10.0.0.2 port 22:
Connection timed out\r\n')
fatal: [10.0.0.2]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host
10.0.0.2 port 22: Connection timed out\r\n",
"unreachable": true
}
<10.0.0.1> (0, '\r\n{"elapsed": 30, "search_regex": "OpenSSH",
"state": "started", "invocation": {"module_args":
{"active_connection_states": ["ESTABLISHED", "FIN_WAIT1", "FIN_WAIT2",
"SYN_RECV", "SYN_SENT", "TIME_WAIT"], "state": "started", "port": 22,
"delay": 30, "search_regex": "OpenSSH", "host": "127.0.0.1", "sleep":
1, "timeout": 300, "exclude_hosts": null, "msg": null, "path": null,
"connect_timeout": 300}}, "path": null, "port": 22}\r\n', 'Shared
connection to 10.0.0.1 closed.\r\n')
ok: [10.0.0.1] => {
"changed": false,
"elapsed": 30,
"failed": false,
"invocation": {
"module_args": {
"active_connection_states": [
"ESTABLISHED",
"FIN_WAIT1",
"FIN_WAIT2",
"SYN_RECV",
"SYN_SENT",
"TIME_WAIT"
],
"connect_timeout": 300,
"delay": 30,
"exclude_hosts": null,
"host": "127.0.0.1",
"msg": null,
"path": null,
"port": 22,
"search_regex": "OpenSSH",
"sleep": 1,
"state": "started",
"timeout": 300
}
},
"path": null,
"port": 22,
"search_regex": "OpenSSH",
"state": "started"
ec2 인스턴스가 시작됩니다.Ansible wait_for 연결 시간 제한 내가 인스턴스의 부부를 시작하고 인스턴스에 대한 작업을 수행 할 어떤 이유도없이 내 Ansible 작전이 후 인스턴스 중 하나에 대한 wait_for 모듈에서 실패하는 것을 시도하고있다
다른 connect_timeout을 시도했지만 300 초를 기다리지는 않습니다.
고마워요! 그게 효과가있어. – upagna