Changeset - a20ca43cd967
[Not reviewed]
0 8 0
Branko Majic (branko) - 5 years ago 2018-11-04 21:27:36
branko@majic.rs
MAR-134: Fix Ansible warning about use of apt and with_items:

- The apt module can accept list of names already, and with_items is
considered to be deprecated in this regard (otherwise it would
end-up running one apt command per item).
- Changed multiple roles where apt was used together along with_items.
8 files changed with 27 insertions and 38 deletions:
0 comments (0 inline, 0 general)
roles/backup_client/tasks/main.yml
Show inline comments
 
@@ -7,11 +7,10 @@
 

	
 
- name: Install backup software
 
  apt:
 
    name: "{{ item }}"
 
    name:
 
      - duplicity
 
      - duply
 
    state: present
 
  with_items:
 
    - duplicity
 
    - duply
 

	
 
- name: Set-up Duply directories
 
  file:
roles/backup_server/tasks/main.yml
Show inline comments
 
@@ -2,11 +2,10 @@
 

	
 
- name: Install backup software
 
  apt:
 
    name: "{{ item }}"
 
    name:
 
      - duplicity
 
      - duply
 
    state: present
 
  with_items:
 
    - duplicity
 
    - duply
 

	
 
- name: Create directory for storing backups
 
  file:
roles/common/tasks/main.yml
Show inline comments
 
@@ -99,9 +99,8 @@
 

	
 
- name: Install common packages
 
  apt:
 
    name: "{{ item }}"
 
    name: "{{ common_packages }}"
 
    state: "present"
 
  with_items: "{{ common_packages }}"
 

	
 
- name: Set-up MariaDB mysql_config symbolic link for compatibility (workaround for Debian bug 766996)
 
  file:
roles/database_server/tasks/main.yml
Show inline comments
 
@@ -2,12 +2,11 @@
 

	
 
- name: Install MariaDB
 
  apt:
 
    name: "{{ item }}"
 
    name:
 
      - mariadb-client
 
      - mariadb-server
 
      - python-mysqldb
 
    state: present
 
  with_items:
 
    - mariadb-client
 
    - mariadb-server
 
    - python-mysqldb
 

	
 
- name: Enable MariaDB service on boot (workaround for systemctl broken handling of SysV)
 
  command: rcconf -on mysql
roles/mail_server/tasks/main.yml
Show inline comments
 
@@ -7,21 +7,19 @@
 

	
 
- name: Install Dovecot packages
 
  apt:
 
    name: "{{ item }}"
 
    name:
 
      - dovecot-imapd
 
      - dovecot-ldap
 
      - dovecot-sieve
 
      - dovecot-managesieved
 
    state: present
 
  with_items:
 
    - dovecot-imapd
 
    - dovecot-ldap
 
    - dovecot-sieve
 
    - dovecot-managesieved
 

	
 
- name: Install Postfix packages
 
  apt:
 
    name: "{{ item }}"
 
    name:
 
      - postfix
 
      - postfix-ldap
 
    state: present
 
  with_items:
 
    - postfix
 
    - postfix-ldap
 

	
 
- name: Purge Exim configuration
 
  apt:
roles/php_website/tasks/main.yml
Show inline comments
 
@@ -59,9 +59,8 @@
 

	
 
- name: Install extra packages for website
 
  apt:
 
    name: "{{ item }}"
 
    name: "{{ packages }}"
 
    state: present
 
  with_items: "{{ packages }}"
 

	
 
- name: Set-up MariaDB mysql_config symbolic link for compatibility on Jessie (workaround for Debian bug 766996)
 
  file:
roles/web_server/tasks/main.yml
Show inline comments
 
@@ -129,13 +129,12 @@
 

	
 
- name: Install base packages for Python web applications
 
  apt:
 
    name: "{{ item }}"
 
    name:
 
      - python-setuptools
 
      - python3-setuptools
 
      - virtualenv
 
      - virtualenvwrapper
 
    state: present
 
  with_items:
 
    - python-setuptools
 
    - python3-setuptools
 
    - virtualenv
 
    - virtualenvwrapper
 

	
 
- name: Create directories for storing per-site socket files
 
  file:
 
@@ -161,10 +160,8 @@
 

	
 
- name: Install base packages for PHP web applications
 
  apt:
 
    name: "{{ item }}"
 
    name: "{{ php_fpm_package_name }}"
 
    state: present
 
  with_items:
 
    - "{{ php_fpm_package_name }}"
 

	
 
- name: Create directory for storing PHP-FPM service configuration overrides
 
  file:
roles/wsgi_website/tasks/main.yml
Show inline comments
 
@@ -75,9 +75,8 @@
 

	
 
- name: Install extra packages for website
 
  apt:
 
    name: "{{ item }}"
 
    name: "{{ packages }}"
 
    state: present
 
  with_items: "{{ packages }}"
 
  register: install_extra_packages
 
  notify:
 
    - Restart WSGI services
0 comments (0 inline, 0 general)