Move two task in systemd handler (try to fix #1)

Try to fix the long delay at the first run.
This commit is contained in:
Jeremy Gardais 2018-07-25 15:06:31 +02:00
parent bf9080fcb3
commit 485f7fa83d
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
3 changed files with 14 additions and 22 deletions

View File

@ -2,6 +2,7 @@
### Enhancements ### Enhancements
* Set a variable to enable/disable the support of Nftables. * Set a variable to enable/disable the support of Nftables.
* Move two task in systemd handler (try to fix #1).
## v1.3.1 ## v1.3.1

View File

@ -1,5 +1,9 @@
--- ---
# handlers file for nftables # handlers file for nftables
- name: restart nftables service - name: Restart nftables service
service: name={{ nft_service_name }} state=restarted systemd:
when: nft_service_manage 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

View File

@ -44,7 +44,7 @@
group: root group: root
mode: 0755 mode: 0755
backup: yes backup: yes
notify: ['restart nftables service'] notify: ['Restart nftables service']
when: nft_enabled|bool when: nft_enabled|bool
- name: CONFIG generate input rules file - name: CONFIG generate input rules file
@ -55,7 +55,7 @@
group: root group: root
mode: 0755 mode: 0755
backup: yes backup: yes
notify: ['restart nftables service'] notify: ['Restart nftables service']
when: nft_enabled|bool when: nft_enabled|bool
- name: CONFIG generate output rules file - name: CONFIG generate output rules file
@ -66,7 +66,7 @@
group: root group: root
mode: 0755 mode: 0755
backup: yes backup: yes
notify: ['restart nftables service'] notify: ['Restart nftables service']
when: nft_enabled|bool when: nft_enabled|bool
- name: CONFIG generate vars definition file - name: CONFIG generate vars definition file
@ -77,7 +77,7 @@
group: root group: root
mode: 0755 mode: 0755
backup: yes backup: yes
notify: ['restart nftables service'] notify: ['Restart nftables service']
when: nft_enabled|bool when: nft_enabled|bool
- name: CONFIG generate sets and maps file - name: CONFIG generate sets and maps file
@ -88,7 +88,7 @@
group: root group: root
mode: 0755 mode: 0755
backup: yes backup: yes
notify: ['restart nftables service'] notify: ['Restart nftables service']
when: nft_enabled|bool when: nft_enabled|bool
# }}} # }}}
@ -104,19 +104,6 @@
register: nftables__register_systemd_service register: nftables__register_systemd_service
when: (nft_enabled|bool and when: (nft_enabled|bool and
nft_service_manage|bool) 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)
# }}} # }}}