Files
qnap-containers/playbook.yml
Marc Fokkert cd79ca9d3e Updates
2024-10-30 20:48:33 +01:00

41 lines
1.2 KiB
YAML

- hosts: localhost
vars:
external_host: "hoarder.rescla.me"
internal_url: "192.168.2.145:3000"
tmp_path: ".tmp"
ftp_server: "192.168.2.64"
ftp_username: "ansible"
ftp_password: "3YffU5iTGQMyx87Vesu"
remote_file_path: "/appdata/nginx-lb/user_conf.d/{{ external_host }}.conf"
tasks:
- name: Ensures the {{ tmp_path }} folder exists
file:
path: "{{ tmp_path }}"
state: directory
- name: Generate nginx configuration from template
template:
src: templates/nginx-site.conf.j2
dest: "{{ tmp_path }}/nginx.conf"
- name: Upload nginx config file via FTP
ansible.builtin.command:
cmd: curl -k -T "{{ tmp_path }}/nginx.conf" "ftp://{{ ftp_username }}:{{ ftp_password }}@{{ ftp_server }}{{ remote_file_path }}"
- name: Clean up generated config
file:
path: "{{ tmp_path }}/nginx.conf"
state: absent
- name: Reload nginx config
ansible.builtin.command:
argv:
- docker
- --tlsverify
- -H=192.168.2.64:2376
- --tlscacert=.docker\ca.pem
- --tlscert=.docker\cert.pem
- --tlskey=.docker\key.pem
- kill --signal=HUP nginx-lb