From 7d6fee478123e55baf73028cd07dd762203e0a56 Mon Sep 17 00:00:00 2001 From: shockrah Date: Tue, 8 Nov 2022 22:11:12 -0800 Subject: [PATCH] Adding first 3 steps/playbooks for setting up atlas Drives are now mounted and services are ready to be spun up at this point --- playbooks/atlas/init/perma-mount-drives.yml | 50 +++++++++++++++++++++ playbooks/atlas/init/system-deps.yml | 39 ++++++++++++++++ playbooks/atlas/vars/drives.yml | 5 +++ 3 files changed, 94 insertions(+) create mode 100644 playbooks/atlas/init/perma-mount-drives.yml create mode 100644 playbooks/atlas/init/system-deps.yml create mode 100644 playbooks/atlas/vars/drives.yml diff --git a/playbooks/atlas/init/perma-mount-drives.yml b/playbooks/atlas/init/perma-mount-drives.yml new file mode 100644 index 0000000..34146e3 --- /dev/null +++ b/playbooks/atlas/init/perma-mount-drives.yml @@ -0,0 +1,50 @@ +# This ensures that the mount points for our docker volumes are present and +# populated correctly +--- +- hosts: atlas + become: yes + vars: + filesystem: ext4 + tasks: + - name: Fetch vars for getting mount points + include_vars: + file: ../vars/drives.yml + + - name: Creat mountpoints for mounted volumes + file: + path: "{{ item }}" + state: directory + owner: ubuntu + loop: + - "{{ CLIPPABLE_MOUNT_POINT }}" + - "{{ FILEBROWSER_MOUNT_POINT }}" + + - name: Partition Devices + community.general.parted: + device: "{{ item }}" + number: 1 + label: gpt + part_start: 0% + part_end: 100% + name: data + loop: + - "{{ FILEBROWSER_DRIVE }}" + - "{{ CLIPPABLE_DRIVE }}" + + - name: Format the drive for use + community.general.filesystem: + dev: "{{ item }}" + fstype: "{{ filesystem }}" + loop: + - "{{ FILEBROWSER_DRIVE }}" + - "{{ CLIPPABLE_DRIVE }}" + + - name: Permanently Mount Drives + mount: + state: mounted + path: "{{ item.dst }}" + src: "{{ item.src }}" + fstype: "{{ filesystem }}" + loop: + - { src: "{{ FILEBROWSER_DRIVE }}", dst: "{{ FILEBROWSER_MOUNT_POINT }}" } + - { src: "{{ CLIPPABLE_DRIVE }}", dst: "{{ CLIPPABLE_MOUNT_POINT }}" } diff --git a/playbooks/atlas/init/system-deps.yml b/playbooks/atlas/init/system-deps.yml new file mode 100644 index 0000000..1305427 --- /dev/null +++ b/playbooks/atlas/init/system-deps.yml @@ -0,0 +1,39 @@ +# This playbook downloads all the basic requirements to give containers +# an environment where they can be brought up safely. We focus primarily +# on the host with this playbook +--- +- hosts: atlas + become: yes + become_method: sudo + tasks: + - name: Install docker dependencies + apt: + name: "{{item}}" + update_cache: yes + loop: + - apt-transport-https + - ca-certificates + - curl + - gnupg + - software-properties-common + - lsb-release + + - name: Install docker GPG key + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + + - name: Add Docker Apt Repo + apt_repository: + repo: deb https://download.docker.com/linux/ubuntu impish stable + state: present + + - name: Install Docker components + apt: + name: "{{item}}" + update_cache: yes + loop: + - docker-ce + - docker-ce-cli + - containerd.io + diff --git a/playbooks/atlas/vars/drives.yml b/playbooks/atlas/vars/drives.yml new file mode 100644 index 0000000..24e2ce2 --- /dev/null +++ b/playbooks/atlas/vars/drives.yml @@ -0,0 +1,5 @@ +# These vars are really only used to configure the host for the first time +CLIPPABLE_MOUNT_POINT: /mnt/clippable +CLIPPABLE_DRIVE: /dev/nvme1n1 +FILEBROWSER_DRIVE: /dev/nvme2n1 +FILEBROWSER_MOUNT_POINT: /mnt/filebrowser