diff --git a/defaults/main.yaml b/defaults/main.yaml index 587f4a0..63ebe40 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -39,10 +39,10 @@ firewalld_rules_permament: true use_copr_microshift: false # The Microshift version that is available in the repository. -microshift_version: 4.14 +microshift_version: 4.15 # Default settings from /etc/microshift/config.yaml.default -# https://github.com/openshift/microshift/blob/release-4.14/packaging/microshift/config.yaml +# https://github.com/openshift/microshift/blob/release-4.15/packaging/microshift/config.yaml microshift_config: apiServer: subjectAltNames: @@ -72,7 +72,7 @@ microshift_config: # nodeIP: "" # Default settings from /etc/microshift/lvmd.yaml.default -# https://github.com/openshift/microshift/blob/release-4.14/packaging/microshift/lvmd.yaml +# https://github.com/openshift/microshift/blob/release-4.15/packaging/microshift/lvmd.yaml microshift_lmvd: # socket-name: /run/lvmd/lvmd.socket device-classes: @@ -86,7 +86,7 @@ microshift_lmvd: # - "" # Default settings from /etc/microshift/ovn.yaml.default -# https://github.com/openshift/microshift/blob/release-4.14/packaging/microshift/ovn.yaml +# https://github.com/openshift/microshift/blob/release-4.15/packaging/microshift/ovn.yaml microshift_ovn: {} # mtu: 1500 @@ -97,6 +97,8 @@ microshift_ovn: {} # Install the OLM - https://olm.operatorframework.io/ setup_olm: false # https://github.com/operator-framework/operator-lifecycle-manager/releases +# NOTE: the olm_version is not working when microshift_olm_package is set to true. +microshift_olm_package: false olm_version: "v0.28.0" # Version of the Operator SDK diff --git a/tasks/olm.yaml b/tasks/olm.yaml index 3abcfc7..5f26a3a 100644 --- a/tasks/olm.yaml +++ b/tasks/olm.yaml @@ -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