Skip to content

Commit

Permalink
EUS: reorder tasks for upgrades
Browse files Browse the repository at this point in the history
Reorder tasks for External User Service, so that it also works
correctly on upgrades from Yoda 1.8
  • Loading branch information
stsnel committed Sep 8, 2023
1 parent b08ff2b commit d41a2c8
Showing 1 changed file with 41 additions and 40 deletions.
81 changes: 41 additions & 40 deletions roles/yoda_external_user_service/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
---
# copyright Utrecht University

# EUS depends on the Yoda portal for theming information. So running mismatched versions
# can result in unexpected errors.
- name: Check whether Yoda portal version matches EUS version
ansible.builtin.fail: # noqa ignore-errors
msg: "Warning: mismatched EUS and portal version can result in EUS theming problems."
when: "yoda_portal_version != yoda_eus_version"
ignore_errors: true


- name: Remove no longer used Yoda External User Service dependencies
ansible.builtin.package:
name:
Expand All @@ -10,15 +19,44 @@
- php-PHPMailer
state: absent


- name: Ensure yodadeployment user exists
ansible.builtin.user:
name: "{{ yoda_deployment_user }}"


- name: Ensure parent directories for EUS repositories are accessible
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ yoda_deployment_user }}"
group: "{{ yoda_deployment_user }}"
mode: '0711'
with_items:
- /var/www/extuser
- /var/www/yoda


- name: Check out Yoda portal for themes used by External User Service
become_user: "{{ yoda_deployment_user }}"
become: true
ansible.builtin.git:
repo: "https://github.com/UtrechtUniversity/yoda-portal.git"
dest: "/var/www/yoda"
version: "{{ yoda_portal_version }}"
force: true
when: "'portals' not in group_names"


- name: Generate Flask secret key
ansible.builtin.shell: openssl rand -base64 32 > /var/www/yoda/flask_secret_key
creates=/var/www/yoda/flask_secret_key
ansible.builtin.shell: openssl rand -base64 32 > /var/www/extuser/flask_secret_key
creates=/var/www/extuser/flask_secret_key
when: not ansible_check_mode and flask_secret_key is not defined


- name: Retrieve Flask secret key
ansible.builtin.slurp:
src: /var/www/yoda/flask_secret_key
src: /var/www/extuser/flask_secret_key
register: secret_key
when: not ansible_check_mode and flask_secret_key is not defined

Expand All @@ -37,32 +75,6 @@
persistent: true


- name: Ensure yodadeployment user exists
ansible.builtin.user:
name: "{{ yoda_deployment_user }}"


- name: Ensure parent directories for EUS repositories are accessible
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ yoda_deployment_user }}"
group: "{{ yoda_deployment_user }}"
mode: '0711'
with_items:
- /var/www/extuser
- /var/www/yoda


# EUS depends on the Yoda portal for theming information. So running mismatched versions
# can result in unexpected errors.
- name: Check whether Yoda portal version matches EUS version
ansible.builtin.fail: # noqa ignore-errors
msg: "Warning: mismatched EUS and portal version can result in EUS theming problems."
when: "yoda_portal_version != yoda_eus_version"
ignore_errors: true


- name: Checkout Yoda External User Service source
become_user: "{{ yoda_deployment_user }}"
become: true
Expand All @@ -73,17 +85,6 @@
force: true


- name: Check out Yoda portal for themes used by External User Service
become_user: "{{ yoda_deployment_user }}"
become: true
ansible.builtin.git:
repo: "https://github.com/UtrechtUniversity/yoda-portal.git"
dest: "/var/www/yoda"
version: "{{ yoda_portal_version }}"
force: true
when: "'portals' not in group_names"


- name: Check portal version for cache buster
become_user: "{{ yoda_deployment_user }}"
become: true
Expand Down

0 comments on commit d41a2c8

Please sign in to comment.