1
0
forked from infra/ansible

replace deprecated with_items with loop

This commit is contained in:
Kishi85 2020-02-03 19:46:31 +01:00
parent 4a11950728
commit cc91246e92
24 changed files with 47 additions and 47 deletions

View File

@ -2,7 +2,7 @@
- name: Install dependencies - name: Install dependencies
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- git - git
- python-cryptography - python-cryptography
- python-dnspython - python-dnspython

View File

@ -2,7 +2,7 @@
- name: Install dependencies - name: Install dependencies
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- git - git
- python3-flask - python3-flask
- python3-flaskext.wtf - python3-flaskext.wtf

View File

@ -2,7 +2,7 @@
- name: Install misc software - name: Install misc software
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- dnsutils - dnsutils
- htop - htop
- less - less
@ -17,7 +17,7 @@
- name: Install software on KVM VMs - name: Install software on KVM VMs
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- acpid - acpid
- qemu-guest-agent - qemu-guest-agent
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm" when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm"
@ -25,7 +25,7 @@
- name: Configure misc software - name: Configure misc software
copy: src={{ item.src }} dest={{ item.dest }} copy: src={{ item.src }} dest={{ item.dest }}
diff: no diff: no
with_items: loop:
- { src: '.zshrc', dest: '/root/.zshrc' } - { src: '.zshrc', dest: '/root/.zshrc' }
- { src: '.zshrc.local', dest: '/root/.zshrc.local' } - { src: '.zshrc.local', dest: '/root/.zshrc.local' }
- { src: 'motd', dest: '/etc/motd' } - { src: 'motd', dest: '/etc/motd' }
@ -45,7 +45,7 @@
- name: Fix network interface names - name: Fix network interface names
copy: src={{ item }} dest=/etc/systemd/network/{{ item }} copy: src={{ item }} dest=/etc/systemd/network/{{ item }}
with_items: loop:
- 50-virtio-kernel-names.link - 50-virtio-kernel-names.link
- 99-default.link - 99-default.link
notify: update-initramfs notify: update-initramfs

View File

@ -2,13 +2,13 @@
- name: Install misc software - name: Install misc software
pkgng: name={{ item }} pkgng: name={{ item }}
with_items: loop:
- vim-lite - vim-lite
- htop - htop
- zsh - zsh
- name: Configure misc software - name: Configure misc software
copy: src={{ item.src }} dest={{ item.dest }} copy: src={{ item.src }} dest={{ item.dest }}
with_items: loop:
- { src: '.zshrc', dest: '/root/.zshrc' } - { src: '.zshrc', dest: '/root/.zshrc' }
- { src: '.zshrc.local', dest: '/root/.zshrc.local' } - { src: '.zshrc.local', dest: '/root/.zshrc.local' }

View File

@ -2,7 +2,7 @@
- name: Install misc software - name: Install misc software
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- dnsutils - dnsutils
- htop - htop
- ipmitool - ipmitool
@ -13,7 +13,7 @@
- name: Configure misc software - name: Configure misc software
copy: src={{ item.src }} dest={{ item.dest }} copy: src={{ item.src }} dest={{ item.dest }}
with_items: loop:
- { src: '.zshrc', dest: '/root/.zshrc' } - { src: '.zshrc', dest: '/root/.zshrc' }
- { src: '.zshrc.local', dest: '/root/.zshrc.local' } - { src: '.zshrc.local', dest: '/root/.zshrc.local' }
- { src: 'motd', dest: '/etc/motd' } - { src: 'motd', dest: '/etc/motd' }

View File

@ -5,7 +5,7 @@
- name: Configure dhcp server - name: Configure dhcp server
template: src={{ item }}.j2 dest=/etc/{{ item }} template: src={{ item }}.j2 dest=/etc/{{ item }}
with_items: loop:
- default/isc-dhcp-server - default/isc-dhcp-server
- dhcp/dhcpd.conf - dhcp/dhcpd.conf
notify: Restart isc-dhcp-server notify: Restart isc-dhcp-server

