On 08.11.2017 07:20, coach rhca wrote:
> Thanks Kai for that insight , i have taken out the port=22 and include
> the
> timeout=600 option in wait_for module in order to check the services
> by
> login to server. Also can we set different timeout values for different
> host in wait_for module.
You can have a variable for each host that you specify the timeout.
> Can you please throw some light as i am created a
> playbook for reboot and calling it in other playbook by specifying
> specific
> host. like below but its not working .
There is a lot of errors in your playbook, you should read up on YAML
file syntax.
http://docs.ansible.com/ansible/latest/YAMLSyntax.html
And then study the other examples you find all over the documentation
and remember to pay attention to the indentation since that is very
important in YAML.
> ---
> tasks:
> shell: sleep 2 && shutdown -r now
> async: 1
> poll: 0
> ignore_errors: true
This is a task file, it can't have "tasks:" in it.
Remove the tasks and add a dash in front of the shell line and make sure
the indentation is correct.
> server.yml
>
> ---
> - name: for the individual hosts
> - hosts: 192.168.3.154 <========( This server requires to wait for the
> server to come online after reboot )
Since you are using the name, you can't have the dash on hosts:
> tasks:
> include: tasks/restart1.yml
The include is missing a dash, and need to be indented properly.
> - name: wait for the server to be online
> local_action: wait_for host={{ inventory_hostname }} state=started
> delay=5 timeout=120
>
> - hosts: 192.168.3.153 <============ ( this server doesnot require to
> wait for the server to come back after reboot )
> tasks:
> - include: tasks/restart1.yml
Here the indentation is incorrect.
--
Kai Stian Olstad