execute command using ansible hang

31 views
Skip to first unread message

Yao

unread,
Aug 25, 2016, 10:57:49 AM8/25/16
to Ansible Project
when run a command using ansible:

ansible -vvvv  test -m shell -a "df -h"
Using /etc/ansible/ansible.cfg as config file
Loaded callback minimal of type stdout, v2.0
<test> ESTABLISH SSH CONNECTION FOR USER: root
<test> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o ServerAliveInterval=60 -o Port=37226 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=20 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r  test  '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python && sleep 0'"'"''


then the prcess  seem hang ,  I want it can stop after 30s,

I try using async in playbook


---

- hosts: test
  remote_user: root
  gather_facts: false
  tasks:

  - name: test
    command: df -h
    async: 45
    poll: 0



ansible-playbook -vvv test.yaml 
Using /etc/ansible/ansible.cfg as config file

PLAYBOOK: test.yaml ************************************************************
1 plays in test.yaml

PLAY [test] ***********************************************************

TASK [test] ********************************************************************
task path: /opt/dcdn/dcdn/test.yaml:8
<test> ESTABLISH SSH CONNECTION FOR USER: root
<test> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o ServerAliveInterval=60 -o Port=37226 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=20 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r test '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1472114920.68-39125238251879 `" && echo ansible-tmp-1472114920.68-39125238251879="` echo $HOME/.ansible/tmp/ansible-tmp-1472114920.68-39125238251879 `" ) && sleep 0'"'"''



The process hang again;

Can i set a  strict execution time S, if running time longger than  S,then the process stop ? How to ?




ansible --version
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

Reply all
Reply to author
Forward
0 new messages