View File

@ -2,7 +2,7 @@
- name: Install powerdns - name: Install powerdns
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- pdns-server - pdns-server
- pdns-backend-sqlite3 - pdns-backend-sqlite3

View File

@ -2,6 +2,6 @@
- name: Restart powerdns - name: Restart powerdns
service: name={{ item }} state=restarted service: name={{ item }} state=restarted
with_items: loop:
- pdns - pdns
- pdns-recursor - pdns-recursor

View File

@ -2,7 +2,7 @@
- name: Install powerdns - name: Install powerdns
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- pdns-server - pdns-server
- pdns-recursor - pdns-recursor
@ -12,7 +12,7 @@
- name: Configure powerdns - name: Configure powerdns
template: src={{ item }}.j2 dest=/etc/powerdns/{{ item }} template: src={{ item }}.j2 dest=/etc/powerdns/{{ item }}
notify: Restart powerdns notify: Restart powerdns
with_items: loop:
- pdns.conf - pdns.conf
- recursor.conf - recursor.conf
- bindbackend.conf - bindbackend.conf
@ -21,6 +21,6 @@
- name: Start the powerdns services - name: Start the powerdns services
service: name={{ item }} state=started enabled=yes service: name={{ item }} state=started enabled=yes
with_items: loop:
- pdns - pdns
- pdns-recursor - pdns-recursor

View File

@ -14,7 +14,7 @@
- name: Install PostgreSQL - name: Install PostgreSQL
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- postgresql - postgresql
- python-psycopg2 - python-psycopg2

View File

@ -29,7 +29,7 @@
- name: Install packages - name: Install packages
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- build-essential - build-essential
- git - git
- nodejs - nodejs

View File

@ -2,7 +2,7 @@
- name: Install dependencies - name: Install dependencies
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- fping - fping
- git - git
- graphviz - graphviz
@ -47,7 +47,7 @@
path: "{{ item }}" path: "{{ item }}"
regexp: ';?date\.timezone' regexp: ';?date\.timezone'
line: 'date.timezone = Europe/Berlin' line: 'date.timezone = Europe/Berlin'
with_items: loop:
- /etc/php/7.3/cli/php.ini - /etc/php/7.3/cli/php.ini
- /etc/php/7.3/fpm/php.ini - /etc/php/7.3/fpm/php.ini

View File

@ -22,7 +22,7 @@
- name: Run postmap - name: Run postmap
command: postmap /etc/{{ item }} command: postmap /etc/{{ item }}
with_items: loop:
- postfix/helo_access - postfix/helo_access
- postfix/recipient_access - postfix/recipient_access
- postfix/transport - postfix/transport

View File

