Added support for x64 bit Debian.

This commit is contained in:
savagebidoof
2023-12-13 17:14:13 +01:00
parent 6902681907
commit 1986a71118
8 changed files with 171 additions and 106 deletions

View File

@ -1,5 +1,5 @@
# Author: Oriol Filter
# 30/07/2023
# 13/12/2023
# Intended for armbian (bullseye, fuck ubuntu tho) it's aarch64
# Maybe still works for orangepi "official" versions, but I only care of make it work for myself soooooo... gl!
# https://medium.com/karlmax-berlin/how-to-install-kubernetes-on-raspberry-pi-53b4ce300b58
@ -10,8 +10,8 @@
vars:
# Testing purposes
ansible_user: "kluser" # Testing purposes
ansible_password: "kluser_1234" # Testing purposes
ansible_user: "my_user" # Testing purposes
ansible_password: "my_password" # Testing purposes
ansible_become_password: "{{ ansible_password }}" # Testing purposes
# Actual vars
@ -26,7 +26,9 @@
# - check vars
- debug: var=set_hostname
- debug: var=is_master
- name: Ping check
ping:
#
# Init / Basic setup
- name: set up node
import_tasks: tasks_prepare_node.yaml

View File

@ -1,9 +1,37 @@
# https://stackoverflow.com/questions/46515704/how-to-kill-a-running-process-using-ansible
- name: Get running processes
shell: "ps -ef | grep -v grep | grep -w ^orangepi | awk '{print $2}'"
register: running_processes
when: delete_user_name is defined and delete_user_name | length > 0
- name: Debug Running processes
debug: var=running_processes
- name: Kill running processes
shell: "kill {{ item }}"
with_items: "{{ running_processes.stdout_lines }}"
when: delete_user_name is defined and delete_user_name | length > 0
- wait_for:
path: "/proc/{{ item }}/status"
state: absent
with_items: "{{ running_processes.stdout_lines }}"
ignore_errors: yes
register: killed_processes
when: delete_user_name is defined and delete_user_name | length > 0
- name: Force kill stuck processes
shell: "kill -9 {{ item }}"
with_items: "{{ killed_processes.results | select('failed') | map(attribute='item') | list }}"
when: delete_user_name is defined and delete_user_name | length > 0
- name: Delete user
ansible.builtin.user:
name: "{{ delete_user_name }}"
remove: true
state: absent
when: delete_user_name != ""
when: delete_user_name is defined and delete_user_name | length > 0
#reboot

View File

@ -4,7 +4,6 @@
ansible.builtin.hostname:
name: "{{ set_hostname }}"
# Swap
- name: Swapoff
ansible.builtin.command: swapoff -a
@ -25,21 +24,26 @@
- ansible_architecture == "aarch64"
- ansible_distribution | lower == "ubuntu" or ansible_distribution | lower == "debian"
# INTENDED FOR ARM DISTROS FUCK U
#- name: Sed when x86_64
# ansible.builtin.command: sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# when: ansible_architecture == "x86_64"
- name: Sed when x86_64
ansible.builtin.command: sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
when:
- ansible_architecture == "x86_64"
- ansible_distribution | lower == "ubuntu" or ansible_distribution | lower == "debian"
# Packages
# Delete default containerd
## Looking forward the version 1.6
- name: apt prune containerd
## Delete default containerd and kuberelated thingies
- name: apt prune containerd and other kube related
ansible.builtin.apt:
name: containerd
name:
- containerd
- kubelet
- kubeadm
- kubectl
state: absent
purge: true
allow_change_held_packages: true
## BnB
- name: apt update
@ -71,18 +75,28 @@
url: https://download.docker.com/linux/debian/gpg
state: present
- name: Add Docker APT repository
- name: Add Docker APT repository (ARM Arch)
apt_repository:
repo: deb [arch=arm64] https://download.docker.com/linux/debian bullseye stable
state: present
when:
- ansible_architecture == "aarch64"
## Kubeshit repo
- name: Add Docker APT repository (x64 Arch)
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable
state: present
when:
- ansible_architecture == "x86_64"
- name: Add Kubernetes GPG key
## Kubeshit repo ARM
- name: Add Kubernetes GPG key (ARM)
apt_key:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
- name: Add Kubernetes APT repository
apt_repository:
repo: deb https://apt.kubernetes.io/ kubernetes-xenial main

View File

@ -3,6 +3,6 @@
- debug: var=_kubeadm_join_command
- name: Join kubeadm
- name: Join kubeadm (this can take a while ... like 20 mins?? idk. probably lot less)
ansible.builtin.command: "{{ _kubeadm_join_command }}"
become: yes