Edge node

This commit is contained in:
Brieuc Dubois 2024-01-19 18:32:10 +01:00
parent 84b8964354
commit c33b51a170
5 changed files with 104 additions and 0 deletions

11
edges/docker-compose.yaml Normal file
View File

@ -0,0 +1,11 @@
services:
gitea-runner:
container_name: gitea-runner
image: gitea/act_runner:latest
restart: unless-stopped
environment:
- GITEA_INSTANCE_URL=https://git.bhasher.com
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN}
volumes:
- /var/run/docker.sock:/var/run/docker.sock

8
edges/hosts.yaml Normal file
View File

@ -0,0 +1,8 @@
master:
hosts:
shp
edges:
hosts:
snode0

View File

@ -0,0 +1,20 @@
---
- hosts: edges
remote_user: pi
become: true
tasks:
- name: Copy docker compose files
ansible.builtin.copy:
src: .
dest: /home/pi/edge
- name: Start edge services
community.docker.docker_compose_v2:
project_src: /home/pi/edge
build: never
env_files: .env
state: present
register: output
- name: Show results
ansible.builtin.debug:
var: output

View File

@ -0,0 +1,60 @@
---
- hosts: edges
remote_user: pi
become: true
tasks:
- name: Remove conflicting packages
apt:
name: "{{item}}"
state: absent
update_cache: yes
loop:
- docker.io
- docker-doc
- docker-compose
- docker-compose-v2
- podman-docker
- containerd
- runc
- name: Install dependencies
apt:
name: "{{item}}"
state: present
update_cache: yes
loop:
- ca-certificates
- curl
- gnupg
- name: add GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: add docker repository to apt
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: install docker
apt:
name: "{{item}}"
state: latest
update_cache: yes
loop:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
- name: check docker is active
service:
name: docker
state: started
enabled: yes
- name: Ensure group "docker" exists
ansible.builtin.group:
name: docker
state: present
- name: adding ubuntu to docker group
user:
name: pi
groups: docker
append: yes

5
edges/requirements.yaml Normal file
View File

@ -0,0 +1,5 @@
---
collections:
- name: https://github.com/ansible-collections/community.docker
type: git
version: main