From 5d201f7d9b55ff50753da2456634a3e51462ba1f Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 22 Jun 2022 20:57:51 -0700 Subject: refactor 'apt' tasks to newer syntax (not 'with_items') --- playbooks/init_adze.yml | 9 ++- playbooks/init_bnewbold_nsa.yml | 9 ++- roles/common/tasks/extrapkg.yml | 24 +++--- roles/common/tasks/main.yml | 129 ++++++++++++++++---------------- roles/common/tasks/ntp.yml | 2 +- roles/common/tasks/security.yml | 15 ++-- roles/git/tasks/cgit.yml | 11 +-- roles/git/tasks/git-daemon.yml | 4 +- roles/git/tasks/gitolite.yml | 2 +- roles/mailserver/tasks/dovecot.yml | 14 ++-- roles/mailserver/tasks/postfix.yml | 13 ++-- roles/mailserver/tasks/rspamd.yml | 4 +- roles/mediagoblin/tasks/mediagoblin.yml | 25 ++++--- roles/nullmailer/tasks/main.yml | 9 ++- roles/znc/tasks/znc.yml | 8 +- 15 files changed, 140 insertions(+), 138 deletions(-) diff --git a/playbooks/init_adze.yml b/playbooks/init_adze.yml index 6850327..9df9fcd 100644 --- a/playbooks/init_adze.yml +++ b/playbooks/init_adze.yml @@ -37,10 +37,11 @@ with_file: - pubkeys/bnewbold.pub - name: Extra packages for this host - apt: name={{item}} state=installed - with_items: - - socat - - rsyslog + apt: + state: present + name: + - socat + - rsyslog post_tasks: - name: Sanity check that we have IPv4 connectivity diff --git a/playbooks/init_bnewbold_nsa.yml b/playbooks/init_bnewbold_nsa.yml index 7c2fb70..9529448 100644 --- a/playbooks/init_bnewbold_nsa.yml +++ b/playbooks/init_bnewbold_nsa.yml @@ -35,10 +35,11 @@ with_file: - pubkeys/bnewbold.pub - name: Extra packages for this host - apt: name={{item}} state=installed - with_items: - - socat - - rsyslog + apt: + state: present + name: + - socat + - rsyslog post_tasks: - name: Sanity check that we have IPv4 connectivity diff --git a/roles/common/tasks/extrapkg.yml b/roles/common/tasks/extrapkg.yml index 0836912..79e08cb 100644 --- a/roles/common/tasks/extrapkg.yml +++ b/roles/common/tasks/extrapkg.yml @@ -1,17 +1,17 @@ --- - name: Install extras that Everybody wants - apt: pkg={{ item }} state=installed - with_items: - - ack-grep - - alpine - - build-essential - - cowsay - - ctorrent - - figlet - - ipython - - ipython3 - - lynx - - manpages-dev + apt: + state: present + name: + - ack-grep + - alpine + - build-essential + - cowsay + - ctorrent + - figlet + - ipython3 + - lynx + - manpages-dev tags: - dependencies diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index a1f4500..ec5ad7b 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -11,70 +11,71 @@ - dependencies - name: Install necessities and nice-to-haves - apt: pkg={{ item }} state=installed - with_items: - # fail2ban in security - # rkhunter in security - - apt-transport-https - - apticron - - aptitude - - bash-completion - - bzip2 - - ca-certificates - - curl - - debian-goodies - - dialog - - dnsutils - - dstat - - etckeeper - - fd-find - - file - - git - - htop - - httpie - - iftop - - ifupdown - - iotop - - iproute - - iputils-ping - - isc-dhcp-client - - jq - - less - - libui-dialog-perl - - lnav - - locales - - locales-all - - lsof - - lvm2 - - man-db - - manpages-dev - - molly-guard - - moreutils - - mosh - - mtr-tiny - - net-tools - - netbase - - netcat - - ngrep - - openssh-server - - openssl - - parallel - - pigz - - pv - - python - - python-software-properties - - ripgrep - - screen - - sqlite3 - - sudo - - tcpdump - - tree - - unattended-upgrades - - unzip - - util-linux - - vim-nox - - wget - - zip + apt: + state: present + name: + # fail2ban in security + # rkhunter in security + - apt-transport-https + - apticron + - aptitude + - bash-completion + - bzip2 + - ca-certificates + - curl + - debian-goodies + - dialog + - dnsutils + - dstat + - etckeeper + - fd-find + - file + - git + - htop + - httpie + - iftop + - ifupdown + - iotop + - iproute + - iputils-ping + - isc-dhcp-client + - jq + - less + - libui-dialog-perl + - lnav + - locales + - locales-all + - lsof + - lvm2 + - man-db + - manpages-dev + - molly-guard + - moreutils + - mosh + - mtr-tiny + - net-tools + - netbase + - netcat + - ngrep + - openssh-server + - openssl + - parallel + - pigz + - pv + - python3 + - python3-software-properties + - ripgrep + - screen + - sqlite3 + - sudo + - tcpdump + - tree + - unattended-upgrades + - unzip + - util-linux + - vim-nox + - wget + - zip tags: - dependencies diff --git a/roles/common/tasks/ntp.yml b/roles/common/tasks/ntp.yml index c1489fd..219cdb5 100644 --- a/roles/common/tasks/ntp.yml +++ b/roles/common/tasks/ntp.yml @@ -2,7 +2,7 @@ # Defines tasks applicable for NTP (Network Time Protocol) - name: Install ntp - apt: pkg=ntp state=installed + apt: name=ntp state=present tags: - dependencies diff --git a/roles/common/tasks/security.yml b/roles/common/tasks/security.yml index c00b941..df2f065 100644 --- a/roles/common/tasks/security.yml +++ b/roles/common/tasks/security.yml @@ -1,12 +1,13 @@ --- - name: Install security-related packages - apt: pkg={{ item }} state=installed - with_items: - - fail2ban - - whois - - lynis - - rkhunter - - debsums + apt: + state: present + name: + - fail2ban + - whois + - lynis + - rkhunter + - debsums tags: - dependencies diff --git a/roles/git/tasks/cgit.yml b/roles/git/tasks/cgit.yml index 9d3f2db..40c5af7 100644 --- a/roles/git/tasks/cgit.yml +++ b/roles/git/tasks/cgit.yml @@ -1,10 +1,11 @@ - name: Install cgit package and deps (fcgi stuff) - apt: pkg={{ item }} state=installed - with_items: - - cgit - - fcgiwrap - - spawn-fcgi + apt: + state: present + name: + - cgit + - fcgiwrap + - spawn-fcgi tags: - dependencies diff --git a/roles/git/tasks/git-daemon.yml b/roles/git/tasks/git-daemon.yml index 793275c..b604401 100644 --- a/roles/git/tasks/git-daemon.yml +++ b/roles/git/tasks/git-daemon.yml @@ -1,8 +1,6 @@ - name: Install git-daemon-sysvinit package - apt: pkg={{ item }} state=installed - with_items: - - git-daemon-sysvinit + apt: name=git-daemon-sysvinit state=present tags: - dependencies diff --git a/roles/git/tasks/gitolite.yml b/roles/git/tasks/gitolite.yml index 09a6ac8..f926560 100644 --- a/roles/git/tasks/gitolite.yml +++ b/roles/git/tasks/gitolite.yml @@ -8,7 +8,7 @@ user: name=www-data groups=git append=yes - name: Install gitolite3 package - apt: pkg=gitolite3 state=installed + apt: name=gitolite3 state=present tags: - dependencies diff --git a/roles/mailserver/tasks/dovecot.yml b/roles/mailserver/tasks/dovecot.yml index 9d2c20e..ca62b96 100644 --- a/roles/mailserver/tasks/dovecot.yml +++ b/roles/mailserver/tasks/dovecot.yml @@ -1,10 +1,12 @@ - name: Install Dovecot and related packages - apt: pkg={{ item }} update_cache=yes state=installed - with_items: - - dovecot-core - - dovecot-imapd - - dovecot-lmtpd - - dovecot-antispam + apt: + update_cache: yes + state: present + name: + - dovecot-core + - dovecot-imapd + - dovecot-lmtpd + - dovecot-antispam tags: - dependencies diff --git a/roles/mailserver/tasks/postfix.yml b/roles/mailserver/tasks/postfix.yml index a36acd6..7b02cf4 100644 --- a/roles/mailserver/tasks/postfix.yml +++ b/roles/mailserver/tasks/postfix.yml @@ -1,10 +1,11 @@ - name: Install Postfix and related packages - apt: pkg={{ item }} state=installed - with_items: - - libsasl2-modules - - postfix - - postfix-pcre - - sasl2-bin + apt: + state: present + name: + - libsasl2-modules + - postfix + - postfix-pcre + - sasl2-bin tags: - dependencies diff --git a/roles/mailserver/tasks/rspamd.yml b/roles/mailserver/tasks/rspamd.yml index 4d870a8..c00bf72 100644 --- a/roles/mailserver/tasks/rspamd.yml +++ b/roles/mailserver/tasks/rspamd.yml @@ -26,9 +26,7 @@ - dependencies - name: Install Rspamd and Redis - apt: pkg={{ item }} state=installed update_cache=yes - with_items: - - rspamd + apt: pkg=rspamd state=installed update_cache=yes tags: - dependencies diff --git a/roles/mediagoblin/tasks/mediagoblin.yml b/roles/mediagoblin/tasks/mediagoblin.yml index ff092e6..12252e1 100644 --- a/roles/mediagoblin/tasks/mediagoblin.yml +++ b/roles/mediagoblin/tasks/mediagoblin.yml @@ -1,16 +1,17 @@ - name: Install mediagoblin dependencies - apt: name={{item}} state=installed - with_items: - - python3-dev - - python3-lxml - - python3-pil - - python3-virtualenv - - python3-babel - - python3-pip - - virtualenv - - automake - - npm # XXX: really? UGH - - nodejs-legacy + apt: + state: present + name: + - python3-dev + - python3-lxml + - python3-pil + - python3-virtualenv + - python3-babel + - python3-pip + - virtualenv + - automake + - npm # XXX: really? UGH + - nodejs-legacy tags: - dependencies diff --git a/roles/nullmailer/tasks/main.yml b/roles/nullmailer/tasks/main.yml index d694173..b22cda3 100644 --- a/roles/nullmailer/tasks/main.yml +++ b/roles/nullmailer/tasks/main.yml @@ -1,9 +1,10 @@ --- - name: Install nullmailer and mailx - apt: name={{ item }} state=installed - with_items: - - nullmailer - - heirloom-mailx + apt: + state: present + name: + - nullmailer + - heirloom-mailx tags: - dependencies diff --git a/roles/znc/tasks/znc.yml b/roles/znc/tasks/znc.yml index ecb6103..a320041 100644 --- a/roles/znc/tasks/znc.yml +++ b/roles/znc/tasks/znc.yml @@ -2,15 +2,11 @@ - name: Install znc (jessie-backports) when: (ansible_distribution == "Debian" and ansible_distribution_major_version == "8") - apt: pkg={{ item }} state=installed repo=jessie-backports - with_items: - - znc + apt: name=znc state=present repo=jessie-backports - name: Install znc (non-jessie) when: not (ansible_distribution == "Debian" and ansible_distribution_major_version == "8") - apt: pkg={{ item }} state=installed - with_items: - - znc + apt: name=znc state=present - name: Create znc group group: name=znc state=present -- cgit v1.2.3