From e56bd4f45f5d9f68aeb406510cf4aa5741405d80 Mon Sep 17 00:00:00 2001 From: Jan Benedikt Date: Tue, 5 May 2020 08:46:19 +0200 Subject: Fix lint errors in package-repository-check role In package-repository-check was changed command module to service module due to lint failing. Failing was caused by errors: [301] Commands should not change things if nothing needs doing [303] service used in place of service module Added molecule test. Issue-ID: OOM-2395 Signed-off-by: Jan Benedikt Change-Id: I6cfdfe920eabfb9a0c43cc9ba4ffcd81df1d6852 --- .../molecule/default/molecule.yml | 58 ++++++++++++++++++++++ .../molecule/default/playbook.yml | 5 ++ 2 files changed, 63 insertions(+) create mode 100755 ansible/roles/package-repository-check/molecule/default/molecule.yml create mode 100755 ansible/roles/package-repository-check/molecule/default/playbook.yml (limited to 'ansible/roles/package-repository-check/molecule/default') diff --git a/ansible/roles/package-repository-check/molecule/default/molecule.yml b/ansible/roles/package-repository-check/molecule/default/molecule.yml new file mode 100755 index 00000000..27003dcb --- /dev/null +++ b/ansible/roles/package-repository-check/molecule/default/molecule.yml @@ -0,0 +1,58 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: + name: yamllint +platforms: + - name: infra_host + image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6} + pre_build_image: True + privileged: true + volume_mounts: + - "/sys/fs/cgroup:/sys/fs/cgroup:ro" + override_command: False + groups: + - infrastructure + - name: node0 + image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6} + pre_build_image: True + privileged: true + volume_mounts: + - "/sys/fs/cgroup:/sys/fs/cgroup:ro" + override_command: False + groups: + - kubernetes +provisioner: + name: ansible + lint: + name: ansible-lint + env: + ANSIBLE_ROLES_PATH: ../../../../test/roles +scenario: + name: default + test_sequence: + - lint + - cleanup + - destroy + - dependency + - syntax + - create + - prepare + - converge + # - idempotence + # --> Action: 'idempotence' + # ERROR: Idempotence test failed because of the following tasks: + # * [infra_host] => package-repository-check : Clean yum cache + # * [node0] => package-repository-check : Clean yum cache + - side_effect + - verify + - cleanup + - destroy +verifier: + name: testinfra + lint: + name: flake8 + options: + v: 1 diff --git a/ansible/roles/package-repository-check/molecule/default/playbook.yml b/ansible/roles/package-repository-check/molecule/default/playbook.yml new file mode 100755 index 00000000..7dd80c77 --- /dev/null +++ b/ansible/roles/package-repository-check/molecule/default/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Activate repository on node host + hosts: all + roles: + - package-repository-check -- cgit 1.2.3-korg