Merge pull request #90 from jdratlif/main

A few updates for the RKE2 ansible plays
This commit is contained in:
James
2024-09-25 15:49:04 +01:00
committed by GitHub
11 changed files with 134 additions and 17 deletions

View File

@@ -0,0 +1,3 @@
[defaults]
inventory = inventory/hosts.ini
host_key_checking = false

View File

@@ -1,18 +1,18 @@
---
os: "linux"
arch: "amd64"
kube_vip_version: "v0.8.0"
vip_interface: eth0
vip: 192.168.3.50
metallb_version: v0.13.12
lb_range: 192.168.3.80-192.168.3.90
lb_pool_name: first-pool
rke2_version: "v1.29.4+rke2r1"
rke2_install_dir: "/usr/local/bin"
rke2_binary_url: "https://github.com/rancher/rke2/releases/download/{{ rke2_version }}/rke2.linux-amd64"
ansible_user: ubuntu
ansible_become: true
ansible_become_method: sudo
################################################################################
# options to change default values
# kube_vip_version: "v0.8.0"
# vip_interface: "eth0"
# rke2_version: "v1.29.4+rke2r1"
# rke2_install_dir: "/usr/local/bin"

View File

@@ -9,3 +9,12 @@ server3 ansible_host=192.168.3.23
[agents]
agent1 ansible_host=192.168.3.24
agent2 ansible_host=192.168.3.25
[rke2]
[rke2:children]
servers
agents
[rke2:vars]
ansible_user=ansible

View File

@@ -0,0 +1,3 @@
---
kube_vip_version: v0.8.0
vip_interface: eth0

View File

@@ -0,0 +1,22 @@
---
argument_specs:
main:
short_description: Install kube-vip manifest
description: Install kube-vip manifest
author:
- James Turland <james@turland.uk>
options:
kube_vip_version:
type: str
required: false
default: v0.8.0
description: Version of kube-vip to install
vip_interface:
type: str
required: false
default: eth0
description: Interface to bind kube-vip
vip:
type: str
required: true
description: The virtual IP to use with kube-vip

View File

@@ -3,7 +3,7 @@
ansible.builtin.file:
path: "/var/lib/rancher/rke2/server/manifests"
state: directory
mode: '0644'
mode: "0755"
when: inventory_hostname in groups['servers']
# Copy kube-vip to server 1 manifest folder for auto deployment at bootstrap
@@ -13,5 +13,5 @@
dest: /var/lib/rancher/rke2/server/manifests/kube-vip.yaml
owner: root
group: root
mode: '0644'
mode: "0644"
when: inventory_hostname == groups['servers'][0]

View File

@@ -0,0 +1,3 @@
---
rke2_install_dir: "/usr/local/bin"
rke2_version: "v1.29.4+rke2r1"

View File

@@ -0,0 +1,2 @@
---
rke2_binary_url: "https://github.com/rancher/rke2/releases/download/{{ rke2_version }}/rke2.{{ os }}-{{ arch }}"

View File

@@ -13,16 +13,11 @@
# bootstraps first server and copies configs for others/agents
- name: Prepare all nodes
hosts: servers,agents
gather_facts: true # enables us to gather lots of useful variables: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/setup_module.html
hosts: rke2
gather_facts: false # fact gathering is slow and not needed for any of our tasks
become: true
roles:
- prepare-nodes
# creates directories for download and then downloads RKE2 and changes permissions
- name: Download RKE2
hosts: servers,agents
gather_facts: true
roles:
- rke2-download
# Creates RKE2 bootstrap manifests folder and copies kube-vip template over (configured with variables)