masto-aio/ansible/roles/certbot/tasks/main.yaml

41 lines
743 B
YAML
Raw Normal View History

2024-01-19 18:58:51 -08:00
---
- name: install base apps
apt:
force_apt_get: yes
name:
- docker-compose-v2
- name: base path
file:
path: "/srv/certbot/{{item}}"
state: directory
recurse: true
with_items:
- www
- etc
- name: copy docker-compose
template:
src: templates/docker-compose.yaml
dest: /srv/certbot/docker-compose.yaml
register: dockercompose
#- name: nginx config
# template:
# src: templates/nginx.conf
# dest: /srv/nginx/conf.d/certbot.conf
# register: nginxconf
- name: launch certbot
command: docker compose up -d
args:
chdir: /srv/certbot
- name: restart certbot
command: docker compose restart
args:
chdir: /srv/certbot
when: dockercompose.changed or nginxconf.changed