From 054db402eac095146380bb773122a1df73c72d51 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 30 Aug 2023 12:08:21 +0200 Subject: [PATCH 1/3] WIP --- .ansible-lint | 1 + .github/workflows/ci.yml | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 7e0172a..b04781e 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,4 +1,5 @@ --- warn_list: - role-name + - name[play] - name[casing] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 292e437..7e2bc34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,9 @@ jobs: python-version: '3.x' - name: Install test dependencies - run: pip install ansible-lint[community,yamllint] + run: | + pip install ansible-lint + ansible-galaxy install -r requirements.yml - name: Lint code run: | @@ -43,11 +45,8 @@ jobs: matrix: include: - distro: debian8 - ansible-version: '<2.10' - distro: debian9 - distro: debian10 - - distro: ubuntu1604 - ansible-version: '>=2.9, <2.10' - distro: ubuntu1604 ansible-version: '>=2.10, <2.11' - distro: ubuntu1604 @@ -66,7 +65,7 @@ jobs: python-version: '3.x' - name: Install test dependencies - run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker + run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker - name: Run Molecule tests run: | From 963f1e634b3d4ec06d7030ee9af976b8fc147cf8 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 30 Aug 2023 12:09:45 +0200 Subject: [PATCH 2/3] WIP --- handlers/main.yml | 2 +- molecule/default/converge.yml | 2 +- molecule/default/prepare.yml | 4 ++-- tasks/main.yml | 10 +++++----- tests/tasks/pre.yml | 2 +- tests/test.yml | 4 ++-- tests/vagrant.yml | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 8cea04d..d29c376 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,7 @@ # handlers file --- - name: restart snmpd - service: + ansible.builtin.service: name: snmpd state: restarted when: service_default_state | default('started') == 'started' diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 73043c4..8596f09 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -4,6 +4,6 @@ become: true pre_tasks: - name: include vars - include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" roles: - ../../../ diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 1600dec..e718055 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -4,6 +4,6 @@ become: true pre_tasks: - name: include vars - include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" - name: include tasks - include: "{{ playbook_dir }}/../../tests/tasks/pre.yml" + ansible.builtin.include: "{{ playbook_dir }}/../../tests/tasks/pre.yml" diff --git a/tasks/main.yml b/tasks/main.yml index 52ecc7e..d20dffc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ # tasks file --- - name: install dependencies - apt: + ansible.builtin.apt: name: "{{ snmpd_dependencies }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true @@ -12,7 +12,7 @@ - snmpd-dependencies - name: install - apt: + ansible.builtin.apt: name: "{{ snmpd_install }}" state: "{{ apt_install_state | default('latest') }}" tags: @@ -21,7 +21,7 @@ - snmpd-install - name: update configuration file - /etc/default/snmpd.conf - template: + ansible.builtin.template: src: etc/default/snmpd.j2 dest: /etc/default/snmpd owner: root @@ -34,7 +34,7 @@ - snmpd-configuration - name: update configuration file - /etc/snmp/snmpd.conf - template: + ansible.builtin.template: src: etc/snmp/snmpd.conf.j2 dest: /etc/snmp/snmpd.conf owner: root @@ -47,7 +47,7 @@ - snmpd-configuration - name: start and enable service - service: + ansible.builtin.service: name: snmpd state: "{{ service_default_state | default('started') }}" enabled: "{{ service_default_enabled | default(true) | bool }}" diff --git a/tests/tasks/pre.yml b/tests/tasks/pre.yml index 9bcc66f..0a6c58d 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -1,7 +1,7 @@ # pre test file --- - name: enable non-free - apt_repository: + ansible.builtin.apt_repository: repo: "{{ item.type }} {{ item.url }} {{ item.component }}" filename: non-free with_items: diff --git a/tests/test.yml b/tests/test.yml index 0062d99..00a505a 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -5,8 +5,8 @@ become: true pre_tasks: - name: include vars - include_vars: "{{ playbook_dir }}/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml" - name: include tasks - include: "{{ playbook_dir }}/tasks/pre.yml" + ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml" roles: - ../../ diff --git a/tests/vagrant.yml b/tests/vagrant.yml index fed2ce2..a30a990 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -5,6 +5,6 @@ become: true pre_tasks: - name: include tasks - include: "{{ playbook_dir }}/tasks/pre.yml" + ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/pre.yml" roles: - ../../ From 5f9bb9e9c79c77145f79f3f93fc451f3e7054ccd Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 30 Aug 2023 12:11:01 +0200 Subject: [PATCH 3/3] WIP --- molecule/default/prepare.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index e718055..c6f4ce8 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -6,4 +6,4 @@ - name: include vars ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml" - name: include tasks - ansible.builtin.include: "{{ playbook_dir }}/../../tests/tasks/pre.yml" + ansible.builtin.import_tasks: "{{ playbook_dir }}/../../tests/tasks/pre.yml"