diff --git a/.ansible-lint b/.ansible-lint index f18a6472898d714ef85310cdbe01e39500977528..5620f63fdead7345765426d57e39bbf4809773f4 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -37,6 +37,7 @@ use_default_rules: true skip_list: - skip_this_tag - git-latest + - name[casing] # Any rule that has the 'opt-in' tag will not be loaded unless its 'id' is # mentioned in the enable_list: diff --git a/ci-playbook.yml b/ci-playbook.yml index 2a7bc1965064ad9dee46cdeceea565adaf637e5f..70cc648f95ba8b8d10b2931f0204cdea89d04984 100644 --- a/ci-playbook.yml +++ b/ci-playbook.yml @@ -12,7 +12,8 @@ # ###### -- hosts: "localhost" +- name: CI run + hosts: "localhost" connection: local # Collect facts from remote system? Possible values: true, false gather_facts: true diff --git a/handlers/main.yml b/handlers/main.yml index 974b01a798380668e9e1800d0b6b0ecd7dba7102..06afe2224858e0cc04ff3e5c77c39decb3bc5af8 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -16,6 +16,7 @@ loop: "{{ vault_service_files.keys() | list }}" - name: save iptables rules (Debian) + when: ansible_os_family == "Debian" block: - name: Ordner für iptables-Config erstellen ansible.builtin.file: @@ -34,9 +35,9 @@ - name: save iptables rules ansible.builtin.command: 'netfilter-persistent save' # noqa no-changed-when listen: "save iptables rules" - when: ansible_os_family == "Debian" - name: save iptables rules (RedHat) + when: ansible_os_family == "RedHat" block: - name: make sure iptables config file exists ansible.builtin.file: @@ -50,4 +51,3 @@ - name: save rules ansible.builtin.command: /usr/sbin/iptables-save # noqa no-changed-when listen: "save iptables rules" - when: ansible_os_family == "RedHat" diff --git a/meta/main.yml b/meta/main.yml index 374bb3530b11c818e17b598a68fb2f557481edf1..4e9ec98089c37b9fc9fde79ca5afd951bf419db2 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,5 +1,7 @@ --- galaxy_info: + role_name: ansible_lza_repair + namespace: slub author: Jörg Sachse description: role to install repair server for the SLUBarchiv digital preservation repository company: SLUB Dresden diff --git a/molecule/resources/playbooks/prepare.yml b/molecule/resources/playbooks/prepare.yml index f03054fe407176213a78ed2040c6dcd36e3271d7..4e63bee10d501d17ae7aef22cb2f0ba01fc23ec7 100644 --- a/molecule/resources/playbooks/prepare.yml +++ b/molecule/resources/playbooks/prepare.yml @@ -7,6 +7,7 @@ name: "lza" become: true - name: configure additional package repositories for Debian + when: ansible_os_family == "Debian" block: - name: install GPG ansible.builtin.apt: @@ -26,7 +27,6 @@ update_cache: true mode: "0644" become: true - when: ansible_os_family == "Debian" - name: install tooling before running the actual tests, so we're not bound by the fixed versions ansible.builtin.apt: name: [ @@ -38,6 +38,7 @@ become: true - name: configure additional package repositories for RedHat + when: ansible_os_family == "RedHat" block: - name: add custom repositories ansible.builtin.yum_repository: @@ -59,4 +60,3 @@ ansible.builtin.file: path: "/etc/yum.repos.d/SLUB.repo" state: absent - when: ansible_os_family == "RedHat" diff --git a/molecule/resources/playbooks/verify.yml b/molecule/resources/playbooks/verify.yml index e707420ab5c87edfa59c7805ce4534ff1b387177..a5cfa75e4c765f52891877bfca5f823b69a2c23b 100644 --- a/molecule/resources/playbooks/verify.yml +++ b/molecule/resources/playbooks/verify.yml @@ -5,6 +5,6 @@ hosts: all gather_facts: false tasks: - - name: Example assertion - ansible.builtin.assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/site.yml b/site.yml index 4b4bbcb6da81a2d5d935e29f6b227c490ef4c10d..e6956ba6f6e071ca5a6ba296e283e9bc83cd232f 100644 --- a/site.yml +++ b/site.yml @@ -1,8 +1,9 @@ --- -- hosts: "*" +- name: install repairserver + hosts: "*" pre_tasks: - name: Verify that the installed version of Ansible meets this playbook's version requirements. - assert: + ansible.builtin.assert: that: "ansible_version.full is version_compare('2.5', '>=')" msg: > "You must update Ansible to at least 2.5 to use this playbook." diff --git a/tasks/configure-nfs-mounts.yml b/tasks/configure-nfs-mounts.yml index dfb4208d952c6242dbd25b85bfe1a6a6c1d405aa..217fbc5faca5551aedbd05fd57fafe3b0f2eadf3 100644 --- a/tasks/configure-nfs-mounts.yml +++ b/tasks/configure-nfs-mounts.yml @@ -38,6 +38,6 @@ path: "{{ item[0] }}/{{ item[1] }}" state: directory mode: "0777" # it's a mixed mode share, so actual mode is 0777 anyway - loop: "{{ vault_nfs_mounts | map(attribute='name') | product( ['unprocessed', 'processed', 'workdir']) }}" + loop: "{{ vault_nfs_mounts | map(attribute='name') | product(['unprocessed', 'processed', 'workdir']) }}" when: '"/var/log/" not in item[0]' tags: [ci] diff --git a/tasks/install-repair-tools.yml b/tasks/install-repair-tools.yml index 67975bd9c56029fb058aed54e2f49967332b7c2e..2fb838f470868f920bd85afb49828e8cce7cc18f 100644 --- a/tasks/install-repair-tools.yml +++ b/tasks/install-repair-tools.yml @@ -1,5 +1,6 @@ --- - name: configure Debian repositories + when: "ansible_facts['distribution'] == 'Debian'" block: - name: öffentlichen Schlüssel hinzufügen (sonst muss bei jeder Installation eine Warnmeldung bestätigt werden) ansible.builtin.apt_key: @@ -15,7 +16,6 @@ mode: "0644" when: ansible_distribution_major_version == '11' tags: [apt] - when: "ansible_facts['distribution'] == 'Debian'" - name: install repairtool dependencies from local Debian repo server (if we're running in prod) ansible.builtin.apt: diff --git a/tasks/main.yml b/tasks/main.yml index de0d353f72edd4039ff8b87876485aec6699a9f7..d29799d8b24a4a053ccf45ff944a9bf34554d62e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,8 +26,8 @@ ### CONFIG LOGROTATE - name: config logrotate - import_tasks: configure-logrotate.yml - tags: [log] + ansible.builtin.import_tasks: "configure_logrotate.yml" + tags: [log, logrotate] ### INSTALLATION REPARATURTOOLS ### - name: install repairtools diff --git a/tests/local/docker-playbook.yml b/tests/local/docker-playbook.yml index 797ef6ca9620948128169a7e904ed24bfcdaac03..cbe58063e7507b63aeeb0674c323f20ec82590bb 100644 --- a/tests/local/docker-playbook.yml +++ b/tests/local/docker-playbook.yml @@ -1,5 +1,6 @@ --- -- hosts: "local" +- name: CI testrun in Docker + hosts: "local" connection: docker # Collect facts from remote system? Possible values: true, false gather_facts: true