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

Merge pull request #34 from roles-ansible/a

improve linting and action
This commit is contained in:
L3D 2023-10-30 01:55:36 +01:00 committed by GitHub
commit 18a56d9045
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 67 additions and 36 deletions

View file

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

View file

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

View file

@ -2,19 +2,19 @@
galaxy_info:
role_name: acmetool
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)
license: "MIT"
min_ansible_version: '2.11'
min_ansible_version: '2.13'
platforms:
- name: Debian
versions:
- all
versions: ['all']
- name: Ubuntu
versions:
- all
versions: ['all']
galaxy_tags:
- acmetool
- acmetool
- letsencrypt
- web
- linux
dependencies: []

View file

@ -1,25 +1,33 @@
---
- name: Perform optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool
ansible.builtin.include_tasks:
file: 'versioncheck.yml'
when: submodules_versioncheck | bool
- name: Install acmetool
ansible.builtin.include_tasks: install.yml
ansible.builtin.include_tasks:
file: 'install.yml'
- name: Configure systemd
ansible.builtin.include_tasks: systemd.yml
ansible.builtin.include_tasks:
file: 'systemd.yml'
- 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
ansible.builtin.include_tasks: hook.yml
ansible.builtin.include_tasks:
file: 'hook.yml'
- 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
ansible.builtin.include_tasks: want_domains.yml
ansible.builtin.include_tasks:
file: 'want_domains.yml'
- name: Optionally unwant domains
ansible.builtin.include_tasks: unwant_domains.yml
ansible.builtin.include_tasks:
file: 'unwant_domains.yml'

View file

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

View file

@ -7,7 +7,7 @@
ansible.builtin.file:
path: '/etc/.ansible-version'
state: directory
mode: 0755
mode: '0755'
when: submodules_versioncheck | bool
- name: Check playbook version
@ -16,15 +16,14 @@
src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version
when: submodules_versioncheck | bool
ignore_errors: true
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
- 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

View file

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

View file

@ -3,8 +3,9 @@
#
# reload hook configuration file
# adding the service to the list of services to be reloaded by acmetool.
SERVICES="$SERVICES
{%- for service in acme_reload_services -%}
{{- ' ' -}}
{{- service -}}
{%- endfor -%}"
{% set services = ['$SERVICES'] %}
{% for service in acme_reload_services %}
{% set _ = services.append(service) %}
{% endfor %}
{% set services_string = services | join(' ') %}
SERVICES="{{ services_string }}"

View file

@ -3,8 +3,9 @@
#
# restart hook configuration file
# adding the service to the list of services to be restarted.
SERVICES="$SERVICES
{%- for service in acme_restart_services -%}
{{- ' ' -}}
{{- service -}}
{%- endfor -%}"
{% set services = ['$SERVICES'] %}
{% for service in acme_restart_services %}
{% set _ = services.append(service) %}
{% endfor %}
{% set services_string = services | join(' ') %}
SERVICES="{{ services_string }}"

View file

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