2022-04-07 12:07:45 +00:00
|
|
|
---
|
|
|
|
- name: Prepare
|
|
|
|
hosts: all
|
|
|
|
tasks:
|
|
|
|
- name: Install sudo
|
|
|
|
ansible.builtin.yum:
|
|
|
|
name: sudo
|
|
|
|
state: present
|
2022-08-02 18:22:35 +00:00
|
|
|
|
|
|
|
- name: "Display hera_home if defined."
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
hera_home: "{{ lookup('env', 'HERA_HOME') }}"
|
|
|
|
|
|
|
|
- ansible.builtin.command: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes -subj '/CN=instance'
|
2022-05-31 17:07:18 +00:00
|
|
|
delegate_to: localhost
|
2022-08-02 18:22:35 +00:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- ansible.builtin.lineinfile:
|
|
|
|
dest: /etc/hosts
|
|
|
|
line: "127.0.0.1 instance"
|
|
|
|
state: present
|
|
|
|
delegate_to: localhost
|
|
|
|
become: yes
|
|
|
|
when:
|
|
|
|
- hera_home is defined
|
|
|
|
- hera_home | length == 0
|
|
|
|
|
|
|
|
- ansible.builtin.file:
|
2022-05-31 17:07:18 +00:00
|
|
|
state: directory
|
|
|
|
path: /opt/keycloak/keycloak-18.0.0/conf/
|
2022-08-02 18:22:35 +00:00
|
|
|
|
|
|
|
- ansible.builtin.copy:
|
2022-05-31 17:07:18 +00:00
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "/opt/keycloak/keycloak-18.0.0/conf/{{ item }}"
|
|
|
|
mode: 0444
|
|
|
|
loop:
|
|
|
|
- cert.pem
|
|
|
|
- key.pem
|