From fd7d59d2be27c49c4bda45c2595395524ecdb546 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 4 Dec 2019 18:24:56 +0530 Subject: [PATCH] fix(ansible): deprecated warnings install loops --- playbooks/macosx.yml | 30 ++++---- .../roles/bench/tasks/setup_firewall.yml | 10 ++- playbooks/roles/common/tasks/debian.yml | 34 ++++---- .../roles/common/tasks/debian_family.yml | 60 ++++++++------- playbooks/roles/common/tasks/macos.yml | 20 ++--- .../roles/common/tasks/redhat_family.yml | 77 ++++++++++--------- playbooks/roles/common/tasks/ubuntu.yml | 45 ++++++----- playbooks/roles/frappe_selinux/tasks/main.yml | 9 ++- playbooks/roles/mariadb/tasks/centos.yml | 15 ++-- playbooks/roles/mariadb/tasks/debian.yml | 16 ++-- .../roles/mariadb/tasks/ubuntu-trusty.yml | 16 ++-- .../mariadb/tasks/ubuntu-xenial_bionic.yml | 16 ++-- .../roles/nodejs/tasks/debian_family.yml | 2 +- playbooks/roles/ntpd/tasks/main.yml | 18 +++-- .../roles/packer/tasks/debian_family.yml | 8 +- .../roles/packer/tasks/redhat_family.yml | 7 +- playbooks/roles/redis/tasks/main.yml | 22 +++--- .../roles/virtualbox/tasks/debian_family.yml | 17 ++-- .../roles/virtualbox/tasks/redhat_family.yml | 9 ++- playbooks/roles/wkhtmltopdf/tasks/main.yml | 27 ++++--- 20 files changed, 255 insertions(+), 203 deletions(-) diff --git a/playbooks/macosx.yml b/playbooks/macosx.yml index 2ca0e174..12be8f04 100644 --- a/playbooks/macosx.yml +++ b/playbooks/macosx.yml @@ -2,24 +2,26 @@ - hosts: localhost become: yes become_user: root + vars: bench_repo_path: "/Users/{{ ansible_user_id }}/.bench" bench_path: "/Users/{{ ansible_user_id }}/frappe-bench" - tasks: - # install pre-requisites - - name: install prequisites - homebrew: name={{ item }} state=present - with_items: - - cmake - - redis - - mariadb - - nodejs - # install wkhtmltopdf - - name: cask installs - homebrew_cask: name={{ item }} state=present - with_items: - - wkhtmltopdf + tasks: + - name: install prequisites + homebrew: + name: + - cmake + - redis + - mariadb + - nodejs + state: present + + - name: install wkhtmltopdf + homebrew_cask: + name: + - wkhtmltopdf + state: present - name: configure mariadb include: roles/mariadb/tasks/main.yml diff --git a/playbooks/roles/bench/tasks/setup_firewall.yml b/playbooks/roles/bench/tasks/setup_firewall.yml index f1fc9fa8..f3186b42 100644 --- a/playbooks/roles/bench/tasks/setup_firewall.yml +++ b/playbooks/roles/bench/tasks/setup_firewall.yml @@ -31,10 +31,12 @@ # For Ubuntu / Debian - name: Install ufw - apt: name={{ item }} state=present force=yes - with_items: - - python-selinux - - ufw + apt: + state: present + force: yes + pkg: + - python-selinux + - ufw when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian' - name: Enable Firewall diff --git a/playbooks/roles/common/tasks/debian.yml b/playbooks/roles/common/tasks/debian.yml index 8aa2555c..b057706c 100644 --- a/playbooks/roles/common/tasks/debian.yml +++ b/playbooks/roles/common/tasks/debian.yml @@ -4,26 +4,30 @@ pip: name=pyOpenSSL version=16.2.0 - name: install pillow prerequisites for Debian < 8 - apt: pkg={{ item }} state=present - with_items: - - libjpeg8-dev - - libtiff4-dev - - tcl8.5-dev - - tk8.5-dev + apt: + pkg: + - libjpeg8-dev + - libtiff4-dev + - tcl8.5-dev + - tk8.5-dev + state: present when: ansible_distribution_version | version_compare('8', 'lt') - name: install pillow prerequisites for Debian >= 8 - apt: pkg={{ item }} state=present - with_items: - - libjpeg62-turbo-dev - - libtiff5-dev - - tcl8.5-dev - - tk8.5-dev + apt: + pkg: + - libjpeg62-turbo-dev + - libtiff5-dev + - tcl8.5-dev + - tk8.5-dev + state: present when: ansible_distribution_version | version_compare('8', 'ge') - name: install pdf prerequisites debian - apt: pkg={{ item }} state=present force=yes - with_items: - - libssl-dev + apt: + pkg: + - libssl-dev + state: present + force: yes ... \ No newline at end of file diff --git a/playbooks/roles/common/tasks/debian_family.yml b/playbooks/roles/common/tasks/debian_family.yml index 1fd90fcd..64eb8485 100644 --- a/playbooks/roles/common/tasks/debian_family.yml +++ b/playbooks/roles/common/tasks/debian_family.yml @@ -3,35 +3,37 @@ - name: Install prerequisites using apt-get become: yes become_user: root - apt: pkg={{ item }} state=present force=yes - with_items: - - dnsmasq - - fontconfig - - git # Version control - - htop # Server stats - - libcrypto++-dev - - libfreetype6-dev - - liblcms2-dev - - libwebp-dev - - libxext6 - - libxrender1 - - libxslt1-dev - - libxslt1.1 - - libffi-dev - - ntp # Clock synchronization - - postfix # Mail Server - - python3-dev # Installing python developer suite - - python-tk - - screen # To aid ssh sessions with connectivity problems - - vim # Is that supposed to be a question!? - - xfonts-75dpi - - xfonts-base - - zlib1g-dev - - apt-transport-https - - libsasl2-dev - - libldap2-dev - - libcups2-dev - - pv # Show progress during database restore + apt: + pkg: + - dnsmasq + - fontconfig + - git # Version control + - htop # Server stats + - libcrypto++-dev + - libfreetype6-dev + - liblcms2-dev + - libwebp-dev + - libxext6 + - libxrender1 + - libxslt1-dev + - libxslt1.1 + - libffi-dev + - ntp # Clock synchronization + - postfix # Mail Server + - python3-dev # Installing python developer suite + - python-tk + - screen # To aid ssh sessions with connectivity problems + - vim # Is that supposed to be a question!? + - xfonts-75dpi + - xfonts-base + - zlib1g-dev + - apt-transport-https + - libsasl2-dev + - libldap2-dev + - libcups2-dev + - pv # Show progress during database restore + state: present + force: yes - include_tasks: debian.yml when: ansible_distribution == 'Debian' diff --git a/playbooks/roles/common/tasks/macos.yml b/playbooks/roles/common/tasks/macos.yml index a5fbd0bf..3fed1da6 100644 --- a/playbooks/roles/common/tasks/macos.yml +++ b/playbooks/roles/common/tasks/macos.yml @@ -9,18 +9,20 @@ tasks: # install pre-requisites - name: install prequisites - homebrew: name={{ item }} state=present - with_items: - - cmake - - redis - - mariadb - - nodejs + homebrew: + name: + - cmake + - redis + - mariadb + - nodejs + state: present # install wkhtmltopdf - name: cask installs - homebrew_cask: name={{ item }} state=present - with_items: - - wkhtmltopdf + homebrew_cask: + name: + - wkhtmltopdf + state: present - name: configure mariadb include_tasks: roles/mariadb/tasks/main.yml diff --git a/playbooks/roles/common/tasks/redhat_family.yml b/playbooks/roles/common/tasks/redhat_family.yml index c2ae15ef..d41097c6 100644 --- a/playbooks/roles/common/tasks/redhat_family.yml +++ b/playbooks/roles/common/tasks/redhat_family.yml @@ -10,42 +10,43 @@ - name: "Setup prerequisites using yum" become: yes become_user: root - yum: name={{ item }} state=present - with_items: - - bzip2-devel - - cronie - - dnsmasq - - freetype-devel - - git - - htop - - lcms2-devel - - libjpeg-devel - - libtiff-devel - - libffi-devel - - libwebp-devel - - libXext - - libXrender - - libzip-devel - - libffi-devel - - ntp - - openssl-devel - - postfix - - python36u - - python-devel - - python-setuptools - - python-pip - - redis - - screen - - sudo - - tcl-devel - - tk-devel - - vim - - which - - xorg-x11-fonts-75dpi - - xorg-x11-fonts-Type1 - - zlib-devel - - openssl-devel - - openldap-devel - - libselinux-python - - cups-libs + yum: + name: + - bzip2-devel + - cronie + - dnsmasq + - freetype-devel + - git + - htop + - lcms2-devel + - libjpeg-devel + - libtiff-devel + - libffi-devel + - libwebp-devel + - libXext + - libXrender + - libzip-devel + - libffi-devel + - ntp + - openssl-devel + - postfix + - python36u + - python-devel + - python-setuptools + - python-pip + - redis + - screen + - sudo + - tcl-devel + - tk-devel + - vim + - which + - xorg-x11-fonts-75dpi + - xorg-x11-fonts-Type1 + - zlib-devel + - openssl-devel + - openldap-devel + - libselinux-python + - cups-libs + state: present ... diff --git a/playbooks/roles/common/tasks/ubuntu.yml b/playbooks/roles/common/tasks/ubuntu.yml index dae12063..20c76a0b 100644 --- a/playbooks/roles/common/tasks/ubuntu.yml +++ b/playbooks/roles/common/tasks/ubuntu.yml @@ -1,34 +1,41 @@ --- - name: install pillow prerequisites for Ubuntu < 14.04 - apt: pkg={{ item }} state=present force=yes - with_items: - - libjpeg8-dev - - libtiff4-dev - - tcl8.5-dev - - tk8.5-dev + apt: + pkg: + - libjpeg8-dev + - libtiff4-dev + - tcl8.5-dev + - tk8.5-dev + state: present + force: yes when: ansible_distribution_version | version_compare('14.04', 'lt') - name: install pillow prerequisites for Ubuntu >= 14.04 - apt: pkg={{ item }} state=present force=yes - with_items: - - libjpeg8-dev - - libtiff5-dev - - tcl8.6-dev - - tk8.6-dev + apt: + pkg: + - libjpeg8-dev + - libtiff5-dev + - tcl8.6-dev + - tk8.6-dev + state: present + force: yes when: ansible_distribution_version | version_compare('14.04', 'ge') - - name: install pdf prerequisites for Ubuntu < 18.04 - apt: pkg={{ item }} state=present force=yes - with_items: - - libssl-dev + apt: + pkg: + - libssl-dev + state: present + force: yes when: ansible_distribution_version | version_compare('18.04', 'lt') - name: install pdf prerequisites for Ubuntu >= 18.04 - apt: pkg={{ item }} state=present force=yes - with_items: - - libssl1.0-dev + apt: + pkg: + - libssl1.0-dev + state: present + force: yes when: ansible_distribution_version | version_compare('18.04', 'ge') ... \ No newline at end of file diff --git a/playbooks/roles/frappe_selinux/tasks/main.yml b/playbooks/roles/frappe_selinux/tasks/main.yml index 43602163..085ad59f 100644 --- a/playbooks/roles/frappe_selinux/tasks/main.yml +++ b/playbooks/roles/frappe_selinux/tasks/main.yml @@ -1,9 +1,10 @@ --- - name: Install deps - yum: name="{{item}}" state=present - with_items: - - policycoreutils-python - - selinux-policy-devel + yum: + name: + - policycoreutils-python + - selinux-policy-devel + state: present when: ansible_distribution == 'CentOS' - name: Check enabled SELinux modules diff --git a/playbooks/roles/mariadb/tasks/centos.yml b/playbooks/roles/mariadb/tasks/centos.yml index c069aacd..7dbe69d1 100644 --- a/playbooks/roles/mariadb/tasks/centos.yml +++ b/playbooks/roles/mariadb/tasks/centos.yml @@ -3,11 +3,16 @@ template: src=mariadb_centos.repo.j2 dest=/etc/yum.repos.d/mariadb.repo owner=root group=root mode=0644 - name: Install MariaDB - yum: name={{ item }} enablerepo=mariadb state=present - with_items: - - MariaDB-server - - MariaDB-client + yum: + name: + - MariaDB-server + - MariaDB-client + enablerepo: mariadb + state: present - name: Install MySQLdb Python package for secure installations. - yum: name=MySQL-python state=present + yum: + name: + - MySQL-python + state: present when: mysql_secure_installation and mysql_root_password is defined diff --git a/playbooks/roles/mariadb/tasks/debian.yml b/playbooks/roles/mariadb/tasks/debian.yml index 8e9596c5..246aff59 100644 --- a/playbooks/roles/mariadb/tasks/debian.yml +++ b/playbooks/roles/mariadb/tasks/debian.yml @@ -21,11 +21,13 @@ shell: export DEBIAN_FRONTEND=noninteractive - name: apt-get install - apt: pkg={{ item }} update_cache=yes state=present - with_items: - - mariadb-server - - mariadb-client - - mariadb-common - - libmariadbclient18 - - python3-mysqldb + apt: + pkg: + - mariadb-server + - mariadb-client + - mariadb-common + - libmariadbclient18 + - python3-mysqldb + update_cache: yes + state: present ... \ No newline at end of file diff --git a/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml b/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml index 6493b985..45839b48 100644 --- a/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml +++ b/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml @@ -16,12 +16,16 @@ changed_when: false - name: Install MariaDB - apt: pkg={{ item }} state=present - with_items: - - mariadb-server - - mariadb-client - - libmariadbclient18 + apt: + pkg: + - mariadb-server + - mariadb-client + - libmariadbclient18 + state: present - name: Install MySQLdb Python package for secure installations. - apt: pkg=python3-mysqldb state=present + apt: + pkg: + - python3-mysqldb + state: present when: mysql_secure_installation and mysql_root_password is defined diff --git a/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml b/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml index 2163cc00..a96dff1b 100644 --- a/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml +++ b/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml @@ -16,12 +16,16 @@ changed_when: false - name: Install MariaDB - apt: pkg={{ item }} state=present - with_items: - - mariadb-server - - mariadb-client - - libmariadbclient18 + apt: + pkg: + - mariadb-server + - mariadb-client + - libmariadbclient18 + state: present - name: Install MySQLdb Python package for secure installations. - apt: pkg=python3-mysqldb state=present + apt: + pkg: + - python3-mysqldb + state: present when: mysql_secure_installation and mysql_root_password is defined diff --git a/playbooks/roles/nodejs/tasks/debian_family.yml b/playbooks/roles/nodejs/tasks/debian_family.yml index b2985729..989e18cb 100644 --- a/playbooks/roles/nodejs/tasks/debian_family.yml +++ b/playbooks/roles/nodejs/tasks/debian_family.yml @@ -7,7 +7,7 @@ - name: Install nodejs {{ node_version }} apt: - name: nodejs + pkg: nodejs state: present update_cache: yes force: yes diff --git a/playbooks/roles/ntpd/tasks/main.yml b/playbooks/roles/ntpd/tasks/main.yml index b2cfb190..46a16768 100644 --- a/playbooks/roles/ntpd/tasks/main.yml +++ b/playbooks/roles/ntpd/tasks/main.yml @@ -1,9 +1,10 @@ --- - name: Install ntpd - yum: name="{{item}}" state=installed - with_items: - - ntp - - ntpdate + yum: + name: + - ntp + - ntpdate + state: installed when: ansible_distribution == 'CentOS' - name: Enable ntpd @@ -11,10 +12,11 @@ when: ansible_distribution == 'CentOS' - name: Install ntpd - apt: name="{{item}}" state=installed - with_items: - - ntp - - ntpdate + apt: + pkg: + - ntp + - ntpdate + state: installed when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - name: Enable ntpd diff --git a/playbooks/roles/packer/tasks/debian_family.yml b/playbooks/roles/packer/tasks/debian_family.yml index 52d34486..6c3c1496 100644 --- a/playbooks/roles/packer/tasks/debian_family.yml +++ b/playbooks/roles/packer/tasks/debian_family.yml @@ -1,6 +1,8 @@ --- - name: Install unzip - apt: pkg={{ item }} update_cache=yes state=present - with_items: - - unzip + apt: + pkg: + - unzip + update_cache: yes + state: present ... \ No newline at end of file diff --git a/playbooks/roles/packer/tasks/redhat_family.yml b/playbooks/roles/packer/tasks/redhat_family.yml index 937adfc0..8cb1071d 100644 --- a/playbooks/roles/packer/tasks/redhat_family.yml +++ b/playbooks/roles/packer/tasks/redhat_family.yml @@ -1,7 +1,8 @@ --- - name: Install unzip - yum: name={{ item }} state=present - with_items: - - unzip + yum: + name: + - unzip + state: present ... diff --git a/playbooks/roles/redis/tasks/main.yml b/playbooks/roles/redis/tasks/main.yml index 472c65c4..4c009dcc 100644 --- a/playbooks/roles/redis/tasks/main.yml +++ b/playbooks/roles/redis/tasks/main.yml @@ -1,21 +1,25 @@ --- - name: Install yum packages - yum: name={{ item }} state=present - with_items: - - redis + yum: + name: + - redis + state: present when: ansible_os_family == 'RedHat' # Prerequisite for Debian and Ubuntu - name: Install apt packages - apt: pkg={{ item }} state=present force=yes - with_items: - - redis-server + apt: + pkg: + - redis-server + state: present + force: yes when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' # Prerequisite for MACOS - name: install prequisites for macos - homebrew: name={{ item }} state=present - with_items: - - redis + homebrew: + name: + - redis + state: present when: ansible_distribution == 'MacOSX' ... \ No newline at end of file diff --git a/playbooks/roles/virtualbox/tasks/debian_family.yml b/playbooks/roles/virtualbox/tasks/debian_family.yml index 8dbcab79..9367c9b7 100644 --- a/playbooks/roles/virtualbox/tasks/debian_family.yml +++ b/playbooks/roles/virtualbox/tasks/debian_family.yml @@ -1,9 +1,10 @@ --- - name: Install dependencies - apt: pkg={{ item }} state=present - with_items: - - apt-transport-https - - ca-certificates + apt: + pkg: + - apt-transport-https + - ca-certificates + state: present - name: Add VirtualBox to sources.list apt_repository: @@ -23,7 +24,9 @@ when: (ansible_distribution == "Debian" and ansible_distribution_major_version < "8") or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version < "16") - name: Install VirtualBox - apt: pkg={{ item }} update_cache=yes state=present - with_items: - - virtualbox-{{ virtualbox_version }} + apt: + pkg: + - virtualbox-{{ virtualbox_version }} + update_cache: yes + state: present ... diff --git a/playbooks/roles/virtualbox/tasks/redhat_family.yml b/playbooks/roles/virtualbox/tasks/redhat_family.yml index 76bd56ab..899de175 100644 --- a/playbooks/roles/virtualbox/tasks/redhat_family.yml +++ b/playbooks/roles/virtualbox/tasks/redhat_family.yml @@ -5,10 +5,11 @@ state: present - name: Install dependencies - yum: name={{ item }} state=present - with_items: - - kernel-devel - - deltarpm + yum: + name: + - kernel-devel + - deltarpm + state: present - copy: src=virtualbox_centos.repo dest=/etc/yum.repos.d/virtualbox.repo owner=root group=root mode=0644 force=no diff --git a/playbooks/roles/wkhtmltopdf/tasks/main.yml b/playbooks/roles/wkhtmltopdf/tasks/main.yml index 18ea0016..59f5c736 100644 --- a/playbooks/roles/wkhtmltopdf/tasks/main.yml +++ b/playbooks/roles/wkhtmltopdf/tasks/main.yml @@ -1,20 +1,23 @@ --- - name: install base fonts - yum: name={{ item }} state=present - with_items: - - libXrender - - libXext - - xorg-x11-fonts-75dpi - - xorg-x11-fonts-Type1 + yum: + name: + - libXrender + - libXext + - xorg-x11-fonts-75dpi + - xorg-x11-fonts-Type1 + state: present when: ansible_os_family == 'RedHat' - name: install base fonts - apt: name={{ item }} state=present force=yes - with_items: - - libxrender1 - - libxext6 - - xfonts-75dpi - - xfonts-base + apt: + pkg: + - libxrender1 + - libxext6 + - xfonts-75dpi + - xfonts-base + state: present + force: yes when: ansible_os_family == 'Debian' # wkhtmltopdf has been locked down to 0.12.3 intentionally since 0.12.4 has problems.