Fix: Update haveged-install ansible role 41/72641/1
authorAnil Belur <abelur@linuxfoundation.org>
Sun, 11 Feb 2024 02:12:14 +0000 (12:12 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Sun, 11 Feb 2024 02:15:19 +0000 (12:15 +1000)
Update molecule test formats and update the role to build with
latest version of ansible. Fix ansible lint errors and warnings.

Update tox and pre-commit dependencies to build with latest versions
of ansible and molecule.

Change-Id: Id80262c552f34092ec18db3bf082127f5ee672ba
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
.yamllint
meta/main.yml
molecule/default/molecule.yml
molecule/default/prepare.yml
tasks/main.yml
tox.ini

index 7626c6e..894450c 100644 (file)
--- a/.yamllint
+++ b/.yamllint
@@ -9,9 +9,7 @@ rules:
     max-spaces-inside: 1
     level: error
   line-length: disable
-  # NOTE(retr0h): Templates no longer fail this lint rule.
-  #               Uncomment if running old Molecule templates.
-  # truthy: disable
+  truthy: disable
 
 ignore: |
   .tox/
index f6dc464..d7d0b4f 100644 (file)
@@ -19,12 +19,12 @@ galaxy_info:
       versions:
         - 7
         - 8
-        - 9
 
     - name: Ubuntu
       versions:
         - bionic
         - focal
+        - jammy
 
   galaxy_tags:
     - system
index 6329307..ece185b 100644 (file)
@@ -3,10 +3,6 @@ dependency:
   name: galaxy
 driver:
   name: docker
-lint: |
-  set -e
-  yamllint .
-  ansible-lint tasks/*.yml
 platforms:
   - name: centos7
     image: centos:7
@@ -16,6 +12,8 @@ platforms:
     image: ubuntu:18.04
   - name: ubuntu2004
     image: ubuntu:20.04
+  - name: ubuntu2204
+    image: ubuntu:22.04
 provisioner:
   name: ansible
 scenario:
index 36e71a8..2be4a86 100644 (file)
@@ -4,7 +4,15 @@
   gather_facts: true
   tasks:
     - name: Update APT cache
-      apt:
+      ansible.builtin.package:
         update_cache: yes
       when: ansible_distribution == 'Ubuntu'
       become: true
+
+    - name: Install EPEL release repo
+      ansible.builtin.yum:
+        name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
+        state: present
+        disable_gpg_check: True
+      when: ansible_os_family == 'RedHat'
+      become: true
index 0e31f0a..9db6381 100644 (file)
@@ -1,22 +1,26 @@
 ---
 - name: Install Epel Repo
-  package: name=epel-release state=present
+  ansible.builtin.package:
+    name: epel-release
+    state: present
   when: ansible_os_family == "RedHat"
   become: true
 
 - name: Install haveged package
-  package: name=haveged state=present
+  ansible.builtin.package:
+    name: haveged
+    state: present
   become: true
 
 - name: Enable haveged service (Ubuntu)
-  service:
+  ansible.builtin.service:
     name: haveged
     enabled: yes
   become: true
   when: ansible_distribution == 'Ubuntu'
 
 - name: Enable haveged service (RedHat)
-  systemd:
+  ansible.builtin.systemd:
     name: haveged
     enabled: yes
   become: true
diff --git a/tox.ini b/tox.ini
index 777d967..5ad109a 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -2,20 +2,17 @@
 minversion = 1.6
 envlist =
     molecule,
-    pre-commit
+    pre-commit,
+    lint
 skipsdist=true
 
 [testenv:molecule]
 basepython = python3
 deps =
-    ansible~=2.9.6
-    ansible-lint~=4.2.0
-    detox~=0.18
+    ansible
     docker
-    yamllint
-    molecule~=3.0.8
-    molecule[docker]
-    pytest~=5.4.0
+    molecule
+    molecule-docker
 passenv = *
 commands =
     ./molecule.sh
@@ -23,8 +20,10 @@ allowlist_externals =
     ./molecule.sh
 
 [testenv:pre-commit]
+allowlist_externals =
+    /bin/sh
 deps = pre-commit
-allowlist_externals = /bin/sh
+passenv = HOME
 commands =
     pre-commit run --all-files --show-diff-on-failure
     /bin/sh -c 'if ! git config --get user.name > /dev/null; then \
@@ -44,3 +43,15 @@ commands =
     /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \
         git config --global --unset user.email; \
         rm -f .git/REMOVE_USEREMAIL; fi"
+
+[testenv:lint]
+basepython = python310
+deps =
+    ansible-lint
+    yamllint
+commands =
+    /bin/bash -c "ansible-lint tasks/*.yml"
+    yamllint .
+allowlist_externals =
+    /bin/bash
+    yamllint