diff --git a/ansible/host_modified.yml b/ansible/host_modified.yml index 1ba1604..21b8f84 100644 --- a/ansible/host_modified.yml +++ b/ansible/host_modified.yml @@ -2,7 +2,7 @@ ansible.builtin.service: name: "{{ item.value['doc'] }}" state: stopped - when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine'] != 'none' and item.value['doc'] in services + when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine'] and item.value['doc'] in services loop: "{{ vars[inventory_hostname]['services'] | dict2items }}" loop_control: label: "{{ item.value['doc'] }}" @@ -55,18 +55,8 @@ loop_control: label: "{{ item.value['doc'] }}" -# some services (like networkd) did not really stoped -- name: "Stop services" - ansible.builtin.service: - name: "{{ item.value['doc'] }}" - state: stopped - when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine'] != 'none' and item.value['doc'] in services - loop: "{{ vars[inventory_hostname]['services'] | dict2items }}" - loop_control: - label: "{{ item.value['doc'] }}" - - name: "Start services" - when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine'] != 'none' + when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine'] ansible.builtin.service: name: "{{ item.value['doc'] }}" state: started @@ -75,7 +65,7 @@ label: "{{ item.value['doc'] }}" - name: "Restart services" - when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine'] == 'none' + when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and not item.value['engine'] ansible.builtin.service: name: "{{ item.value['doc'] }}" state: restarted