mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2025-10-27 16:53:04 +00:00
v0
This commit is contained in:
12
roles/common/tasks/main.yml
Normal file
12
roles/common/tasks/main.yml
Normal file
@ -0,0 +1,12 @@
|
||||
- name: Update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Install basic packages
|
||||
apt:
|
||||
name:
|
||||
- curl
|
||||
- vim
|
||||
- net-tools
|
||||
- gnupg
|
||||
state: present
|
||||
21
roles/kube-master/tasks/main.yml
Normal file
21
roles/kube-master/tasks/main.yml
Normal file
@ -0,0 +1,21 @@
|
||||
- name: Initialize Kubernetes master
|
||||
command: kubeadm init --pod-network-cidr=192.168.1.3/16
|
||||
args:
|
||||
creates: /etc/kubernetes/admin.conf
|
||||
|
||||
- name: Set up kubeconfig for user
|
||||
copy:
|
||||
src: /etc/kubernetes/admin.conf
|
||||
dest: /home/ubuntu/.kube/config
|
||||
remote_src: yes
|
||||
owner: ubuntu
|
||||
group: ubuntu
|
||||
mode: 0644
|
||||
|
||||
- name: Install Calico CNI
|
||||
become: yes
|
||||
become_user: ubuntu
|
||||
shell: |
|
||||
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
|
||||
environment:
|
||||
KUBECONFIG: /home/ubuntu/.kube/config
|
||||
3
roles/kube-node/tasks/main.yml
Normal file
3
roles/kube-node/tasks/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
- name: Join Kubernetes cluster
|
||||
shell: "{{ hostvars['master1']['kubeadm_join_command'] }}"
|
||||
when: hostvars['master1']['kubeadm_join_command'] is defined
|
||||
31
roles/kubernetes/tasks/main.yml
Normal file
31
roles/kubernetes/tasks/main.yml
Normal file
@ -0,0 +1,31 @@
|
||||
- name: Install containerd
|
||||
apt:
|
||||
name: containerd
|
||||
state: present
|
||||
|
||||
- name: Add Kubernetes APT key
|
||||
apt_key:
|
||||
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
|
||||
state: present
|
||||
|
||||
- name: Add Kubernetes repo
|
||||
apt_repository:
|
||||
repo: deb http://apt.kubernetes.io/ kubernetes-xenial main
|
||||
state: present
|
||||
|
||||
- name: Install Kubernetes components
|
||||
apt:
|
||||
name:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Hold Kubernetes packages
|
||||
apt:
|
||||
name:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
state: hold
|
||||
Reference in New Issue
Block a user