- 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 }}/ loop: "{{ lookup('fileglob', '/tmp/new_configurations/*', wantlist=True) }}" - name: "Enable machines" machinectl: state: enabled machines: "{{ vars | machineslist(only_name=True) }}" - 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