Compare commits

..

No commits in common. "5db5bbbb4d4798443ceabd7c63e530153ce19c93" and "cfcd2ca654bbca67016c5bdaa74beb7dee42b319" have entirely different histories.

11 changed files with 21 additions and 58 deletions

View file

@ -1,21 +1,7 @@
IMAGE_NAME = "bento/ubuntu-22.04" IMAGE_NAME = "bento/ubuntu-22.04"
CONTROL_PLANES = 1 CONTROL_PLANES = 1
NODES = 0 NODES = 0
ansible_groups = {
"control_planes" => [
"control-plane-[1:#{CONTROL_PLANES}]"
],
"nodes" => [
"node-[1:#{NODES}]"
],
"local_dev" => [
"control-plane-[1:#{CONTROL_PLANES}]",
"node-[1:#{NODES}]"
],
}
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.ssh.insert_key = false config.ssh.insert_key = false
@ -31,9 +17,10 @@ Vagrant.configure("2") do |config|
control_plane.vm.hostname = "control-plane-#{i}" control_plane.vm.hostname = "control-plane-#{i}"
control_plane.vm.provision "ansible" do |ansible| control_plane.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yaml" ansible.playbook = "playbook.yaml"
ansible.groups = ansible_groups
ansible.extra_vars = { ansible.extra_vars = {
node_ip: "192.168.56.#{10 + i}" cluster_name: "gerar",
node_ip: "192.168.56.#{10 + i}",
is_control_plane: true,
} }
end end
end end
@ -46,9 +33,10 @@ Vagrant.configure("2") do |config|
node.vm.hostname = "node-#{i}" node.vm.hostname = "node-#{i}"
node.vm.provision "ansible" do |ansible| node.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yaml" ansible.playbook = "playbook.yaml"
ansible.groups = ansible_groups
ansible.extra_vars = { ansible.extra_vars = {
cluster_name: "gerar",
node_ip: "192.168.56.#{20 + i}", node_ip: "192.168.56.#{20 + i}",
is_control_plane: false,
control_plane_endpoint: "192.168.56.11", control_plane_endpoint: "192.168.56.11",
} }
end end

View file

@ -1 +0,0 @@
kubeadmin_config: "/etc/kubernetes/admin.conf"

View file

@ -1 +0,0 @@
is_control_plane: true

View file

@ -1,5 +0,0 @@
ansible_user: servant
cluster_name: "gerar"
k8s_version: "1.26"
pod_network_cidr: "10.254.0.0/16"
service_cidr: "10.255.0.0/16"

View file

@ -1,5 +0,0 @@
cluster_name: "local-dev"
k8s_version: "1.26"
pod_network_cidr: "10.254.0.0/16"
service_cidr: "10.255.0.0/16"
kubeadmin_config: "/etc/kubernetes/admin.conf"

View file

@ -1 +0,0 @@
is_control_plane: false

View file

@ -5,7 +5,19 @@ all:
control_planes: control_planes:
hosts: hosts:
matthew.gerar.jilits.se: matthew.gerar.jilits.se:
vars:
is_control_plane: true
nodes: nodes:
hosts: hosts:
mark.gerar.jilits.se: mark.gerar.jilits.se:
luke.gerar.jilits.se: luke.gerar.jilits.se:
vars:
is_control_plane: false
vars:
ansible_user: servant
cluster_name: "gerar"
k8s_version: 1.26
pod_network_cidr: "10.254.0.0/16"
service_cidr: "10.255.0.0/16"
vars:
kubeadmin_config: /etc/kubernetes/admin.conf

View file

@ -2,8 +2,6 @@
- hosts: all - hosts: all
gather_facts: yes gather_facts: yes
roles: roles:
- include_role:
name: install_system_tools
- include_role: - include_role:
name: remove_swap name: remove_swap
- include_role: - include_role:

View file

@ -1,10 +0,0 @@
---
- name: Install system tools
become: true
vars:
packages:
- less
ansible.builtin.apt:
name: "{{ packages }}"
state: present
update_cache: yes

View file

@ -9,9 +9,8 @@
- curl - curl
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ packages }}" name: "{{ packages }}"
state: latest state: present
update_cache: yes update_cache: yes
cache_valid_time: 3600
- name: Setup Kubernetes repository - name: Setup Kubernetes repository
become: true become: true
@ -26,29 +25,19 @@
repo: deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main repo: deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main
state: present state: present
- name: Update apt cache
ansible.builtin.apt:
update_cache: yes
- name: Get Kubernetes package version
ansible.builtin.shell: "apt-cache show kubeadm | grep -F 'Version: {{ k8s_version }}.' | cut -d' ' -f2 | sort -n | tail -n 1"
register: k8s_pkg_ver
- name: Setup Kubernetes packages - name: Setup Kubernetes packages
become: true become: true
vars: vars:
packages: packages:
- kubelet={{ k8s_pkg_ver.stdout }} - kubelet
- kubeadm={{ k8s_pkg_ver.stdout }} - kubeadm
- kubectl={{ k8s_pkg_ver.stdout }} - kubectl
block: block:
- name: Install kubelet, kubeadm and kubectl - name: Install kubelet, kubeadm and kubectl
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ packages }}" name: "{{ packages }}"
state: present state: present
update_cache: yes update_cache: yes
allow_downgrade: no
cache_valid_time: 3600
- name: Hold Kubernetes packages - name: Hold Kubernetes packages
loop: "{{ packages }}" loop: "{{ packages }}"

View file

@ -53,7 +53,6 @@
name: "{{ packages }}" name: "{{ packages }}"
state: present state: present
update_cache: yes update_cache: yes
cache_valid_time: 3600
- name: Install Kubernetes module dependencies - name: Install Kubernetes module dependencies
ansible.builtin.pip: ansible.builtin.pip: