Add initial nginx config to deployment playbook
This commit is contained in:
parent
d611301f8a
commit
eb1ff31e30
@ -10,6 +10,8 @@
|
||||
- name: Clean up old orechestration data
|
||||
hosts: cluster
|
||||
gather_facts: false
|
||||
tags:
|
||||
- cleanup
|
||||
vars_files:
|
||||
- vars/services.yaml
|
||||
- vars/access.yaml
|
||||
@ -53,6 +55,19 @@
|
||||
loop_control:
|
||||
label: "{{ item.Name }}"
|
||||
|
||||
- name: Fetch existing Nginx configs
|
||||
ansible.builtin.command:
|
||||
cmd: ls {{ local_datastore_mount }}/appdata/nginx/conf.d/
|
||||
changed_when: false
|
||||
register: _nginx_configs
|
||||
|
||||
- name: Remove legacy nginx configs
|
||||
when: item.replace('.conf', '') not in skylab_services
|
||||
ansible.builtin.file:
|
||||
path: "{{ local_datastore_mount }}/appdata/nginx/conf.d/{{ item }}.conf"
|
||||
state: absent
|
||||
loop: "{{ _nginx_configs.stdout_lines }}"
|
||||
|
||||
|
||||
- name: Deploy stack service{{ (' ' + service) if service is defined else 's' }}
|
||||
hosts: cluster
|
||||
@ -83,6 +98,15 @@
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Create compose directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ skylab_compose_dir }}"
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ skylab_group_admin.name }}"
|
||||
mode: 0770
|
||||
|
||||
- name: Install compose file
|
||||
vars:
|
||||
app: "{{ item.value }}"
|
||||
@ -124,6 +148,9 @@
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
|
||||
- name: Configure datastore directories
|
||||
run_once: true
|
||||
block:
|
||||
- name: Determine volume directories
|
||||
vars:
|
||||
_stack_volume_directories: []
|
||||
@ -143,3 +170,31 @@
|
||||
group: "{{ skylab_group_admin.name }}"
|
||||
mode: 0770
|
||||
loop: "{{ _stack_volume_directories | subelements('volumes') }}"
|
||||
|
||||
- name: Deploy stack
|
||||
vars:
|
||||
ansible_python_interpreter: "{{ skylab_ansible_venv }}/bin/python"
|
||||
community.docker.docker_stack:
|
||||
name: "{{ item.key }}"
|
||||
compose:
|
||||
- "{{ skylab_compose_dir }}/{{ item.key }}.yaml"
|
||||
prune: false
|
||||
state: present
|
||||
loop: "{{ _services | dict2items }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
|
||||
- name: Configure reverse proxy
|
||||
run_once: true
|
||||
block:
|
||||
- name: Create nginx config
|
||||
when: item.value.domain is defined
|
||||
ansible.builtin.template:
|
||||
src: stack-nginx.conf.j2
|
||||
dest: "{{ local_datastore_mount }}/appdata/nginx/conf.d/{{ item.key }}.conf"
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ skylab_group_admin.name }}"
|
||||
mode: 0464
|
||||
loop: "{{ _services | dict2items }}"
|
||||
loop_control:
|
||||
label: "{{ item.value.domain | default(item.key) }}"
|
||||
|
Reference in New Issue
Block a user