From 35c57434559b46182a37187fd531f0a614eba1b3 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 25 Oct 2022 22:51:18 +0200 Subject: [PATCH] update ansible-linting --- meta/main.yml | 9 +++++---- tasks/configure.yml | 2 +- tasks/hook.yml | 8 ++++---- tasks/main.yml | 10 +++++----- tasks/systemd.yml | 4 ++-- tasks/unwant_domains.yml | 2 +- tasks/versioncheck.yml | 19 ++++++++++--------- tasks/want_domains.yml | 2 +- vars/main.yml | 2 +- 9 files changed, 30 insertions(+), 28 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index aeff827..cc8d9ae 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,13 +4,14 @@ galaxy_info: author: do1jlr description: Install acmetool, an easy-to-use command line tool for automatically acquiring certificates from ACME servers (eg. Let's Encrypt) license: "MIT" - min_ansible_version: 2.11 - github_branch: main + min_ansible_version: '2.11' platforms: - name: Debian - versions: all + versions: + - all - name: Ubuntu - versions: all + versions: + - all galaxy_tags: - acmetool - acmetool diff --git a/tasks/configure.yml b/tasks/configure.yml index 09b855b..c37eb48 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -11,7 +11,7 @@ - name: Copy acmetool response file become: true ansible.builtin.template: - src: "{{ lookup('first_found', acmetool__response_file ) }}" + src: "{{ lookup('first_found', acmetool__response_file) }}" dest: '/var/lib/acme/conf/responses' owner: root group: root diff --git a/tasks/hook.yml b/tasks/hook.yml index 5ddf595..5720141 100644 --- a/tasks/hook.yml +++ b/tasks/hook.yml @@ -2,13 +2,13 @@ - name: Copy hook to enable acmetool to reload services become: true ansible.builtin.copy: - src: "{{ lookup('first_found', acmetool__reload_hook ) }}" + src: "{{ lookup('first_found', acmetool__reload_hook) }}" dest: '/etc/acme/hooks/' owner: root group: root mode: 'u=rx,g=rx,o=rx' -- name: create hook configuration to reload services via ansible +- name: Create hook configuration to reload services via ansible become: true ansible.builtin.template: src: 'templates/acmetool_reload.j2' @@ -20,13 +20,13 @@ - name: Copy hook to enable acmetool to restart services become: true ansible.builtin.copy: - src: "{{ lookup('first_found', acmetool__restart_hook ) }}" + src: "{{ lookup('first_found', acmetool__restart_hook) }}" dest: '/etc/acme/hooks/' owner: root group: root mode: 'u=rx,g=rx,o=rx' -- name: create hook configuration to restart services via ansible +- name: Create hook configuration to restart services via ansible become: true ansible.builtin.template: src: 'templates/acmetool_restart.j2' diff --git a/tasks/main.yml b/tasks/main.yml index bbb1f90..cb6d15c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,13 +3,13 @@ ansible.builtin.include_tasks: versioncheck.yml when: submodules_versioncheck|bool -- name: install acmetool +- name: Install acmetool ansible.builtin.include_tasks: install.yml -- name: configure systemd +- name: Configure systemd ansible.builtin.include_tasks: systemd.yml -- name: configure acmetool +- name: Configure acmetool ansible.builtin.include_tasks: configure.yml - name: Copy hook to enable acmetool to restart services @@ -18,8 +18,8 @@ - name: Reload systemd and enable acmetool timer unit ansible.builtin.include_tasks: timer.yml -- name: optionally want domains +- name: Optionally want domains ansible.builtin.include_tasks: want_domains.yml -- name: optionally unwant domains +- name: Optionally unwant domains ansible.builtin.include_tasks: unwant_domains.yml diff --git a/tasks/systemd.yml b/tasks/systemd.yml index d8fdd34..9fffee6 100644 --- a/tasks/systemd.yml +++ b/tasks/systemd.yml @@ -1,5 +1,5 @@ --- -- name: deploy systemd service file +- name: Deploy systemd service file become: true ansible.builtin.template: src: 'templates/acmetool.service.j2' @@ -8,7 +8,7 @@ group: 'root' mode: '0644' -- name: force systemd to reread configs and start acmetool +- name: Force systemd to reread configs and start acmetool become: true ansible.builtin.systemd: daemon_reload: true diff --git a/tasks/unwant_domains.yml b/tasks/unwant_domains.yml index efd0359..8f19da0 100644 --- a/tasks/unwant_domains.yml +++ b/tasks/unwant_domains.yml @@ -1,5 +1,5 @@ --- -- name: disable acmetool for acme_domain_unwant_list domains +- name: Disable acmetool for acme_domain_unwant_list domains become: true ansible.builtin.command: "acmetool unwant {{ _domain.name }}" with_items: "{{ acme_domain_unwant_list }}" diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index 5128cc8..dd22a1a 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -8,37 +8,38 @@ path: '/etc/.ansible-version' state: directory mode: 0755 - when: submodules_versioncheck|bool + 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 + when: submodules_versioncheck | bool ignore_errors: true failed_when: false - name: Print remote role version 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 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: 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 diff --git a/tasks/want_domains.yml b/tasks/want_domains.yml index 332be7a..4e6d66f 100644 --- a/tasks/want_domains.yml +++ b/tasks/want_domains.yml @@ -1,5 +1,5 @@ --- -- name: enable acmetool for acme_domain_list domains +- name: Enable acmetool for acme_domain_list domains become: true ansible.builtin.command: "acmetool want {{ _domain.name }}" args: diff --git a/vars/main.yml b/vars/main.yml index 2de8caa..4e0f827 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -33,5 +33,5 @@ acmetool__restart_hook: - 'files' # versionscheck -playbook_version_number: 33 # should be a integer +playbook_version_number: 34 # should be a integer playbook_version_path: 'do1jlr.role-acmetool.version'