-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prepare.sh * test-environment * cluster_admin gets kube config * kubeblocks * roles
- Loading branch information
1 parent
95c7ef2
commit c60ab7b
Showing
10 changed files
with
94 additions
and
52 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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env ansible-playbook | ||
--- | ||
|
||
- name: Kube config on controller | ||
hosts: kube_control_plane | ||
tags: [kube_config] | ||
gather_facts: true | ||
tasks: | ||
- name: Gather facts | ||
become: false | ||
ansible.builtin.setup: | ||
gather_subset: platform | ||
|
||
- name: Set local user | ||
become: false | ||
ansible.builtin.set_fact: | ||
local_user: "{{ lookup('env', 'USER') }}" | ||
|
||
- name: Create local config dirs | ||
delegate_to: localhost | ||
become: true | ||
ansible.builtin.file: | ||
path: "~{{ local_user }}/.kube" | ||
owner: "{{ local_user }}" | ||
state: directory | ||
mode: '0700' | ||
|
||
- name: Fetch kube config from master | ||
when: inventory_hostname in groups['kube_control_plane'] | ||
become: true | ||
ansible.builtin.fetch: | ||
src: /etc/kubernetes/admin.conf | ||
dest: "~{{ local_user }}/.kube/config" | ||
owner: "{{ local_user }}" | ||
mode: '0600' | ||
flat: true | ||
|
||
- name: Configure k8s master | ||
delegate_to: localhost | ||
become: true | ||
ansible.builtin.lineinfile: | ||
path: "~{{ local_user }}/.kube/config" | ||
regexp: ' server.*6443$' | ||
line: " server: https://{{ groups['kube_control_plane'][0] }}:6443" | ||
state: present | ||
mode: '0600' | ||
|
||
- name: Create local config dirs | ||
delegate_to: localhost | ||
become: true | ||
ansible.builtin.file: | ||
path: "~{{ cluster_admin | default('root') }}/.kube" | ||
owner: "{{ cluster_admin | default('root') }}" | ||
group: "{{ cluster_admin | default('root') }}" | ||
state: directory | ||
mode: '0700' | ||
|
||
- name: Copy kube config to cluster | ||
delegate_to: localhost | ||
become: true | ||
ansible.builtin.copy: | ||
remote_src: true | ||
src: "~{{ local_user }}/.kube/config" | ||
dest: "~{{ cluster_admin | default('root') }}/.kube/" | ||
owner: "{{ cluster_admin | default('root') }}" | ||
group: "{{ cluster_admin | default('root') }}" | ||
mode: '0600' |
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,2 +1,3 @@ | ||
#!/bin/bash | ||
ansible-galaxy install -r roles/requirements.yml | ||
ansible-galaxy collection install -r collections/requirements.yml |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Install KubeBlocks add-ons | ||
when: | ||
- kubeblocks_add_ons|length >= 1 | ||
ansible.builtin.include_tasks: addons.yml | ||
loop: "{{ kubeblocks_add_ons }}" | ||
|
||
- name: Install KubeBlock clusters | ||
when: | ||
- kubeblocks_clusters|length >= 1 | ||
ansible.builtin.include_tasks: clusters.yml | ||
loop: "{{ kubeblocks_clusters }}" |