From dfe949eca5971322f554f8209050cbe309d6d83c Mon Sep 17 00:00:00 2001 From: William Graef Date: Mon, 23 Sep 2024 09:24:04 -0400 Subject: [PATCH 1/3] add ocne2 repo and pkgs --- ocne2/default_vars.yml | 1 + ocne2/deploy_ocne_libvirt.yml | 42 ++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ocne2/default_vars.yml b/ocne2/default_vars.yml index 66da95d..e2e2faf 100644 --- a/ocne2/default_vars.yml +++ b/ocne2/default_vars.yml @@ -19,4 +19,5 @@ block_count: 1 ocne_type: libvirt install_ocne_rpm: false +create_ocne_cluster: false update_all: false \ No newline at end of file diff --git a/ocne2/deploy_ocne_libvirt.yml b/ocne2/deploy_ocne_libvirt.yml index e15eb30..855a762 100644 --- a/ocne2/deploy_ocne_libvirt.yml +++ b/ocne2/deploy_ocne_libvirt.yml @@ -100,4 +100,44 @@ append: true - name: Reset ssh connection to allow user changes to affect 'current login user' - ansible.builtin.meta: reset_connection \ No newline at end of file + ansible.builtin.meta: reset_connection + + - name: Install repository and packages + when: + - install_ocne_rpm + block: + - name: Install ocne repository + ansible.builtin.dnf: + name: oracle-olcne-release-el8 + state: present + when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8' + + - name: Enable ocne repository + ansible.builtin.command: + cmd: dnf config-manager --enable ol8_ocne + register: dnf_result + changed_when: dnf_result.rc == 0 + when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8' + + - name: Install ocne repository + ansible.builtin.dnf: + name: oracle-olcne-release-el9 + state: present + when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '9' + + - name: Enable ocne repository + ansible.builtin.command: + cmd: dnf config-manager --enable ol9_ocne + register: dnf_result + changed_when: dnf_result.rc == 0 + when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '9' + + - name: Install ocne package + ansible.builtin.dnf: + name: + - ocne + - kubectl + state: present + + +# run ocne cluster start -- add string of flags \ No newline at end of file From daed8799a465f74bf08b55535bed1d69c0b538ce Mon Sep 17 00:00:00 2001 From: William Graef Date: Mon, 23 Sep 2024 10:25:36 -0400 Subject: [PATCH 2/3] add create cluster with options --- ocne2/default_vars.yml | 2 ++ ocne2/deploy_ocne_libvirt.yml | 28 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ocne2/default_vars.yml b/ocne2/default_vars.yml index e2e2faf..fc94593 100644 --- a/ocne2/default_vars.yml +++ b/ocne2/default_vars.yml @@ -20,4 +20,6 @@ block_count: 1 ocne_type: libvirt install_ocne_rpm: false create_ocne_cluster: false +ocne_cluster_node_options: "" +ocne_cluster_name: "ocne" update_all: false \ No newline at end of file diff --git a/ocne2/deploy_ocne_libvirt.yml b/ocne2/deploy_ocne_libvirt.yml index 855a762..48a45a0 100644 --- a/ocne2/deploy_ocne_libvirt.yml +++ b/ocne2/deploy_ocne_libvirt.yml @@ -139,5 +139,29 @@ - kubectl state: present - -# run ocne cluster start -- add string of flags \ No newline at end of file + - name: Create an ocne cluster + when: + - install_ocne_rpm + - create_ocne_cluster + block: + - name: Provision the cluster + ansible.builtin.shell: | + ocne cluster start {{ ocne_cluster_node_options }} -C {{ ocne_cluster_name | default('ocne') }} + args: + chdir: ~/ + become: true + become_user: "{{ username }}" + register: provision_cluster + changed_when: provision_cluster.rc == 0 + + - name: Print cluster provision output + ansible.builtin.debug: + var: provision_cluster + when: debug_enabled + + - name: Add kubeconfig to .bashrc file + ansible.builtin.lineinfile: + path: ~/.bashrc + line: "export KUBECONFIG=$HOME/.kube/kubeconfig.{{ ocne_cluster_name | default('ocne') }}.local" + become: true + become_user: "{{ username }}" From db5c37670142c1be7097096609b95b24e37aae04 Mon Sep 17 00:00:00 2001 From: William Graef Date: Mon, 23 Sep 2024 11:01:45 -0400 Subject: [PATCH 3/3] disable auto-start-ui --- ocne2/deploy_ocne_libvirt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocne2/deploy_ocne_libvirt.yml b/ocne2/deploy_ocne_libvirt.yml index 48a45a0..b0af7b3 100644 --- a/ocne2/deploy_ocne_libvirt.yml +++ b/ocne2/deploy_ocne_libvirt.yml @@ -146,7 +146,7 @@ block: - name: Provision the cluster ansible.builtin.shell: | - ocne cluster start {{ ocne_cluster_node_options }} -C {{ ocne_cluster_name | default('ocne') }} + ocne cluster start {{ ocne_cluster_node_options }} -C {{ ocne_cluster_name | default('ocne') }} -u false args: chdir: ~/ become: true