Skip to content

Commit

Permalink
replace simple with_items with loop
Browse files Browse the repository at this point in the history
  • Loading branch information
likg committed Jun 11, 2019
1 parent 4a3fd52 commit d5ccebc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
owner: root
group: root
mode: 0600
with_items:
loop:
- 'csf.allow'
- 'csf.ignore'
- 'csf.pignore'
Expand Down Expand Up @@ -60,7 +60,7 @@
line: '{{ item }}|\1'
state: present
backrefs: yes
with_items: '{{ csf_blocklists }}'
loop: '{{ csf_blocklists }}'
when: csf_blocklists is defined
notify:
- check csf conf
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
name: '{{ item }}'
state: started
enabled: yes
with_items:
loop:
- csf
- lfd
tags:
Expand Down
6 changes: 3 additions & 3 deletions tests/docker_playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
privileged: true
volumes:
- '/sys/fs/cgroup:/sys/fs/cgroup:ro'
with_items: '{{ containers }}'
loop: '{{ containers }}'

- name: add containers to inventory
add_host:
name: '{{ item.name }}'
groups: docker_containers
ansible_connection: docker
changed_when: false
with_items: '{{ containers }}'
loop: '{{ containers }}'

- name: run tasks in containers
hosts: docker_containers
Expand All @@ -52,7 +52,7 @@
docker_container:
name: '{{ item.name }}'
state: absent
with_items: '{{ containers }}'
loop: '{{ containers }}'
changed_when: false
tags:
- destroy

0 comments on commit d5ccebc

Please sign in to comment.