Changeset - 694893c0259a
[Not reviewed]
0 17 0
Branko Majic (branko) - 16 days ago 2024-09-03 13:00:00
branko@majic.rs
MAR-218: Fix linting errors for unnamed plays:

- All plays should be named at this point.
- Improve naming of some plays.
- Group some of the common tasks together to speed-up the prepare
step.
- Minor refactoring to make the prepare playbooks more consistent
across the roles.
17 files changed with 137 insertions and 146 deletions:
0 comments (0 inline, 0 general)
roles/backup/molecule/default/prepare.yml
Show inline comments
 
@@ -2,17 +2,14 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
roles/backup_client/molecule/default/prepare.yml
Show inline comments
 
@@ -2,23 +2,21 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
      changed_when: false
 

	
 
- hosts: backup-server
 
- name: Prepare, helpers
 
  hosts: backup-server
 
  become: true
 
  tasks:
 

	
roles/backup_server/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Prepare
 
  hosts: all
 
  gather_facts: false
 
  tasks:
 

	
 
- hosts: localhost
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  tasks:
 

	
 
@@ -17,13 +13,14 @@
 
        - tests/data/ssh/client1
 
        - tests/data/ssh/client2
 

	
 
- hosts: all
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
roles/bootstrap/molecule/default/prepare.yml
Show inline comments
 
@@ -2,15 +2,22 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
      changed_when: false
 

	
 
# Put Ansible key into root's authorized_keys to test its removal.
 
- hosts: parameters-mandatory
 
- name: Prepare, text fixtures
 
  hosts: parameters-mandatory
 
  become: true
 
  tasks:
 

	
 
@@ -20,7 +27,8 @@
 
        key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
 

	
 
# Put Ansible key into root's authorized_keys to test its removal.
 
- hosts: parameters-optional
 
- name: Prepare, text fixtures
 
  hosts: parameters-optional
 
  become: true
 
  tasks:
 

	
roles/common/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -20,18 +20,14 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
@@ -42,7 +38,13 @@
 
        name: net-tools
 
        state: present
 

	
 
