ansible-role-keycloak/tasks/keycloak-install.yml

53 lines
2.9 KiB
YAML
Raw Normal View History

---
- name: Install the keycloak distribution
block:
- name: Create the keycloak user
user: name={{ keycloak_user }} home={{ keycloak_install_dir }} createhome=no shell=/usr/sbin/nologin system=yes
- name: Create the keycloak installation directory, if it does not already exist.
file: dest={{ keycloak_install_dir }} owner=root group=root state=directory recurse=yes
- name: Create the {{ keycloak_properties_directory }}
file: dest={{ keycloak_properties_directory }} owner=root group=root state=directory
tags: [ keycloak, keycloak_data_dir ]
- name: Create the {{ keycloak_data_directory }}
file: dest={{ keycloak_data_directory }}/{{ item }} state=directory owner={{ keycloak_user }} group={{ keycloak_user }} mode='0755'
loop: '{{ keycloak_data_subdirs }}'
when: keycloak_data_directory != keycloak_distribution_data_directory
tags: [ keycloak, keycloak_data_dir ]
- name: Download the keycloak distribution
unarchive: remote_src=yes src={{ keycloak_download_url }} dest={{ keycloak_install_dir }} owner=root group=root
args:
creates: '{{ keycloak_install_dir }}/{{ keycloak_distribution }}'
- name: Create the keycloak log directory
file: dest={{ keycloak_log_directory }} state=directory owner={{ keycloak_user }} group={{ keycloak_user }} mode='0755'
- name: Create some log files with the correct permissions
file: dest={{ keycloak_log_directory }}/{{ item }} owner={{ keycloak_user }} group={{ keycloak_user }} mode='0644' state=touch
with_items:
- 'server.log'
- 'audit.log'
2021-02-16 20:07:12 +01:00
- name: Fix the permissions of the directories into keycloak must be able to write
file: dest={{ keycloak_install_dir }}/{{ keycloak_distribution }}/{{ keycloak_wildfly_mode }}/{{ item }} state=directory owner={{ keycloak_user }} group={{ keycloak_user }} mode='0750' recurse=yes
with_items: '{{ keycloak_owned_directories }}'
2021-02-16 20:07:12 +01:00
2021-02-24 16:17:34 +01:00
- name: Fix the permissions of the keycloak data directories if they are inside the distribution {{ keycloak_install_dir }}/{{ keycloak_distribution }}/{{ keycloak_wildfly_mode }}/data
2021-02-16 20:07:12 +01:00
file: dest={{ keycloak_install_dir }}/{{ keycloak_distribution }}/{{ keycloak_wildfly_mode }}/data/{{ item }} state=directory owner={{ keycloak_user }} group={{ keycloak_user }} mode='0750' recurse=yes
with_items: '{{ keycloak_data_subdirs }}'
when: keycloak_data_directory == keycloak_distribution_data_directory
- name: Remove the log directory inside the keycloak distribution
file: dest={{ keycloak_install_dir }}/{{ keycloak_distribution }}/{{ keycloak_wildfly_mode }}/log state=absent
- name: Remove the log directory inside the keycloak distribution
file: dest={{ keycloak_install_dir }}/{{ keycloak_distribution }}/{{ keycloak_wildfly_mode }}/log state=absent
- name: Link to the external log directory
file: src={{ keycloak_log_directory }} dest={{ keycloak_install_dir }}/{{ keycloak_distribution }}/{{ keycloak_wildfly_mode }}/log state=link
tags: keycloak