Skip to content

Commit 664ecb5

Browse files
authored
Merge pull request #33 from bgraef/main
add ocne2 install and cluster start
2 parents 9e4c334 + db5c376 commit 664ecb5

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

ocne2/default_vars.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ block_count: 1
1919

2020
ocne_type: libvirt
2121
install_ocne_rpm: false
22+
create_ocne_cluster: false
23+
ocne_cluster_node_options: ""
24+
ocne_cluster_name: "ocne"
2225
update_all: false

ocne2/deploy_ocne_libvirt.yml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,68 @@
100100
append: true
101101

102102
- name: Reset ssh connection to allow user changes to affect 'current login user'
103-
ansible.builtin.meta: reset_connection
103+
ansible.builtin.meta: reset_connection
104+
105+
- name: Install repository and packages
106+
when:
107+
- install_ocne_rpm
108+
block:
109+
- name: Install ocne repository
110+
ansible.builtin.dnf:
111+
name: oracle-olcne-release-el8
112+
state: present
113+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
114+
115+
- name: Enable ocne repository
116+
ansible.builtin.command:
117+
cmd: dnf config-manager --enable ol8_ocne
118+
register: dnf_result
119+
changed_when: dnf_result.rc == 0
120+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
121+
122+
- name: Install ocne repository
123+
ansible.builtin.dnf:
124+
name: oracle-olcne-release-el9
125+
state: present
126+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '9'
127+
128+
- name: Enable ocne repository
129+
ansible.builtin.command:
130+
cmd: dnf config-manager --enable ol9_ocne
131+
register: dnf_result
132+
changed_when: dnf_result.rc == 0
133+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '9'
134+
135+
- name: Install ocne package
136+
ansible.builtin.dnf:
137+
name:
138+
- ocne
139+
- kubectl
140+
state: present
141+
142+
- name: Create an ocne cluster
143+
when:
144+
- install_ocne_rpm
145+
- create_ocne_cluster
146+
block:
147+
- name: Provision the cluster
148+
ansible.builtin.shell: |
149+
ocne cluster start {{ ocne_cluster_node_options }} -C {{ ocne_cluster_name | default('ocne') }} -u false
150+
args:
151+
chdir: ~/
152+
become: true
153+
become_user: "{{ username }}"
154+
register: provision_cluster
155+
changed_when: provision_cluster.rc == 0
156+
157+
- name: Print cluster provision output
158+
ansible.builtin.debug:
159+
var: provision_cluster
160+
when: debug_enabled
161+
162+
- name: Add kubeconfig to .bashrc file
163+
ansible.builtin.lineinfile:
164+
path: ~/.bashrc
165+
line: "export KUBECONFIG=$HOME/.kube/kubeconfig.{{ ocne_cluster_name | default('ocne') }}.local"
166+
become: true
167+
become_user: "{{ username }}"

0 commit comments

Comments
 (0)