masto-aio/ansible/roles/nginx/tasks/main.yaml
2024-01-18 20:47:07 -08:00

38 lines
674 B
YAML

---
- name: install base apps
apt:
force_apt_get: yes
name:
- docker-compose-v2
- name: base path
file:
path: "/srv/nginx/conf.d"
state: directory
recurse: true
- name: copy docker-compose
copy:
src: files/docker-compose.yaml
dest: /srv/nginx/docker-compose.yaml
register: dockercompose
- name: nginx config
template:
src: templates/nginx.conf
dest: /srv/nginx/nginx.conf
register: nginxconf
- name: launch nginx
command: docker compose up -d
args:
chdir: /srv/nginx
- name: restart nginx
command: docker compose restart
args:
chdir: /srv/nginx
when: dockercompose.changed or nginxconf.changed