Add OneLab Helm chart, Argo CD Application, and GitOps values for k3s

Made-with: Cursor
This commit is contained in:
timotheereausanofi
2026-03-20 10:15:15 +01:00
commit 52847814e0
102 changed files with 4476 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
#!/bin/bash
ANSIBLE_LOG_PATH=../../logs/ansible/$(date +%F)-ansible.log ansible-playbook ./restore.yml

View File

@@ -0,0 +1,104 @@
---
- name: Restoring OneLab (1.27.0)
hosts: localhost
vars_prompt:
- name: "userchoice"
prompt: "Confirm OneLab 1.27.0 restore: yes/no"
private: no
vars:
onelab_path: '../..'
onelab_images_path: '../../../onelab-images-1.27.0.tar.gz'
main_path: '../../..'
tasks:
- name: Checking if the OneLab images bundle is existing
stat:
path: "{{ onelab_images_path }}"
get_checksum: no
register: docker_images_tar
- name: Aborting the restore process
fail:
msg: Aborting the restore process
when: userchoice != "yes"
# Stop OneLab if OneLab is running
- name: Checking if OneLab is running
shell: docker stack ls | grep 'onelab' | wc -l
become: true
register: stack_count
# Stop OneLab (unkown version) if OneLab is running
- include_tasks: "{{ onelab_path }}/installation/latest/app/playbooks/tasks/stop-onelab.yml"
when: stack_count.stdout != "0"
- include_tasks: "{{ onelab_path }}/installation/latest/app/playbooks/tasks/stop-proxy.yml"
when: stack_count.stdout != "0"
# Load docker images
- name: Loading Docker images
debug:
msg:
- "Loading images could take few minutes, please do not interrupt"
when: (docker_images_tar is defined) and (docker_images_tar.stat.exists)
- name: Loading OneLab images from the tar file
shell:
docker load --input {{ onelab_images_path }}
become: true
when: (docker_images_tar is defined) and (docker_images_tar.stat.exists)
- name: Unzipping backup
shell: |
tar xzvf ./onelab.tar.gz -C ./../..
become: true
- name: Cleaning latest installation
ansible.builtin.file:
path: "{{ onelab_path }}/installation/latest"
state: absent
- name: Flagging restored version as current
ansible.builtin.copy:
src: ../../installation/1.27.0/
dest: ../../installation/latest
directory_mode: no
remote_src: yes
# Load configuration
- include_vars:
file: "{{ onelab_path }}/configurations.yml"
# Perform reconfiguration
- include_tasks: "{{ onelab_path }}/installation/latest/app/playbooks/tasks/reconfigure-task.yml"
# Checking if volumes are existing
- name: Getting the list of docker volumes
shell: docker volume ls
become: true
register: volumes_result
# Removing volumes
- name: Resetting postgres database & cleaning cache
shell: |
docker volume rm onelab_pgdata -f
docker volume rm onelab_rabbitmq_data -f
become: true
when: "'rabbitmq' in volumes_result.stdout or 'pgdata' in volumes_result.stdout"
# Restoring database
- include_tasks: "{{ onelab_path }}/installation/latest/app/playbooks/tasks/start-db-only.yml"
- name: Restoring database
shell: >
docker exec -i $(docker ps --filter "name=onelab_db|onelab-db" -q) pg_restore -Upostgres -dpostgres -v -Fc < ./db.tar.gz
become: true
- include_tasks: "{{ onelab_path }}/installation/latest/app/playbooks/tasks/stop-db-only.yml"
# Start OneLab if OneLab was running
- include_tasks: "{{ onelab_path }}/installation/latest/app/playbooks/tasks/start-proxy.yml"
when: stack_count.stdout != "0"
- include_tasks: "{{ onelab_path }}/installation/latest/app/playbooks/tasks/start-onelab.yml"
when: stack_count.stdout != "0"

View File

@@ -0,0 +1,27 @@
#!/bin/bash
sudo yum install dnf
# update the DNF package repository cache
sudo dnf makecache
# To enable EPEL repository, install the epel-release package
sudo dnf install epel-release -y
# update the DNF package repository cache again
sudo dnf makecache
# Install Ansible
sudo dnf install ansible -y
# Create the ansible log file
sudo touch /var/log/ansible.log
# Provide permissions for ansible log file
sudo chmod 666 /var/log/ansible.log
# Update Ansible hosts file for local connection
sudo sed -i '$ a localhost ansible_connection=local' /etc/ansible/hosts
# Update Ansible configuration file with logs path
sudo sed -i '13 a log_path = /var/log/ansible.log' /etc/ansible/ansible.cfg

View File

@@ -0,0 +1,17 @@
#!/bin/bash
# Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# Install Docker Engine
sudo yum install docker-ce docker-ce-cli containerd.io -y
# Start Docker
sudo systemctl start docker
# Enable Docker
sudo systemctl enable docker

View File

@@ -0,0 +1,22 @@
#!/bin/bash
sudo sed -i '$ a deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y gnupg2
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt update
sudo apt install -y ansible
# Create the ansible log file
sudo touch /var/log/ansible.log
# Provide permissions for ansible log file
sudo chmod 666 /var/log/ansible.log
# Update Ansible hosts file for local connection
sudo sed -i '$ a localhost ansible_connection=local' /etc/ansible/hosts
# Update Ansible configuration file with logs path
sudo sed -i '13 a log_path = /var/log/ansible.log' /etc/ansible/ansible.cfg

View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Install Dependencies
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release -y
# Install Docker
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
sudo systemctl start docker
sudo systemctl enable docker
# Add user to docker group
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,13 @@
#!/bin/bash
sudo apt update
sudo apt install ansible
# Create the ansible log file
sudo touch /var/log/ansible.log
# Provide permissions for ansible log file
sudo chmod 666 /var/log/ansible.log

View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,13 @@
#!/bin/bash
sudo apt update
sudo apt install ansible
# Create the ansible log file
sudo touch /var/log/ansible.log
# Provide permissions for ansible log file
sudo chmod 666 /var/log/ansible.log

View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,19 @@
#!/bin/bash
sudo dnf install ansible -y
#Install openssl
sudo yum install openssl -y
# Create the ansible log file
sudo touch /var/log/ansible.log
# Provide permissions for ansible log file
sudo chmod 666 /var/log/ansible.log
# Update Ansible hosts file for local connection
sudo sed -i '$ a localhost ansible_connection=local' /etc/ansible/hosts
# Update Ansible configuration file with logs path
sudo sed -i '13 a log_path = /var/log/ansible.log' /etc/ansible/ansible.cfg

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Install the dnf-plugins-core package (which provides the commands to manage your DNF repositories)
sudo dnf -y install dnf-plugins-core -y
# Setup stable repository
sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo -y
# Install the latest version of Docker Engine and containerd
sudo dnf install docker-ce docker-ce-cli containerd.io -y
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Install Extra Packages for Linux
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
# Install Ansible
sudo yum install ansible -y
# Create the ansible log file
sudo touch /var/log/ansible.log
# Provide permissions for ansible log file
sudo chmod 666 /var/log/ansible.log
# Update Ansible hosts file for local connection
sudo sed -i '$ a localhost ansible_connection=local' /etc/ansible/hosts
# Update Ansible configuration file with logs path
sudo sed -i '13 a log_path = /var/log/ansible.log' /etc/ansible/ansible.cfg

View File

@@ -0,0 +1,27 @@
#!/bin/bash
# Install the yum-utils package
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# RHEL-7 requires the below dependencies to be installed to setup Docker
sudo yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm -y
sudo yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/fuse3-libs-3.6.1-4.el7.x86_64.rpm -y
sudo yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm -y
sudo yum install http://mirror.centos.org/centos/7/extras/x86_64/Packages/slirp4netns-0.4.3-4.el7_8.x86_64.rpm -y
# Ended dependencies installation
sudo yum install docker-ce -y
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,5 @@
#!/bin/bash
sudo dnf update
sudo dnf install ansible-core

View File

@@ -0,0 +1,15 @@
#!/bin/bash
sudo dnf update -y
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
# To verify which version of docker is available for installation
# sudo dnf list docker-ce
sudo dnf install docker-ce --nobest -y
sudo systemctl start docker
sudo systemctl enable docker
# Get current user and add to 'docker' group
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,5 @@
#!/bin/bash
sudo dnf update
sudo dnf install ansible-core

View File

@@ -0,0 +1,15 @@
#!/bin/bash
sudo dnf update -y
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
# To verify which version of docker is available for installation
# sudo dnf list docker-ce
sudo dnf install docker-ce --nobest -y
sudo systemctl start docker
sudo systemctl enable docker
# Get current user and add to 'docker' group
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Install Dependencies
sudo apt update
sudo apt install software-properties-common
# Install Ansible
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt update
sudo apt install ansible
# Create the ansible log file
sudo touch /var/log/ansible.log
# Provide permissions for ansible log file
sudo chmod 666 /var/log/ansible.log
# Update Ansible hosts file for local connection
sudo sed -i '$ a localhost ansible_connection=local' /etc/ansible/hosts
# Update Ansible configuration file with logs path
sudo sed -i '13 a log_path = /var/log/ansible.log' /etc/ansible/ansible.cfg

View File

@@ -0,0 +1,23 @@
#!/bin/bash
# Install Dependencies
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# Install Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
# Add user to docker group
sudo usermod -aG docker $USER

View File

@@ -0,0 +1,14 @@
# /etc/systemd/system/onelab.service
[Unit]
Description=OneLab
Requires=docker.service
After=docker.service
[Service]
Type=simple
RemainAfterExit=yes
ExecStart={{ ansiblebin_result.stdout }} {{ playbook_dir.split('/onelab-enterprise-installer')[0].split('/onelab/installation')[0] }}/onelab/installation/latest/app/playbooks/deploy.yml
ExecStop={{ ansiblebin_result.stdout }} {{ playbook_dir.split('/onelab-enterprise-installer')[0].split('/onelab/installation')[0] }}/onelab/installation/latest/app/playbooks/stop.yml
[Install]
WantedBy=default.target