From 23be96a70e2245070571eab04742aefcd03134f2 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 19 Aug 2024 16:06:07 +0200 Subject: [PATCH] refctor: rework ci to ue ansible-lint and fix molecule --- .later.yml | 15 --------------- .woodpecker/lint.yaml | 6 +++--- .yamllint | 20 ++++++++++++++++++++ defaults/main.yml | 4 ++-- handlers/main.yml | 5 +++-- meta/main.yml | 2 -- tasks/main.yml | 9 ++++++--- 7 files changed, 34 insertions(+), 27 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/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/.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/defaults/main.yml b/defaults/main.yml index becf151..dc38b50 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,12 +12,12 @@ network_interfaces: {} # network_interfaces: # eth0: # bootproto: none -# onboot: yes +# onboot: "yes" # hwaddr: "aa:bb:cc:dd:ee" # ipaddr: 192.168.0.5 # prefix: 26 # gateway: "192.168.0.1" -# userctl: no +# userctl: "no" # @end network_routes: {} diff --git a/handlers/main.yml b/handlers/main.yml index f2a4ebd..c373c54 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -5,7 +5,8 @@ listen: __network_host_reboot - name: Restart network - ansible.builtin.shell: "{{ __network_restart_command }}" + ansible.builtin.shell: "{{ __network_restart_command }}" # noqa command-instead-of-shell + changed_when: False async: 1 poll: 0 when: @@ -20,7 +21,7 @@ msg: "Reboot triggered by Ansible" async: 1 poll: 0 - ignore_errors: True + ignore_errors: True # noqa ignore-errors when: network_reboot_enabled | bool listen: __network_host_reboot diff --git a/meta/main.yml b/meta/main.yml index c9bf7c2..7f15ff1 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -20,5 +20,3 @@ galaxy_info: galaxy_tags: - network dependencies: [] -collections: - - community.general diff --git a/tasks/main.yml b/tasks/main.yml index 9d64127..19e2201 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,6 @@ --- -- ansible.builtin.include_vars: "{{ var_files }}" +- name: Include OS specific vars + ansible.builtin.include_vars: "{{ var_files }}" vars: var_files: "{{ lookup('first_found', params, errors='ignore') }}" params: @@ -11,6 +12,8 @@ paths: - "vars" when: var_files -- ansible.builtin.include_tasks: nm.yml +- name: Configure NetworkManager + ansible.builtin.include_tasks: nm.yml when: __network_nmcli | bool -- ansible.builtin.include_tasks: setup.yml +- name: Configure network + ansible.builtin.include_tasks: setup.yml