diff --git a/.github/workflows/ansible-debian-stable.yml b/.github/workflows/ansible-debian-stable.yml index e47f773..9630036 100644 --- a/.github/workflows/ansible-debian-stable.yml +++ b/.github/workflows/ansible-debian-stable.yml @@ -2,7 +2,13 @@ name: Ansible check debian:stable # yamllint disable-line rule:truthy -on: [push, pull_request] +on: + push: + branches: '*' + pull_request: + branches: '*' + schedule: + - cron: '23 6 * */1 *' jobs: build: diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 41dcb97..7973217 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -2,7 +2,13 @@ name: Ansible Lint check # yamllint disable-line rule:truthy -on: [push, pull_request] +on: + push: + branches: '*' + pull_request: + branches: '*' + schedule: + - cron: '42 6 * */1 *' jobs: build: diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml new file mode 100644 index 0000000..b5dc0ec --- /dev/null +++ b/.github/workflows/galaxy.yml @@ -0,0 +1,20 @@ +--- +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/yamllint.yaml b/.github/workflows/yamllint.yaml index 39c49f8..ddb5b89 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -2,7 +2,13 @@ name: 'Yamllint GitHub Actions' # yamllint disable-line rule:truthy -on: [push, pull_request] +on: + push: + branches: '*' + pull_request: + branches: '*' + schedule: + - cron: '23 6 * */1 *' jobs: yamllint: @@ -16,7 +22,3 @@ jobs: 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 similarity index 100% rename from readme.md rename to README.md diff --git a/handlers/main.yml b/handlers/main.yml index b17118a..5a28d58 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,10 +1,12 @@ --- - name: unbound checkconf - command: unbound-checkconf /etc/unbound/unbound.conf + become: true + ansible.builtin.command: unbound-checkconf /etc/unbound/unbound.conf changed_when: true notify: systemctl restart unbound - name: systemctl restart unbound - service: + become: true + ansible.builtin.service: name: unbound state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index ece361d..59981ad 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,18 +1,20 @@ --- -- include_tasks: versioncheck.yml +- name: run optional versionscheck + ansible.builtin.include_tasks: versioncheck.yml when: submodules_versioncheck|bool - name: Install unbound - apt: - package: + become: true + ansible.builtin.apt: + name: - unbound state: "{{ unbound__state }}" update_cache: true cache_valid_time: 43200 - - name: Copy unbound configuration snippets - copy: + become: true + ansible.builtin.copy: src: '{{ item }}' dest: '/etc/unbound/unbound.conf.d/' owner: root @@ -23,9 +25,9 @@ notify: - unbound checkconf - - name: Copy main unbound configuration - template: + become: true + ansible.builtin.template: src: 'files/unbound.conf' dest: '/etc/unbound/unbound.conf' owner: root diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index c4f3337..dca3e47 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -1,7 +1,7 @@ --- - name: Create directory for versionscheck become: true - file: + ansible.builtin.file: path: '/etc/.ansible-version' state: directory mode: 0755 @@ -9,7 +9,7 @@ - name: check playbook version become: true - slurp: + ansible.builtin.slurp: src: "/etc/.ansible-version/{{ playbook_version_path }}" register: playbook_version when: submodules_versioncheck|bool @@ -17,30 +17,30 @@ failed_when: false - name: Print remote role version - debug: + ansible.builtin.debug: msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" when: submodules_versioncheck|bool - name: Print locale role version - debug: + ansible.builtin.debug: msg: "Local role version: '{{ playbook_version_number|string }}'." when: submodules_versioncheck|bool - name: Check if your version is outdated - fail: + 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 - name: check if '/etc/ansible-version/' is empty - find: + ansible.builtin.find: paths: '/etc/ansible-version/' register: filesFound - name: write new version to remote disk become: true - copy: + ansible.builtin.copy: content: "{{ playbook_version_number }}" dest: "/etc/.ansible-version/{{ playbook_version_path }}" - mode: 0644 + mode: '0644' when: submodules_versioncheck|bool