Skip to content

Commit

Permalink
Stepupapps: Exit when deploying to a docker host when docker is not yet
Browse files Browse the repository at this point in the history
available. This prevents installing the old vm based app on the docker
hosts
  • Loading branch information
quartje committed Mar 21, 2024
1 parent d754a7d commit 8351546
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 310 deletions.
3 changes: 3 additions & 0 deletions roles/stepupgateway/tasks/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Exiting since there is no docker support yet
meta: end_play
130 changes: 6 additions & 124 deletions roles/stepupgateway/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,125 +1,7 @@
- name: Install Apache and FPM config
include_role:
name: apachefpm
- name: Include docker tasks when running docker
include_tasks: docker.yml
when: "'docker' in group_names"

- name: Install the symfony app
include_role:
name: stepupapp

- name: Install images
include_role:
name: stepupapp
tasks_from: copyimages

- name: Install second factor images
include_role:
name: stepupapp
tasks_from: copysfimages

- name: Place config parameterfiles
template:
src: "{{ item }}.yml.j2"
dest: "{{ current_release_config_dir_name }}/{{ item }}.yaml"
mode: 0640
owner: root
group: "{{ appname }}"
with_items:
- parameters
- samlstepupproviders
- samlstepupproviders_parameters
- global_view_parameters
notify:
- clear cache {{ appname }}
- reload php72-fpm {{ appname }}

- name: Place .env file
template:
src: env.j2
dest: "{{ current_release_appdir }}/.env.local"
mode: 0640
owner: root
group: "{{ appname }}"
notify:
- clear cache {{ appname }}
- reload php72-fpm {{ appname }}

# Writing all the SAML keys and certificates. Since the gateway is special no need to include it from other roles
- name: Write GateWay SAML SP private key
copy:
content: "{{ gateway_saml_sp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/sp.key"
owner: "{{ appname }}"
mode: 0400

- name: Write SAML SP certificate
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_saml_sp.crt"
dest: "{{ current_release_config_file_dir_name }}/sp.crt"
group: "{{ appname }}"
mode: 0640

- name: Write GSSP SP private key
copy:
content: "{{ gateway_gssp_sp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/sp_gssp.key"
owner: "{{ appname }}"
mode: 0400

- name: Write GSSP SP certificate
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_gssp_sp.crt"
dest: "{{ current_release_config_file_dir_name }}/sp_gssp.crt"
group: "{{ appname }}"
mode: 0640

- name: Write SAML IdP private key
copy:
content: "{{ gateway_saml_idp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/idp.key"
owner: "{{ appname }}"
mode: 0400

- name: Write SAML IdP public key
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_saml_idp.crt"
dest: "{{ current_release_config_file_dir_name }}/idp.crt"
group: "{{ appname }}"
mode: 0640

- name: Write GSSP IdP cert
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_gssp_idp.crt"
dest: "{{ current_release_config_file_dir_name }}/idp_gssp.crt"
owner: "{{ appname }}"
mode: 0600

- name: Write GSSP IdP key
copy:
content: "{{ gateway_gssp_idp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/idp_gssp.key"
owner: "{{ appname }}"
mode: 0600

- name: Activate the symlink
file:
src: "{{ current_release_appdir }}/"
dest: "{{ current_release_symlink }}"
state: link

- name: Remove gateway database db_migrate script from /root/
file:
path: "/root/01-gateway-db_migrate.sh"
state: absent

- name: Put logout.php in public
template:
src: "logout.php.j2"
dest: "{{ current_release_appdir }}/public/logout.php"
mode: "444"

- meta: flush_handlers

- name: Include post installation tasks
include_role:
name: stepupapp
tasks_from: postinstall
- name: Include vm tasks when running on a vm
include_tasks: vm.yml
when: "'docker' not in group_names"
125 changes: 125 additions & 0 deletions roles/stepupgateway/tasks/vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
- name: Install Apache and FPM config
include_role:
name: apachefpm

- name: Install the symfony app
include_role:
name: stepupapp

- name: Install images
include_role:
name: stepupapp
tasks_from: copyimages

- name: Install second factor images
include_role:
name: stepupapp
tasks_from: copysfimages

- name: Place config parameterfiles
template:
src: "{{ item }}.yml.j2"
dest: "{{ current_release_config_dir_name }}/{{ item }}.yaml"
mode: 0640
owner: root
group: "{{ appname }}"
with_items:
- parameters
- samlstepupproviders
- samlstepupproviders_parameters
- global_view_parameters
notify:
- clear cache {{ appname }}
- reload php72-fpm {{ appname }}

- name: Place .env file
template:
src: env.j2
dest: "{{ current_release_appdir }}/.env.local"
mode: 0640
owner: root
group: "{{ appname }}"
notify:
- clear cache {{ appname }}
- reload php72-fpm {{ appname }}

# Writing all the SAML keys and certificates. Since the gateway is special no need to include it from other roles
- name: Write GateWay SAML SP private key
copy:
content: "{{ gateway_saml_sp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/sp.key"
owner: "{{ appname }}"
mode: 0400

- name: Write SAML SP certificate
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_saml_sp.crt"
dest: "{{ current_release_config_file_dir_name }}/sp.crt"
group: "{{ appname }}"
mode: 0640

- name: Write GSSP SP private key
copy:
content: "{{ gateway_gssp_sp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/sp_gssp.key"
owner: "{{ appname }}"
mode: 0400

- name: Write GSSP SP certificate
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_gssp_sp.crt"
dest: "{{ current_release_config_file_dir_name }}/sp_gssp.crt"
group: "{{ appname }}"
mode: 0640

- name: Write SAML IdP private key
copy:
content: "{{ gateway_saml_idp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/idp.key"
owner: "{{ appname }}"
mode: 0400

- name: Write SAML IdP public key
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_saml_idp.crt"
dest: "{{ current_release_config_file_dir_name }}/idp.crt"
group: "{{ appname }}"
mode: 0640

- name: Write GSSP IdP cert
copy:
src: "{{ inventory_dir }}/files/certs/stepup/gateway_gssp_idp.crt"
dest: "{{ current_release_config_file_dir_name }}/idp_gssp.crt"
owner: "{{ appname }}"
mode: 0600

- name: Write GSSP IdP key
copy:
content: "{{ gateway_gssp_idp_privatekey }}"
dest: "{{ current_release_config_file_dir_name }}/idp_gssp.key"
owner: "{{ appname }}"
mode: 0600

- name: Activate the symlink
file:
src: "{{ current_release_appdir }}/"
dest: "{{ current_release_symlink }}"
state: link

- name: Remove gateway database db_migrate script from /root/
file:
path: "/root/01-gateway-db_migrate.sh"
state: absent

- name: Put logout.php in public
template:
src: "logout.php.j2"
dest: "{{ current_release_appdir }}/public/logout.php"
mode: "444"

- meta: flush_handlers

- name: Include post installation tasks
include_role:
name: stepupapp
tasks_from: postinstall
3 changes: 3 additions & 0 deletions roles/stepupmiddleware/tasks/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Exiting since there is no docker support yet
meta: end_play
Loading

0 comments on commit 8351546

Please sign in to comment.