I'm using a blog post I found [0] to set up a reboot and recovery for a
playbook that deploys kubernetes across a handful of atomic hosts. It's
simplistic and mostly for my learning experience.
The playbook snippet i'm using.
- hosts: all
remote_user: root
tasks:
- name: reboot all servers
command: sleep 2 && systemctl reboot
async: 1
poll: 0
ignore_errors: true
- name: waiting for server to come back
local_action: wait_for host={{ inventory_hostname }} state=started
delay=30 timeout=300 port=22
sudo: false
It goes through fine, but doesn't actually reboot the systems.
If i set 'async: 0' and run it, i get the following error for each host:
failed: [kube0.example.com] => {"changed": true, "cmd": ["sleep", "2",
"&&", "systemctl", "reboot"], "delta": "0:00:00.002212", "end": "2016-02-10
09:58:09.760378", "rc": 1, "start": "2016-02-10 09:58:09.758166",
"warnings": []}
stderr: sleep: invalid time interval '&&'
sleep: invalid time interval 'systemctl'
sleep: invalid time interval 'reboot'
Try 'sleep --help' for more information.
I'm running the playbook on Fedora 23 with ansible 1.9.4
jduncan@dhcp-192-168-1-140 ansible_deploy$ cat /etc/fedora-release
Fedora release 23 (Twenty Three)
jduncan@dhcp-192-168-1-140 ansible_deploy$ rpm -qa ansible
ansible-1.9.4-1.fc23.noarch
I don't quite get how's it's passing that into a shell and the shell is
mis-interpreting it. Can someone point me in the right direction?
thanks!
jduncan
0
-
https://support.ansible.com/hc/en-us/articles/201958037-Reboot-a-server-and-wait-for-it-to-come-back
--
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/42b79666-8e32-47ab-8cbd-8c157a5588c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.