From 55d44f7b9bbedd83a4ffc63cc1ba5ffdd46f741c Mon Sep 17 00:00:00 2001 From: Kevin Coakley Date: Wed, 19 Oct 2022 10:24:56 -0700 Subject: [PATCH 1/5] Update molecule tests --- .github/workflows/molecule-test.yml | 7 +++++-- molecule/ansible-lint.yml | 7 +++++++ molecule/default/molecule.yml | 7 ++++--- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 molecule/ansible-lint.yml diff --git a/.github/workflows/molecule-test.yml b/.github/workflows/molecule-test.yml index 09ea701..6e5868d 100644 --- a/.github/workflows/molecule-test.yml +++ b/.github/workflows/molecule-test.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false max-parallel: 4 matrix: - molecule_distro: ['centos7', 'centos8', 'ubuntu1804', 'ubuntu2004'] + molecule_distro: ['rockylinux8', 'ubuntu2004', 'ubuntu2204'] env: ANSIBLE_CALLBACK_WHITELIST: profile_tasks @@ -21,7 +21,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install ansible-lint flake8 molecule docker + pip install ansible ansible-lint flake8 molecule molecule-docker docker yamllint + ansible --version + ansible-lint --version + molecule --version - name: Test with molecule run: | molecule test --all diff --git a/molecule/ansible-lint.yml b/molecule/ansible-lint.yml new file mode 100644 index 0000000..e9ae42b --- /dev/null +++ b/molecule/ansible-lint.yml @@ -0,0 +1,7 @@ +--- +warn_list: + - internal-error + - role-name + - fqcn-builtins +skip_list: + - yaml diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index bb5d5fb..091198e 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -6,14 +6,15 @@ driver: lint: | set -e yamllint -c molecule/yaml-lint.yml . - ansible-lint + ansible-lint -c molecule/ansible-lint.yml . flake8 platforms: - name: instance - image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: true pre_build_image: true provisioner: From be7cea1d253f4fa9f4fb5720bd647fcb9c0056a8 Mon Sep 17 00:00:00 2001 From: Kevin Coakley Date: Wed, 19 Oct 2022 10:25:43 -0700 Subject: [PATCH 2/5] Update meta and readme Removed centos 7 and ubuntu 18.04 added ubuntu 22.04 --- README.md | 2 +- meta/main.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 62363a6..26e34f4 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ are not present in the list of Ansible facts, like the container's private ip ad Requirements ------------ -None. Tested on CentOS 7 & 8 and Ubuntu 18.04 & 20.04. +None. Tested on CentOS 8 and Ubuntu 20.04 & 22.04. Role Variables -------------- diff --git a/meta/main.yml b/meta/main.yml index 1497047..e0679e0 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,7 @@ --- galaxy_info: role_name: facter + namespace: kevincoakley author: Kevin Coakley description: Install Facter on a host then regather the host facts @@ -17,7 +18,7 @@ galaxy_info: # - CC-BY license: BSD - min_ansible_version: 2.5 + min_ansible_version: "2.5" # # platforms is a list of platforms, and each platform has a name and a list of versions. @@ -25,8 +26,7 @@ galaxy_info: platforms: - name: EL versions: - - 7 - - 8 + - "8" - name: Ubuntu versions: - bionic From 5b84430e48736fee2415d785748c973a9c19cfd7 Mon Sep 17 00:00:00 2001 From: Kevin Coakley Date: Wed, 19 Oct 2022 10:25:55 -0700 Subject: [PATCH 3/5] Set norc to true --- tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/main.yml b/tasks/main.yml index 9cf936f..6c2e4c1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -28,6 +28,7 @@ state: present version: "{{ facter_version }}" user_install: false + norc: true retries: 5 delay: 5 From 3a572844b1048fd14640ae5cce7102adfc77e7ba Mon Sep 17 00:00:00 2001 From: Kevin Coakley Date: Wed, 19 Oct 2022 10:39:21 -0700 Subject: [PATCH 4/5] Change min version to 2.10 Use FQCN names --- .github/workflows/molecule-test.yml | 2 +- meta/main.yml | 4 ++-- molecule/ansible-lint.yml | 4 ---- tasks/main.yml | 16 +++++++++------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/molecule-test.yml b/.github/workflows/molecule-test.yml index 6e5868d..27fe296 100644 --- a/.github/workflows/molecule-test.yml +++ b/.github/workflows/molecule-test.yml @@ -10,7 +10,7 @@ jobs: matrix: molecule_distro: ['rockylinux8', 'ubuntu2004', 'ubuntu2204'] env: - ANSIBLE_CALLBACK_WHITELIST: profile_tasks + ANSIBLE_CALLBACKS_ENABLED: profile_tasks steps: - uses: actions/checkout@v1 diff --git a/meta/main.yml b/meta/main.yml index e0679e0..70b2041 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -18,7 +18,7 @@ galaxy_info: # - CC-BY license: BSD - min_ansible_version: "2.5" + min_ansible_version: "2.10" # # platforms is a list of platforms, and each platform has a name and a list of versions. @@ -29,8 +29,8 @@ galaxy_info: - "8" - name: Ubuntu versions: - - bionic - focal + - jammy galaxy_tags: - system diff --git a/molecule/ansible-lint.yml b/molecule/ansible-lint.yml index e9ae42b..5891ff5 100644 --- a/molecule/ansible-lint.yml +++ b/molecule/ansible-lint.yml @@ -1,7 +1,3 @@ --- -warn_list: - - internal-error - - role-name - - fqcn-builtins skip_list: - yaml diff --git a/tasks/main.yml b/tasks/main.yml index 6c2e4c1..e1ecbb9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Download and install rubygems (RedHat) - package: + ansible.builtin.package: name: rubygems state: present when: ansible_os_family == "RedHat" @@ -8,14 +8,14 @@ delay: 5 - name: Run "apt-get update" (Debian) - apt: + ansible.builtin.apt: update_cache: true when: ansible_os_family == "Debian" retries: 5 delay: 5 - name: Download and install Ruby (Debian) - package: + ansible.builtin.package: name: ruby state: present when: ansible_os_family == "Debian" @@ -23,7 +23,7 @@ delay: 5 - name: Download and install the facter Gem - gem: + community.general.gem: name: facter state: present version: "{{ facter_version }}" @@ -33,7 +33,7 @@ delay: 5 - name: Create a symbolic link for /usr/bin/facter (RedHat) - file: + ansible.builtin.file: src: /usr/local/bin/facter dest: /usr/bin/facter owner: root @@ -41,5 +41,7 @@ state: link when: ansible_os_family == "RedHat" -- name: Rerun setup to gather the new facter facts - action: setup +- name: Rerun setup module to gather facts + ansible.builtin.setup: + gather_subset: + - facter From cb54d964a4aec9c14d0f1fa134d644152de863e4 Mon Sep 17 00:00:00 2001 From: Kevin Coakley Date: Wed, 19 Oct 2022 10:53:07 -0700 Subject: [PATCH 5/5] Add CentOS 9 --- .github/workflows/molecule-test.yml | 2 +- README.md | 2 +- meta/main.yml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/molecule-test.yml b/.github/workflows/molecule-test.yml index 27fe296..4ab028d 100644 --- a/.github/workflows/molecule-test.yml +++ b/.github/workflows/molecule-test.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false max-parallel: 4 matrix: - molecule_distro: ['rockylinux8', 'ubuntu2004', 'ubuntu2204'] + molecule_distro: ['rockylinux8', 'rockylinux9', 'ubuntu2004', 'ubuntu2204'] env: ANSIBLE_CALLBACKS_ENABLED: profile_tasks diff --git a/README.md b/README.md index 26e34f4..fa99ad5 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ are not present in the list of Ansible facts, like the container's private ip ad Requirements ------------ -None. Tested on CentOS 8 and Ubuntu 20.04 & 22.04. +None. Tested on CentOS 8 & 9 and Ubuntu 20.04 & 22.04. Role Variables -------------- diff --git a/meta/main.yml b/meta/main.yml index 70b2041..9265e9d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -27,6 +27,7 @@ galaxy_info: - name: EL versions: - "8" + - "9" - name: Ubuntu versions: - focal