@ -8,7 +8,7 @@
- name: Install packages - name: Install packages
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- bsd-mailx - bsd-mailx
- dovecot-core - dovecot-core
- dovecot-imapd - dovecot-imapd
@ -55,7 +55,7 @@
- name: Render rspamd config templates - name: Render rspamd config templates
template: src=rspamd/local.d/{{ item }}.j2 dest=/etc/rspamd/local.d/{{ item }} template: src=rspamd/local.d/{{ item }}.j2 dest=/etc/rspamd/local.d/{{ item }}
notify: Restart rspamd notify: Restart rspamd
with_items: loop:
- options.inc - options.inc
- settings.conf - settings.conf
- arc.conf - arc.conf
@ -63,7 +63,7 @@
- name: Copy spam learn/unlearn sieve and shell scripts - name: Copy spam learn/unlearn sieve and shell scripts
copy: src=dovecot/{{ item }} dest=/var/vmail/.sieve/{{ item }} copy: src=dovecot/{{ item }} dest=/var/vmail/.sieve/{{ item }}
with_items: loop:
- bin/learn-spam.sh - bin/learn-spam.sh
- bin/learn-ham.sh - bin/learn-ham.sh
- move-spam.sieve - move-spam.sieve
@ -72,7 +72,7 @@
- name: Configure dovecot - name: Configure dovecot
template: src={{ item }}.j2 dest=/etc/{{ item }} template: src={{ item }}.j2 dest=/etc/{{ item }}
with_items: loop:
- dovecot/dovecot-ldap.conf.ext - dovecot/dovecot-ldap.conf.ext
- dovecot/dovecot-ldap.conf.lmtp - dovecot/dovecot-ldap.conf.lmtp
- dovecot/local.conf - dovecot/local.conf
@ -80,14 +80,14 @@
- name: Compile sieve scripts - name: Compile sieve scripts
shell: sievec /var/vmail/.sieve/{{ item|basename }} shell: sievec /var/vmail/.sieve/{{ item|basename }}
with_items: loop:
- move-spam.sieve - move-spam.sieve
- report-spam.sieve - report-spam.sieve
- report-ham.sieve - report-ham.sieve
- name: Ensure learn scripts are executable - name: Ensure learn scripts are executable
file: mode=0750 path=/var/vmail/.sieve/bin/{{ item }} file: mode=0750 path=/var/vmail/.sieve/bin/{{ item }}
with_items: loop:
- learn-spam.sh - learn-spam.sh
- learn-ham.sh - learn-ham.sh
@ -104,7 +104,7 @@
- name: Configure mailman - name: Configure mailman
template: src={{ item }}.j2 dest=/etc/{{ item }} template: src={{ item }}.j2 dest=/etc/{{ item }}
with_items: loop:
- mailman/mm_cfg.py - mailman/mm_cfg.py
notify: Restart postfix notify: Restart postfix
@ -129,21 +129,21 @@
- name: Configure postfix - name: Configure postfix
template: src={{ item }}.j2 dest=/etc/{{ item }} template: src={{ item }}.j2 dest=/etc/{{ item }}
with_items: loop:
- postfix/main.cf - postfix/main.cf
- postfix/master.cf - postfix/master.cf
notify: Restart postfix notify: Restart postfix
- name: Configure postsrsd - name: Configure postsrsd
template: src={{ item }}.j2 dest=/etc/{{ item }} template: src={{ item }}.j2 dest=/etc/{{ item }}
with_items: loop:
- default/postsrsd - default/postsrsd
- postsrsd.secret - postsrsd.secret
notify: Restart postsrsd notify: Restart postsrsd
- name: Configure postfix maps - name: Configure postfix maps
template: src={{ item }}.j2 dest=/etc/{{ item }} template: src={{ item }}.j2 dest=/etc/{{ item }}
with_items: loop:
- postfix/helo_access - postfix/helo_access
- postfix/transport - postfix/transport
- postfix/virtual-alias - postfix/virtual-alias

View File

@ -11,7 +11,7 @@
- name: Install matrix - name: Install matrix
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- matrix-synapse-py3 - matrix-synapse-py3
- postgresql - postgresql
- python-psycopg2 - python-psycopg2
@ -28,7 +28,7 @@
- name: Configure matrix - name: Configure matrix
template: src=matrix-synapse/{{ item }}.j2 dest=/etc/matrix-synapse/{{ item }} template: src=matrix-synapse/{{ item }}.j2 dest=/etc/matrix-synapse/{{ item }}
with_items: loop:
- homeserver.yaml - homeserver.yaml
- log.yaml - log.yaml
- conf.d/server_name.yaml - conf.d/server_name.yaml

View File

@ -2,7 +2,7 @@
- name: Install software for members - name: Install software for members
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- ansible - ansible
- git - git
- irssi - irssi

View File

@ -11,7 +11,7 @@
- name: Install packages - name: Install packages
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- php-redis - php-redis
- php7.3 - php7.3
- php7.3-bcmath - php7.3-bcmath

View File

@ -20,7 +20,7 @@
- name: Create DH parameters - name: Create DH parameters
command: openssl dhparam -outform PEM -out {{ item }} 2048 creates={{ item }} command: openssl dhparam -outform PEM -out {{ item }} 2048 creates={{ item }}
when: nginx_ssl == True when: nginx_ssl == True
with_items: loop:
- /etc/nginx/dhparam.pem - /etc/nginx/dhparam.pem
- name: Configure nginx - name: Configure nginx

