Hi
Please find below my playbook
- name: Patch the server and Reboot
hosts: tariq-test
tasks:
- name: Patch the server
become: yes
become_user: root
tags: Patch
shell: "yum -y update"
exclude: kernel*,mongo*
register: patchresult
- name: Reboot the server
tags: reboot
become: yes
become_user: root
shell: "sleep 5 && reboot"
async: 1
poll: 0
- name: Wait for the reboot and reconnect
wait_for:
port: 22
host: '{{
(ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
search_regex: OpenSSH
delay: 10
timeout: 60
connection: local
- name: Check the Uptime of the servers
shell: "uptime"
register: Uptime
- debug: var=Uptime
I would like to able to run this via cron, but whenever I try, the job
starts, according to the cron log, but doesn't actually do anything.
I've tried allsorts, nothing works.
07 11 * * * /bin/ansible-playbook /etc/ansible/playbooks/reboot.yml >>
/var/tmp/reboot.log >/dev/null 2>&1
06 12 * * * if ! out=`ansible-playbook /etc/ansible/playbooks/reboot.yml`;
then echo $out; fi
14 12 * * * /bin/ansible-playbook /etc/ansible/playbooks/reboot.yml >>
/var/tmp/reboot.log >/dev/null 2>&1
Any ideas please?
Regards
Tariq
--
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/60f5b636-a28d-4c08-b37b-a268daa3b89b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.