---

- name : Configuring Keycloak
  template:
    src: standalone-ha.xml.j2
    dest: "{{ keycloak_config_dir }}/standalone-ha.xml"
    owner: root
    group: root
    mode: 0644
  become: yes
  notify:
    - reload systemd
    - restart keycloak

- name: Create Keycloak admin user
  command:
  args:
    argv:
      - "{{ keycloak_jboss_home }}/bin/add-user-keycloak.sh"
      - -rmaster
      - -u{{ keycloak_admin_user }}
      - -p{{ keycloak_admin_password }}
    creates: "{{ keycloak_config_dir }}/keycloak-add-user.json"
  become: yes
  tags:
    - skip_ansible_lint
