Add Linode setup and mergerfs (#11)
parent
f271baa7d8
commit
9208ba6c95
@ -1,3 +1,4 @@
|
||||
.idea
|
||||
venv
|
||||
stack.env
|
||||
linodehosts.ini
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
[servers]
|
||||
localhost
|
||||
@ -1,53 +0,0 @@
|
||||
---
|
||||
- hosts: servers
|
||||
vars_files:
|
||||
- ../variables.yml
|
||||
become: true
|
||||
tasks:
|
||||
- name: Ensure /mnt/hdds directory
|
||||
file:
|
||||
path: /mnt/hdds
|
||||
state: directory
|
||||
|
||||
- name: Unmount HDDS
|
||||
ansible.posix.mount:
|
||||
path: /mnt/hdds/
|
||||
src: "UUID={{hdds_uuid}}"
|
||||
fstype: ext4
|
||||
state: unmounted
|
||||
opts: defaults,nofail
|
||||
|
||||
- name: Make /mnt/hdds immutable
|
||||
ansible.builtin.shell: chattr +i /mnt/hdds
|
||||
|
||||
- name: Mount HDDS
|
||||
ansible.posix.mount:
|
||||
path: /mnt/hdds
|
||||
src: "UUID={{hdds_uuid}}"
|
||||
fstype: ext4
|
||||
state: mounted
|
||||
opts: defaults,nofail
|
||||
|
||||
- name: Ensure /mnt/ssd0 directory
|
||||
file:
|
||||
path: /mnt/ssd0
|
||||
state: directory
|
||||
|
||||
- name: Unmount SSD0
|
||||
ansible.posix.mount:
|
||||
path: /mnt/ssd0/
|
||||
src: "UUID={{ssd0_uuid}}"
|
||||
fstype: ext4
|
||||
state: unmounted
|
||||
opts: defaults,nofail
|
||||
|
||||
- name: Make /mnt/ssd0 immutable
|
||||
ansible.builtin.shell: chattr +i /mnt/ssd0
|
||||
|
||||
- name: Mount SSD0
|
||||
ansible.posix.mount:
|
||||
path: /mnt/ssd0/
|
||||
src: "UUID={{ssd0_uuid}}"
|
||||
fstype: ext4
|
||||
state: mounted
|
||||
opts: defaults,nofail
|
||||
@ -1,11 +0,0 @@
|
||||
---
|
||||
- hosts: servers
|
||||
vars_files:
|
||||
- ../variables.yml
|
||||
become: true
|
||||
tasks:
|
||||
- name: Checkout Git Repos
|
||||
import_tasks: ../tasks/checkout-git-repos-tasks.yml
|
||||
|
||||
- name: Restart Dashy
|
||||
ansible.builtin.command: docker restart dashy
|
||||
@ -1,163 +0,0 @@
|
||||
###
|
||||
# restore-all restores a manually specified list of volumes.
|
||||
# This is intended for user when initially setting up a home lab environment
|
||||
# and want to restore all applications from existing backups
|
||||
#
|
||||
# Restores will be skipped if there is no archive in the backup directory.
|
||||
#
|
||||
# If a container exists, it will be stopped, restored and started
|
||||
# If a container does not exist, the volume will be still be created.
|
||||
###
|
||||
|
||||
############################################
|
||||
# TODO: add a command which lists all the stack, and each stack can list all the containers. From there we can iterate
|
||||
# through each container in the stack calling restore-volume-tasks.yml and then call create-stack-tasks.yml
|
||||
############################################
|
||||
|
||||
---
|
||||
- name: Redeploy Portainer and All Volumes
|
||||
hosts: servers
|
||||
vars_files:
|
||||
- ../variables.yml
|
||||
- ~/.homelab/variables.yml
|
||||
tasks:
|
||||
- name: Create next cloud a network
|
||||
docker_network:
|
||||
name: nextcloud_net
|
||||
|
||||
# The docker volume backup image utilizes these images
|
||||
- name: Pull ubuntu
|
||||
docker_image:
|
||||
name: ubuntu
|
||||
source: pull
|
||||
- name: Pull busybox
|
||||
docker_image:
|
||||
name: busybox
|
||||
source: pull
|
||||
- name: Pull docker-volume-backup
|
||||
docker_image:
|
||||
name: "{{docker_volume_backup_image}}"
|
||||
source: pull
|
||||
- name: Pull start-portainer-stack
|
||||
docker_image:
|
||||
name: ghcr.io/chatton/start-portainer-stack:master
|
||||
source: pull
|
||||
|
||||
- name: Restore Portainer
|
||||
import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
vars:
|
||||
container_name: "portainer"
|
||||
|
||||
- name: "Restore {{item}}"
|
||||
import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
vars:
|
||||
container_name: "{{item}}"
|
||||
with_items: {{stacks}}
|
||||
|
||||
- name: "Start {{item}} Stack"
|
||||
import_tasks: ../tasks/create-stack-tasks.yml
|
||||
vars:
|
||||
stack_name: "{{item}}"
|
||||
with_items: {{stacks}}
|
||||
|
||||
|
||||
# - name: Restore Linkding
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "linkding"
|
||||
#
|
||||
# - name: Start Linkding Stack
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "linkding"
|
||||
#
|
||||
# - name: Restore Nginx Proxy Manager
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "nginx-proxy-manager"
|
||||
#
|
||||
# - name: Start Nginx Proxy Manager
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "nginx-proxy-manager"
|
||||
#
|
||||
# - name: Restore Vpn Stack
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "vpn-stack"
|
||||
#
|
||||
# - name: Start Vpn Stack
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "vpn-stack"
|
||||
#
|
||||
#
|
||||
# - name: Restore MariaDB
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "mariadb"
|
||||
#
|
||||
# - name: Start MariaDB
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "mariadb"
|
||||
#
|
||||
# - name: Restore Nextcloud
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "nextcloud"
|
||||
#
|
||||
# - name: Start Nextcloud
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "nextcloud"
|
||||
#
|
||||
# - name: Restore Photoprism
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "photoprism"
|
||||
#
|
||||
# - name: Start Photoprism
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "photoprism"
|
||||
#
|
||||
# - name: Restore Plex
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "plex"
|
||||
#
|
||||
# - name: Start Plex
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "plex"
|
||||
#
|
||||
# - name: Restore Mealie
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "mealie"
|
||||
#
|
||||
# - name: Start Mealie
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "mealie"
|
||||
#
|
||||
# - name: Restore Overseerr
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "overseerr"
|
||||
#
|
||||
# - name: Start Overseerr
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "overseerr"
|
||||
#
|
||||
# - name: Restore Uptime Kuma
|
||||
# import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
# vars:
|
||||
# container_name: "uptime-kuma"
|
||||
#
|
||||
# - name: Start Uptime Kuma
|
||||
# import_tasks: ../tasks/create-stack-tasks.yml
|
||||
# vars:
|
||||
# stack_name: "uptime-kuma"
|
||||
@ -1,34 +0,0 @@
|
||||
---
|
||||
- hosts: servers
|
||||
become: true
|
||||
vars_files:
|
||||
- ../variables.yml
|
||||
tasks:
|
||||
- name: Update and upgrade apt packages
|
||||
apt:
|
||||
upgrade: yes
|
||||
update_cache: yes
|
||||
cache_valid_time: 86400
|
||||
|
||||
- name: Install aptitude
|
||||
apt:
|
||||
name: aptitude
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Install Dev Tooling
|
||||
import_tasks: ../tasks/install-dev-tooling-tasks.yml
|
||||
|
||||
- name: Install & Configure Sudo
|
||||
import_tasks: ../tasks/install-sudo-tasks.yml
|
||||
|
||||
- name: Checkout Git Repos
|
||||
import_tasks: ../tasks/checkout-git-repos-tasks.yml
|
||||
|
||||
- name: Install Docker
|
||||
import_tasks: ../tasks/install-docker-tasks.yml
|
||||
|
||||
- name: Create and Portainer
|
||||
tags: "skip-e2e" # we can't mount volumes on test runners.
|
||||
community.docker.docker_compose:
|
||||
project_src: "{{home_lab_checkout_dir}}/docker-compose/portainer"
|
||||
@ -1,11 +0,0 @@
|
||||
### Example:
|
||||
# ansible-playbook -v ansible/playbooks/volume-restore.yml -e "container_name=mariadb"
|
||||
---
|
||||
- hosts: servers
|
||||
vars_files:
|
||||
- ../variables.yml
|
||||
tasks:
|
||||
- name: Restore Volume
|
||||
import_tasks: ../tasks/restore-volume-tasks.yml
|
||||
vars:
|
||||
container_name: "{{ container_name }}"
|
||||
@ -1,13 +0,0 @@
|
||||
---
|
||||
- name: Git checkout HomeLab repository
|
||||
ansible.builtin.git:
|
||||
repo: 'https://github.com/chatton/HomeLab.git'
|
||||
dest: "{{home_lab_checkout_dir}}"
|
||||
force: true
|
||||
version: master
|
||||
|
||||
- name: Change Ownership
|
||||
file:
|
||||
path: "{{home_lab_checkout_dir}}"
|
||||
owner: "{{homelab_user}}"
|
||||
group: "{{homelab_group}}"
|
||||
@ -1,7 +0,0 @@
|
||||
---
|
||||
- name: Start stack
|
||||
ansible.builtin.command: docker run --rm
|
||||
-e PORTAINER_USER_NAME=admin
|
||||
-e PORTAINER_PASSWORD="{{portainer_password}}"
|
||||
-e PORTAINER_BASE_URL="http://{{ansible_eth0.ipv4.address}}:9000"
|
||||
ghcr.io/chatton/start-portainer-stack:master "{{stack_name}}"
|
||||
@ -1,11 +0,0 @@
|
||||
---
|
||||
- name: Install Dev Tooling
|
||||
ansible.builtin.apt:
|
||||
pkg:
|
||||
- jq
|
||||
- fzf
|
||||
- git
|
||||
- mdadm
|
||||
- parted
|
||||
- ncdu
|
||||
- tree
|
||||
@ -1,74 +0,0 @@
|
||||
---
|
||||
- name: Install required system packages
|
||||
apt:
|
||||
pkg:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- curl
|
||||
- software-properties-common
|
||||
- python3-pip
|
||||
- virtualenv
|
||||
- python3-setuptools
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Add Docker GPG apt Key
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
|
||||
- name: Add Docker Repository
|
||||
apt_repository:
|
||||
repo: deb https://download.docker.com/linux/ubuntu focal stable
|
||||
state: present
|
||||
|
||||
- name: Update apt and install docker-ce
|
||||
apt:
|
||||
name: docker-ce
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Install Docker Module for Python
|
||||
pip:
|
||||
name: docker
|
||||
|
||||
- name: Install Docker Compose Module for Python
|
||||
pip:
|
||||
name: docker-compose
|
||||
|
||||
- name: Install docker-compose
|
||||
get_url:
|
||||
url : https://github.com/docker/compose/releases/download/1.25.1-rc1/docker-compose-Linux-x86_64
|
||||
dest: /usr/local/bin/docker-compose
|
||||
mode: 'u+x,g+x'
|
||||
#
|
||||
## Change the docker dir.
|
||||
#- name: Stop docker service
|
||||
# ansible.builtin.service:
|
||||
# name: docker
|
||||
# state: stopped
|
||||
#
|
||||
#- name: Change volume path
|
||||
# tags: "skip-e2e"
|
||||
# copy:
|
||||
# dest: "/etc/docker/daemon.json"
|
||||
# content: |
|
||||
# {
|
||||
# "data-root": "{{docker_daemon_data_root}}"
|
||||
# }
|
||||
#
|
||||
#- name: Backup old files
|
||||
# tags: "skip-e2e"
|
||||
# ansible.builtin.shell: cp -r /var/lib/docker /var/lib/docker.bak
|
||||
#
|
||||
#- name: Delete old docker directory
|
||||
# tags: "skip-e2e"
|
||||
# file:
|
||||
# state: absent
|
||||
# path: /var/lib/docker
|
||||
#
|
||||
#- name: Start docker service
|
||||
# tags: "skip-e2e"
|
||||
# ansible.builtin.service:
|
||||
# name: docker
|
||||
# state: started
|
||||
@ -1,27 +0,0 @@
|
||||
---
|
||||
# https://stackoverflow.com/questions/37333305/ansible-create-a-user-with-sudo-privileges
|
||||
- name: Install Sudo
|
||||
apt:
|
||||
pkg:
|
||||
- sudo
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Make sure we have a '{{homelab_group}}' group
|
||||
group:
|
||||
name: "{{homelab_group}}"
|
||||
state: present
|
||||
- name: Allow '{{homelab_user}}' group to have passwordless sudo
|
||||
lineinfile:
|
||||
dest: /etc/sudoers
|
||||
state: present
|
||||
regexp: '^%{{homelab_user}}'
|
||||
line: '%{{homelab_user}} ALL=(ALL) NOPASSWD: ALL'
|
||||
validate: 'visudo -cf %s'
|
||||
|
||||
- name: Add User
|
||||
ansible.builtin.user:
|
||||
name: "{{homelab_user}}"
|
||||
comment: "{{homelab_user}} user"
|
||||
uid: 1000
|
||||
group: "{{homelab_group}}"
|
||||
@ -1,40 +0,0 @@
|
||||
---
|
||||
# https://stackoverflow.com/questions/45237632/ansible-w-docker-show-current-container-state
|
||||
- name: Get container info
|
||||
docker_container_info:
|
||||
name: "{{container_name}}"
|
||||
register: result
|
||||
# We find the volumes
|
||||
- name: Find volumes
|
||||
ansible.builtin.shell: docker run --rm
|
||||
-v /var/run/docker.sock:/var/run/docker.sock
|
||||
-v "{{backup_dir}}:{{backup_dir}}"
|
||||
"{{docker_volume_backup_image}}"
|
||||
list-backups
|
||||
--host-path "{{backup_dir}}"
|
||||
--volume-name-filter {{container_name}}
|
||||
--newest-only
|
||||
register: out
|
||||
|
||||
- name: Stop the container
|
||||
# not out.stdout is search("null") occurs when there is no volume in the backups dir
|
||||
when: result.exists and not out.stdout is search("null")
|
||||
docker_container:
|
||||
name: "{{container_name}}"
|
||||
state: stopped
|
||||
- name: Restore Volume
|
||||
ansible.builtin.command: docker run --rm
|
||||
-v /var/run/docker.sock:/var/run/docker.sock
|
||||
{{docker_volume_backup_image}}
|
||||
restore-volume
|
||||
--volume {{item.volumeName}}
|
||||
--archive {{item.absoluteFilePath}}
|
||||
with_items: "{{ out.stdout }}"
|
||||
# the output will be "null" if there are no backups. We simply skip if this is the case
|
||||
when: not out.stdout is search("null")
|
||||
- name: Start the container
|
||||
# not out.stdout is search("null") occurs when there is no volume in the backups dir
|
||||
when: result.exists and not out.stdout is search("null")
|
||||
docker_container:
|
||||
name: "{{container_name}}"
|
||||
state: started
|
||||
@ -1,23 +0,0 @@
|
||||
---
|
||||
homelab_user: cianhatton
|
||||
homelab_group: cianhatton
|
||||
backup_dir: /mnt/hdds/backups/
|
||||
docker_volume_backup_image: ghcr.io/chatton/docker-volume-backup:master
|
||||
home_lab_checkout_dir: /home/cianhatton/checkouts/HomeLab
|
||||
hdds_uuid: 8d6e8b33-7d7f-456b-9976-7baea0cf4260
|
||||
ssd0_uuid: c528bf82-61ab-4f3d-87e0-d1e6e02ef7ec
|
||||
#docker_daemon_data_root: /mnt/docker
|
||||
|
||||
networks:
|
||||
- nextcloud_net
|
||||
stacks:
|
||||
- linkding
|
||||
- nginx-proxy-manager
|
||||
- vpn-stack
|
||||
- mariadb
|
||||
- nextcloud
|
||||
- photoprism
|
||||
- plex
|
||||
- mealie
|
||||
- overseerr
|
||||
- uptime-kuma
|
||||
@ -1,4 +1,6 @@
|
||||
[defaults]
|
||||
default_module_path=library
|
||||
inventory=hosts.ini
|
||||
vault_password_file=.vault-pass
|
||||
vault_password_file=.vault-pass.sh
|
||||
host_key_checking = False
|
||||
enable_plugins = linode
|
||||
|
||||
@ -1,2 +1,5 @@
|
||||
[servers]
|
||||
cianhatton@qnap
|
||||
|
||||
[localhost]
|
||||
localhost ansible_connection=local ansible_python_interpreter=/Users/chatton/checkouts/ansible-homelab/venv/bin/python
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
---
|
||||
# https://www.linode.com/docs/guides/deploy-linodes-using-ansible/#plugin-parameters
|
||||
plugin: linode
|
||||
@ -0,0 +1,12 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
36356161663039666634393933383830653035633438343866643730303434353632383031303965
|
||||
3465343332353437616663643662343262373333366162300a373662386533363234636234633339
|
||||
35383439373430656130353938653531636563663066646265643838323230356231333836326262
|
||||
6439626538643837390a383039373366626637333738386332356361306131323133383534323462
|
||||
32376564376363663666383639313064316365353037356633363035373632313561643030643933
|
||||
34663533313231636162306465656433663634643038343938396462643261656238626432633136
|
||||
39356562353463353034373534386537313634326534623830616362336638396337386631663538
|
||||
30663236653532316461306636333536373836626537363430613961346137626261333238366234
|
||||
30633438653936316539326436393634366236616664383835396434373966333166366265636661
|
||||
39666335653265323565313831303264336331363339333532353939653330383362363965353032
|
||||
383434386133323961373833303262336439
|
||||
@ -0,0 +1,10 @@
|
||||
---
|
||||
# defaults file for setup_linode
|
||||
ssh_keys:
|
||||
- "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
||||
label: simple-linode
|
||||
|
||||
# hosts that are added to the generated .ini file.
|
||||
hosts:
|
||||
- user: root
|
||||
ip: "{{my_linode.instance.ipv4[0]}}"
|
||||
@ -0,0 +1,53 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
namespace: chatton
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: Include vault variables.
|
||||
include_vars: defaults/main-vault.yml
|
||||
|
||||
- name: Create a new Linode.
|
||||
linode_v4:
|
||||
label: "{{ label }}"
|
||||
access_token: "{{ token }}"
|
||||
type: g6-nanode-1
|
||||
region: us-east
|
||||
image: linode/debian11
|
||||
root_pass: "{{ password }}"
|
||||
authorized_keys: "{{ ssh_keys }}"
|
||||
group: servers
|
||||
state: present
|
||||
register: my_linode
|
||||
|
||||
|
||||
- name: Wait for SSH to come up
|
||||
local_action:
|
||||
module: wait_for
|
||||
host={{ my_linode.instance.ipv4[0] }}
|
||||
port=22
|
||||
search_regex=OpenSSH
|
||||
timeout=320
|
||||
|
||||
- name: Instance Details
|
||||
debug:
|
||||
msg: "{{my_linode}}"
|
||||
|
||||
- name: Template Hosts File
|
||||
template:
|
||||
src: hosts.j2
|
||||
dest: linodehosts.ini
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
[servers]
|
||||
{% for host in hosts %}
|
||||
{{host.user}}@{{host.ip}}
|
||||
{% endfor %}
|
||||
@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for setup_linode
|
||||
@ -0,0 +1,21 @@
|
||||
---
|
||||
# defaults file for setup_mergerfs
|
||||
mounts:
|
||||
- path: /mnt/mergerfs
|
||||
state: mounted
|
||||
branches:
|
||||
- "/mnt/data/device0"
|
||||
- "/mnt/data/device1"
|
||||
- "/mnt/data/device2"
|
||||
options: allow_other,use_ino
|
||||
|
||||
devices:
|
||||
- uuid: "a54c1bde-1400-4975-bf24-08c603ca3a11" # /dev/sdc1
|
||||
path: "/mnt/data/device0"
|
||||
- uuid: "727dddaa-f7a1-439a-995f-5f4d35322e08" # /dev/sdd1
|
||||
path: "/mnt/data/device1"
|
||||
- uuid: "f3cff115-9adc-4761-b1e9-e81055f3e0af" # /dev/sda1
|
||||
path: "/mnt/data/device2"
|
||||
# SSD for downloads / transcoding
|
||||
- uuid: "c528bf82-61ab-4f3d-87e0-d1e6e02ef7ec" # /dev/sdf
|
||||
path: "/mnt/ssd0/"
|
||||
@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for setup_mergerfs
|
||||
@ -0,0 +1,53 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
namespace: chatton
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
@ -0,0 +1,41 @@
|
||||
---
|
||||
# dangerous to use this as the device name changes when there are new drives.
|
||||
# can this be done with an ID?
|
||||
#- name: Create a ext4 filesystem on /dev/sdb1
|
||||
# filesystem:
|
||||
# fstype: ext4
|
||||
# dev: /dev/sdb1
|
||||
# state: present
|
||||
|
||||
- name: Mount Volumes
|
||||
mount:
|
||||
path: "{{item.path}}"
|
||||
src: "UUID={{item.uuid}}"
|
||||
fstype: ext4
|
||||
state: mounted
|
||||
opts: defaults,nofail
|
||||
loop: "{{ devices }}"
|
||||
register: volume_out
|
||||
|
||||
- debug: msg="{{volume_out}}"
|
||||
|
||||
# tasks file for setup_mergerfs
|
||||
- name: Create Mergefs directory
|
||||
file:
|
||||
path: /mnt/mergerfs
|
||||
state: directory
|
||||
owner: cianhatton
|
||||
group: cianhatton
|
||||
mode: 0775
|
||||
register: directory_creation
|
||||
|
||||
# Ensure the actual folder can't be written to only when it has just been created.
|
||||
- name: Make /mnt/mergerfs immutable
|
||||
command: chattr +i /mnt/mergerfs
|
||||
when: directory_creation.changed == true
|
||||
|
||||
- name: Create Mergerfs pool
|
||||
include_role:
|
||||
name: sprat.mergerfs
|
||||
vars:
|
||||
mergerfs_mounts: "{{mounts}}"
|
||||
@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for setup_mergerfs
|
||||
@ -1,7 +0,0 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: "Include chatton.samba"
|
||||
include_role:
|
||||
name: "chatton.samba"
|
||||
@ -1,13 +0,0 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: instance
|
||||
image: quay.io/centos/centos:stream8
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
name: ansible
|
||||
verifier:
|
||||
name: ansible
|
||||
@ -1,10 +0,0 @@
|
||||
---
|
||||
# This is an example playbook to execute Ansible tests.
|
||||
|
||||
- name: Verify
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Example assertion
|
||||
ansible.builtin.assert:
|
||||
that: true
|
||||
@ -1,2 +0,0 @@
|
||||
localhost
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- samba
|
||||
@ -0,0 +1,7 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
become: true
|
||||
vars:
|
||||
ansible_python_interpreter: /Users/chatton/checkouts/ansible-homelab/venv/bin/python
|
||||
roles:
|
||||
- role: 'roles/setup_linode'
|
||||
Loading…
Reference in New Issue