-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set default version to 4.15; add feature to install olm via rpm
This commit provides few features related to that project: - added workaround when the version file does not exists, so clean setup of the MicroShift 4.15 was not possible - added a feature to setup the OLM via MicroShift RPM package
- Loading branch information
Showing
2 changed files
with
51 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,49 @@ | ||
--- | ||
- name: Fetch operator-sdk | ||
become: true | ||
ansible.builtin.uri: | ||
url: https://github.com/operator-framework/operator-sdk/releases/download/{{ operator_sdk_version }}/operator-sdk_linux_amd64 | ||
dest: /usr/local/bin/operator-sdk | ||
mode: "755" | ||
status_code: | ||
- 200 | ||
- 304 | ||
- name: Install OLM via rpm package | ||
when: microshift_olm_package | ||
block: | ||
- name: Install OLM rpm | ||
become: true | ||
ansible.builtin.yum: | ||
name: microshift-olm | ||
state: present | ||
enablerepo: microshift-rpms,microshift-deps-rpms | ||
notify: Restart Microshift | ||
|
||
- name: Check if OLM is installed | ||
ansible.builtin.command: /usr/local/bin/operator-sdk olm status | ||
register: olm_status | ||
failed_when: olm_status.rc not in [0, 1] | ||
changed_when: true | ||
- name: Flush handlers | ||
ansible.builtin.meta: flush_handlers | ||
|
||
# Set ns/user to SCC before we run the OLM installation | ||
- name: Ensure privileged SCC for OLM | ||
ansible.builtin.command: | ||
oc adm policy add-scc-to-user privileged system:serviceaccount:olm:{{ item }} | ||
changed_when: true | ||
loop: | ||
- "default" | ||
- "operatorhubio-catalog" | ||
- "olm-operator-serviceaccount" | ||
- name: Install OLM via OperatorSDK | ||
when: not microshift_olm_package | ||
block: | ||
- name: Fetch operator-sdk | ||
become: true | ||
ansible.builtin.uri: | ||
url: https://github.com/operator-framework/operator-sdk/releases/download/{{ operator_sdk_version }}/operator-sdk_linux_amd64 | ||
dest: /usr/local/bin/operator-sdk | ||
mode: "755" | ||
status_code: | ||
- 200 | ||
- 304 | ||
|
||
- name: Install OLM with SDK | ||
ansible.builtin.command: | | ||
/usr/local/bin/operator-sdk olm install --version {{ olm_version }} | ||
when: olm_status.rc != 0 | ||
changed_when: true | ||
- name: Check if OLM is installed | ||
ansible.builtin.command: /usr/local/bin/operator-sdk olm status | ||
register: olm_status | ||
failed_when: olm_status.rc not in [0, 1] | ||
changed_when: true | ||
|
||
# Set ns/user to SCC before we run the OLM installation | ||
- name: Ensure privileged SCC for OLM | ||
ansible.builtin.command: | ||
oc adm policy add-scc-to-user privileged system:serviceaccount:olm:{{ item }} | ||
changed_when: true | ||
loop: | ||
- "default" | ||
- "operatorhubio-catalog" | ||
- "olm-operator-serviceaccount" | ||
|
||
- name: Install OLM with SDK | ||
ansible.builtin.command: | | ||
/usr/local/bin/operator-sdk olm install --version {{ olm_version }} | ||
when: olm_status.rc != 0 | ||
changed_when: true |