i have add the vvv to ansible and to ssh command. The log provided comes from this run. I don't have more logs. I will try tomorrow to make a new run just with the wait task.
reza Le 12 déc. 2016 20:12, "Guilherme Ueno" <[email protected]> a écrit : > Reza, > > You have to put the parameter at the end of command, like: > ansible-playbook -i inventory........... -vvv > > Guilherme. > > On Monday, December 12, 2016 at 4:28:48 PM UTC-2, Reza ISSANY wrote: >> >> I can't reproduce the same run. Actually, ansible ask me to provide a >> password to connect. I don't know why. >> Ansible has to wait until he can connect using the command I provide no ? >> >> 2016-12-12 19:23:31,939 p=12608 u=deploy | Using ansible.cfg as config >> file >> 2016-12-12 19:23:32,048 p=12608 u=deploy | PLAYBOOK: main.yml >> ************************************************************* >> 2016-12-12 19:23:32,048 p=12608 u=deploy | 1 plays in main.yml >> 2016-12-12 19:23:32,051 p=12608 u=deploy | PLAY [all] >> ********************************************************************* >> 2016-12-12 19:23:32,095 p=12608 u=deploy | TASK [wait-for-available : >> waiting for host to start] ************************** >> 2016-12-12 19:23:32,095 p=12608 u=deploy | task path: >> /ansible/roles/wait-for-available/tasks/main.yml:1 >> 2016-12-12 19:23:32,265 p=12608 u=deploy | Using module file >> /ansible/modules/utilities/logic/wait_for.py >> 2016-12-12 19:23:57,413 p=12608 u=deploy | ok: [192.168.0.57 -> >> localhost] => { >> "changed": false, >> "elapsed": 25, >> "invocation": { >> "module_args": { >> "connect_timeout": 5, >> "delay": 10, >> "exclude_hosts": null, >> "host": "192.168.0.57", >> "path": null, >> "port": 22, >> "search_regex": null, >> "sleep": 1, >> "state": "started", >> "timeout": 300 >> }, >> "module_name": "wait_for" >> }, >> "path": null, >> "port": 22, >> "search_regex": null, >> "state": "started" >> } >> 2016-12-12 19:23:57,415 p=12608 u=deploy | TASK [wait-for-available : >> waiting to connect to ansible user] ************* >> 2016-12-12 19:23:57,415 p=12608 u=deploy | task path: >> /ansible/roles/wait-for-available/tasks/main.yml:10 >> 2016-12-12 19:23:57,567 p=12608 u=deploy | Using module file >> /ansible/modules/commands/command.py >> 2016-12-12 19:25:03,496 p=12608 u=deploy | [ERROR]: User interrupted >> execution >> >> - name: "waiting for host to start" >> local_action: wait_for >> host={{ inventory_hostname }} >> state=started >> port=22 >> delay=10 >> become: false >> when: ostype == 'Linux' >> >> - name: "waiting to connect to ansible user" >> local_action: command ssh -vvv -i ~/.ssh/deploy -o ConnectTimeout=5 -o >> ConnectionAttempts=1 -o UserKnownHostsFile=/dev/null -o >> StrictHostKeyChecking=no -o GSSAPIAuthentication=no -o GSSAPIKeyExchange=no >> -l ansible {{inventory_hostname}} exit >> register: result >> until: result.rc == 0 >> retries: 20 >> delay: 5 >> when: ostype == 'Linux' >> >> - name: "waiting the uname" >> command: uname -a >> register: result >> when: ostype == 'Linux' >> >> - name: "uname" >> debug: >> var: result.stdout >> when: ostype == 'Linux' >> >> >> *reza.* >> >> 2016-12-12 17:18 GMT+01:00 Guilherme Ueno <[email protected]>: >> >>> Reza, >>> >>> Could you run with -vvv at the end? >>> >>> Thanks, >>> Guilherme. >>> >>> On Monday, December 12, 2016 at 1:25:56 PM UTC-2, Reza ISSANY wrote: >>>> >>>> yess I've already tried shell butsame issue. If I try to connect >>>> manually, it works. The problem is that ansible doesn't release the >>>> first connection attemps while the server isn't ready. I don't know >>>> why ... >>>> >>>> 2016-12-12 13:58 UTC+01:00, Guilherme Ueno <[email protected]>: >>>> > Hi, >>>> > >>>> > Did you already try to use "shell" instead "command"? When you try to >>>> > execute that command from another machine it works? >>>> > >>>> > thanks, >>>> > Guilherme. >>>> > >>>> > On Monday, December 12, 2016 at 8:39:25 AM UTC-2, [email protected] >>>> wrote: >>>> >> >>>> >> Hi, forgive me for my bad english. >>>> >> >>>> >> I'm trying to find a way to test an ssh connection to a specific >>>> user on a >>>> >> >>>> >> new server. >>>> >> >>>> >> When I create a new virtual server, an ansible playbook is executed >>>> to >>>> >> finish the soft deployments: >>>> >> 1 Check if ssh is available (port 22) >>>> >> 2 Chekc if the ansible user is available >>>> >> 3 Get the uname >>>> >> 4 Install packages >>>> >> >>>> >> >>>> >> I have no problem for 1, 3 and 4: >>>> >> >>>> >> - name: "waiting for host to start" >>>> >> local_action: wait_for >>>> >> host={{ inventory_hostname }} >>>> >> state=started >>>> >> port=22 >>>> >> delay=10 >>>> >> become: false >>>> >> >>>> >> - name: "waiting to connect to xxxx user" >>>> >> local_action: command ssh -i ~/.ssh/mykey -o ConnectTimeout=5 -o >>>> >> ConnectionAttempts=1 -o UserKnownHostsFile=/dev/null -o >>>> >> StrictHostKeyChecking=no -o GSSAPIAuthentication=no -o >>>> >> GSSAPIKeyExchange=no >>>> >> -l xxxxx {{inventory_hostname}} exit >>>> >> register: result >>>> >> until: result.rc == 0 >>>> >> retries: 20 >>>> >> delay: 5 >>>> >> >>>> >> - name: "waiting the uname" >>>> >> command: uname -a >>>> >> register: result >>>> >> >>>> >> - name: "uname" >>>> >> debug: >>>> >> var: result.stdout >>>> >> >>>> >> but the second step is never OK. When the playbook execute this >>>> step, >>>> >> ansible execute the command, but never exit from this command. I >>>> have to >>>> >> kill the process of this command to force ansible to re-run a new >>>> test. >>>> >> Finally when the server and user is available, after a new kill, >>>> ansible >>>> >> can continue with step 3. >>>> >> >>>> >> How can I resolve this problem. I can add a sleep before the step 2, >>>> but >>>> >> it is not a good solution. Thanks in advance for your helps. >>>> >> >>>> > >>>> > -- >>>> > You received this message because you are subscribed to a topic in >>>> the >>>> > Google Groups "Ansible Project" group. >>>> > To unsubscribe from this topic, visit >>>> > https://groups.google.com/d/topic/ansible-project/cyOQIh3lPH >>>> M/unsubscribe. >>>> > To unsubscribe from this group and all its topics, send an email to >>>> > [email protected]. >>>> > To post to this group, send email to [email protected]. >>>> > To view this discussion on the web visit >>>> > https://groups.google.com/d/msgid/ansible-project/04b175df- >>>> ec92-4579-a17c-d4efc100d23f%40googlegroups.com. >>>> > For more options, visit https://groups.google.com/d/optout. >>>> > >>>> >>>> >>>> -- >>>> *reza.* >>>> >>> >> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAAxzbSRNL_7q%2Bi0bht1i6iM_-A49NOUh-d5xCUHheu87cXvB1g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
