diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 401323b..8ef5f9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: cmd: yq ".galaxy_info.min_ansible_container_version" ${GITHUB_WORKSPACE}/meta/main.yml molecule: - name: Molecule for Ansible ${{ matrix.ansible_version }} / ${{ matrix.distro }} / Python ${{ matrix.python_version }} + name: Molecule for Ansible ${{ matrix.ansible_scenario }} / ${{ matrix.distro }} / Python ${{ matrix.python_version }} runs-on: ubuntu-22.04 continue-on-error: ${{ matrix.experimental }} needs: lint @@ -43,27 +43,17 @@ jobs: matrix: include: - distro: ubuntu-20.04 + ansible_scenario: ansible_current test_type: unit - ansible_version: '>=2.9, <2.10' - ansible_compat_version: '<3' - jinja2_version: '<3.1' - molecule_version: '<5' python_version: '3.8' experimental: false - distro: ubuntu-20.04 + ansible_scenario: ansible_next test_type: unit - ansible_version: '>=2.10, <2.11' - ansible_compat_version: '<3' - jinja2_version: '<3.1' - molecule_version: '<5' python_version: '3.8' - experimental: false - - distro: ubuntu-20.04 - test_type: unit - python_version: '3.8' - jinja2_version: '<3.1' experimental: true - distro: ubuntu-22.04 + ansible_scenario: ansible_latest test_type: unit python_version: '3.10' experimental: true @@ -72,11 +62,8 @@ jobs: - uses: Rheinwerk/molecule@v1 with: distro: ${{ matrix.distro }} + ansible_scenario: ${{ matrix.ansible_scenario }} test_type: ${{ matrix.test_type }} - ansible_version: ${{ matrix.ansible_version }} - ansible_compat_version: ${{ matrix.ansible_compat_version }} - jinja2_version: ${{ matrix.jinja2_version }} - molecule_version: ${{ matrix.molecule_version }} python_version: ${{ matrix.python_version }} release: diff --git a/handlers/main.yml b/handlers/main.yml index 962d209..f65ed45 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,5 +1,5 @@ --- - name: Restart scollector - service: + ansible.builtin.service: name: scollector state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index 9317f6f..8e9dff1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,36 +6,35 @@ when: _scollector.apt_repos is defined block: - name: Add Repo Signing Keys - apt_key: + ansible.builtin.apt_key: id: "{{ item.key_id }}" url: "{{ item.key_url }}" with_items: "{{ _scollector.apt_repos }}" - name: Add Apt Repo - apt_repository: + ansible.builtin.apt_repository: repo: "{{ item.repo_line }}" state: present with_items: "{{ _scollector.apt_repos }}" register: repo_added - name: Apt Update - apt: + ansible.builtin.apt: update_cache: yes when: RW_APT_CACHE_UPDATE is defined or repo_added is changed - name: Set install_state - set_fact: + ansible.builtin.set_fact: install_state: latest when: RW_ENABLE_DOWNLOADS is defined - - name: Install packages # noqa args[module] - apt: + ansible.builtin.apt: state: "{{ install_state | default('present') }}" name: "{{ _scollector.packages }}" - name: Create scollector configuration file - template: + ansible.builtin.template: src: "{{ item }}.j2" dest: "/{{ item }}" owner: root @@ -50,7 +49,7 @@ when: _scollector.external_collectors is defined block: - name: Create external collectors directory - file: + ansible.builtin.file: path: "{{ _scollector.external_collectors.dir }}" state: directory owner: root @@ -61,7 +60,7 @@ when: _scollector.external_collectors.collectors is defined block: - name: Create external collectors interval directories - file: + ansible.builtin.file: path: "{{ _scollector.external_collectors.dir }}/{{ item.interval }}" state: directory owner: root @@ -72,7 +71,7 @@ - Restart scollector - name: Create external collectors - template: + ansible.builtin.template: src: "external_collectors/{{ item.template }}" dest: "{{ _scollector.external_collectors.dir }}/{{ item.interval }}/{{ item.filename }}" owner: root @@ -82,18 +81,17 @@ notify: - Restart scollector - - name: Include external_collectors.metric_metadata announcement when: _scollector.external_collectors.metric_metadata is defined block: - name: Set curl_auth - set_fact: + ansible.builtin.set_fact: curl_auth: "--user '{{ _scollector.auth.user }}:{{ _scollector.auth.password }}'" when: _scollector.auth is defined - name: Announce Meta data of external collector metrics # noqa command-instead-of-module no-changed-when run_once: True - command: > + ansible.builtin.command: > curl -w "%{http_code}" {{ curl_auth | default("") }} -H "Content-Type: application/json" -X POST -d '[ { "metric": "{{ item.metric }}", "name": "rate", "value": "{{ item.ratetype }}" }, { "metric": "{{ item.metric }}", "name": "unit", "value": "{{ item.unit }}" }, { "metric": "{{ item.metric }}", "name": "desc", "value": "{{ item.desc | default('') }}" } ]' {{ _scollector.server.protocol | default("https") }}://{{ _scollector.server.ip }}:{{ _scollector.server.port }}/api/metadata/put register: result failed_when: result.stdout != "204"