summaryrefslogtreecommitdiff
path: root/roles/nginx/auth/sso/backend/tasks/main.yml
blob: 4d555d6914a3c4535189aba34f73419bcbead2b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
- name: install nginx-sso package
  apt:
    name: nginx-sso
    state: present

- name: create configuration directory
  file:
    path: /etc/nginx/auth/sso
    state: directory

- name: generate configuration file
  loop: "{{ nginx_sso_backend_configs | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  copy:
    content: |
      # ansible generated

      {{ item.value | to_nice_yaml }}
    dest: "/etc/nginx/auth/sso/{{ item.key }}.yml"
    mode: 0400
  notify: reload nginx-sso

- name: generate systemd service unit
  template:
    src: nginx-sso@.service.j2
    dest: /etc/systemd/system/nginx-sso@.service
  notify: restart nginx-sso

- name: make sure nginx-sso services are enabled and started
  loop: "{{ nginx_sso_backend_configs | list }}"
  systemd:
    name: "nginx-sso@{{ item }}.service"
    daemon_reload: yes
    state: started
    enabled: yes