Skip to content

Commit 47b2e54

Browse files
committed
Simplifying SimpleSAMLphp installation
1 parent 22605db commit 47b2e54

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

src/roles/saml/tasks/main.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,29 @@
4848
- name: Check current SimpleSAMLphp version if installed
4949
shell: |
5050
if [ -f "{{ m_simplesamlphp_path }}/composer.lock" ]; then
51-
grep -A 3 '"name": "simplesamlphp/simplesamlphp"' {{ m_simplesamlphp_path }}/composer.lock | grep '"version"' | head -1 | cut -d'"' -f4
51+
grep -A 3 '"name": "simplesamlphp/simplesamlphp"' {{ m_simplesamlphp_path }}/composer.lock | grep '"version"' | head -1 | cut -d'"' -f4 | sed 's/^v//'
5252
else
5353
echo "not_installed"
5454
fi
5555
register: current_ssp_version
5656
changed_when: false
5757
when: simplesamlphp_composer.stat.exists
5858

59-
- name: Remove SimpleSAMLphp if version mismatch
59+
- name: Remove SimpleSAMLphp directory for fresh install (if wrong version or missing)
6060
file:
6161
path: "{{ m_simplesamlphp_path }}"
6262
state: absent
6363
when:
6464
- simplesamlphp_composer.stat.exists
6565
- current_ssp_version.stdout != simplesamlphp_version
66-
- current_ssp_version.stdout != "v{{ simplesamlphp_version }}"
66+
67+
- name: Recreate SimpleSAMLphp directory
68+
file:
69+
path: "{{ m_simplesamlphp_path }}"
70+
state: directory
71+
owner: "{{ m_simplesamlphp_owner }}"
72+
group: "{{ m_simplesamlphp_group }}"
73+
mode: "{{ m_simplesamlphp_mode }}"
6774

6875
- name: Install SimpleSAMLphp {{ simplesamlphp_version }} via Composer
6976
become: yes
@@ -73,20 +80,7 @@
7380
arguments: simplesamlphp/simplesamlphp:{{ simplesamlphp_version }} .
7481
working_dir: "{{ m_simplesamlphp_path }}"
7582
no_dev: no
76-
when: not simplesamlphp_composer.stat.exists
77-
78-
- name: Update SimpleSAMLphp to {{ simplesamlphp_version }} via Composer
79-
become: yes
80-
become_user: "{{ m_simplesamlphp_owner }}"
81-
composer:
82-
command: require
83-
arguments: simplesamlphp/simplesamlphp:{{ simplesamlphp_version }}
84-
working_dir: "{{ m_simplesamlphp_path }}"
85-
no_dev: no
86-
when:
87-
- simplesamlphp_composer.stat.exists
88-
- current_ssp_version.stdout != simplesamlphp_version
89-
- current_ssp_version.stdout != ("v" + simplesamlphp_version)
83+
when: not simplesamlphp_composer.stat.exists or current_ssp_version.stdout != simplesamlphp_version
9084

9185
- name: Ensure required SimpleSAMLphp directories exist
9286
file:

0 commit comments

Comments
 (0)