From d55fc84fe9404c5e50c8030f9255ca2e044d8cfa Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 19 Aug 2024 10:25:06 +0200 Subject: [PATCH] refctor: rework ci to ue ansible-lint and fix molecule --- .later.yml | 15 --------------- .woodpecker/docs.yaml | 10 +++++----- .woodpecker/lint.yaml | 6 +++--- .woodpecker/test.yaml | 2 +- .yamllint | 20 ++++++++++++++++++++ handlers/main.yml | 6 +++--- meta/main.yml | 2 -- molecule/default/molecule.yml | 2 +- molecule/default/prepare.yml | 4 ++++ tasks/main.yml | 6 +++--- 10 files changed, 40 insertions(+), 33 deletions(-) delete mode 100644 .later.yml create mode 100644 .yamllint diff --git a/.later.yml b/.later.yml deleted file mode 100644 index 2703cb9..0000000 --- a/.later.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -ansible: - custom_modules: - - iptables_raw - - openssl_pkcs12 - - proxmox_kvm - - ucr - - corenetworks_dns - - corenetworks_token - -rules: - exclude_files: - - "LICENSE*" - - "**/*.md" - - "**/*.ini" diff --git a/.woodpecker/docs.yaml b/.woodpecker/docs.yaml index f053ca8..857444b 100644 --- a/.woodpecker/docs.yaml +++ b/.woodpecker/docs.yaml @@ -9,11 +9,11 @@ steps: - name: generate image: quay.io/thegeeklab/ansible-doctor environment: - ANSIBLE_DOCTOR_EXCLUDE_FILES: molecule/ - ANSIBLE_DOCTOR_FORCE_OVERWRITE: "true" - ANSIBLE_DOCTOR_LOG_LEVEL: INFO - ANSIBLE_DOCTOR_ROLE_NAME: ${CI_REPO_NAME} - ANSIBLE_DOCTOR_TEMPLATE: readme + ANSIBLE_DOCTOR_EXCLUDE_FILES: "['molecule/']" + ANSIBLE_DOCTOR_RENDERER__FORCE_OVERWRITE: "true" + ANSIBLE_DOCTOR_LOGGING__LEVEL: info + ANSIBLE_DOCTOR_ROLE__NAME: ${CI_REPO_NAME} + ANSIBLE_DOCTOR_TEMPLATE__NAME: readme - name: format image: quay.io/thegeeklab/alpine-tools diff --git a/.woodpecker/lint.yaml b/.woodpecker/lint.yaml index 36b1ec8..c48a8e4 100644 --- a/.woodpecker/lint.yaml +++ b/.woodpecker/lint.yaml @@ -6,10 +6,10 @@ when: - ${CI_REPO_DEFAULT_BRANCH} steps: - - name: ansible-later - image: quay.io/thegeeklab/ansible-later:4 + - name: ansible-lint + image: quay.io/thegeeklab/ansible-dev-tools:1 commands: - - ansible-later + - ansible-lint environment: FORCE_COLOR: "1" diff --git a/.woodpecker/test.yaml b/.woodpecker/test.yaml index 256ad91..661dc8b 100644 --- a/.woodpecker/test.yaml +++ b/.woodpecker/test.yaml @@ -7,7 +7,7 @@ when: variables: - &molecule_base - image: quay.io/thegeeklab/molecule:6 + image: quay.io/thegeeklab/ansible-dev-tools:1 group: molecule environment: PY_COLORS: "1" diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..df1d39e --- /dev/null +++ b/.yamllint @@ -0,0 +1,20 @@ +--- +extends: default + +rules: + truthy: + allowed-values: ["True", "False"] + comments: + min-spaces-from-content: 1 + comments-indentation: False + line-length: disable + braces: + min-spaces-inside: 0 + max-spaces-inside: 1 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 0 + indentation: enable + octal-values: + forbid-implicit-octal: True + forbid-explicit-octal: True diff --git a/handlers/main.yml b/handlers/main.yml index 85d1771..d1b137e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,8 +1,8 @@ --- - name: Restart dnsmasq Service - service: + ansible.builtin.service: name: dnsmasq state: restarted - daemon_reload: yes - enabled: yes + daemon_reload: True + enabled: True listen: __dnsmasq_restart diff --git a/meta/main.yml b/meta/main.yml index 9f8b3d9..38d15f2 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -21,5 +21,3 @@ galaxy_info: - dns - dnsmasq dependencies: [] -collections: - - community.general diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 1c23e30..9243c48 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -8,7 +8,7 @@ dependency: requirements-file: molecule/requirements.yml platforms: - name: "rocky9-dnsmasq" - server_type: "CX22" + server_type: "cx22" image: "rocky-9" provisioner: name: ansible diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 0df1d77..b843a15 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -9,3 +9,7 @@ ((test -e /usr/bin/apt && (apt -y update && apt install -y python-minimal)) || echo "Warning: Python not boostrapped due to unknown platform.") changed_when: False + retries: 3 + delay: 5 + register: __bootstrap_python + until: __bootstrap_python.rc == 0 diff --git a/tasks/main.yml b/tasks/main.yml index 68d852b..2b5a50f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,18 +1,18 @@ --- - name: Install package - package: + ansible.builtin.package: name: dnsmasq state: present - name: Create dnsmasq configuration - copy: + ansible.builtin.copy: content: "{{ dnsmasq_conf }}" dest: "/etc/dnsmasq.d/local.conf" mode: "0644" notify: __dnsmasq_restart - name: Ensure dnsmasq is up and running - service: + ansible.builtin.service: name: dnsmasq enabled: True state: started