with_items to loop

Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
Mark Bolwell 2023-01-25 10:01:14 +00:00
parent 674e0fab16
commit 7760f35161
No known key found for this signature in database
GPG key ID: 1DE02A772D0908F9
4 changed files with 5 additions and 8 deletions

View file

@ -62,8 +62,7 @@
mode: "0600"
owner: root
group: root
with_items:
- tipc
loop: tipc # note the item used in the template
- name: "3.1.3 | PATCH | Ensure TIPC is disabled | blacklist"
ansible.builtin.lineinfile:

View file

@ -21,8 +21,7 @@
ansible.builtin.systemd:
name: "{{ item }}"
masked: true
with_items:
- firewalld
loop: firewalld
when:
- item in ansible_facts.packages
- rhel9cis_firewall == 'nftables'
@ -31,8 +30,7 @@
ansible.builtin.systemd:
name: "{{ item }}"
masked: true
with_items:
- nftables
loop: nftables
when:
- item in ansible_facts.packages
- rhel9cis_firewall == 'firewalld'

View file

@ -102,7 +102,7 @@
- name: "3.4.2.3 | PATCH | Ensure nftables base chains exist | Create chains if needed"
ansible.builtin.shell: "{{ item }}"
failed_when: false
with_items:
loop:
- nft create chain inet "{{ rhel9cis_nft_tables_tablename }}" input { type filter hook input priority 0 \; }
- nft create chain inet "{{ rhel9cis_nft_tables_tablename }}" forward { type filter hook forward priority 0 \; }
- nft create chain inet "{{ rhel9cis_nft_tables_tablename }}" output { type filter hook output priority 0 \; }