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

update metadata

This commit is contained in:
L3D 2021-03-20 17:59:44 +01:00
parent 7c98b4eabd
commit 5693b494a5
Signed by: l3d
GPG key ID: CD08445BFF4313D1
6 changed files with 75 additions and 8 deletions

View file

@ -1,3 +1,5 @@
---
acme_notification_email: 'root@example.org'
# should we do a version check? (recomended)
submodules_versioncheck: false

19
meta/main.yml Normal file
View file

@ -0,0 +1,19 @@
---
galaxy_info:
role_name: acmetool
author: do1jlr
description: Install acmetool and get it working together with the do1jlr.nginx role.
license: "MIT"
min_ansible_version: 2.8
github_branch: main
platforms:
- name: Debian
versions: all
- name: Ubuntu
versions: all
galaxy_tags:
- acmetool
- acmetool
- letsencrypt
- web
dependencies: []

View file

@ -1,4 +1,6 @@
---
- ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool
- name: Install acmetool
ansible.builtin.package:
@ -8,7 +10,6 @@
- installation
- acmetool
# Todo: Reconsider best practice
#- name: Remove acmetool snippet for nginx from package installation
# ansible.builtin.file:
@ -19,7 +20,6 @@
# - configuration
# - acmetool
- name: Create directory for acmetool response file
ansible.builtin.file:
name: '/var/lib/acme/conf'
@ -31,7 +31,6 @@
- installation
- acmetool
- name: Copy acmetool response file
ansible.builtin.template:
src: 'files/response-file.yml.j2'
@ -42,10 +41,9 @@
tags:
- configuration
- acmetool
# Todo: with_first_found?
# Todo: with_first_found?
# consider usage of loop:
- name: Perform acmetool quickstart
ansible.builtin.command: acmetool quickstart --expert
args:
@ -55,7 +53,6 @@
- operation
- acmetool
- name: Copy hook to enable acmetool to restart services
ansible.builtin.copy:
src: 'files/restart'
@ -67,7 +64,6 @@
- configuration
- acmetool
- name: Reload systemd and enable acmetool timer unit
ansible.builtin.systemd:
name: 'acmetool.timer'

46
tasks/versioncheck.yml Normal file
View file

@ -0,0 +1,46 @@
---
- name: Create directory for versionscheck
become: true
ansible.builtin.file:
path: '/etc/.ansible-version'
state: directory
mode: 0755
when: submodules_versioncheck|bool
- 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
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
- name: Print locale role version
ansible.builtin.debug:
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
- name: check if '/etc/ansible-version/' is empty
ansible.builtin.find:
paths: '/etc/ansible-version/'
register: filesFound
- 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

4
vars/main.yml Normal file
View file

@ -0,0 +1,4 @@
---
# versionscheck
playbook_version_number: 23 # should be a integer
playbook_version_path: 'do1jlr.role-acmetool.version'