|
48 | 48 | - name: Check current SimpleSAMLphp version if installed |
49 | 49 | shell: | |
50 | 50 | 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//' |
52 | 52 | else |
53 | 53 | echo "not_installed" |
54 | 54 | fi |
55 | 55 | register: current_ssp_version |
56 | 56 | changed_when: false |
57 | 57 | when: simplesamlphp_composer.stat.exists |
58 | 58 |
|
59 | | -- name: Remove SimpleSAMLphp if version mismatch |
| 59 | +- name: Remove SimpleSAMLphp directory for fresh install (if wrong version or missing) |
60 | 60 | file: |
61 | 61 | path: "{{ m_simplesamlphp_path }}" |
62 | 62 | state: absent |
63 | 63 | when: |
64 | 64 | - simplesamlphp_composer.stat.exists |
65 | 65 | - 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 }}" |
67 | 74 |
|
68 | 75 | - name: Install SimpleSAMLphp {{ simplesamlphp_version }} via Composer |
69 | 76 | become: yes |
|
73 | 80 | arguments: simplesamlphp/simplesamlphp:{{ simplesamlphp_version }} . |
74 | 81 | working_dir: "{{ m_simplesamlphp_path }}" |
75 | 82 | 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 |
90 | 84 |
|
91 | 85 | - name: Ensure required SimpleSAMLphp directories exist |
92 | 86 | file: |
|
0 commit comments