Update with_items loops to use new-ish "loop" keyword

Ansible 2.4 and 2.5 are moving away from specialized loop functions
and the old syntax will eventually be deprecated and removed. I did
not change the with_fileglob loops because I'm not sure about their
syntax yet.

See: https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html
This commit is contained in:
2018-04-02 15:52:51 +03:00
parent fbf61c8e61
commit 57120308dc
11 changed files with 21 additions and 21 deletions

View File

@ -2,7 +2,7 @@
- name: Configure cron-apt (config)
copy: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }} owner={{ item.owner }} group={{ item.group }}
with_items:
loop:
- { src: 'etc/cron-apt/config', dest: '/etc/cron-apt/config', mode: '0644', owner: 'root', group: 'root' }
- { src: 'etc/cron-apt/3-download', dest: '/etc/cron-apt/action.d/3-download', mode: '0644', owner: 'root', group: 'root' }

View File

@ -2,7 +2,7 @@
- name: Install firewalld and deps
when: ansible_distribution_major_version is version_compare('8', '>=')
apt: pkg={{ item }} state=present
with_items:
loop:
- firewalld
- tidy
tags: packages

View File

@ -2,7 +2,7 @@
- name: Install firewalld and deps
when: ansible_distribution_version is version_compare('15.04', '>=')
apt: pkg={{ item }} state=present
with_items:
loop:
- firewalld
- tidy
tags: packages

View File

@ -4,7 +4,7 @@
- name: Install base packages
apt: name={{ item }} update_cache=yes
with_items:
loop:
- git
- tmux
- iotop

View File

@ -8,7 +8,7 @@
- name: Install base packages
apt: pkg={{ item }}
with_items:
loop:
- git
- tmux
- iotop
@ -29,13 +29,13 @@
- name: Security hardening (CIS Benchmark 1.0)
apt: pkg={{ item }} state=absent purge=yes
with_items:
loop:
- whoopsie # CIS 4.1
- apport # CIS 4.1
- name: Remove annoying packages
apt: pkg={{ item }} state=absent purge=yes
with_items:
loop:
- command-not-found
- command-not-found-data
- python3-commandnotfound

View File

@ -15,7 +15,7 @@
- name: Remove DSA and ECDSA host keys
file: name=/etc/ssh/{{ item }} state=absent
with_items:
loop:
- ssh_host_dsa_key
- ssh_host_dsa_key.pub
- ssh_host_ecdsa_key