mirror of
https://github.com/roles-ansible/ansible_role_acmetool.git
synced 2024-08-16 12:29:49 +02:00
improve acmetool
This commit is contained in:
parent
b29d4abc86
commit
a613fc7f8a
8 changed files with 83 additions and 63 deletions
16
README.md
16
README.md
|
@ -15,6 +15,22 @@ Install and configure the `acmetool` LE client.
|
||||||
* ``submodules_versioncheck:`` (Default: ``false``):
|
* ``submodules_versioncheck:`` (Default: ``false``):
|
||||||
Enable basic versionscheck. *(``true`` is recomended)*
|
Enable basic versionscheck. *(``true`` is recomended)*
|
||||||
|
|
||||||
|
|
||||||
|
Files
|
||||||
|
-------
|
||||||
|
* We search the ``response-file.yml.j2`` using the [first_found_loopup](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/first_found_lookup.html) with the following config:
|
||||||
|
```yaml
|
||||||
|
files:
|
||||||
|
- "response-file.{{ inventory_hostname }}.yml.j2"
|
||||||
|
- 'response-file.yml.j2'
|
||||||
|
paths:
|
||||||
|
- 'templates/acmetool'
|
||||||
|
- "templates/{{ inventory_hostname }}"
|
||||||
|
- 'files/acmetool'
|
||||||
|
- "files/{{ inventory_hostname }}"
|
||||||
|
- 'templates'
|
||||||
|
```
|
||||||
|
|
||||||
References
|
References
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|
24
tasks/configure.yml
Normal file
24
tasks/configure.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
- name: Create directory for acmetool response file
|
||||||
|
become: true
|
||||||
|
ansible.builtin.file:
|
||||||
|
name: '/var/lib/acme/conf'
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 'u=rwx,g=rx,o=rx'
|
||||||
|
|
||||||
|
- name: Copy acmetool response file
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ lookup('first_found', acmetool__response_file ) }}"
|
||||||
|
dest: '/var/lib/acme/conf/responses'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 'u=rw,g=r,o=r'
|
||||||
|
|
||||||
|
- name: Perform acmetool quickstart
|
||||||
|
become: true
|
||||||
|
ansible.builtin.command: acmetool quickstart --expert
|
||||||
|
args:
|
||||||
|
creates: '/var/lib/acme/conf/target'
|
10
tasks/hook.yml
Normal file
10
tasks/hook.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
- name: Copy hook to enable acmetool to restart services
|
||||||
|
become: true
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: 'files/restart'
|
||||||
|
dest: '/etc/acme/hooks/'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 'u=rx,g=rx,o=rx'
|
||||||
|
|
6
tasks/install.yml
Normal file
6
tasks/install.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: Install acmetool
|
||||||
|
become: true
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: 'acmetool'
|
||||||
|
state: present
|
|
@ -3,70 +3,15 @@
|
||||||
ansible.builtin.include_tasks: versioncheck.yml
|
ansible.builtin.include_tasks: versioncheck.yml
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck|bool
|
||||||
|
|
||||||
- name: Install acmetool
|
- name: install acmetool
|
||||||
become: true
|
ansible.builtin.include_tasks: install.yml
|
||||||
ansible.builtin.package:
|
|
||||||
name: 'acmetool'
|
|
||||||
state: present
|
|
||||||
tags:
|
|
||||||
- installation
|
|
||||||
- acmetool
|
|
||||||
|
|
||||||
- name: Create directory for acmetool response file
|
- name: configure acmetool
|
||||||
become: true
|
ansible.builtin.include_tasks: configure.yml
|
||||||
ansible.builtin.file:
|
|
||||||
name: '/var/lib/acme/conf'
|
|
||||||
state: directory
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 'u=rwx,g=rx,o=rx'
|
|
||||||
tags:
|
|
||||||
- installation
|
|
||||||
- acmetool
|
|
||||||
|
|
||||||
- name: Copy acmetool response file
|
|
||||||
become: true
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: 'files/response-file.yml.j2'
|
|
||||||
dest: '/var/lib/acme/conf/responses'
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 'u=rw,g=r,o=r'
|
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- acmetool
|
|
||||||
# Todo: with_first_found?
|
|
||||||
# consider usage of loop:
|
|
||||||
|
|
||||||
- name: Perform acmetool quickstart
|
|
||||||
become: true
|
|
||||||
ansible.builtin.command: acmetool quickstart --expert
|
|
||||||
args:
|
|
||||||
creates: '/var/lib/acme/conf/target'
|
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- operation
|
|
||||||
- acmetool
|
|
||||||
|
|
||||||
- name: Copy hook to enable acmetool to restart services
|
- name: Copy hook to enable acmetool to restart services
|
||||||
become: true
|
ansible.builtin.include_tasks: hook.yml
|
||||||
ansible.builtin.copy:
|
|
||||||
src: 'files/restart'
|
|
||||||
dest: '/etc/acme/hooks/'
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 'u=rx,g=rx,o=rx'
|
|
||||||
tags:
|
|
||||||
- configuration
|
|
||||||
- acmetool
|
|
||||||
|
|
||||||
- name: Reload systemd and enable acmetool timer unit
|
- name: Reload systemd and enable acmetool timer unit
|
||||||
become: true
|
ansible.builtin.include_tasks: timer.yml
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: 'acmetool.timer'
|
|
||||||
daemon_reload: true
|
|
||||||
enabled: true
|
|
||||||
state: started
|
|
||||||
tags:
|
|
||||||
- operation
|
|
||||||
- acmetool
|
|
||||||
|
|
8
tasks/timer.yml
Normal file
8
tasks/timer.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
- name: Reload systemd and enable acmetool timer unit
|
||||||
|
become: true
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: 'acmetool.timer'
|
||||||
|
daemon_reload: true
|
||||||
|
enabled: true
|
||||||
|
state: started
|
|
@ -1,4 +1,15 @@
|
||||||
---
|
---
|
||||||
|
acmetool__response_file:
|
||||||
|
files:
|
||||||
|
- "response-file.{{ inventory_hostname }}.yml.j2"
|
||||||
|
- 'response-file.yml.j2'
|
||||||
|
paths:
|
||||||
|
- 'templates/acmetool'
|
||||||
|
- "templates/{{ inventory_hostname }}"
|
||||||
|
- 'files/acmetool'
|
||||||
|
- "files/{{ inventory_hostname }}"
|
||||||
|
- 'templates'
|
||||||
|
|
||||||
# versionscheck
|
# versionscheck
|
||||||
playbook_version_number: 25 # should be a integer
|
playbook_version_number: 26 # should be a integer
|
||||||
playbook_version_path: 'do1jlr.role-acmetool.version'
|
playbook_version_path: 'do1jlr.role-acmetool.version'
|
||||||
|
|
Loading…
Reference in a new issue