Reputation: 11
i am executing the play book using command module when i ran command manually tha command will execute 20 minitues same command i am execute ansible playbook i am getting the ssh session time out error how can i over comet this error
ansible-playbook -i hots test.yml -T 1500
ansible-playbook -i hots test.yml --timeout 1500
tasks:
- name: executing the command
command: -------------
retries: 30
i have tried shell or command to execution of playbook
tasks:
- name: executing the create foldr
command: echo "hi"
- name: executing the command
command: -------------
retries: 30
how can i set the time period to execution of my play book 3o minitues
or completion command execution
in my playbook i have run a multiple command modules in my play book all are in simple execution but one command module is taking the time to execution of the command
Upvotes: 1
Views: 5641
Reputation: 5773
You should look for async
and poll
option.
- name: executing the command
command: "-------------"
async: 30
poll: 0
Also you can refer wait_for option if your requirement is to pause the playbook or wait for some specific condition
Upvotes: 1
Reputation: 927
For long running tasks, it's advised to make it async such that you aren't holding the ssh connection open and aren't partial to timeouts from the network or otherwise. https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html
Upvotes: 0
Reputation: 13
My suggestion is to play with this parameter:
# SSH timeout
#timeout = 10
in /etc/ansible/ansible.cfg
Upvotes: 0