Changeset - a20ca43cd967
[Not reviewed]
0 8 0
Branko Majic (branko) - 7 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
 
@@ -4,17 +4,16 @@
 
  apt:
 
    name: "python-pexpect"
 
    state: present
 

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

	
 
- name: Set-up Duply directories
 
  file:
 
    path: "{{ item }}"
 
    state: directory
 
    owner: root
roles/backup_server/tasks/main.yml
Show inline comments
 
---
 

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

	
 
- name: Create directory for storing backups
 
  file:
 
    path: "/srv/backups"
 
    state: directory
 
    owner: root
roles/common/tasks/main.yml
Show inline comments
 
@@ -96,15 +96,14 @@
 
  apt:
 
    name: rcconf
 
    state: present
 

	
 
- 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:
 
    src: "/usr/bin/mariadb_config"
 
    dest: "/usr/bin/mysql_config"
 
    state: link
roles/database_server/tasks/main.yml
Show inline comments
 
---
 

	
 
- 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
 
  register: result
 
  changed_when: result.stderr == ""
 

	
roles/mail_server/tasks/main.yml
Show inline comments
 
@@ -4,27 +4,25 @@
 
  apt:
 
    name: rsync
 
    state: present
 

	
 
- 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:
 
    name: "exim4*"
 
    state: absent
 
    purge: true
roles/php_website/tasks/main.yml
Show inline comments
 
@@ -56,15 +56,14 @@
 
    owner: root
 
    group: "{{ user }}"
 
    mode: 0640
 

	
 
- 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:
 
    src: "/usr/bin/mariadb_config"
 
    dest: "/usr/bin/mysql_config"
 
    state: link
roles/web_server/tasks/main.yml
Show inline comments
 
@@ -126,19 +126,18 @@
 
    name: nginx
 
    enabled: true
 
    state: started
 

	
 
- 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:
 
    path: "{{ item }}"
 
    state: directory
 
    owner: root
 
@@ -158,16 +157,14 @@
 
  with_items:
 
    - wsgi
 
    - "{{ php_fpm_service_name }}"
 

	
 
- 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:
 
    path: "/etc/systemd/system/{{ php_fpm_service_name }}.service.d/"
 
    state: directory
 
    owner: root
roles/wsgi_website/tasks/main.yml
Show inline comments
 
@@ -72,15 +72,14 @@
 
    owner: root
 
    group: "{{ user }}"
 
    mode: 0640
 

	
 
- name: Install extra packages for website
 
  apt:
 
    name: "{{ item }}"
 
    name: "{{ packages }}"
 
    state: present
 
  with_items: "{{ packages }}"
 
  register: install_extra_packages
 
  notify:
 
    - Restart WSGI services
 

	
 
- name: Set-up MariaDB mysql_config symbolic link for compatibility (workaround for Debian bug 766996)
 
  file:
0 comments (0 inline, 0 general)