View File

@ -2,7 +2,7 @@
- name: Install dependencies - name: Install dependencies
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- php7.3-fpm - php7.3-fpm
- php7.3-ldap - php7.3-ldap
- php7.3-mysql - php7.3-mysql

View File

@ -9,7 +9,7 @@
- name: Install prosody - name: Install prosody
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- prosody - prosody
- libsasl2-modules-ldap - libsasl2-modules-ldap
- sasl2-bin - sasl2-bin
@ -25,7 +25,7 @@
- name: Configure sasl - name: Configure sasl
copy: src={{ item }} dest=/etc/{{ item }} copy: src={{ item }} dest=/etc/{{ item }}
with_items: loop:
- default/saslauthd - default/saslauthd
- sasl/xmpp.conf - sasl/xmpp.conf

View File

@ -24,19 +24,19 @@
- name: Create DH parameters - name: Create DH parameters
command: openssl dhparam -outform PEM -out {{ item }} 2048 creates={{ item }} command: openssl dhparam -outform PEM -out {{ item }} 2048 creates={{ item }}
with_items: loop:
- /etc/freeradius/3.0/certs/dh - /etc/freeradius/3.0/certs/dh
notify: Restart freeradius notify: Restart freeradius
- name: Configure radius server - name: Configure radius server
template: src={{ item }}.j2 dest=/etc/freeradius/3.0/{{ item }} owner=freerad group=freerad template: src={{ item }}.j2 dest=/etc/freeradius/3.0/{{ item }} owner=freerad group=freerad
with_items: loop:
- clients.conf - clients.conf
notify: Restart freeradius notify: Restart freeradius
- name: Configure radius server - name: Configure radius server
copy: src={{ item }} dest=/etc/freeradius/3.0/{{ item }} owner=freerad group=freerad copy: src={{ item }} dest=/etc/freeradius/3.0/{{ item }} owner=freerad group=freerad
with_items: loop:
- mods-available/eap - mods-available/eap
- mods-config/files/authorize - mods-config/files/authorize
- sites-available/default - sites-available/default
@ -47,7 +47,7 @@
- name: Ensure sites are symlinked - name: Ensure sites are symlinked
file: src=../sites-available/{{ item }} dest=/etc/freeradius/3.0/sites-enabled/{{ item }} state=link file: src=../sites-available/{{ item }} dest=/etc/freeradius/3.0/sites-enabled/{{ item }} state=link
with_items: loop:
- default - default
- inner-tunnel - inner-tunnel
notify: Restart freeradius notify: Restart freeradius

View File

@ -13,7 +13,7 @@
- name: Copy schema definitons - name: Copy schema definitons
copy: src={{ item }} dest=/etc/ldap/{{ item }} copy: src={{ item }} dest=/etc/ldap/{{ item }}
with_items: loop:
- schema/kitchen.schema - schema/kitchen.schema
- schema/openssh-lpk.schema - schema/openssh-lpk.schema
- schema/radius.schema - schema/radius.schema

View File

@ -2,12 +2,12 @@
- name: Install unattended upgrades - name: Install unattended upgrades
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- unattended-upgrades - unattended-upgrades
- debian-goodies - debian-goodies
- name: Configure unattended upgrades - name: Configure unattended upgrades
template: src={{ item }}.j2 dest=/etc/apt/apt.conf.d/{{ item }} template: src={{ item }}.j2 dest=/etc/apt/apt.conf.d/{{ item }}
with_items: loop:
- 02periodic - 02periodic
- 50unattended-upgrades - 50unattended-upgrades

View File

@ -2,7 +2,7 @@
- name: Install dependencies - name: Install dependencies
apt: name={{ item }} apt: name={{ item }}
with_items: loop:
- php-fpm - php-fpm
- php-ldap - php-ldap
- php-sqlite3 - php-sqlite3