2022-10-01 22:33:11 +02:00
|
|
|
- name: "Stop machines with new configuration"
|
|
|
|
machinectl:
|
|
|
|
state: stopped
|
|
|
|
machines: "{{ lookup('fileglob', '/tmp/new_configurations/*', wantlist=True) | map('basename') | list }}"
|
|
|
|
|
|
|
|
- name: "Remove files directory"
|
|
|
|
file:
|
|
|
|
path: "/var/lib/risotto/configurations/{{ item }}"
|
|
|
|
state: absent
|
|
|
|
loop: "{{ lookup('fileglob', '/tmp/new_configurations/*', wantlist=True) | map('basename') | list }}"
|
|
|
|
|
|
|
|
- name: "Create files directory"
|
|
|
|
file:
|
|
|
|
path: "/var/lib/risotto/configurations/{{ item }}"
|
|
|
|
state: directory
|
|
|
|
loop: "{{ lookup('fileglob', '/tmp/new_configurations/*', wantlist=True) | map('basename') | list }}"
|
|
|
|
|
|
|
|
- name: "Copy configuration"
|
|
|
|
unarchive:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: /var/lib/risotto/configurations/{{ item | basename }}/
|
2022-12-21 16:35:58 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
2022-10-01 22:33:11 +02:00
|
|
|
loop: "{{ lookup('fileglob', '/tmp/new_configurations/*', wantlist=True) }}"
|
|
|
|
|
2022-10-17 18:51:04 +02:00
|
|
|
- name: "Enable machines"
|
|
|
|
machinectl:
|
|
|
|
state: enabled
|
|
|
|
machines: "{{ vars | machineslist(only_name=True) }}"
|
|
|
|
|
2022-10-01 22:33:11 +02:00
|
|
|
- name: "Start machines"
|
|
|
|
machinectl:
|
|
|
|
state: started
|
|
|
|
machines: "{{ vars | machineslist(only_name=True) }}"
|
|
|
|
|
|
|
|
- name: "Remove compressed files directory"
|
|
|
|
local_action:
|
|
|
|
module: file
|
|
|
|
path: /tmp/new_configurations
|
|
|
|
state: absent
|
2022-12-21 16:35:58 +01:00
|
|
|
|
|
|
|
- name: "Remove compressed templates directory"
|
|
|
|
local_action:
|
|
|
|
module: file
|
|
|
|
path: /tmp/new_templates
|
|
|
|
state: absent
|