08:53
This commit is contained in:
25
files/ansible-playbooks/restart-cloud-agent.yml
Normal file
25
files/ansible-playbooks/restart-cloud-agent.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Temporarily move cloud-agent and restore it
|
||||
hosts: all
|
||||
gather_facts: no
|
||||
|
||||
tasks:
|
||||
- name: Move /tmp/launchd/services/cloud-agent to /root/
|
||||
ansible.builtin.raw: |
|
||||
set -e
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
|
||||
mv -f /tmp/launchd/services/cloud-agent /root/
|
||||
register: move_out
|
||||
changed_when: true
|
||||
|
||||
- name: Wait 3s before restoring
|
||||
ansible.builtin.pause:
|
||||
seconds: 3
|
||||
|
||||
- name: Move /root/cloud-agent back to /tmp/launchd/services/
|
||||
ansible.builtin.raw: |
|
||||
set -e
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
|
||||
mv -f /root/cloud-agent /tmp/launchd/services/
|
||||
register: move_back
|
||||
changed_when: true
|
||||
Reference in New Issue
Block a user