- hosts: helper
 
    - name: Remove the ss utility (see https://github.com/philpep/testinfra/pull/320)
 
      file:
 
        path: "/bin/ss"
 
        state: absent
 

	
 
- name: Prepare, helpers
 
  hosts: helper
 
  become: true
 
  tasks:
 

	
 
@@ -51,7 +53,8 @@
 
        name: apt-cacher-ng
 
        state: present
 

	
 
- hosts: client
 
- name: Prepare, helpers
 
  hosts: client
 
  become: true
 
  tasks:
 

	
 
@@ -75,7 +78,8 @@
 
        fd00::192:168:56:21: parameters-mandatory-bookworm
 
        fd00::192:168:56:22: parameters-optional-bookworm
 

	
 
- hosts: parameters-mandatory,parameters-optional
 
- name: Prepare, test fixtures
 
  hosts: parameters-mandatory,parameters-optional
 
  become: true
 
  tasks:
 

	
 
@@ -156,12 +160,3 @@
 
          - ntp
 
          - ntpdate
 
        state: present
 

	
 
- hosts: parameters-mandatory,parameters-optional
 
  become: true
 
  tasks:
 

	
 
    - name: Remove the ss utility (see https://github.com/philpep/testinfra/pull/320)
 
      file:
 
        path: "/bin/ss"
 
        state: absent
roles/database/molecule/default/prepare.yml
Show inline comments
 
@@ -2,23 +2,21 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
      changed_when: false
 

	
 
- hosts: backup-server
 
- name: Prepare, helpers
 
  hosts: backup-server
 
  become: true
 
  roles:
 
    - role: backup_server
roles/database_server/molecule/default/prepare.yml
Show inline comments
 
@@ -2,17 +2,14 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
roles/ldap_client/handlers/main.yml
Show inline comments
 
---
 

	
 
- debug:
 
    msg: "No handlers are available for ldap_client role."
 
- name: Dummy handler to suppress Ansible warnings
 
  debug:
 
    msg: "This is just a dummy task to suppress the Ansible warning about an empty include."
roles/ldap_client/molecule/default/prepare.yml
Show inline comments
 
@@ -2,17 +2,14 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
roles/ldap_server/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -36,17 +36,14 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
@@ -60,7 +57,21 @@
 
        group: root
 
        mode: 0644
 

	
 
- hosts: client
 
    - name: Remove the ss utility (see https://github.com/philpep/testinfra/pull/320)
 
      file:
 
        path: "/bin/ss"
 
        state: absent
 

	
 
    - name: Install tools for testing
 
      apt:
 
        name:
 
          - net-tools
 
          - nmap
 
          - gnutls-bin
 
        state: present
 

	
 
- name: Prepare, helpers
 
  hosts: client
 
  become: true
 
  tasks:
 

	
 
@@ -82,7 +93,8 @@
 
        192.168.56.21: parameters-mandatory-bookworm
 
        192.168.56.22: parameters-optional-bookworm
 

	
 
- hosts: parameters-optional
 
- name: Prepare, test fixtures
 
  hosts: parameters-optional
 
  become: true
 
  tasks:
 

	
 
@@ -98,7 +110,8 @@
 
      with_dict:
 
        127.0.2.1: parameters-optional
 

	
 
- hosts: parameters-mandatory
 
- name: Prepare, test fixtures
 
  hosts: parameters-mandatory
 
  become: true
 
  tasks:
 

	
 
@@ -114,7 +127,8 @@
 
      with_dict:
 
        127.0.2.1: parameters-mandatory
 

	
 
- hosts: backup-server
 
- name: Prepare, helpers
 
  hosts: backup-server
 
  become: true
 
  roles:
 
    - role: backup_server
 
@@ -126,20 +140,3 @@
 
        - server: localhost
 
          ip: 127.0.0.1
 
          public_key: "{{ lookup('file', 'tests/data/ssh/parameters-optional.pub') }}"
 

	
 
- hosts: parameters-mandatory,parameters-optional
 
  become: true
 
  tasks:
 

	
 
    - name: Remove the ss utility (see https://github.com/philpep/testinfra/pull/320)
 
      file:
 
        path: "/bin/ss"
 
        state: absent
 

	
 
    - name: Install tools for testing
 
      apt:
 
        name:
 
          - net-tools
 
          - nmap
 
          - gnutls-bin
 
        state: present
roles/mail_forwarder/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -34,26 +34,19 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Set-up the hosts file
 
      lineinfile:
 
        path: /etc/hosts
 
@@ -75,7 +68,8 @@
 
        name: gnutls-bin
 
        state: present
 

	
 
- hosts: clients
 
- name: Prepare, helpers
 
  hosts: clients
 
  become: true
 
  tasks:
 

	
 
@@ -104,7 +98,8 @@
 
    - name: Update CA certificate cache
 
      command: /usr/sbin/update-ca-certificates --fresh
 

	
 
- hosts: mail-servers
 
- name: Prepare, helpers
 
  hosts: mail-servers
 
  become: true
 
  tasks:
 

	
 
@@ -174,7 +169,8 @@
 
        name: postfix
 
        state: restarted
 

	
 
- hosts: parameters-optional
 
- name: Prepare, test fixtures
 
  hosts: parameters-optional
 
  become: true
 
  tasks:
 

	
roles/mail_server/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -46,17 +46,13 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
@@ -69,7 +65,7 @@
 
          - nmap
 
        state: present
 

	
 
- name: Set-up a local ClamAV database mirror to avoid hitting upstream rate limits
 
- name: Prepare, helpers, local ClamAV database mirror (avoid upstream rate limits)
 
  hosts: clamav-database
 
  become: true
 
  tasks:
 
@@ -173,7 +169,8 @@
 
        name: nginx
 
        state: restarted
 

	
 
- hosts: bookworm
 
- name: Prepare, test fixtures
 
  hosts: bookworm
 
  become: true
 
  tasks:
 

	
 
@@ -213,7 +210,8 @@
 
        192.168.56.31: "parameters-mandatory parameters-mandatory-bookworm"
 
        192.168.56.32: "parameters-optional parameters-optional-bookworm"
 

	
 
- hosts: client
 
- name: Prepare, helpers
 
  hosts: client
 
  become: true
 
  tasks:
 

	
 
@@ -336,13 +334,15 @@
 
        name: postfix
 
        state: restarted
 

	
 
- hosts: ldap-server
 
- name: Prepare, helpers
 
  hosts: ldap-server
 
  become: true
 
  roles:
 
    - ldap_server
 
    - backup_server
 

	
 
- hosts: ldap-server
 
- name: Prepare, test fixtures
 
  hosts: ldap-server
 
  become: true
 
  tasks:
 

	
 
@@ -420,7 +420,8 @@
 
          - uid=john,ou=people,dc=local
 
          - uid=jane,ou=people,dc=local
 

	
 
- hosts: parameters-mandatory,parameters-optional
 
- name: Prepare, test fixtures
 
  hosts: parameters-mandatory,parameters-optional
 
  become: true
 
  tasks:
 

	
roles/php_website/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -38,17 +38,15 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
roles/preseed/molecule/default/prepare.yml
Show inline comments
 
@@ -2,9 +2,15 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
      changed_when: false
roles/web_server/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -36,17 +36,14 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
@@ -59,7 +56,8 @@
 
          - nmap
 
        state: present
 

	
 
- hosts: bookworm
 
- name: Prepare, test fixtures
 
  hosts: bookworm
 
  become: true
 
  tasks:
 

	
 
@@ -81,7 +79,8 @@
 
        mode: 0644
 
        state: present
 

	
 
- hosts: all
 
- name: Prepare, test fixtures
 
  hosts: all
 
  become: true
 
  tasks:
 

	
 
@@ -104,7 +103,8 @@
 
        name: curl
 
        state: present
 

	
 
- hosts: client
 
- name: Prepare, helpers
 
  hosts: client
 
  become: true
 
  tasks:
 

	
roles/wsgi_website/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -40,22 +40,29 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: wsgi-website
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
      changed_when: false
 

	
 
    - name: Remove the ss utility (see https://github.com/philpep/testinfra/pull/320)
 
      file:
 
        path: "/bin/ss"
 
        state: absent
 

	
 
- name: Prepare, test fixtures
 
  hosts: wsgi-website
 
  become: true
 
  tasks:
 

	
 
    - name: Set-up /etc/hosts entries
 
      lineinfile:
 
        dest: /etc/hosts
 
@@ -118,11 +125,6 @@
 
        group: user
 
        shell: /bin/bash
 

	
 
    - name: Remove the ss utility (see https://github.com/philpep/testinfra/pull/320)
 
      file:
 
        path: "/bin/ss"
 
        state: absent
 

	
 
  handlers:
 

	
 
    - name: Restart Postfix
roles/xmpp_server/molecule/default/prepare.yml
Show inline comments
 
---
 

	
 
- name: Set-up fixtures
 
- name: Prepare, test fixtures
 
  hosts: localhost
 
  connection: local
 
  gather_facts: false
 
@@ -47,17 +47,15 @@
 

	
 
- name: Prepare
 
  hosts: all
 
  become: true
 
  gather_facts: false
 
  tasks:
 

	
 
    - name: Install python for Ansible
 
      raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
 
      become: true
 
      changed_when: false
 

	
 
- hosts: all
 
  become: true
 
  tasks:
 

	
 
    - name: Update all caches to avoid errors due to missing remote archives
 
      apt:
 
        update_cache: true
 
@@ -76,7 +74,8 @@
 
        regexp: "host\\.name\\)"
 
        replace: "host.targetname)"
 

	
 
- hosts: bookworm
 
- name: Prepare, test fixtures
 
  hosts: bookworm
 
  become: true
 
  tasks:
 

	
 
@@ -113,7 +112,8 @@
 
        192.168.56.31: "parameters-mandatory domain1 proxy.domain1 conference.domain1"
 
        192.168.56.32: "parameters-optional domain2 proxy.domain2 conference.domain2 domain3 proxy.domain3 conference.domain3"
 

	
 
- hosts: clients
 
- name: Prepare, helpers
 
  hosts: clients
 
  become: true
 
  tasks:
 

	
 
@@ -187,13 +187,15 @@
 
    - name: Update CA certificate cache
 
      command: /usr/sbin/update-ca-certificates --fresh
 

	
 
- hosts: ldap-server
 
- name: Prepare, helpers
 
  hosts: ldap-server
 
  become: true
 
  roles:
 
    - ldap_server
 
    - backup_server
 

	
 
- hosts: ldap-server
 
- name: Prepare, test fixtures
 
  hosts: ldap-server
 
  become: true
 
  tasks:
 

	
 
@@ -258,7 +260,8 @@
 
          - uid=mick,ou=people,dc=local
 
          - uid=eve,ou=people,dc=local
 

	
 
- hosts: parameters-mandatory,parameters-optional
 
- name: Prepare, test fixtures
 
  hosts: parameters-mandatory,parameters-optional
 
  become: true
 
  tasks:
 

	
0 comments (0 inline, 0 general)