Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Oct 16, 2023
1 parent b94b614 commit e0e525d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"filename": "playbooks/acs.yml",
"hashed_secret": "0eeb6b7bb932e8594b4ffe039dc15332f670cbd9",
"is_verified": false,
"line_number": 390,
"line_number": 382,
"is_secret": false
}
],
Expand Down Expand Up @@ -279,5 +279,5 @@
}
]
},
"generated_at": "2023-10-11T14:44:48Z"
"generated_at": "2023-10-16T09:05:33Z"
}
16 changes: 4 additions & 12 deletions playbooks/acs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,18 +334,10 @@
when: identity_enabled
ansible.builtin.set_fact:
adf_app_oauth_configuration:
authType:
value: OAUTH
placeholder: APP_CONFIG_AUTH_TYPE
identityHost:
value: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
placeholder: APP_CONFIG_IDENTITY_HOST
host:
value: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
placeholder: APP_CONFIG_OAUTH2_HOST
clientId:
value: alfresco
placeholder: APP_CONFIG_OAUTH2_CLIENTID
authType: OAUTH
identityHost: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
host: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
clientId: alfresco

- name: Alfresco Control Center Role
hosts: acc
Expand Down
48 changes: 12 additions & 36 deletions roles/adf_app/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,15 @@ adf_app_configuration: {}
# Other defaults
adf_app_config_json_path: "{{ nginx_default_vhost_docroot }}/{{ adf_app_name }}/app.config.json"
adf_app_default_configuration:
providers:
value: ECM
placeholder: APP_CONFIG_PROVIDER
ecmHost:
value: "{protocol}//{hostname}{:port}"
placeholder: APP_CONFIG_ECM_HOST
bpmHost:
placeholder: APP_CONFIG_BPM_HOST
value: "{protocol}//{hostname}{:port}"
authType:
value: BASIC
placeholder: APP_CONFIG_AUTH_TYPE
identityHost:
value: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
placeholder: APP_CONFIG_IDENTITY_HOST
host:
value: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
placeholder: APP_CONFIG_OAUTH2_HOST
clientId:
value: alfresco
placeholder: APP_CONFIG_OAUTH2_CLIENTID
implicitFlow:
value: true
placeholder: APP_CONFIG_OAUTH2_IMPLICIT_FLOW
silentLogin:
value: true
placeholder: APP_CONFIG_OAUTH2_SILENT_LOGIN
redirectSilentIframeUri:
value: "{protocol}//{hostname}{:port}/assets/silent-refresh.html"
placeholder: APP_CONFIG_OAUTH2_REDIRECT_SILENT_IFRAME_URI
redirectUri:
value: "/"
placeholder: APP_CONFIG_OAUTH2_REDIRECT_LOGIN
redirectUriLogout:
value: "/"
placeholder: APP_CONFIG_OAUTH2_REDIRECT_LOGOUT
providers: ECM
ecmHost: "{protocol}//{hostname}{:port}"
bpmHost: "{protocol}//{hostname}{:port}"
authType: BASIC
identityHost: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
host: "{protocol}//{hostname}{:port}/auth/realms/alfresco"
clientId: alfresco
implicitFlow: true
silentLogin: true
redirectSilentIframeUri: "{protocol}//{hostname}{:port}/assets/silent-refresh.html"
redirectUri: "/"
redirectUriLogout: "/"
20 changes: 2 additions & 18 deletions roles/adf_app/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@
- name: Flush handlers
ansible.builtin.meta: flush_handlers

- name: Replace $placeholders in packaged app.config.json - if present
become: true
ansible.builtin.replace:
path: "{{ adf_app_config_json_path }}"
regexp: "{{ '\\${' }}{{ item.value.placeholder }}{{ '}' }}"
replace: "{{ (item.value.value is boolean) | ternary(item.value.value | to_json, item.value.value) }}"
loop: "{{ adf_app_merged_configuration | dict2items }}"
when: item.value.placeholder is defined

- name: Retrieve the current app.config.json contents
- name: Retrieve the app.config.json in the packaged application
ansible.builtin.slurp:
src: "{{ adf_app_config_json_path }}"
register: app_config_json
Expand All @@ -53,17 +44,10 @@
- app_config_json['content'] | b64decode | from_json
quiet: true

- name: Flatten configuration before merging into app.config.json
ansible.builtin.set_fact:
adf_app_flattened_configuration: "{{ adf_app_flattened_configuration | default({}) | ansible.builtin.combine({item.key: item.value.value}) }}"
loop: "{{ adf_app_merged_configuration | dict2items }}"
loop_control:
label: "{{ item.key }}={{ item.value.value }}"

- name: Ensure app.config.json is merged with current configuration
become: true
ansible.builtin.copy:
content: "{{ app_config_json['content'] | b64decode | from_json | ansible.builtin.combine(adf_app_flattened_configuration) | to_nice_json }}"
content: "{{ app_config_json['content'] | b64decode | from_json | ansible.builtin.combine(adf_app_merged_configuration) | to_nice_json }}"
dest: "{{ adf_app_config_json_path }}"
mode: "0644"

Expand Down

0 comments on commit e0e525d

Please sign in to comment.