ansible-role-sso/tasks/main.yml

98 lines
2.7 KiB
YAML
Raw Normal View History

2022-07-19 14:26:08 +02:00
---
- name: Add required utilities
ansible.builtin.apt:
name:
- gpg
- wget
- openssl
update_cache: yes
state: present
become: true
2022-07-19 14:26:08 +02:00
- name: Add LetsEncrypt missing intermediate certificates
command: "bash -c 'wget -O- --no-check-certificate https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash'"
args:
creates: /etc/ssl/certs/lets-encrypt-e1.pem.pem
become: true
2022-07-19 14:26:08 +02:00
- name: Add cadoles-pod debian repository key
ansible.builtin.apt_key:
url: "{{ cadoles_pod_debian_repository_key_url }}"
state: present
become: true
2022-07-19 14:26:08 +02:00
- name: Configure cadoles-pod debian repository
ansible.builtin.apt_repository:
repo: "deb {{ cadoles_pod_debian_repository_url }} {{ cadoles_pod_debian_repository }} main"
state: present
become: true
2022-07-19 14:26:08 +02:00
- name: Install core packages
ansible.builtin.apt:
name:
2022-07-21 14:19:23 +02:00
- haproxy={{ haproxy_package_version }}
- cadoles-pod-hydra-v1={{ cadoles_pod_hydra_v1_package_version }}
- cadoles-pod-hydra-dispatcher-v1={{ cadoles_pod_hydra_dispatcher_v1_package_version }}
2022-07-19 14:26:08 +02:00
update_cache: yes
2022-07-21 14:19:23 +02:00
state: present
become: true
2022-07-19 14:26:08 +02:00
- name: Configure Hydra local database
ansible.builtin.include_tasks: hydra-database.yml
when: not hydra_use_external_database
2022-07-19 14:26:08 +02:00
- name: Configure HAProxy
template:
src: haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
validate: "haproxy -c -f %s"
notify:
- Restart HAProxy
become: true
2022-07-19 14:26:08 +02:00
- name: Create hydra-clients
template:
src: hydra-client.json.j2
dest: "/etc/hydra/clients.d/{{ item.client_id }}.json"
with_items: "{{ hydra_clients }}"
notify:
- Reload hydra clients
become: true
2022-07-19 14:26:08 +02:00
- name: Configure cadoles-pod-hydra-v1
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- src: cadoles-pod-hydra-v1.conf.j2
dest: /etc/cadoles-pod-hydra-v1.conf
notify:
- Restart cadoles-pod-hydra-v1
become: true
2022-07-19 14:26:08 +02:00
- name: Configure cadoles-pod-hydra-dispatcher-v1
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- src: cadoles-pod-hydra-dispatcher-v1.conf.j2
dest: /etc/cadoles-pod-hydra-dispatcher-v1.conf
- src: hydra-dispatcher-apps.yml.j2
dest: /etc/hydra-dispatcher/conf.d/apps.yml
notify:
- Restart cadoles-pod-hydra-dispatcher-v1
become: true
2022-07-19 14:26:08 +02:00
- name: Configure passwordless authentification if enabled
ansible.builtin.include_tasks: hydra-passwordless.yml
when: enable_hydra_passwordless
- name: Configure SAML authentification if enabled
ansible.builtin.include_tasks: hydra-saml.yml
when: enable_hydra_saml
- name: Sart OIDC Test app if enabled
ansible.builtin.include_tasks: oidc-test.yml
when: enable_oidc_test_app