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

@ -18,7 +18,7 @@
- name: Install certbot dependencies (Ubuntu 16.04)
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('16.04', '==')
apt: name={{ item }} state=present update_cache=yes
with_items:
loop:
- augeas-doc
- augeas-tools
- binutils
@ -62,7 +62,7 @@
- name: Install certbot dependencies (Debian 9)
when: ansible_distribution == 'Debian' and ansible_distribution_major_version is version_compare('9', '==')
apt: name={{ item }} state=present update_cache=yes
with_items:
loop:
- augeas-doc
- augeas-tools
- autoconf

View File

@ -19,7 +19,7 @@
- name: Copy extra nginx configs
copy: src={{ item }} dest=/etc/nginx/{{ item }} mode=0644 owner=root group=root
with_items:
loop:
- extra-security.conf
- fastcgi_cache
notify:

View File

@ -2,7 +2,7 @@
- name: Configure https vhosts
template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.domain_name }}.conf mode=0644 owner=root group=root
with_items: "{{ nginx_vhosts }}"
loop: "{{ nginx_vhosts }}"
notify:
- reload nginx
@ -18,18 +18,18 @@
- name: Create vhost document roots
file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory mode=0755 owner=nginx group=nginx
with_items: "{{ nginx_vhosts }}"
loop: "{{ nginx_vhosts }}"
- name: Install WordPress
git: repo=https://github.com/WordPress/WordPress.git dest={{ nginx_root_prefix }}/{{ item.domain_name }}/wordpress version={{ item.wordpress_version }} depth=1 force=yes
when: item.has_wordpress is defined and item.has_wordpress == True
with_items: "{{ nginx_vhosts }}"
loop: "{{ nginx_vhosts }}"
tags: wordpress
- name: Fix WordPress directory permissions
file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory owner=nginx group=nginx recurse=yes
when: item.has_wordpress is defined and item.has_wordpress == True
with_items: "{{ nginx_vhosts }}"
loop: "{{ nginx_vhosts }}"
tags: wordpress
- import_tasks: letsencrypt.yml