Adjust playbooks for Ansible 2.4 import changes

Ansible 2.4 changes the way includes work. Now you have to use "import"
for playbooks and tasks that are static, and "include" for those that
are dynamic (ie, those that use variables, loops, etc).

See: http://docs.ansible.com/ansible/devel/playbooks_reuse_includes.html
This commit is contained in:
Alan Orth 2017-09-21 21:30:47 +03:00
parent 3e581f9a46
commit 16a9ebf97f
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
8 changed files with 16 additions and 16 deletions

View File

@ -3,16 +3,16 @@
# lineinfile: dest=/etc/hosts insertafter=^127.0.0.1 line='127.0.1.1 {{ inventory_hostname }}'
# tags: hostname
- include: ntp.yml
- import_tasks: ntp.yml
tags: ntp
- include: packages_{{ ansible_distribution }}.yml
- include_tasks: packages_{{ ansible_distribution }}.yml
tags: packages
- include: iptables_{{ ansible_distribution }}.yml
- include_tasks: iptables_{{ ansible_distribution }}.yml
tags: firewall
- include: sshd.yml
- import_tasks: sshd.yml
tags: sshd
# containers identify as virtualization hosts, which makes this tricky, because we have actual Debian VM hosts!
@ -31,7 +31,7 @@
template: src=etc/udev/rules.d/60-scheduler.rules.j2 dest=/etc/udev/rules.d/60-scheduler.rules owner=root group=root mode=0644
tags: udev
- include: ssh-keys.yml
- import_tasks: ssh-keys.yml
tags: ssh-keys
# vim: set sw=2 ts=2:

View File

@ -20,9 +20,9 @@
- lrzip
- unzip
- include: cron-apt.yml
- import_tasks: cron-apt.yml
tags: cron-apt
- include: tarsnap.yml
- import_tasks: tarsnap.yml
# vim: set sw=2 ts=2:

View File

@ -43,9 +43,9 @@
- command-not-found-data
- python3-commandnotfound
- include: cron-apt.yml
- import_tasks: cron-apt.yml
tags: cron-apt
- include: tarsnap.yml
- import_tasks: tarsnap.yml
# vim: set sw=2 ts=2:

View File

@ -1,6 +1,6 @@
---
- include: munin.yml
- import_tasks: munin.yml
tags: munin
- include: munin-node.yml
- import_tasks: munin-node.yml
tags: munin-node

View File

@ -34,7 +34,7 @@
file: path=/var/cache/nginx/cached/fastcgi state=directory owner=nginx group=nginx mode=0755
tags: nginx
- include: vhosts.yml
- import_tasks: vhosts.yml
when: nginx_vhosts is defined
tags: nginx

View File

@ -32,7 +32,7 @@
with_items: "{{ nginx_vhosts }}"
tags: wordpress
- include: letsencrypt.yml
- import_tasks: letsencrypt.yml
when: use_letsencrypt is defined and use_letsencrypt == True
tags: letsencrypt

View File

@ -2,11 +2,11 @@
# Note: Debian 9's php-fpm config is identical to Ubuntu 16.04's, so for now we
# can capitalize on that and use the same tasks.
- include: Debian.yml
- import_tasks: Debian.yml
when: ansible_distribution == 'Debian' and ansible_distribution_major_version | version_compare('9', '<')
tags: php-fpm
- include: Ubuntu.yml
- import_tasks: Ubuntu.yml
when: ansible_distribution == 'Ubuntu' or (ansible_distribution == 'Debian' and ansible_distribution_major_version | version_compare('9', '=='))
tags: php-fpm

View File

@ -1,6 +1,6 @@
---
# file: site.yml
- include: web.yml
- import_playbook: web.yml
# vim: set sw=2 ts=2: