forked from devopshobbies/devops-gpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compose): edit some related fields to compose
- Loading branch information
Showing
32 changed files
with
1,897 additions
and
294 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 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
Empty file.
Empty file.
Empty file.
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
Empty file.
Empty file.
Empty file.
100 changes: 100 additions & 0 deletions
100
app/media/MyAnsible/roles/join_master/tasks/join_master.yml
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,100 @@ | ||
- name: Init cluster | Check if kubeadm has already run | ||
stat: | ||
path: "/var/lib/kubelet/config.yaml" | ||
register: kubeadm_already_run | ||
|
||
- block: | ||
- name: Generate join command | ||
command: kubeadm token create --print-join-command | ||
register: join_command | ||
|
||
- name: Print join command | ||
debug: | ||
msg: "{{ join_command.stdout_lines[0] }}" | ||
|
||
- name: Copy join command to local file | ||
become: false | ||
local_action: copy content="{{ join_command.stdout_lines[0] }} $@" dest="roles/join_master/files/join-command" | ||
|
||
- name: copy kubeadmcnf.yaml | ||
template: | ||
src: kubeadmcnf-join.yml.j2 | ||
dest: /root/kubeadm-config.yaml | ||
|
||
when: | ||
- inventory_hostname == groups['k8s_masters'][0] | ||
delegate_to: "{{ groups['k8s_masters'][0] }}" | ||
|
||
- block: | ||
- name: Copy the join command to server location | ||
copy: | ||
src: roles/join_master/files/join-command | ||
dest: /root/join-command.sh | ||
mode: "0777" | ||
|
||
when: | ||
- inventory_hostname != groups['k8s_masters'][0] | ||
- inventory_hostname in groups['k8s_masters'] | ||
- not kubeadm_already_run.stat.exists | ||
|
||
- block: | ||
- name: get certificate key | ||
shell: kubeadm init phase upload-certs --upload-certs --config=/root/kubeadm-config.yaml | ||
register: kubeadm_cert_key | ||
|
||
- name: Print certificate key | ||
debug: | ||
msg: "{{ kubeadm_cert_key.stdout_lines[2] }}" | ||
|
||
- name: register the cert key | ||
set_fact: | ||
control_plane_certkey: "{{ kubeadm_cert_key.stdout_lines[2] }}" | ||
|
||
when: | ||
- inventory_hostname in groups['k8s_masters'][0] | ||
delegate_to: "{{ groups['k8s_masters'][0] }}" | ||
run_once: false | ||
delegate_facts: true | ||
|
||
- name: Join | Join control-plane to cluster | ||
command: "sh /root/join-command.sh --control-plane --certificate-key={{ hostvars[groups['k8s_masters'][0]].control_plane_certkey }} --cri-socket={{ cri_socket }}" | ||
when: | ||
- inventory_hostname != groups['k8s_masters'][0] | ||
- inventory_hostname in groups['k8s_masters'] | ||
- not kubeadm_already_run.stat.exists | ||
|
||
- block: | ||
- name: Create kubectl directory | ||
file: | ||
path: /root/.kube | ||
state: directory | ||
|
||
- name: Configure kubectl | ||
copy: | ||
src: /etc/kubernetes/admin.conf | ||
dest: /root/.kube/config | ||
remote_src: yes | ||
|
||
- name: Fetch kubeconfig | ||
fetch: | ||
src: /etc/kubernetes/admin.conf | ||
dest: kubeconfig/ | ||
flat: yes | ||
when: | ||
- inventory_hostname != groups['k8s_masters'][0] | ||
- inventory_hostname in groups['k8s_masters'] | ||
- not kubeadm_already_run.stat.exists | ||
|
||
- name: remove apiserver_url to point to the masters temporary | ||
lineinfile: | ||
dest: /etc/hosts | ||
line: "{{ hostvars[groups['k8s_masters'][0]].private_ip }} {{ apiserver_url }}" | ||
state: absent | ||
|
||
- name: Add apiserver_url to point to the masters | ||
lineinfile: | ||
dest: /etc/hosts | ||
line: "{{ private_ip }} {{ apiserver_url }}" | ||
state: present | ||
when: | ||
- inventory_hostname in groups['k8s_masters'] |
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,5 @@ | ||
--- | ||
# tasks file for join_master | ||
|
||
- name: Join master(s) node to cluster | ||
include_tasks: join_master.yml |
Empty file.
Empty file.
Empty file.
38 changes: 38 additions & 0 deletions
38
app/media/MyAnsible/roles/join_worker/tasks/join_worker.yml
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,38 @@ | ||
- name: Init cluster | Check if kubeadm has already run | ||
stat: | ||
path: "/var/lib/kubelet/config.yaml" | ||
register: kubeadm_already_run | ||
|
||
- block: | ||
- name: Generate join command | ||
command: kubeadm token create --print-join-command | ||
register: join_command | ||
|
||
- name: Print join command | ||
debug: | ||
msg: "{{ join_command.stdout_lines[0] }}" | ||
|
||
- name: Copy join command to local file | ||
become: false | ||
local_action: copy content="{{ join_command.stdout_lines[0] }} $@" dest="roles/join_worker/files/join-command" | ||
|
||
when: | ||
- inventory_hostname not in groups['k8s_masters'][0] | ||
delegate_to: "{{ groups['k8s_masters'][0] }}" | ||
|
||
- block: | ||
- name: Copy the join command to server location | ||
copy: | ||
src: roles/join_worker/files/join-command | ||
dest: /root/join-command.sh | ||
mode: "0777" | ||
|
||
when: | ||
- inventory_hostname not in groups['k8s_masters'] | ||
- not kubeadm_already_run.stat.exists | ||
|
||
- name: Join | Join worker nodes to the cluster | ||
command: sh /root/join-command.sh | ||
when: | ||
- inventory_hostname not in groups['k8s_masters'] | ||
- not kubeadm_already_run.stat.exists |
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,5 @@ | ||
--- | ||
# tasks file for join_worker | ||
|
||
- name: Join worker(s) node to cluster | ||
include_tasks: join_worker.yml |
Empty file.
Empty file.
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
11 changes: 0 additions & 11 deletions
11
app/media/MyAnsible/roles/lb/templates/check_apiserveer.sh.j2
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.