Updates
This commit is contained in:
40
playbook.yml
Normal file
40
playbook.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
- 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
|
||||
Reference in New Issue
Block a user