1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_acmetool.git synced 2024-08-16 12:29:49 +02:00

improve linting and action

This commit is contained in:
L3D 2023-10-29 22:34:09 +01:00
parent 83df9b7490
commit 99bb507d4c
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
10 changed files with 57 additions and 26 deletions

View file

@ -1,9 +1,9 @@
--- ---
# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2 version: 2
updates: updates:
- package-ecosystem: github-actions
- package-ecosystem: "github-actions"
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
assignees:
- 'do1jlr'

View file

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 'Checkout git repo' - name: Checkout git repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
submodules: true submodules: true

22
.github/workflows/j2lint-check.yml vendored Normal file
View file

@ -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: "./"

View file

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 'checkout git repo' - name: Checkout git repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
submodules: true submodules: true

View file

@ -2,19 +2,19 @@
galaxy_info: galaxy_info:
role_name: acmetool role_name: acmetool
author: do1jlr author: do1jlr
namespace: l3d
description: Install acmetool, an easy-to-use command line tool for automatically acquiring certificates from ACME servers (eg. Let's Encrypt) description: Install acmetool, an easy-to-use command line tool for automatically acquiring certificates from ACME servers (eg. Let's Encrypt)
license: "MIT" license: "MIT"
min_ansible_version: '2.11' min_ansible_version: '2.13'
platforms: platforms:
- name: Debian - name: Debian
versions: versions: ['all']
- all
- name: Ubuntu - name: Ubuntu
versions: versions: ['all']
- all
galaxy_tags: galaxy_tags:
- acmetool - acmetool
- acmetool - acmetool
- letsencrypt - letsencrypt
- web - web
- linux
dependencies: [] dependencies: []

View file

@ -1,25 +1,33 @@
--- ---
- name: Perform optional versionscheck - name: Perform optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml ansible.builtin.include_tasks:
when: submodules_versioncheck|bool file: 'versioncheck.yml'
when: submodules_versioncheck | bool
- name: Install acmetool - name: Install acmetool
ansible.builtin.include_tasks: install.yml ansible.builtin.include_tasks:
file: 'install.yml'
- name: Configure systemd - name: Configure systemd
ansible.builtin.include_tasks: systemd.yml ansible.builtin.include_tasks:
file: 'systemd.yml'
- name: Configure acmetool - name: Configure acmetool
ansible.builtin.include_tasks: configure.yml ansible.builtin.include_tasks:
file: 'configure.yml'
- name: Copy hook to enable acmetool to restart services - name: Copy hook to enable acmetool to restart services
ansible.builtin.include_tasks: hook.yml ansible.builtin.include_tasks:
file: 'hook.yml'
- name: Reload systemd and enable acmetool timer unit - name: Reload systemd and enable acmetool timer unit
ansible.builtin.include_tasks: timer.yml ansible.builtin.include_tasks:
file: 'timer.yml'
- name: Optionally want domains - name: Optionally want domains
ansible.builtin.include_tasks: want_domains.yml ansible.builtin.include_tasks:
file: 'want_domains.yml'
- name: Optionally unwant domains - name: Optionally unwant domains
ansible.builtin.include_tasks: unwant_domains.yml ansible.builtin.include_tasks:
file: 'unwant_domains.yml'

View file

@ -2,7 +2,8 @@
- name: Disable acmetool for acme_domain_unwant_list domains - name: Disable acmetool for acme_domain_unwant_list domains
become: true become: true
ansible.builtin.command: "acmetool unwant {{ _domain.name }}" ansible.builtin.command: "acmetool unwant {{ _domain.name }}"
with_items: "{{ acme_domain_unwant_list }}" loop:
- "{{ acme_domain_unwant_list }}"
loop_control: loop_control:
loop_var: _domain loop_var: _domain
changed_when: true changed_when: true

View file

@ -7,7 +7,7 @@
ansible.builtin.file: ansible.builtin.file:
path: '/etc/.ansible-version' path: '/etc/.ansible-version'
state: directory state: directory
mode: 0755 mode: '0755'
when: submodules_versioncheck | bool when: submodules_versioncheck | bool
- name: Check playbook version - name: Check playbook version
@ -16,15 +16,14 @@
src: "/etc/.ansible-version/{{ playbook_version_path }}" src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version register: playbook_version
when: submodules_versioncheck | bool when: submodules_versioncheck | bool
ignore_errors: true
failed_when: false failed_when: false
- name: Print remote role version - name: Print remote role version # noqa: H500
ansible.builtin.debug: ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" 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: ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number | string }}'." msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck | bool when: submodules_versioncheck | bool

View file

@ -4,6 +4,7 @@
ansible.builtin.command: "acmetool want {{ _domain.name }}" ansible.builtin.command: "acmetool want {{ _domain.name }}"
args: args:
creates: "/var/lib/acme/live/{{ _domain.name }}" creates: "/var/lib/acme/live/{{ _domain.name }}"
with_items: "{{ acme_domain_want_list }}" loop:
- "{{ acme_domain_want_list }}"
loop_control: loop_control:
loop_var: _domain loop_var: _domain

View file

@ -33,5 +33,5 @@ acmetool__restart_hook:
- 'files' - 'files'
# versionscheck # versionscheck
playbook_version_number: 34 # should be a integer playbook_version_number: 35 # should be a integer
playbook_version_path: 'do1jlr.role-acmetool.version' playbook_version_path: 'do1jlr.role-acmetool.version'