ansible-role-keycloak/tasks/main.yml

49 lines
2.1 KiB
YAML

---
- name: Install the Keycloack distribution
block:
- name: Create the keycloack user
user: name={{ keycloack_user }} home={{ keycloack_install_dir }} createhome=no shell=/usr/sbin/nologin system=yes
- name: Create the keycloack installation directory, if it does not already exist.
file: dest={{ keycloack_install_dir }} owner=root group=root state=directory recurse=yes
- name: Download the Keycloack distribution
unarchive: remote_src=yes src={{ keycloack_download_url }} dest={{ keycloack_install_dir }} owner=root group=root
args:
creates: '{{ keycloack_install_dir }}/{{ keycloack_distribution }}'
- name: Create the Keycloack log directory
file: dest={{ keycloack_log_directory }} state=directory owner={{ keycloack_user }} group={{ keycloack_user }} mode='0755'
- name: Fix the permissions of some Keycloack directories
file: dest={{ keycloack_install_dir }}/{{ keycloack_distribution }}/{{ keycloack_wildfly_mode }}/{{ item }} state=directory owner={{ keycloack_user }} group={{ keycloack_user }} mode='0755'
with_items: '{{ keycloack_owned_directories }}'
- name: Remove the log directory inside the Keycloack distribution
file: dest={{ keycloack_install_dir }}/{{ keycloack_distribution }}/{{ keycloack_wildfly_mode }}/log state=absent
- name: Remove the log directory inside the Keycloack distribution
file: dest={{ keycloack_install_dir }}/{{ keycloack_distribution }}/{{ keycloack_wildfly_mode }}/log state=absent
- name: Link to the external log directory
file: src={{ keycloack_log_directory }} dest={{ keycloack_install_dir }}/{{ keycloack_distribution }}/{{ keycloack_wildfly_mode }}/log state=link
tags: keycloack
- name: Manage the Keycloack installation
block:
- name: Install the keycloack systemd unit
template: src=keycloack.service.j2 dest=/etc/systemd/system/keycloack.service owner=root group=root mode=0644
register: keycloack_unit
- name: Reload systemd
systemd:
daemon_reload: yes
when: keycloack_unit is changed
tags: keycloack
# Install the standalone.xml file with the db configuration
# Install the JDBC driver
# Ensure that the service il started