updated ansible for lightning-lane

This commit is contained in:
2026-03-07 22:47:37 -06:00
parent 36c2e9540c
commit 344e8dff69
19 changed files with 480 additions and 132 deletions

View File

@@ -1,101 +1,45 @@
# ------------------------------------------------------------------------------
# FILE: roles/common/tasks/main.yml
# DESCRIPTION: Baseline configuration applied to all managed hosts.
# Handles hostname, timezone, core packages, NTP, and
# ansible user setup.
# ------------------------------------------------------------------------------
- name: Disable swap
command: swapoff -a
changed_when: false
- name: Persist swap off by commenting out swap in fstab
replace:
path: /etc/fstab
regexp: '^(\s*)([^#\n]+\s+swap\s+.*)$'
replace: '#\2'
backup: yes
- name: Set hostname
hostname:
name: "{{ inventory_hostname | replace('_', '-') }}"
- name: Load required kernel modules
modprobe:
name: "{{ item }}"
state: present
loop:
- overlay
- br_netfilter
- name: Set timezone
timezone:
name: "{{ common_timezone }}"
- name: Persist kernel modules on boot
copy:
dest: /etc/modules-load.d/k8s.conf
content: |
overlay
br_netfilter
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
- name: Configure required sysctl params for Kubernetes
copy:
dest: /etc/sysctl.d/k8s.conf
content: |
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
- name: Apply sysctl params without reboot
command: sysctl --system
changed_when: false
- name: Set SELinux to permissive mode
selinux:
policy: targeted
state: permissive
- name: Install DNF plugins core for managing repositories
dnf:
name: dnf-plugins-core
- name: Install base utility packages
apt:
name: "{{ common_packages }}"
state: present
- name: Add Docker CE repository
command: dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
args:
creates: /etc/yum.repos.d/docker-ce.repo
- name: Configure NTP to use sundial
template:
src: timesyncd.conf.j2
dest: /etc/systemd/timesyncd.conf
mode: '0644'
notify: restart timesyncd
- name: Install containerd
dnf:
name: containerd.io
state: present
- name: Create containerd config directory
file:
path: /etc/containerd
state: directory
- name: Generate default containerd config and enable SystemdCgroup
shell: |
containerd config default > /etc/containerd/config.toml
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
args:
creates: /etc/containerd/config.toml
- name: Restart and enable containerd service
- name: Ensure systemd-timesyncd is enabled and running
systemd:
name: containerd
state: restarted
name: systemd-timesyncd
state: started
enabled: yes
daemon_reload: yes
- name: Add Kubernetes repository
yum_repository:
name: kubernetes
description: Kubernetes
baseurl: https://pkgs.k8s.io/core:/stable:/v1.33/rpm/
gpgkey: https://pkgs.k8s.io/core:/stable:/v1.33/rpm/repodata/repomd.xml.key
gpgcheck: yes
- name: Install Kubernetes packages
dnf:
name:
- kubelet
- kubeadm
- kubectl
state: present
disable_excludes: kubernetes
- name: Enable the kubelet service
systemd:
name: kubelet
enabled: yes
- name: Ensure ansible user has sudo without password
lineinfile:
path: /etc/sudoers.d/{{ ansible_user }}
line: "{{ ansible_user }} ALL=(ALL) NOPASSWD:ALL"
create: yes
mode: '0440'
validate: 'visudo -cf %s'