Skip to content

Commit

Permalink
add create cluster with options
Browse files Browse the repository at this point in the history
  • Loading branch information
bgraef committed Sep 23, 2024
1 parent dfe949e commit daed879
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ocne2/default_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
28 changes: 26 additions & 2 deletions ocne2/deploy_ocne_libvirt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,29 @@
- kubectl
state: present


# run ocne cluster start -- add string of flags
- 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 }}"

0 comments on commit daed879

Please sign in to comment.