From bc2dcb258d2b977b072dcc410d78db5f1a6fdfe9 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 3 Jan 2024 13:04:32 -0800 Subject: [PATCH 1/6] syntax fixes from ansible-lint --- .ansible-lint | 9 ------- .github/workflows/chrony.yml | 35 ++++++++++++------------ .github/workflows/epel.yml | 19 ++++++------- .github/workflows/logrotate.yml | 35 ++++++++++++------------ .github/workflows/ntp.yml | 25 ++++++++--------- .github/workflows/release.yml | 3 ++- .github/workflows/remi_repo.yml | 25 ++++++++--------- .github/workflows/selinux.yml | 19 ++++++------- .vscode/settings.json | 3 +++ build/galaxy_deploy.yml | 16 +++++------ galaxy.yml | 7 +++-- molecule/chrony/converge.yml | 7 ++--- molecule/chrony/verify.yml | 6 ++--- molecule/default/converge.yml | 3 ++- molecule/default/verify.yml | 6 ++--- molecule/epel/converge.yml | 3 ++- molecule/epel/verify.yml | 6 ++--- molecule/logrotate/converge.yml | 17 ++++++------ molecule/logrotate/verify.yml | 6 ++--- molecule/ntp/converge.yml | 3 ++- molecule/ntp/verify.yml | 6 ++--- molecule/remi_repo/converge.yml | 3 ++- molecule/remi_repo/verify.yml | 6 ++--- molecule/selinux/converge.yml | 6 +++-- molecule/selinux/verify.yml | 6 ++--- roles/chrony/defaults/main.yml | 6 +++-- roles/chrony/handlers/main.yml | 4 ++- roles/chrony/meta/main.yml | 8 +++--- roles/chrony/tasks/archlinux.yml | 14 +++++++--- roles/chrony/tasks/debian.yml | 7 ++++- roles/chrony/tasks/main.yml | 16 ++++++----- roles/chrony/tasks/redhat.yml | 14 +++++++--- roles/chrony/tasks/suse.yml | 10 +++++-- roles/chrony/vars/archlinux.yml | 2 ++ roles/chrony/vars/debian.yml | 2 ++ roles/chrony/vars/redhat.yml | 2 ++ roles/chrony/vars/suse.yml | 2 ++ roles/epel/defaults/main.yml | 10 ++++--- roles/epel/meta/main.yml | 10 ++++--- roles/epel/tasks/main.yml | 6 +++-- roles/epel/tasks/redhat.yml | 13 ++++----- roles/epel/tasks/redhat_manual.yml | 9 ++++--- roles/logrotate/defaults/main.yml | 2 ++ roles/logrotate/handlers/main.yml | 2 ++ roles/logrotate/meta/main.yml | 4 ++- roles/logrotate/tasks/main.yml | 7 +++-- roles/logrotate/vars/main.yml | 2 ++ roles/ntp/defaults/main.yml | 43 +++++++++++++++--------------- roles/ntp/handlers/main.yml | 6 +++-- roles/ntp/tasks/debian.yml | 4 +-- roles/ntp/tasks/main.yml | 10 +++---- roles/ntp/tasks/redhat.yml | 4 +-- roles/ntp/tasks/suse.yml | 2 +- roles/remi_repo/tasks/dnf.yml | 5 ++-- roles/remi_repo/tasks/main.yml | 7 ++--- roles/remi_repo/tasks/yum.yml | 5 ++-- roles/remi_repo/vars/default.yml | 2 +- roles/remi_repo/vars/fedora.yml | 2 +- roles/selinux/defaults/main.yml | 2 ++ roles/selinux/meta/main.yml | 2 ++ roles/selinux/tasks/main.yml | 16 +++++++---- roles/selinux/vars/default.yml | 1 + roles/selinux/vars/redhat.yml | 1 + 63 files changed, 314 insertions(+), 230 deletions(-) delete mode 100644 .ansible-lint create mode 100644 .vscode/settings.json diff --git a/.ansible-lint b/.ansible-lint deleted file mode 100644 index c2d844e..0000000 --- a/.ansible-lint +++ /dev/null @@ -1,9 +0,0 @@ ---- -parseable: true -skip_list: - - ANSIBLE0010 -use_default_rules: true -verbosity: 1 -exclude_paths: - - ./tests/ - - ./plugins/ diff --git a/.github/workflows/chrony.yml b/.github/workflows/chrony.yml index b401802..f76c55e 100644 --- a/.github/workflows/chrony.yml +++ b/.github/workflows/chrony.yml @@ -1,15 +1,16 @@ -name: "ericsysmin.system.chrony" +--- +name: ericsysmin.system.chrony on: push: paths: - - 'roles/chrony/**' - - 'molecule/chrony/**' - - '.github/workflows/chrony.yml' + - roles/chrony/** + - molecule/chrony/** + - .github/workflows/chrony.yml pull_request: paths: - - 'roles/chrony/**' - - 'molecule/chrony/**' - - '.github/workflows/chrony.yml' + - roles/chrony/** + - molecule/chrony/** + - .github/workflows/chrony.yml jobs: molecule: runs-on: ubuntu-18.04 @@ -20,16 +21,16 @@ jobs: fail-fast: true matrix: molecule_distro: - - { "distro":"centos-7", "command":"/usr/sbin/init" } - - { "distro":"centos-8", "command":"/usr/sbin/init" } - - { "distro":"fedora-32", "command":"/usr/sbin/init" } - - { "distro":"fedora-31", "command":"/usr/sbin/init" } - - { "distro":"fedora-30", "command":"/usr/lib/systemd/systemd" } - - { "distro":"ubuntu-16.04", "command":"/sbin/init" } - - { "distro":"ubuntu-18.04", "command":"/lib/systemd/systemd" } - - { "distro":"ubuntu-20.04", "command":"/lib/systemd/systemd" } - - { "distro":"debian-9", "command":"/lib/systemd/systemd" } - - { "distro":"debian-10", "command":"/lib/systemd/systemd" } + - { distro: centos-7, command: /usr/sbin/init } + - { distro: centos-8, command: /usr/sbin/init } + - { distro: fedora-32, command: /usr/sbin/init } + - { distro: fedora-31, command: /usr/sbin/init } + - { distro: fedora-30, command: /usr/lib/systemd/systemd } + - { distro: ubuntu-16.04, command: /sbin/init } + - { distro: ubuntu-18.04, command: /lib/systemd/systemd } + - { distro: ubuntu-20.04, command: /lib/systemd/systemd } + - { distro: debian-9, command: /lib/systemd/systemd } + - { distro: debian-10, command: /lib/systemd/systemd } collection_role: - chrony steps: diff --git a/.github/workflows/epel.yml b/.github/workflows/epel.yml index 0ce38f6..c1edff7 100644 --- a/.github/workflows/epel.yml +++ b/.github/workflows/epel.yml @@ -1,15 +1,16 @@ -name: "ericsysmin.system.epel" +--- +name: ericsysmin.system.epel on: push: paths: - - 'roles/epel/**' - - 'molecule/epel/**' - - '.github/workflows/epel.yml' + - roles/epel/** + - molecule/epel/** + - .github/workflows/epel.yml pull_request: paths: - - 'roles/epel/**' - - 'molecule/epel/**' - - '.github/workflows/epel.yml' + - roles/epel/** + - molecule/epel/** + - .github/workflows/epel.yml jobs: molecule: runs-on: ubuntu-18.04 @@ -20,8 +21,8 @@ jobs: fail-fast: true matrix: molecule_distro: - - { "distro":"centos-7", "command":"/usr/sbin/init" } - - { "distro":"centos-8", "command":"/usr/sbin/init" } + - { distro: centos-7, command: /usr/sbin/init } + - { distro: centos-8, command: /usr/sbin/init } collection_role: - epel steps: diff --git a/.github/workflows/logrotate.yml b/.github/workflows/logrotate.yml index bc10a77..ee6a28f 100644 --- a/.github/workflows/logrotate.yml +++ b/.github/workflows/logrotate.yml @@ -1,15 +1,16 @@ -name: "ericsysmin.system.logrotate" +--- +name: ericsysmin.system.logrotate on: push: paths: - - 'roles/logrotate/**' - - 'molecule/logrotate/**' - - '.github/workflows/logrotate.yml' + - roles/logrotate/** + - molecule/logrotate/** + - .github/workflows/logrotate.yml pull_request: paths: - - 'roles/logrotate/**' - - 'molecule/logrotate/**' - - '.github/workflows/logrotate.yml' + - roles/logrotate/** + - molecule/logrotate/** + - .github/workflows/logrotate.yml jobs: logrotate: runs-on: ubuntu-18.04 @@ -20,16 +21,16 @@ jobs: fail-fast: true matrix: molecule_distro: - - { "distro":"centos-7", "command":"/usr/sbin/init" } - - { "distro":"centos-8", "command":"/usr/sbin/init" } - - { "distro":"fedora-32", "command":"/usr/sbin/init" } - - { "distro":"fedora-31", "command":"/usr/sbin/init" } - - { "distro":"fedora-30", "command":"/usr/lib/systemd/systemd" } - - { "distro":"ubuntu-16.04", "command":"/sbin/init" } - - { "distro":"ubuntu-18.04", "command":"/lib/systemd/systemd" } - - { "distro":"ubuntu-20.04", "command":"/lib/systemd/systemd" } - - { "distro":"debian-9", "command":"/lib/systemd/systemd" } - - { "distro":"debian-10", "command":"/lib/systemd/systemd" } + - { distro: centos-7, command: /usr/sbin/init } + - { distro: centos-8, command: /usr/sbin/init } + - { distro: fedora-32, command: /usr/sbin/init } + - { distro: fedora-31, command: /usr/sbin/init } + - { distro: fedora-30, command: /usr/lib/systemd/systemd } + - { distro: ubuntu-16.04, command: /sbin/init } + - { distro: ubuntu-18.04, command: /lib/systemd/systemd } + - { distro: ubuntu-20.04, command: /lib/systemd/systemd } + - { distro: debian-9, command: /lib/systemd/systemd } + - { distro: debian-10, command: /lib/systemd/systemd } collection_role: - logrotate steps: diff --git a/.github/workflows/ntp.yml b/.github/workflows/ntp.yml index 6ee9e37..328a367 100644 --- a/.github/workflows/ntp.yml +++ b/.github/workflows/ntp.yml @@ -1,15 +1,16 @@ -name: "ericsysmin.system.ntp" +--- +name: ericsysmin.system.ntp on: push: paths: - - 'roles/ntp/**' - - 'molecule/ntp/**' - - '.github/workflows/ntp.yml' + - roles/ntp/** + - molecule/ntp/** + - .github/workflows/ntp.yml pull_request: paths: - - 'roles/ntp/**' - - 'molecule/ntp/**' - - '.github/workflows/ntp.yml' + - roles/ntp/** + - molecule/ntp/** + - .github/workflows/ntp.yml jobs: molecule: runs-on: ubuntu-18.04 @@ -20,11 +21,11 @@ jobs: fail-fast: true matrix: molecule_distro: - - { "distro":"centos-7", "command":"/usr/sbin/init" } - - { "distro":"ubuntu-16.04", "command":"/sbin/init" } - - { "distro":"ubuntu-18.04", "command":"/lib/systemd/systemd" } - - { "distro":"ubuntu-20.04", "command":"/lib/systemd/systemd" } - - { "distro":"debian-9", "command":"/lib/systemd/systemd" } + - { distro: centos-7, command: /usr/sbin/init } + - { distro: ubuntu-16.04, command: /sbin/init } + - { distro: ubuntu-18.04, command: /lib/systemd/systemd } + - { distro: ubuntu-20.04, command: /lib/systemd/systemd } + - { distro: debian-9, command: /lib/systemd/systemd } collection_role: - ntp steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e134c3..23fa2d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,5 @@ -name: "release" +--- +name: release on: release: types: diff --git a/.github/workflows/remi_repo.yml b/.github/workflows/remi_repo.yml index 4a1ea3f..6d65f67 100644 --- a/.github/workflows/remi_repo.yml +++ b/.github/workflows/remi_repo.yml @@ -1,15 +1,16 @@ -name: "ericsysmin.system.remi_repo" +--- +name: ericsysmin.system.remi_repo on: push: paths: - - 'roles/remi_repo/**' - - 'molecule/remi_repo/**' - - '.github/workflows/remi_repo.yml' + - roles/remi_repo/** + - molecule/remi_repo/** + - .github/workflows/remi_repo.yml pull_request: paths: - - 'roles/remi_repo/**' - - 'molecule/remi_repo/**' - - '.github/workflows/remi_repo.yml' + - roles/remi_repo/** + - molecule/remi_repo/** + - .github/workflows/remi_repo.yml jobs: molecule: runs-on: ubuntu-18.04 @@ -20,11 +21,11 @@ jobs: fail-fast: true matrix: molecule_distro: - - { "distro":"centos-7", "command":"/usr/sbin/init" } - - { "distro":"centos-8", "command":"/usr/sbin/init" } - - { "distro":"fedora-32", "command":"/usr/sbin/init" } - - { "distro":"fedora-31", "command":"/usr/sbin/init" } - - { "distro":"fedora-30", "command":"/usr/lib/systemd/systemd" } + - { distro: centos-7, command: /usr/sbin/init } + - { distro: centos-8, command: /usr/sbin/init } + - { distro: fedora-32, command: /usr/sbin/init } + - { distro: fedora-31, command: /usr/sbin/init } + - { distro: fedora-30, command: /usr/lib/systemd/systemd } collection_role: - remi_repo steps: diff --git a/.github/workflows/selinux.yml b/.github/workflows/selinux.yml index 065ef03..5a8225d 100644 --- a/.github/workflows/selinux.yml +++ b/.github/workflows/selinux.yml @@ -1,15 +1,16 @@ -name: "ericsysmin.system.selinux" +--- +name: ericsysmin.system.selinux on: push: paths: - - 'roles/selinux/**' - - 'molecule/selinux/**' - - '.github/workflows/selinux.yml' + - roles/selinux/** + - molecule/selinux/** + - .github/workflows/selinux.yml pull_request: paths: - - 'roles/selinux/**' - - 'molecule/selinux/**' - - '.github/workflows/selinux.yml' + - roles/selinux/** + - molecule/selinux/** + - .github/workflows/selinux.yml jobs: molecule: runs-on: ubuntu-18.04 @@ -20,8 +21,8 @@ jobs: fail-fast: true matrix: molecule_distro: - - { "distro":"centos-7", "command":"/usr/sbin/init" } - - { "distro":"centos-8", "command":"/usr/sbin/init" } + - { distro: centos-7, command: /usr/sbin/init } + - { distro: centos-8, command: /usr/sbin/init } collection_role: - selinux steps: diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8b9d64d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "ansible.python.interpreterPath": "/Users/eanderson/.pyenv/versions/3.11.7/bin/python" +} \ No newline at end of file diff --git a/build/galaxy_deploy.yml b/build/galaxy_deploy.yml index 2505bce..04da8d8 100644 --- a/build/galaxy_deploy.yml +++ b/build/galaxy_deploy.yml @@ -7,31 +7,31 @@ tag: "{{ github_tag.split('/')[-1] }}" pre_tasks: - name: Ensure the ANSIBLE_GALAXY_TOKEN environment variable is set. - fail: + ansible.builtin.fail: msg: ANSIBLE_GALAXY_TOKEN is not set. - when: "lookup('env','ANSIBLE_GALAXY_TOKEN') | length == 0" + when: lookup('env','ANSIBLE_GALAXY_TOKEN') | length == 0 - name: Ensure the ~/.ansible directory exists. - file: + ansible.builtin.file: path: ~/.ansible state: directory - name: Write the Galaxy token to ~/.ansible/galaxy_token - copy: + ansible.builtin.copy: content: | - token: {{ lookup('env','ANSIBLE_GALAXY_TOKEN') }} + token: {{ lookup('env', 'ANSIBLE_GALAXY_TOKEN') }} dest: ~/.ansible/galaxy_token tasks: - name: Template out the galaxy.yml file. - template: + ansible.builtin.template: src: templates/galaxy.yml.j2 dest: ../galaxy.yml register: galaxy_yml - name: Build the collection. # noqa 503 - command: > + ansible.builtin.command: > ansible-galaxy collection build chdir=../ when: galaxy_yml.changed - name: Publish the collection. # noqa 503 - command: > + ansible.builtin.command: > ansible-galaxy collection publish ./ericsysmin-system-{{ tag }}.tar.gz chdir=../ when: galaxy_yml.changed diff --git a/galaxy.yml b/galaxy.yml index 211251d..a850d99 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,3 +1,4 @@ +--- ### REQUIRED # The namespace of the collection. This can be a company/brand/organization or product namespace under which all @@ -17,8 +18,7 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- Eric Anderson (https://ericsysmin.com) - + - Eric Anderson (https://ericsysmin.com) ### OPTIONAL but strongly recommended @@ -32,7 +32,7 @@ description: Collection of System Administration Roles # The path to the license file for the collection. This path is relative to the root of the collection. This key is # mutually exclusive with 'license' -license_file: 'LICENSE' +license_file: LICENSE # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' @@ -52,7 +52,6 @@ tags: # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version # range specifiers can be set and are separated by ',' dependencies: {} - # The URL of the originating SCM repository repository: https://github.com/ericsysmin/ansible-collection-system diff --git a/molecule/chrony/converge.yml b/molecule/chrony/converge.yml index 1134dfa..18df755 100644 --- a/molecule/chrony/converge.yml +++ b/molecule/chrony/converge.yml @@ -2,8 +2,8 @@ - name: Converge hosts: all pre_tasks: - - name: Wait for systemd to complete initialization. # noqa 303 - command: systemctl is-system-running + - name: Wait for systemd to complete initialization. # noqa command-instead-of-module + ansible.builtin.command: systemctl is-system-running register: systemctl_status until: >- "running" in systemctl_status.stdout or "degraded" in @@ -15,7 +15,8 @@ - ansible_distribution == "Fedora" changed_when: false - name: Update package cache - package: update_cache=yes + ansible.builtin.package: + update_cache: true changed_when: false register: task_result until: task_result is success diff --git a/molecule/chrony/verify.yml b/molecule/chrony/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/chrony/verify.yml +++ b/molecule/chrony/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 2588f27..86f8c2a 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,7 +3,8 @@ hosts: all pre_tasks: - name: Update package cache - package: update_cache=yes + ansible.builtin.package: + update_cache: true changed_when: false register: task_result until: task_result is success diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/epel/converge.yml b/molecule/epel/converge.yml index 269cd06..d473818 100644 --- a/molecule/epel/converge.yml +++ b/molecule/epel/converge.yml @@ -3,7 +3,8 @@ hosts: all pre_tasks: - name: Update package cache - package: update_cache=yes + ansible.builtin.package: + update_cache: true changed_when: false register: task_result until: task_result is success diff --git a/molecule/epel/verify.yml b/molecule/epel/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/epel/verify.yml +++ b/molecule/epel/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/logrotate/converge.yml b/molecule/logrotate/converge.yml index 47d4d25..ef6ef6e 100644 --- a/molecule/logrotate/converge.yml +++ b/molecule/logrotate/converge.yml @@ -3,29 +3,30 @@ hosts: all pre_tasks: - name: Update package cache - package: update_cache=yes + ansible.builtin.package: + update_cache: true changed_when: false register: task_result until: task_result is success retries: 10 delay: 2 - - name: create containerd folder - file: + - name: Create containerd folder + ansible.builtin.file: path: /etc/systemd/system/containerd.service.d state: directory - mode: 0755 + mode: "0755" when: ansible_service_mgr == "systemd" - - name: override file for containerd - copy: + - name: Override file for containerd + ansible.builtin.copy: src: files/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf - mode: 0664 + mode: "0664" when: ansible_service_mgr == "systemd" roles: - role: ericsysmin.system.logrotate logrotate_files: - name: rails - path: "/var/log/service_logs" + path: /var/log/service_logs options: - weekly - size 25M diff --git a/molecule/logrotate/verify.yml b/molecule/logrotate/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/logrotate/verify.yml +++ b/molecule/logrotate/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/ntp/converge.yml b/molecule/ntp/converge.yml index 9810ec4..f6d9121 100644 --- a/molecule/ntp/converge.yml +++ b/molecule/ntp/converge.yml @@ -3,7 +3,8 @@ hosts: all pre_tasks: - name: Update package cache - package: update_cache=yes + ansible.builtin.package: + update_cache: true changed_when: false register: task_result until: task_result is success diff --git a/molecule/ntp/verify.yml b/molecule/ntp/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/ntp/verify.yml +++ b/molecule/ntp/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/remi_repo/converge.yml b/molecule/remi_repo/converge.yml index 5bd0017..ea38198 100644 --- a/molecule/remi_repo/converge.yml +++ b/molecule/remi_repo/converge.yml @@ -3,7 +3,8 @@ hosts: all pre_tasks: - name: Update package cache - package: update_cache=yes + ansible.builtin.package: + update_cache: true changed_when: false register: task_result until: task_result is success diff --git a/molecule/remi_repo/verify.yml b/molecule/remi_repo/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/remi_repo/verify.yml +++ b/molecule/remi_repo/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/selinux/converge.yml b/molecule/selinux/converge.yml index 8e0a12f..9fb420b 100644 --- a/molecule/selinux/converge.yml +++ b/molecule/selinux/converge.yml @@ -3,14 +3,16 @@ hosts: all pre_tasks: - name: Update package cache - package: update_cache=yes + ansible.builtin.package: + update_cache: yes changed_when: false register: task_result until: task_result is success retries: 10 delay: 2 - name: Install SELinux-policy - package: name=selinux-policy + ansible.builtin.package: + name: selinux-policy when: ansible_os_family == "RedHat" roles: - role: ericsysmin.system.selinux diff --git a/molecule/selinux/verify.yml b/molecule/selinux/verify.yml index a82dd6f..6e148b1 100644 --- a/molecule/selinux/verify.yml +++ b/molecule/selinux/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/roles/chrony/defaults/main.yml b/roles/chrony/defaults/main.yml index 0ebda26..2e791d3 100644 --- a/roles/chrony/defaults/main.yml +++ b/roles/chrony/defaults/main.yml @@ -1,9 +1,11 @@ --- +# code: language=ansible + chrony_pkg_state: present chrony_service_state: started -chrony_service_enabled: yes +chrony_service_enabled: true chrony_config_server: - - 0.pool.ntp.org + - "0.pool.ntp.org" - 1.pool.ntp.org - 2.pool.ntp.org - 3.pool.ntp.org diff --git a/roles/chrony/handlers/main.yml b/roles/chrony/handlers/main.yml index 2f77ac9..896a335 100644 --- a/roles/chrony/handlers/main.yml +++ b/roles/chrony/handlers/main.yml @@ -1,5 +1,7 @@ --- -- name: restart chrony +# code: language=ansible + +- name: Restart chrony ansible.builtin.service: name: "{{ chrony_service_name }}" state: restarted diff --git a/roles/chrony/meta/main.yml b/roles/chrony/meta/main.yml index 7fe9442..88864be 100644 --- a/roles/chrony/meta/main.yml +++ b/roles/chrony/meta/main.yml @@ -1,16 +1,18 @@ --- +# code: language=ansible + galaxy_info: author: ericsysmin role_name: chrony company: ericsymsin description: This role enables users to install and configure chrony on their hosts. license: MIT - min_ansible_version: 2.4 + min_ansible_version: "2.10" platforms: - name: EL versions: - - 7 - - 8 + - "7" + - "8" - name: Debian versions: - buster diff --git a/roles/chrony/tasks/archlinux.yml b/roles/chrony/tasks/archlinux.yml index a53c56d..88ec627 100644 --- a/roles/chrony/tasks/archlinux.yml +++ b/roles/chrony/tasks/archlinux.yml @@ -1,11 +1,19 @@ --- +# code: language=ansible + - name: Install the required packages in Arch Linux - community.general.pacman: name=chrony state={{ chrony_pkg_state }} + community.general.pacman: + name: chrony + state: "{{ chrony_pkg_state }}" - name: Check if ntpd service exists - ansible.builtin.stat: path="/usr/lib/systemd/system/ntpd.service" + ansible.builtin.stat: + path: /usr/lib/systemd/system/ntpd.service register: ntpd_service_status - name: Stop and mask ntpd service - ansible.builtin.systemd: name=ntpd state=stopped masked=yes + ansible.builtin.systemd: + name: ntpd + state: stopped + masked: true when: ntpd_service_status.stat.exists diff --git a/roles/chrony/tasks/debian.yml b/roles/chrony/tasks/debian.yml index 1c2423a..c68c4dd 100644 --- a/roles/chrony/tasks/debian.yml +++ b/roles/chrony/tasks/debian.yml @@ -1,3 +1,8 @@ --- +# code: language=ansible + - name: Install the require packages in Debian derivatives - ansible.builtin.apt: name=chrony state={{ chrony_pkg_state }} update_cache=true + ansible.builtin.apt: + name: chrony + state: "{{ chrony_pkg_state }}" + update_cache: true diff --git a/roles/chrony/tasks/main.yml b/roles/chrony/tasks/main.yml index 967c89b..d9132d7 100644 --- a/roles/chrony/tasks/main.yml +++ b/roles/chrony/tasks/main.yml @@ -1,19 +1,21 @@ --- -- name: chrony | Add the OS specific variables - ansible.builtin.include_vars: "{{ ansible_os_family|lower }}.yml" +# code: language=ansible -- name: chrony | Installation - ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml" +- name: Chrony | Add the OS specific variables + ansible.builtin.include_vars: "{{ ansible_os_family | lower }}.yml" -- name: chrony | Copy the chrony.conf template file +- name: Chrony | Installation + ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml" + +- name: Chrony | Copy the chrony.conf template file ansible.builtin.template: src: chrony.conf.j2 dest: "{{ chrony_config_location }}" - mode: 0644 + mode: "0644" notify: - restart chrony -- name: chrony | start and enable chrony service +- name: Chrony | start and enable chrony service ansible.builtin.service: name: "{{ chrony_service_name }}" state: "{{ chrony_service_state }}" diff --git a/roles/chrony/tasks/redhat.yml b/roles/chrony/tasks/redhat.yml index e5f04bc..1e85c25 100644 --- a/roles/chrony/tasks/redhat.yml +++ b/roles/chrony/tasks/redhat.yml @@ -1,11 +1,19 @@ --- +# code: language=ansible + - name: Install the required packages in Redhat derivatives - ansible.builtin.yum: name=chrony state={{ chrony_pkg_state }} + ansible.builtin.yum: + name: chrony + state: "{{ chrony_pkg_state }}" - name: Check if ntpd service exists - ansible.builtin.stat: path="/usr/lib/systemd/system/ntpd.service" + ansible.builtin.stat: + path: /usr/lib/systemd/system/ntpd.service register: ntpd_service_status - name: Stop and mask ntpd service - ansible.builtin.systemd: name=ntpd state=stopped masked=yes + ansible.builtin.systemd: + name: ntpd + state: stopped + masked: true when: ntpd_service_status.stat.exists diff --git a/roles/chrony/tasks/suse.yml b/roles/chrony/tasks/suse.yml index c3325ea..1f78322 100644 --- a/roles/chrony/tasks/suse.yml +++ b/roles/chrony/tasks/suse.yml @@ -1,13 +1,19 @@ --- +# code: language=ansible + - name: Install the required packages on SuSE community.general.zypper: name: chrony state: "{{ chrony_pkg_state }}" - name: Check if ntpd service exists - ansible.builtin.stat: path="/usr/lib/systemd/system/ntpd.service" + ansible.builtin.stat: + path: /usr/lib/systemd/system/ntpd.service register: ntpd_service_status - name: Stop and mask ntpd service - ansible.builtin.systemd: name=ntpd state=stopped masked=yes + ansible.builtin.systemd: + name: ntpd + state: stopped + masked: true when: ntpd_service_status.stat.exists diff --git a/roles/chrony/vars/archlinux.yml b/roles/chrony/vars/archlinux.yml index bdf4880..75e07e4 100644 --- a/roles/chrony/vars/archlinux.yml +++ b/roles/chrony/vars/archlinux.yml @@ -1,4 +1,6 @@ --- +# code: language=ansible + chrony_service_name: chronyd chrony_config_location: /etc/chrony.conf chrony_config_driftfile: /var/lib/chrony/drift diff --git a/roles/chrony/vars/debian.yml b/roles/chrony/vars/debian.yml index 8cd6485..aa7d593 100644 --- a/roles/chrony/vars/debian.yml +++ b/roles/chrony/vars/debian.yml @@ -1,4 +1,6 @@ --- +# code: language=ansible + chrony_service_name: chrony chrony_config_location: /etc/chrony/chrony.conf chrony_config_driftfile: /var/lib/chrony/chrony.drift diff --git a/roles/chrony/vars/redhat.yml b/roles/chrony/vars/redhat.yml index bdf4880..75e07e4 100644 --- a/roles/chrony/vars/redhat.yml +++ b/roles/chrony/vars/redhat.yml @@ -1,4 +1,6 @@ --- +# code: language=ansible + chrony_service_name: chronyd chrony_config_location: /etc/chrony.conf chrony_config_driftfile: /var/lib/chrony/drift diff --git a/roles/chrony/vars/suse.yml b/roles/chrony/vars/suse.yml index bdf4880..75e07e4 100644 --- a/roles/chrony/vars/suse.yml +++ b/roles/chrony/vars/suse.yml @@ -1,4 +1,6 @@ --- +# code: language=ansible + chrony_service_name: chronyd chrony_config_location: /etc/chrony.conf chrony_config_driftfile: /var/lib/chrony/drift diff --git a/roles/epel/defaults/main.yml b/roles/epel/defaults/main.yml index 54f04af..48ff386 100644 --- a/roles/epel/defaults/main.yml +++ b/roles/epel/defaults/main.yml @@ -1,13 +1,15 @@ --- +# code: language=ansible + # defaults file for ericsysmin.epel epel_manual: false # vars if epel_manual is true -epel_repo_gpg_key_url: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" -epel_repo_gpg_key_file: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" -epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" -epel_repofile_path: "/etc/yum.repos.d/epel.repo" +epel_repo_gpg_key_url: http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }} +epel_repo_gpg_key_file: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }} +epel_repo_url: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm +epel_repofile_path: /etc/yum.repos.d/epel.repo epel_repo_use_baseurl: false epel_repo_baseurl: http://download.fedoraproject.org/pub/epel/{{ ansible_distribution_major_version }}/$basearch diff --git a/roles/epel/meta/main.yml b/roles/epel/meta/main.yml index 2cdb8d2..48e0356 100644 --- a/roles/epel/meta/main.yml +++ b/roles/epel/meta/main.yml @@ -1,16 +1,18 @@ --- +# code: language=ansible + galaxy_info: author: ericsymsin role_name: epel description: Role to configure EPEL on RHEL/CentOS based systems license: MIT - min_ansible_version: 2.4 + min_ansible_version: "2.10" platforms: - name: EL versions: - - 6 - - 7 - - 8 + - "6" + - "7" + - "8" galaxy_tags: - epel - rhel diff --git a/roles/epel/tasks/main.yml b/roles/epel/tasks/main.yml index 6011590..f554a59 100644 --- a/roles/epel/tasks/main.yml +++ b/roles/epel/tasks/main.yml @@ -1,13 +1,15 @@ --- +# code: language=ansible + # tasks file for ericsysmin.epel -- name: epel | Install epel repo using epel-release +- name: Epel | Install epel repo using epel-release ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml" when: - ansible_os_family|lower == "redhat" - not epel_manual -- name: epel | Install epel repo manually +- name: Epel | Install epel repo manually ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}_manual.yml" when: - ansible_os_family|lower == "redhat" diff --git a/roles/epel/tasks/redhat.yml b/roles/epel/tasks/redhat.yml index 6785f5d..9b6cedb 100644 --- a/roles/epel/tasks/redhat.yml +++ b/roles/epel/tasks/redhat.yml @@ -1,12 +1,15 @@ --- +# code: language=ansible + - name: Install EPEL repo via Repository Package - ansible.builtin.yum: name=epel-release state=present + ansible.builtin.yum: + name: epel-release + state: present register: task_result until: task_result is success retries: 10 delay: 2 - when: ansible_distribution == 'CentOS' or - ansible_distribution == 'Red Hat Enterprise Linux' + when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' - name: Install EPEL repo via Repository Package ansible.builtin.dnf: @@ -15,6 +18,4 @@ until: task_result is success retries: 10 delay: 2 - when: - - ansible_os_family == "RedHat" - - ansible_distribution_major_version|int >= 8 + when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8 diff --git a/roles/epel/tasks/redhat_manual.yml b/roles/epel/tasks/redhat_manual.yml index e071e04..4cb6e76 100644 --- a/roles/epel/tasks/redhat_manual.yml +++ b/roles/epel/tasks/redhat_manual.yml @@ -1,11 +1,12 @@ --- +# code: language=ansible - name: Import EPEL GPG key. ansible.builtin.rpm_key: key: "{{ epel_repo_gpg_key_url }}" state: present -- name: epel | add epel repository +- name: Epel | add epel repository ansible.builtin.yum_repository: name: epel description: Extra Packages for Enterprise Linux {{ ansible_distribution_major_version }} - $basearch @@ -17,7 +18,7 @@ gpgkey: "{{ epel_repo_gpgkey }}" file: epel -- name: epel | add epel-debuginfo repository +- name: Epel | add epel-debuginfo repository ansible.builtin.yum_repository: name: epel-debuginfo description: Extra Packages for Enterprise Linux {{ ansible_distribution_major_version }} - $basearch - Debug @@ -29,14 +30,14 @@ gpgkey: "{{ epel_debuginfo_repo_gpgkey }}" file: epel -- name: epel | add epel-source repository +- name: Epel | add epel-source repository ansible.builtin.yum_repository: name: epel-source description: Extra Packages for Enterprise Linux {{ ansible_distribution_major_version }} - $basearch - Source baseurl: "{{ epel_source_repo_baseurl if epel_source_repo_use_baseurl else omit }}" metalink: "{{ epel_source_repo_metalink if not epel_source_repo_use_baseurl else omit }}" failovermethod: "{{ epel_source_repo_failovermethod }}" - gpgcheck: "{{ epel_source_repo_gpgcheck }}" + gpgcheck: "{{ epel_source_repo_gpgcheck }}" enabled: "{{ epel_source_repo_enabled }}" gpgkey: "{{ epel_source_repo_gpgkey }}" file: epel diff --git a/roles/logrotate/defaults/main.yml b/roles/logrotate/defaults/main.yml index 2881d94..023990e 100644 --- a/roles/logrotate/defaults/main.yml +++ b/roles/logrotate/defaults/main.yml @@ -1,4 +1,6 @@ --- +# code: language=ansible + # defaults file for ericsysmin.logrotate logrotate_install: true logrotate_conf_dir: /etc/logrotate.d/ diff --git a/roles/logrotate/handlers/main.yml b/roles/logrotate/handlers/main.yml index f3ddf5a..2ef0a52 100644 --- a/roles/logrotate/handlers/main.yml +++ b/roles/logrotate/handlers/main.yml @@ -1,2 +1,4 @@ --- +# code: language=ansible + # handlers file for ericsysmin.logrotate diff --git a/roles/logrotate/meta/main.yml b/roles/logrotate/meta/main.yml index dc07d92..f93e2b9 100644 --- a/roles/logrotate/meta/main.yml +++ b/roles/logrotate/meta/main.yml @@ -1,11 +1,13 @@ --- +# code: language=ansible + galaxy_info: author: ericsysmin role_name: logrotate description: Role manages logrotate instlalation issue_tracker_url: https://github.com/ericsysmin/ansible-role-logrotate/issues license: MIT - min_ansible_version: 2.0 + min_ansible_version: "2.11" platforms: - name: EL versions: diff --git a/roles/logrotate/tasks/main.yml b/roles/logrotate/tasks/main.yml index 2486968..8bc2406 100644 --- a/roles/logrotate/tasks/main.yml +++ b/roles/logrotate/tasks/main.yml @@ -1,8 +1,11 @@ --- +# code: language=ansible + # tasks file for ericsysmin.logrotate - name: Logrotate | Install logrotate - ansible.builtin.package: name=logrotate + ansible.builtin.package: + name: logrotate when: logrotate_install register: task_result until: task_result is success @@ -13,6 +16,6 @@ ansible.builtin.template: src: logrotate.d.j2 dest: "{{ logrotate_conf_dir }}{{ item.name }}" - mode: 0644 + mode: "0644" with_items: "{{ logrotate_files }}" when: logrotate_files is defined diff --git a/roles/logrotate/vars/main.yml b/roles/logrotate/vars/main.yml index f75cdc2..2a9c30f 100644 --- a/roles/logrotate/vars/main.yml +++ b/roles/logrotate/vars/main.yml @@ -1,2 +1,4 @@ --- +# code: language=ansible + # vars file for ericsysmin.logrotate diff --git a/roles/ntp/defaults/main.yml b/roles/ntp/defaults/main.yml index 9052652..e96a706 100644 --- a/roles/ntp/defaults/main.yml +++ b/roles/ntp/defaults/main.yml @@ -1,34 +1,35 @@ --- +# code: language=ansible + ntp_pkg_state: present ntp_service_state: started -ntp_service_enabled: yes +ntp_service_enabled: true ntp_config_server: - - 0.pool.ntp.org + - "0.pool.ntp.org" - 1.pool.ntp.org - 2.pool.ntp.org - 3.pool.ntp.org ntp_config_restrict: - - '-4 default kod notrap nomodify nopeer noquery' - - '-6 default kod notrap nomodify nopeer noquery' - - '127.0.0.1' - - '::1' + - -4 default kod notrap nomodify nopeer noquery + - -6 default kod notrap nomodify nopeer noquery + - 127.0.0.1 + - ::1 ntp_config_listen: [] - ntp_config_filegen: - - 'loopstats file loopstats type day enable' - - 'peerstats file peerstats type day enable' - - 'clockstats file clockstats type day enable' + - loopstats file loopstats type day enable + - peerstats file peerstats type day enable + - clockstats file clockstats type day enable -ntp_config_statistics: 'loopstats peerstats clockstats' -ntp_config_crypto: '' -ntp_config_includefile: '' -ntp_config_keys: '' -ntp_config_trustedkey: '' -ntp_config_requestkey: '' -ntp_config_controlkey: '' -ntp_config_broadcast: '' -ntp_config_broadcastclient: '' -ntp_config_multicastclient: '' -ntp_config_tinker_panic_enabled: '' +ntp_config_statistics: loopstats peerstats clockstats +ntp_config_crypto: "" +ntp_config_includefile: "" +ntp_config_keys: "" +ntp_config_trustedkey: "" +ntp_config_requestkey: "" +ntp_config_controlkey: "" +ntp_config_broadcast: "" +ntp_config_broadcastclient: "" +ntp_config_multicastclient: "" +ntp_config_tinker_panic_enabled: "" diff --git a/roles/ntp/handlers/main.yml b/roles/ntp/handlers/main.yml index d18df56..16483e6 100644 --- a/roles/ntp/handlers/main.yml +++ b/roles/ntp/handlers/main.yml @@ -1,3 +1,5 @@ --- -- name: restart ntp - service: name={{ ntp_service_name }} state=restarted +- name: Restart ntp + ansible.builtin.service: + name: "{{ ntp_service_name }}" + state: restarted diff --git a/roles/ntp/tasks/debian.yml b/roles/ntp/tasks/debian.yml index 22d59fe..90026dc 100644 --- a/roles/ntp/tasks/debian.yml +++ b/roles/ntp/tasks/debian.yml @@ -1,8 +1,8 @@ --- -- name: ntp | Debian | Install the required packages in Debian derivatives +- name: Ntp | Debian | Install the required packages in Debian derivatives ansible.builtin.apt: name: ntp - update_cache: yes + update_cache: true cache_valid_time: 86400 state: "{{ ntp_pkg_state }}" when: ansible_os_family == 'Debian' diff --git a/roles/ntp/tasks/main.yml b/roles/ntp/tasks/main.yml index 5241721..b52905b 100644 --- a/roles/ntp/tasks/main.yml +++ b/roles/ntp/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: ntp | Add the OS specific variables +- name: Ntp | Add the OS specific variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml" @@ -11,14 +11,14 @@ - service - ntp -- name: ntp | Installation +- name: Ntp | Installation ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml" -- name: ntp | Copy the ntp.conf template file +- name: Ntp | Copy the ntp.conf template file ansible.builtin.template: src: ntp.conf.j2 dest: /etc/ntp.conf - mode: 0664 + mode: "0664" notify: - restart ntp tags: @@ -31,7 +31,7 @@ name: "{{ ntp_service_name }}" state: "{{ ntp_service_state }}" enabled: "{{ ntp_service_enabled }}" - pattern: '/ntpd' + pattern: /ntpd tags: - service - ntp diff --git a/roles/ntp/tasks/redhat.yml b/roles/ntp/tasks/redhat.yml index d0c7371..62fa225 100644 --- a/roles/ntp/tasks/redhat.yml +++ b/roles/ntp/tasks/redhat.yml @@ -1,5 +1,5 @@ --- -- name: ntp | RedHat | Remove chrony from RedHat 7 Installations to prevent conflict. +- name: Ntp | RedHat | Remove chrony from RedHat 7 Installations to prevent conflict. ansible.builtin.yum: name: chrony state: absent @@ -12,7 +12,7 @@ - package - ntp -- name: ntp | RedHat | Install the required packages in Redhat derivatives +- name: Ntp | RedHat | Install the required packages in Redhat derivatives ansible.builtin.yum: name: ntp state: "{{ ntp_pkg_state }}" diff --git a/roles/ntp/tasks/suse.yml b/roles/ntp/tasks/suse.yml index a659709..1c45c7d 100644 --- a/roles/ntp/tasks/suse.yml +++ b/roles/ntp/tasks/suse.yml @@ -1,5 +1,5 @@ --- -- name: ntp | Suse | Install the required packages in Suse derivatives +- name: Ntp | Suse | Install the required packages in Suse derivatives ansible.general.zypper: name: ntp state: "{{ ntp_pkg_state }}" diff --git a/roles/remi_repo/tasks/dnf.yml b/roles/remi_repo/tasks/dnf.yml index ec26f3e..2cacb3a 100644 --- a/roles/remi_repo/tasks/dnf.yml +++ b/roles/remi_repo/tasks/dnf.yml @@ -5,6 +5,7 @@ validate_certs: "{{ remi_repo_validate_certs }}" - name: Repo Remi | Enable/Disable specific remi repository + when: remi_repo_enable_list is defined or remi_repo_disable_list is defined block: - name: Repo Remi | DNF | Make sure dnf-plugins-core is present ansible.builtin.dnf: @@ -22,6 +23,4 @@ - name: Repo Remi | Update dnf cache ansible.builtin.dnf: - update_cache: yes - when: remi_repo_enable_list is defined or - remi_repo_disable_list is defined + update_cache: true diff --git a/roles/remi_repo/tasks/main.yml b/roles/remi_repo/tasks/main.yml index 59a42e5..8be974f 100644 --- a/roles/remi_repo/tasks/main.yml +++ b/roles/remi_repo/tasks/main.yml @@ -2,7 +2,7 @@ - name: Repo Remi | Include {{ ansible_distribution }} specific variables ansible.builtin.include_vars: "{{ item }}" with_first_found: - - vars/{{ ansible_distribution|lower }}.yml + - vars/{{ ansible_distribution | lower }}.yml - vars/default.yml - name: Repo Remi | Import remi GPG keys. @@ -19,13 +19,14 @@ delay: 2 rescue: - name: Repo Remi | Ensure curl is present (systems without SNI). - ansible.builtin.package: name=curl + ansible.builtin.package: + name: curl register: task_result until: task_result is success retries: 10 delay: 2 - name: Repo Remi | Download GPG key (systems without SNI). # noqa no-changed-when command-instead-of-module - ansible.builtin.command: "curl -sSL {{ remi_repo_gpg_key_url }} -o /tmp/remi_repo-gpg" + ansible.builtin.command: curl -sSL {{ remi_repo_gpg_key_url }} -o /tmp/remi_repo-gpg - name: Repo Remi | Add Docker GPG key (systems without SNI). # noqa no-changed-when command-instead-of-module ansible.builtin.command: rpm --import /tmp/remi_repo-gpg - name: Repo Remi | Remove docker-gpg from tmp folder diff --git a/roles/remi_repo/tasks/yum.yml b/roles/remi_repo/tasks/yum.yml index f0970c3..799f3e5 100644 --- a/roles/remi_repo/tasks/yum.yml +++ b/roles/remi_repo/tasks/yum.yml @@ -5,6 +5,7 @@ validate_certs: "{{ remi_repo_validate_certs }}" - name: Repo Remi | Enable/Disable specific remi repository + when: remi_repo_enable_list is defined or remi_repo_disable_list is defined block: - name: Repo Remi | Make sure yum-utils are present ansible.builtin.yum: @@ -22,6 +23,4 @@ - name: Repo Remi | Update yum cache ansible.builtin.yum: - update_cache: yes - when: remi_repo_enable_list is defined or - remi_repo_disable_list is defined + update_cache: true diff --git a/roles/remi_repo/vars/default.yml b/roles/remi_repo/vars/default.yml index e47fcb8..0f70513 100644 --- a/roles/remi_repo/vars/default.yml +++ b/roles/remi_repo/vars/default.yml @@ -1,2 +1,2 @@ --- -remi_repo_url: "http://rpms.remirepo.net/enterprise/remi-release-{{ ansible_distribution_major_version }}.rpm" +remi_repo_url: http://rpms.remirepo.net/enterprise/remi-release-{{ ansible_distribution_major_version }}.rpm diff --git a/roles/remi_repo/vars/fedora.yml b/roles/remi_repo/vars/fedora.yml index 40ab962..3a80e90 100644 --- a/roles/remi_repo/vars/fedora.yml +++ b/roles/remi_repo/vars/fedora.yml @@ -1,2 +1,2 @@ --- -remi_repo_url: "https://rpms.remirepo.net/fedora/remi-release-{{ ansible_distribution_major_version }}.rpm" +remi_repo_url: https://rpms.remirepo.net/fedora/remi-release-{{ ansible_distribution_major_version }}.rpm diff --git a/roles/selinux/defaults/main.yml b/roles/selinux/defaults/main.yml index 8144fc2..e3f3958 100644 --- a/roles/selinux/defaults/main.yml +++ b/roles/selinux/defaults/main.yml @@ -1,4 +1,6 @@ --- +# code: language=ansible + selinux_policy: targeted selinux_state: enforcing reboot: false diff --git a/roles/selinux/meta/main.yml b/roles/selinux/meta/main.yml index de0cd7a..b03b054 100644 --- a/roles/selinux/meta/main.yml +++ b/roles/selinux/meta/main.yml @@ -1,4 +1,6 @@ --- +# code: language=ansible + galaxy_info: author: ericsysmin role_name: selinux diff --git a/roles/selinux/tasks/main.yml b/roles/selinux/tasks/main.yml index 07132f7..d2e8c35 100644 --- a/roles/selinux/tasks/main.yml +++ b/roles/selinux/tasks/main.yml @@ -1,23 +1,29 @@ --- -- name: SELinux | Include {{ ansible_os_family }} specific variables +# code: language=ansible + +- name: SELinux | Include specific variables {{ ansible_os_family }} ansible.builtin.include_vars: "{{ item }}" with_first_found: - - vars/{{ ansible_os_family|lower }}.yml + - vars/{{ ansible_os_family | lower }}.yml - vars/default.yml - name: SELinux | RedHat | Install libselinux-python - ansible.builtin.package: name={{ selinux_python_package }} + ansible.builtin.package: + name: "{{ selinux_python_package }}" register: task_result until: task_result is success retries: 10 delay: 2 - name: SELinux | Set SELinux policy and state - ansible.posix.selinux: policy={{ selinux_policy }} state={{ selinux_state }} + ansible.posix.selinux: + policy: "{{ selinux_policy }}" + state: "{{ selinux_state }}" register: selinux - name: SELinux | Show the output of the previous SELinux change - ansible.builtin.debug: var=selinux + ansible.builtin.debug: + var: selinux - name: SELinux | Restart machine ansible.builtin.reboot: diff --git a/roles/selinux/vars/default.yml b/roles/selinux/vars/default.yml index 530c579..630dc1d 100644 --- a/roles/selinux/vars/default.yml +++ b/roles/selinux/vars/default.yml @@ -1 +1,2 @@ +--- selinux_python_package: libselinux-python diff --git a/roles/selinux/vars/redhat.yml b/roles/selinux/vars/redhat.yml index 899a2ac..218890b 100644 --- a/roles/selinux/vars/redhat.yml +++ b/roles/selinux/vars/redhat.yml @@ -1,3 +1,4 @@ +--- selinux_python_package: >- {%- if ansible_python.version.major == 2 -%}libselinux-python {%- else -%}libselinux-python3 From 14b569b96be75b71d3e11a57628311b2d5ab40d1 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 3 Jan 2024 22:57:37 -0800 Subject: [PATCH 2/6] use ubuntu-latest as specific versions are no longer supported --- .github/workflows/chrony.yml | 2 +- .github/workflows/epel.yml | 2 +- .github/workflows/logrotate.yml | 2 +- .github/workflows/ntp.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/remi_repo.yml | 2 +- .github/workflows/selinux.yml | 2 +- build/galaxy_deploy.yml | 3 ++- galaxy.yml | 4 +++- roles/chrony/meta/main.yml | 2 +- roles/ntp/tasks/suse.yml | 2 +- 11 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/chrony.yml b/.github/workflows/chrony.yml index f76c55e..b393525 100644 --- a/.github/workflows/chrony.yml +++ b/.github/workflows/chrony.yml @@ -13,7 +13,7 @@ on: - .github/workflows/chrony.yml jobs: molecule: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/epel.yml b/.github/workflows/epel.yml index c1edff7..f43be54 100644 --- a/.github/workflows/epel.yml +++ b/.github/workflows/epel.yml @@ -13,7 +13,7 @@ on: - .github/workflows/epel.yml jobs: molecule: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/logrotate.yml b/.github/workflows/logrotate.yml index ee6a28f..ca0dff3 100644 --- a/.github/workflows/logrotate.yml +++ b/.github/workflows/logrotate.yml @@ -13,7 +13,7 @@ on: - .github/workflows/logrotate.yml jobs: logrotate: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/ntp.yml b/.github/workflows/ntp.yml index 328a367..231bdf8 100644 --- a/.github/workflows/ntp.yml +++ b/.github/workflows/ntp.yml @@ -13,7 +13,7 @@ on: - .github/workflows/ntp.yml jobs: molecule: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23fa2d8..dc4556e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - created jobs: release: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: ANSIBLE_GALAXY_TOKEN: ${{ secrets.ANSIBLE_GALAXY_TOKEN }} ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/remi_repo.yml b/.github/workflows/remi_repo.yml index 6d65f67..1d6904d 100644 --- a/.github/workflows/remi_repo.yml +++ b/.github/workflows/remi_repo.yml @@ -13,7 +13,7 @@ on: - .github/workflows/remi_repo.yml jobs: molecule: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/selinux.yml b/.github/workflows/selinux.yml index 5a8225d..17a0078 100644 --- a/.github/workflows/selinux.yml +++ b/.github/workflows/selinux.yml @@ -13,7 +13,7 @@ on: - .github/workflows/selinux.yml jobs: molecule: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/build/galaxy_deploy.yml b/build/galaxy_deploy.yml index 04da8d8..e0bca80 100644 --- a/build/galaxy_deploy.yml +++ b/build/galaxy_deploy.yml @@ -1,5 +1,6 @@ --- -- hosts: localhost +- nname: Deploy to Ansible Galaxy + hosts: localhost connection: local gather_facts: false vars: diff --git a/galaxy.yml b/galaxy.yml index a850d99..b8b0da7 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -51,7 +51,9 @@ tags: # collection label 'namespace.name'. The value is a version range # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version # range specifiers can be set and are separated by ',' -dependencies: {} +dependencies: + "community.general": "*" + # The URL of the originating SCM repository repository: https://github.com/ericsysmin/ansible-collection-system diff --git a/roles/chrony/meta/main.yml b/roles/chrony/meta/main.yml index 88864be..91faed6 100644 --- a/roles/chrony/meta/main.yml +++ b/roles/chrony/meta/main.yml @@ -25,7 +25,7 @@ galaxy_info: - xenial - name: ArchLinux versions: - - any + - all - name: opensuse versions: - 15.2 diff --git a/roles/ntp/tasks/suse.yml b/roles/ntp/tasks/suse.yml index 1c45c7d..02a27c3 100644 --- a/roles/ntp/tasks/suse.yml +++ b/roles/ntp/tasks/suse.yml @@ -1,6 +1,6 @@ --- - name: Ntp | Suse | Install the required packages in Suse derivatives - ansible.general.zypper: + community.general.zypper: name: ntp state: "{{ ntp_pkg_state }}" when: ansible_os_family == 'Suse' From e960608808686c3241469d446ed4c17e839c8d9e Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 3 Jan 2024 22:59:40 -0800 Subject: [PATCH 3/6] use python 3.11 --- .github/workflows/chrony.yml | 4 ++-- .github/workflows/epel.yml | 4 ++-- .github/workflows/logrotate.yml | 4 ++-- .github/workflows/ntp.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- .github/workflows/remi_repo.yml | 4 ++-- .github/workflows/selinux.yml | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/chrony.yml b/.github/workflows/chrony.yml index b393525..295cd5e 100644 --- a/.github/workflows/chrony.yml +++ b/.github/workflows/chrony.yml @@ -39,10 +39,10 @@ jobs: with: path: ansible_collections/ericsysmin/system - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | diff --git a/.github/workflows/epel.yml b/.github/workflows/epel.yml index f43be54..f261f01 100644 --- a/.github/workflows/epel.yml +++ b/.github/workflows/epel.yml @@ -31,10 +31,10 @@ jobs: with: path: ansible_collections/ericsysmin/system - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | diff --git a/.github/workflows/logrotate.yml b/.github/workflows/logrotate.yml index ca0dff3..406c450 100644 --- a/.github/workflows/logrotate.yml +++ b/.github/workflows/logrotate.yml @@ -39,10 +39,10 @@ jobs: with: path: ansible_collections/ericsysmin/system - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | diff --git a/.github/workflows/ntp.yml b/.github/workflows/ntp.yml index 231bdf8..1324f29 100644 --- a/.github/workflows/ntp.yml +++ b/.github/workflows/ntp.yml @@ -34,10 +34,10 @@ jobs: with: path: ansible_collections/ericsysmin/system - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc4556e..cb33b82 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,10 +14,10 @@ jobs: - name: Check out code uses: actions/checkout@v1 - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | diff --git a/.github/workflows/remi_repo.yml b/.github/workflows/remi_repo.yml index 1d6904d..42aba1d 100644 --- a/.github/workflows/remi_repo.yml +++ b/.github/workflows/remi_repo.yml @@ -34,10 +34,10 @@ jobs: with: path: ansible_collections/ericsysmin/system - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | diff --git a/.github/workflows/selinux.yml b/.github/workflows/selinux.yml index 17a0078..69a1045 100644 --- a/.github/workflows/selinux.yml +++ b/.github/workflows/selinux.yml @@ -31,10 +31,10 @@ jobs: with: path: ansible_collections/ericsysmin/system - - name: Set up Python 3.8 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.11 - name: Install dependencies run: | From 341186cb34d3e90c2663fc0b634293f0fe9fb8d8 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 3 Jan 2024 23:01:12 -0800 Subject: [PATCH 4/6] update version of setup-python action --- .github/workflows/chrony.yml | 2 +- .github/workflows/epel.yml | 2 +- .github/workflows/logrotate.yml | 2 +- .github/workflows/ntp.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/remi_repo.yml | 2 +- .github/workflows/selinux.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/chrony.yml b/.github/workflows/chrony.yml index 295cd5e..758d712 100644 --- a/.github/workflows/chrony.yml +++ b/.github/workflows/chrony.yml @@ -40,7 +40,7 @@ jobs: path: ansible_collections/ericsysmin/system - name: Set up Python 3.11 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/epel.yml b/.github/workflows/epel.yml index f261f01..9ce1183 100644 --- a/.github/workflows/epel.yml +++ b/.github/workflows/epel.yml @@ -32,7 +32,7 @@ jobs: path: ansible_collections/ericsysmin/system - name: Set up Python 3.11 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/logrotate.yml b/.github/workflows/logrotate.yml index 406c450..b53f8c2 100644 --- a/.github/workflows/logrotate.yml +++ b/.github/workflows/logrotate.yml @@ -40,7 +40,7 @@ jobs: path: ansible_collections/ericsysmin/system - name: Set up Python 3.11 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/ntp.yml b/.github/workflows/ntp.yml index 1324f29..031add4 100644 --- a/.github/workflows/ntp.yml +++ b/.github/workflows/ntp.yml @@ -35,7 +35,7 @@ jobs: path: ansible_collections/ericsysmin/system - name: Set up Python 3.11 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb33b82..095eeb9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v1 - name: Set up Python 3.11 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/remi_repo.yml b/.github/workflows/remi_repo.yml index 42aba1d..bc517f5 100644 --- a/.github/workflows/remi_repo.yml +++ b/.github/workflows/remi_repo.yml @@ -35,7 +35,7 @@ jobs: path: ansible_collections/ericsysmin/system - name: Set up Python 3.11 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.11 diff --git a/.github/workflows/selinux.yml b/.github/workflows/selinux.yml index 69a1045..500cfcf 100644 --- a/.github/workflows/selinux.yml +++ b/.github/workflows/selinux.yml @@ -32,7 +32,7 @@ jobs: path: ansible_collections/ericsysmin/system - name: Set up Python 3.11 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: 3.11 From e679b96dba5714388ad5dc27d9617f262a4d3aea Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 3 Jan 2024 23:07:38 -0800 Subject: [PATCH 5/6] use latest version of checkout --- .github/workflows/chrony.yml | 2 +- .github/workflows/epel.yml | 2 +- .github/workflows/logrotate.yml | 2 +- .github/workflows/ntp.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/remi_repo.yml | 2 +- .github/workflows/selinux.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/chrony.yml b/.github/workflows/chrony.yml index 758d712..7672481 100644 --- a/.github/workflows/chrony.yml +++ b/.github/workflows/chrony.yml @@ -35,7 +35,7 @@ jobs: - chrony steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/ericsysmin/system diff --git a/.github/workflows/epel.yml b/.github/workflows/epel.yml index 9ce1183..993673a 100644 --- a/.github/workflows/epel.yml +++ b/.github/workflows/epel.yml @@ -27,7 +27,7 @@ jobs: - epel steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/ericsysmin/system diff --git a/.github/workflows/logrotate.yml b/.github/workflows/logrotate.yml index b53f8c2..a58fbf4 100644 --- a/.github/workflows/logrotate.yml +++ b/.github/workflows/logrotate.yml @@ -35,7 +35,7 @@ jobs: - logrotate steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/ericsysmin/system diff --git a/.github/workflows/ntp.yml b/.github/workflows/ntp.yml index 031add4..13abb62 100644 --- a/.github/workflows/ntp.yml +++ b/.github/workflows/ntp.yml @@ -30,7 +30,7 @@ jobs: - ntp steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/ericsysmin/system diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 095eeb9..cb715be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: ANSIBLE_FORCE_COLOR: 1 steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 diff --git a/.github/workflows/remi_repo.yml b/.github/workflows/remi_repo.yml index bc517f5..5d0e530 100644 --- a/.github/workflows/remi_repo.yml +++ b/.github/workflows/remi_repo.yml @@ -30,7 +30,7 @@ jobs: - remi_repo steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/ericsysmin/system diff --git a/.github/workflows/selinux.yml b/.github/workflows/selinux.yml index 500cfcf..07887b5 100644 --- a/.github/workflows/selinux.yml +++ b/.github/workflows/selinux.yml @@ -27,7 +27,7 @@ jobs: - selinux steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/ericsysmin/system From 0f7c7a59171c170d4be843aa36282e8582519434 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 3 Jan 2024 23:29:34 -0800 Subject: [PATCH 6/6] remove vscode --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 8b9d64d..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ansible.python.interpreterPath": "/Users/eanderson/.pyenv/versions/3.11.7/bin/python" -} \ No newline at end of file