use become

This commit is contained in:
Robert Kaussow 2018-07-06 23:18:11 +02:00
parent c6f2c9c54f
commit 1f36ad2c49
3 changed files with 43 additions and 37 deletions

View File

@ -1,5 +1,5 @@
--- ---
- name: restart iptables - name: Restart iptables
shell: sleep 2 && systemctl restart iptables shell: sleep 2 && systemctl restart iptables
async: 1 async: 1
poll: 0 poll: 0

View File

@ -1,4 +1,6 @@
--- ---
- name: Setup iptables
block:
- name: Set custom iptables rules - name: Set custom iptables rules
iptables_raw: iptables_raw:
name: 'iptables_custom_rules_{{ item.name }}' name: 'iptables_custom_rules_{{ item.name }}'
@ -28,3 +30,4 @@
state: '{{ (iptables_default_tail != "" ) | ternary("present", "absent") }}' state: '{{ (iptables_default_tail != "" ) | ternary("present", "absent") }}'
rules: '{{ iptables_default_tail }}' rules: '{{ iptables_default_tail }}'
tags: iptables tags: iptables
become: True

View File

@ -1,7 +1,9 @@
--- ---
- name: Install package - name: Install iptables
block:
- name: Install packages
package: package:
name: '{{ iptables_package }}' name: "{{ iptables_package }}"
state: latest state: latest
- name: Enable and start service - name: Enable and start service
@ -9,3 +11,4 @@
name: iptables name: iptables
enabled: True enabled: True
state: started state: started
become: True