Skip to content
Extraits de code Groupes Projets
update-service.yml 1,14 ko
Newer Older
nono's avatar
nono a validé
# Update the keycloak installation
- name: Checking for pre-existing installation
  stat:
    path: "{{ keycloak_base_path }}/keycloak-{{ keycloak_previous_version }}"
  register: is_there_an_existing_keycloak
nono's avatar
nono a validé

- name: Printing status of pre-existing installation
  debug:
    msg: "{{ is_there_an_existing_keycloak }}"

- name: Updating if needed
  block:
    # Stop the service
    - name: Stopping the service for the update.
      become: yes
      systemd:
        name: "{{ keycloak_service_name }}"
        state: stopped

nono's avatar
nono a validé
    # NB: We are installing to a new directory. We don't touch
    # the old directory.

    # Backup the database
    - name: Backing up the of database
      become: yes
      shell: mysqldump keycloak > /root/keycloak-backup-$(date --iso).sql

    # Upgrade the server
    #- name: Upgrading the server with the new files
    # This is actually reinstalling the files.
  when: is_there_an_existing_keycloak.stat.exists

- name: Update state
  debug:
    msg: "No update done."
  when: not is_there_an_existing_keycloak.stat.exists
nono's avatar
nono a validé

- name:  Force systemd to reread configs
  become: yes
nono's avatar
nono a validé
  ansible.builtin.systemd:
    daemon_reload: yes