You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
adc/ansible/roles/halo/tasks/main.yml

89 lines
2.6 KiB

---
# deploy a halo host
# boot strap server
- name: Install aptitude using apt
apt: name=aptitude state=latest update_cache=yes force_apt_get=yes
- name: Install required system packages for docker install
apt: name={{ item }} state=latest update_cache=yes
loop: [ 'apt-transport-https', 'ca-certificates', 'software-properties-common']
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: Add tailscale GPG apt Key
apt_key:
url: https://pkgs.tailscale.com/stable/debian/bullseye.noarmor.gpg
state: present
- name: Add tailscsale Repository
apt_repository:
repo: deb https://pkgs.tailscale.com/stable/debian bullseye main
state: present
- name: Update apt
apt: update_cache=yes
- name: Install required system packages
apt: name={{ sys_packages }} state=latest
- name: add 'josiah' to docker group
user:
name='josiah'
groups=docker
append=yes
- name: install python packages
pip:
name: ["jsondiff", "docker"]
# init new swarm, set up
- name: Init a new swarm with default parameters
docker_swarm:
state: present
advertise_addr: "100.108.51.49"
- name: ensure the app folders exist
file: state=directory path={{ item }} owner=josiah group=josiah mode=0700
loop: [ '/home/josiah/apps/smokeping/', '/home/josiah/apps/letsencrypt/', '/home/josiah/apps/smokeping/config/', '/home/josiah/apps/smokeping/data', '/home/josiah/apps/overseerr/config/' ]
- name: copy over awful-All config files
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0777
with_items:
- {src: 'halo-compose.yml', dest: '/home/josiah/apps/halo-compose.yml'}
- {src: 'traefik.yml', dest: '/home/josiah/apps/traefik/traefik.yml'}
- {src: 'Targets', dest: '/home/josiah/apps/smokeping/config/Targets'}
# you have to force remove the whole stack for some changes to take effect
# I have no idea which ones, but this solved a problem for me with traefik conifgs + multi networks.
- name: Remove the mediaserver stack
block:
- name: Remove the mediaserver stack
docker_stack:
state: absent
name: mediaserver
compose:
- /home/josiah/apps/halo/halo-compose.yml
- name: Pause so the network gets deleted too
pause:
seconds: 15
- name: Deploy halo stack
docker_stack:
state: present
name: halo
compose:
- /home/josiah/apps/halo-compose.yml