Initial role-data
This commit is contained in:
7
kubernetes/tasks/install/agent/install_k3s.yml
Normal file
7
kubernetes/tasks/install/agent/install_k3s.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- name: Install K3s agent
|
||||
command: /root/k3s_install.sh {{ type }}
|
||||
register: command
|
||||
changed_when: "'No change detected' in command.stdout"
|
||||
until: "command is not failed"
|
||||
retries: 2
|
||||
delay: 10
|
||||
17
kubernetes/tasks/install/server/install_helm.yml
Normal file
17
kubernetes/tasks/install/server/install_helm.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
- name: Add Balto key
|
||||
apt_key:
|
||||
url: https://baltocdn.com/helm/signing.asc
|
||||
state: present
|
||||
|
||||
- name: Add Balto Repository
|
||||
apt_repository:
|
||||
repo: "deb https://baltocdn.com/helm/stable/debian/ all main"
|
||||
state: present
|
||||
filename: kubernetes
|
||||
update_cache: yes
|
||||
|
||||
- name: Install helm
|
||||
package:
|
||||
name:
|
||||
- helm
|
||||
state: latest
|
||||
36
kubernetes/tasks/install/server/install_k3s.yml
Normal file
36
kubernetes/tasks/install/server/install_k3s.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
- name: Install K3s-server for 1st-node
|
||||
command: /root/k3s_install.sh {{ type }}
|
||||
when: "inventory_hostname == groups['kubernetes'][0]"
|
||||
register: command
|
||||
changed_when: "'No change detected' in command.stdout"
|
||||
|
||||
- name: Waiting for K3s-server to accept connections
|
||||
ansible.builtin.wait_for:
|
||||
host: "{{ inventory_hostname }}"
|
||||
port: 6443
|
||||
state: started
|
||||
when: "inventory_hostname == groups['kubernetes'][0]"
|
||||
|
||||
- name: Install K3s-server for other nodes
|
||||
command: /root/k3s_install.sh {{ type }}
|
||||
when: "inventory_hostname != groups['kubernetes'][0]"
|
||||
register: command
|
||||
changed_when: "'No change detected' in command.stdout"
|
||||
until: "command is not failed"
|
||||
retries: 2
|
||||
delay: 10
|
||||
|
||||
- name: Waiting for K3s-server to accept connections on other nodes
|
||||
ansible.builtin.wait_for:
|
||||
host: "{{ inventory_hostname }}"
|
||||
port: 6443
|
||||
state: started
|
||||
when: "inventory_hostname != groups['kubernetes'][0]"
|
||||
|
||||
#- name: Add Kubernetes environment-vars to /etc/profile.d/
|
||||
# blockinfile:
|
||||
# path: /etc/profile.d/k3s-bin.sh
|
||||
# marker: "# {mark} ANSIBLE MANAGED BLOCK | k3s"
|
||||
# block: |
|
||||
# export KUBECONFIG="/etc/rancher/k3s/k3s.yaml"
|
||||
# create: true
|
||||
6
kubernetes/tasks/install/server/setup_network.yml
Normal file
6
kubernetes/tasks/install/server/setup_network.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
- name: Set control-plane-dns-endpoint towards local-ip
|
||||
blockinfile:
|
||||
path: /etc/hosts
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK | k3s"
|
||||
block: |
|
||||
{{ nodeip_ipv4 }} {{ kubernetes.control_plane.dns_name }}
|
||||
Reference in New Issue
Block a user