diff --git a/.github/galaxy.svg b/.github/galaxy.svg deleted file mode 100644 index f5e2bad..0000000 --- a/.github/galaxy.svg +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.github/license.svg b/.github/license.svg deleted file mode 100644 index 4ab6d9a..0000000 --- a/.github/license.svg +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - image/svg+xml - - - - - - 3D <l3d@c3woc.de> - - - - - MIT License - - - - - - - - - - - - - - - - - - - - - - - - - - - MIT - MIT - - - license - license - - diff --git a/.github/workflows/ansible-centos-centos7.yml b/.github/workflows/ansible-centos-centos7.yml deleted file mode 100644 index 401d2c0..0000000 --- a/.github/workflows/ansible-centos-centos7.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check centos:centos7 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:centos7 - uses: roles-ansible/check-ansible-centos-centos7-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-centos-centos8.yml b/.github/workflows/ansible-centos-centos8.yml deleted file mode 100644 index f20097b..0000000 --- a/.github/workflows/ansible-centos-centos8.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check centos:centos8 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:centos8 - uses: roles-ansible/check-ansible-centos-centos8-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-centos-latest.yml b/.github/workflows/ansible-centos-latest.yml deleted file mode 100644 index 94eb54b..0000000 --- a/.github/workflows/ansible-centos-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check centos:latest - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:latest - uses: roles-ansible/check-ansible-centos-latest-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-fedora-31.yml b/.github/workflows/ansible-fedora-31.yml deleted file mode 100644 index 08502fe..0000000 --- a/.github/workflows/ansible-fedora-31.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check fedora:31 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with fedora:31 - uses: roles-ansible/check-ansible-fedora-31-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-fedora-32.yml b/.github/workflows/ansible-fedora-32.yml deleted file mode 100644 index e362dd4..0000000 --- a/.github/workflows/ansible-fedora-32.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check fedora:32 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with fedora:32 - uses: roles-ansible/check-ansible-fedora-32-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-fedora-33.yml b/.github/workflows/ansible-fedora-33.yml deleted file mode 100644 index 70c52ad..0000000 --- a/.github/workflows/ansible-fedora-33.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check fedora:33 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with fedora:33 - uses: roles-ansible/check-ansible-fedora-33-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 41dcb97..2e4d4bb 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -6,17 +6,17 @@ on: [push, pull_request] jobs: build: - + name: Ansible Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout git repo + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 - - name: Lint Ansible Playbook - uses: ansible/ansible-lint-action@master + - name: Run ansible-lint + uses: ansible-actions/ansible-lint-action@v1.0.3 with: - targets: "." - # [required] - # Paths to ansible files (i.e., playbooks, tasks, handlers etc..) - args: "" - # [optional] + target: "./" diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml deleted file mode 100644 index b5dc0ec..0000000 --- a/.github/workflows/galaxy.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Galaxy release - -# yamllint disable-line rule:truthy -on: - push: - branches: ['main'] - release: - types: ['created'] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v2 - - name: galaxy - uses: robertdebock/galaxy-action@1.1.0 - with: - galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/.github/workflows/j2lint-check.yml b/.github/workflows/j2lint-check.yml new file mode 100644 index 0000000..00c7861 --- /dev/null +++ b/.github/workflows/j2lint-check.yml @@ -0,0 +1,22 @@ +--- +name: Jinja2 Linting check + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + name: Jinja2 Linting + runs-on: ubuntu-latest + + steps: + - name: Checkout git repo + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Run j2lint + uses: ansible-actions/j2lint-action@v0.0.1 + with: + target: "./" diff --git a/.github/workflows/yamllint-check.yml b/.github/workflows/yamllint-check.yml new file mode 100644 index 0000000..4dd2d82 --- /dev/null +++ b/.github/workflows/yamllint-check.yml @@ -0,0 +1,22 @@ +--- +name: Yamllint check + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + name: Yamllint + runs-on: ubuntu-latest + + steps: + - name: Checkout git repo + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Run yamllint + uses: ansible-actions/yamllint-action@v0.0.2 + with: + target: "./" diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml deleted file mode 100644 index 39c49f8..0000000 --- a/.github/workflows/yamllint.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: 'Yamllint GitHub Actions' - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - yamllint: - name: 'Yamllint' - runs-on: ubuntu-latest - steps: - - name: 'Checkout' - uses: actions/checkout@master - - name: 'Yamllint' - uses: karancode/yamllint-github-action@master - with: - yamllint_file_or_dir: '.' - yamllint_config_filepath: './.yamllint' - yamllint_strict: false - yamllint_comment: true -# env: -# GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN } diff --git a/README.md b/README.md index 00ecd0a..cdc4738 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Ansible Galaxy](https://raw.githubusercontent.com/roles-ansible/ansible_role_resolvconf/main/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/resolvconf) [![MIT License](https://raw.githubusercontent.com/roles-ansible/ansible_role_resolvconf/main/.github/license.svg?sanitize=true)](https://github.com/roles-ansible/ansible_role_resolvconf/blob/main/LICENSE) +[![License](https://ansible.l3d.space/svg/l3d.linux_license_collection.svg)](LICENSE) ansible role resolvconf ========================= @@ -17,13 +17,7 @@ Ansible role to manage the ``/etc/resolv.conf`` file. | ``resolvconf__options: []`` | `` `` | Optionally set a list of additional options like ``rotate`` or ``timeout:2`` | | ``submodules_versioncheck:`` | ``false`` | Run optional simple Versionscheck *(``true`` is recomended)* | - Testing ----------- -This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems. Linting is tested via travis-ci and the [ansible-lint action](https://github.com/marketplace/actions/ansible-lint). -If you want to find out more about our tests, please have a look at the github marketplace. - -| test status | Github Marketplace | -| :--------- | :---------------- | -| [![Ansible Lint check](https://github.com/roles-ansible/ansible_role_resolvconf/actions/workflows/ansible-linting-check.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_resolvconf/actions/workflows/ansible-linting-check.yml) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint) | -| [![Yamllint GitHub Actions](https://github.com/roles-ansible/ansible_role_resolvconf/actions/workflows/yamllint.yaml/badge.svg)](https://github.com/roles-ansible/ansible_role_resolvconf/actions/workflows/yamllint.yaml) | [yamllint github actions](https://github.com/marketplace/actions/yamllint-github-action) | -| [![Galaxy release](https://github.com/roles-ansible/ansible_role_resolvconf/actions/workflows/galaxy.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_resolvconf/actions/workflows/galaxy.yml) | [publish-ansible-role-to-galaxy](https://github.com/marketplace/actions/publish-ansible-role-to-galaxy) | +## Collection +This role is part of the l3d.linux collection. + + [![collection l3d.linux](https://ansible.l3d.space/svg/l3d.linux_ansible-collection_collection.svg)](https://galaxy.ansible.com/ui/repo/published/l3d/linux/) + + [![l3d.linux.resolvconf](https://ansible.l3d.space/svg/l3d.linux.resolvconf_ansible-role.svg)](https://github.com/roles-ansible/ansible_role_resolvconf.git) diff --git a/meta/main.yml b/meta/main.yml index ea8dc47..4fcbdd9 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,19 +4,21 @@ galaxy_info: author: do1jlr description: Manage your /etc/resolv.conf file. license: "MIT" - min_ansible_version: 2.8 - github_branch: main + min_ansible_version: "2.12" platforms: - - name: Archlinux - versions: all + - name: ArchLinux + versions: ['all'] - name: Debian - versions: all + versions: ['all'] - name: Ubuntu - versions: all + versions: ['all'] - name: Fedora - versions: all + versions: ['all'] + - name: EL + versions: ['all'] galaxy_tags: - resolv - resolvconf - dns + - linux dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml index 755bc55..ede6d7b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,9 +1,9 @@ --- -- name: run versionscheck +- name: Run versionscheck ansible.builtin.include_tasks: versioncheck.yml - when: submodules_versioncheck|bool + when: submodules_versioncheck | bool -- name: resolv.conf is ino longer immutable. +- name: Resolv.conf is ino longer immutable. become: true ansible.builtin.file: path: '/etc/resolv.conf' @@ -12,7 +12,7 @@ changed_when: "resolv_file.changed and not resolveconf__immutable" ignore_errors: true -- name: deploy resolv.conf +- name: Deploy resolv.conf block: - name: "Configure resolv.conf" become: true @@ -29,7 +29,7 @@ path: '/etc/resolv.conf' state: absent - - name: "try to deplpy resolv.conf again" + - name: "Try to deplpy resolv.conf again" become: true ansible.builtin.template: src: 'templates/resolv.conf.j2' diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index dca3e47..7dd80c5 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -1,46 +1,44 @@ --- +# Copyright (c) 2021 L3D +# this file is released with the MIT license. +# License: https://github.com/roles-ansible/ansible_role_template/blob/main/LICENSE - name: Create directory for versionscheck become: true ansible.builtin.file: path: '/etc/.ansible-version' state: directory - mode: 0755 - when: submodules_versioncheck|bool + mode: '0755' + when: submodules_versioncheck | bool -- name: check playbook version +- name: Check playbook version become: true ansible.builtin.slurp: src: "/etc/.ansible-version/{{ playbook_version_path }}" register: playbook_version - when: submodules_versioncheck|bool - ignore_errors: true + when: submodules_versioncheck | bool failed_when: false -- name: Print remote role version +- name: Print remote role version # noqa: H500 ansible.builtin.debug: msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" - when: submodules_versioncheck|bool + when: submodules_versioncheck | bool -- name: Print locale role version +- name: Print locale role version # noqa: H500 ansible.builtin.debug: - msg: "Local role version: '{{ playbook_version_number|string }}'." - when: submodules_versioncheck|bool + msg: "Local role version: '{{ playbook_version_number | string }}'." + when: submodules_versioncheck | bool - name: Check if your version is outdated ansible.builtin.fail: msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!" when: - - playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool + - playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck | bool -- name: check if '/etc/ansible-version/' is empty - ansible.builtin.find: - paths: '/etc/ansible-version/' - register: filesFound - -- name: write new version to remote disk +- name: Write new version to remote disk become: true ansible.builtin.copy: content: "{{ playbook_version_number }}" dest: "/etc/.ansible-version/{{ playbook_version_path }}" mode: '0644' - when: submodules_versioncheck|bool + when: submodules_versioncheck | bool + tags: skip_ansible_lint_template-instead-of-copy