54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
---
|
|
# Certbot
|
|
#
|
|
# Linux-Server-Admin.com Ansible Role for cert management with Certbot
|
|
#
|
|
# Fact Tasks
|
|
#
|
|
|
|
- name: Install python3 and pip (inkl. venv)
|
|
ansible.builtin.package:
|
|
name:
|
|
- python3
|
|
- python3-pip
|
|
- python3-psutil
|
|
- python3-venv
|
|
state: latest
|
|
update_cache: true
|
|
become: true
|
|
|
|
- name: Create python venv for facts
|
|
ansible.builtin.command:
|
|
cmd: python3 -m venv /opt/ansible-facts-venv
|
|
become: true
|
|
args:
|
|
creates: /opt/ansible-facts-venv
|
|
|
|
- name: Install pyyaml in venv
|
|
ansible.builtin.command:
|
|
cmd: /opt/ansible-facts-venv/bin/pip install pyyaml
|
|
become: true
|
|
|
|
- name: "Create certbot parse facts script"
|
|
ansible.builtin.template:
|
|
src: "certbot-certificates.py.j2"
|
|
dest: "/usr/local/bin/ansible_certbot_parse_facts.py"
|
|
mode: +x
|
|
become: true
|
|
|
|
- name: "Create directory for ansible system facts"
|
|
ansible.builtin.file:
|
|
state: directory
|
|
recurse: true
|
|
path: /etc/ansible/facts.d
|
|
become: true
|
|
|
|
- name: "Set certbot fact file"
|
|
ansible.builtin.template:
|
|
src: "certbot.fact.j2"
|
|
dest: "/etc/ansible/facts.d/certbot.json"
|
|
become: true
|
|
|
|
- name: Run certbot parse script in venv
|
|
ansible.builtin.shell: certbot certificates | /opt/ansible-facts-venv/bin/python3 /usr/local/bin/ansible_certbot_parse_facts.py
|
|
become: true |