110 lines
3.0 KiB
YAML
110 lines
3.0 KiB
YAML
---
|
|
# Master playbook for eom.dev
|
|
|
|
- name: Initialize new nodes
|
|
hosts: all
|
|
become: true
|
|
vars:
|
|
is_new_host: false
|
|
tasks:
|
|
- name: Update apt
|
|
when: is_new_host == true
|
|
apt:
|
|
update_cache: yes
|
|
- name: Install debconf-utils
|
|
when: is_new_host == true
|
|
apt:
|
|
name: debconf-utils
|
|
state: present
|
|
- name: Create preseed file
|
|
when: is_new_host == true
|
|
shell: echo "#_preseed_V1" > /root/preseed.txt
|
|
- name: Append installer's debconf database to the preseed file
|
|
when: is_new_host == true
|
|
shell: debconf-get-selections --installer >> /root/preseed.txt
|
|
- name: Append debconf database to the preseed file
|
|
when: is_new_host == true
|
|
shell: debconf-get-selections >> /root/preseed.txt
|
|
- name: Append text from files/motd to the beginning of remote motd file
|
|
when: is_new_host == true
|
|
blockinfile:
|
|
path: /etc/motd
|
|
marker: ""
|
|
block: |
|
|
{{ lookup('file', 'files/motd') }}
|
|
|
|
- name: Initialize systems
|
|
hosts: all
|
|
become: true
|
|
pre_tasks:
|
|
- name: Update apt
|
|
apt:
|
|
update_cache: yes
|
|
- name: Copy nftables configuration template
|
|
template:
|
|
src: "nftables.conf.j2"
|
|
dest: /etc/nftables.conf
|
|
- name: Enable nftables
|
|
service:
|
|
name: nftables
|
|
state: started
|
|
enabled: true
|
|
- name: Install prometheus node exporter
|
|
apt:
|
|
name: prometheus-node-exporter
|
|
state: present
|
|
- name: Enable prometheus node exporter
|
|
service:
|
|
name: prometheus-node-exporter
|
|
state: started
|
|
enabled: true
|
|
roles:
|
|
- role: ericomeehan.ericomeehan
|
|
|
|
- name: Initialize cluster nodes
|
|
hosts: clusters
|
|
become: true
|
|
pre_tasks:
|
|
- name: Update sysctl configuration to enable IPv4 packet forwarding
|
|
lineinfile:
|
|
path: /etc/sysctl.conf
|
|
line: 'net.ipv4.ip_forward = 1'
|
|
state: present
|
|
- name: Update sysctl configuration to enable IPv6 packet forwarding
|
|
lineinfile:
|
|
path: /etc/sysctl.conf
|
|
line: 'net.ipv6.conf.all.forwarding = 1'
|
|
state: present
|
|
- name: Reload sysctl configuration
|
|
command: sysctl --system
|
|
- name: Enable br_netfilter kernel module
|
|
command: modprobe br_netfilter
|
|
- name: Add the module to a configuration file for persistence
|
|
lineinfile:
|
|
path: /etc/modules-load.d/modules.conf
|
|
line: "br_netfilter"
|
|
- name: Install kubernetes library
|
|
apt:
|
|
name: python3-kubernetes
|
|
state: present
|
|
roles:
|
|
- role: geerlingguy.containerd
|
|
- role: geerlingguy.kubernetes
|
|
- role: geerlingguy.helm
|
|
when: kubernetes_role == 'control_plane'
|
|
- role: ericomeehan.nvidia_driver_debian
|
|
when: nvidia_driver_needed == true
|
|
|
|
- name: Deploy services
|
|
hosts: alpha-control-plane
|
|
vars_files:
|
|
- vars/secrets.yaml
|
|
become: true
|
|
roles:
|
|
- role: ericomeehan.eom
|
|
vars:
|
|
target_namespace: prod
|
|
- role: ericomeehan.gondwana
|
|
vars:
|
|
target_namespace: prod
|