diff --git a/CHANGELOG.md b/CHANGELOG.md index 2adb30f..892d6ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Enhancements * Set a variable to enable/disable the support of Nftables. +* Move two task in systemd handler (try to fix #1). ## v1.3.1 diff --git a/handlers/main.yml b/handlers/main.yml index 139c24b..4fac10e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,5 +1,9 @@ --- # handlers file for nftables -- name: restart nftables service - service: name={{ nft_service_name }} state=restarted - when: nft_service_manage +- name: Restart nftables service + systemd: + daemon_reload: '{{ nftables__register_systemd_service.changed | default(False) }}' + state: 'restarted' + name: '{{ nft_service_name }}' + enabled: '{{ nft_service_enabled }}' + when: ansible_service_mgr == 'systemd' and nft_service_manage diff --git a/tasks/main.yml b/tasks/main.yml index a070eaa..1441cd5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -44,7 +44,7 @@ group: root mode: 0755 backup: yes - notify: ['restart nftables service'] + notify: ['Restart nftables service'] when: nft_enabled|bool - name: CONFIG generate input rules file @@ -55,7 +55,7 @@ group: root mode: 0755 backup: yes - notify: ['restart nftables service'] + notify: ['Restart nftables service'] when: nft_enabled|bool - name: CONFIG generate output rules file @@ -66,7 +66,7 @@ group: root mode: 0755 backup: yes - notify: ['restart nftables service'] + notify: ['Restart nftables service'] when: nft_enabled|bool - name: CONFIG generate vars definition file @@ -77,7 +77,7 @@ group: root mode: 0755 backup: yes - notify: ['restart nftables service'] + notify: ['Restart nftables service'] when: nft_enabled|bool - name: CONFIG generate sets and maps file @@ -88,7 +88,7 @@ group: root mode: 0755 backup: yes - notify: ['restart nftables service'] + notify: ['Restart nftables service'] when: nft_enabled|bool # }}} @@ -104,19 +104,6 @@ register: nftables__register_systemd_service when: (nft_enabled|bool and nft_service_manage|bool) - notify: ['restart nftables service'] + notify: ['Restart nftables service'] -- name: Reload systemd daemons - command: systemctl daemon-reload - notify: ['restart nftables service'] - when: (nft_service_manage|bool and - nftables__register_systemd_service|changed) - -- name: SERVICE manage '{{ nft_service_name }}' - service: - name: '{{ nft_service_name }}' - state: started - enabled: '{{ nft_service_enabled }}' - when: (nft_enabled|bool and - nft_service_manage|bool) # }}}