meow :3
This commit is contained in:
parent
667fc21c12
commit
75cacd3182
15 changed files with 125 additions and 148 deletions
6
flock.yml
Normal file
6
flock.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: Provision Guest
|
||||||
|
ansible.builtin.import_playbook: ./plays/provision-guest.yml
|
||||||
|
|
||||||
|
- name: Install Software
|
||||||
|
ansible.builtin.import_playbook: ./plays/install-software.yml
|
45
hosts.yml
45
hosts.yml
|
@ -1,45 +0,0 @@
|
||||||
templates:
|
|
||||||
hosts:
|
|
||||||
template-vm:
|
|
||||||
template-vm-docker:
|
|
||||||
template-lxc:
|
|
||||||
|
|
||||||
lxc:
|
|
||||||
hosts:
|
|
||||||
template-lxc:
|
|
||||||
ansible_user: root
|
|
||||||
ansible_ssh_user: root
|
|
||||||
jellyfin:
|
|
||||||
ansible_host: 10.0.1.105
|
|
||||||
technitium:
|
|
||||||
ansible_host: 10.0.1.111
|
|
||||||
immich:
|
|
||||||
ansible_host: 10.0.1.104
|
|
||||||
|
|
||||||
vm:
|
|
||||||
children:
|
|
||||||
docker:
|
|
||||||
hosts:
|
|
||||||
template-vm:
|
|
||||||
media-share:
|
|
||||||
ansible_host: 10.0.1.101
|
|
||||||
|
|
||||||
docker:
|
|
||||||
hosts:
|
|
||||||
template-vm-docker:
|
|
||||||
fern-garden:
|
|
||||||
ansible_host: 10.0.1.102
|
|
||||||
ferngarden-net:
|
|
||||||
ansible_host: 10.0.1.116
|
|
||||||
minecraft:
|
|
||||||
ansible_host: 10.0.1.107
|
|
||||||
|
|
||||||
nfs-client:
|
|
||||||
hosts:
|
|
||||||
fern-garden:
|
|
||||||
ferngarden-net:
|
|
||||||
jellyfin:
|
|
||||||
|
|
||||||
nfs-server:
|
|
||||||
hosts:
|
|
||||||
media-share:
|
|
40
inventory/hosts.yml
Normal file
40
inventory/hosts.yml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
ungrouped:
|
||||||
|
hosts:
|
||||||
|
technitium.local:
|
||||||
|
immich.local:
|
||||||
|
monitoring.local:
|
||||||
|
administration.local:
|
||||||
|
fern-garden.local:
|
||||||
|
ferngarden-net.local:
|
||||||
|
minecraft.local:
|
||||||
|
|
||||||
|
lxc:
|
||||||
|
hosts:
|
||||||
|
jellyfin.local:
|
||||||
|
technitium.local:
|
||||||
|
immich.local:
|
||||||
|
monitoring.local:
|
||||||
|
administration.local:
|
||||||
|
|
||||||
|
vm:
|
||||||
|
children:
|
||||||
|
docker:
|
||||||
|
hosts:
|
||||||
|
#media-share.local:
|
||||||
|
|
||||||
|
docker:
|
||||||
|
hosts:
|
||||||
|
fern-garden.local:
|
||||||
|
ferngarden-net.local:
|
||||||
|
minecraft.local:
|
||||||
|
|
||||||
|
nfs-client:
|
||||||
|
hosts:
|
||||||
|
fern-garden.local:
|
||||||
|
ferngarden-net.local:
|
||||||
|
jellyfin.local:
|
||||||
|
|
||||||
|
nfs-server:
|
||||||
|
hosts:
|
||||||
|
#media-share:
|
5
plays/install-software.yml
Normal file
5
plays/install-software.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- hosts: jellyfin.local
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- tomhesse.jellyfin
|
62
plays/provision-guest.yml
Normal file
62
plays/provision-guest.yml
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
resolv_nameservers:
|
||||||
|
- 10.0.1.1
|
||||||
|
roles:
|
||||||
|
- lifeofguenter.resolvconf
|
||||||
|
- hifis.toolkit.unattended_upgrades
|
||||||
|
tasks:
|
||||||
|
- import_tasks: ./tasks/provisioning/debian.yml
|
||||||
|
|
||||||
|
- hosts: vm
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- import_tasks: ./tasks/provisioning/vm.yml
|
||||||
|
|
||||||
|
- hosts: lxc
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- import_tasks: ./tasks/provisioning/lxc.yml
|
||||||
|
|
||||||
|
- hosts: docker
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
docker_users:
|
||||||
|
- fern
|
||||||
|
roles:
|
||||||
|
- geerlingguy.docker
|
||||||
|
|
||||||
|
- hosts: nfs-server
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- import_tasks: ./tasks/provisioning/mount-hdds.yml
|
||||||
|
|
||||||
|
- hosts: nfs-server
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
nfs_exports: [
|
||||||
|
"/export/film 10.0.1.0/24(rw,subtree_check,insecure,no_root_squash,anonuid=100,anongid=100)",
|
||||||
|
"/export/tv 10.0.1.0/24(rw,subtree_check,insecure,no_root_squash,anonuid=100,anongid=100)",
|
||||||
|
"/export/misc 10.0.1.0/24(rw,subtree_check,insecure,no_root_squash,anonuid=100,anongid=100)"
|
||||||
|
]
|
||||||
|
roles:
|
||||||
|
- geerlingguy.nfs
|
||||||
|
|
||||||
|
- hosts: nfs-client
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- import_tasks: ./tasks/provisioning/nfs-client.yml
|
||||||
|
|
||||||
|
- hosts: all
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
sshd_config_file: /etc/ssh/sshd_config
|
||||||
|
tasks:
|
||||||
|
- import_tasks: ./tasks/provisioning/post-install.yml
|
||||||
|
handlers:
|
||||||
|
- name: restart sshd
|
||||||
|
service:
|
||||||
|
name: sshd
|
||||||
|
state: restarted
|
|
@ -1,6 +1,6 @@
|
||||||
- name: Set a hostname
|
- name: Set a hostname
|
||||||
ansible.builtin.hostname:
|
ansible.builtin.hostname:
|
||||||
name: '{{ inventory_hostname }}'
|
name: '{{ inventory_hostname.split(".")[0] | lower }}'
|
||||||
use: debian
|
use: debian
|
||||||
|
|
||||||
- name: Set the timezone
|
- name: Set the timezone
|
||||||
|
@ -22,11 +22,6 @@
|
||||||
repo: deb https://mirror.aarnet.edu.au/debian-security bookworm-security main contrib
|
repo: deb https://mirror.aarnet.edu.au/debian-security bookworm-security main contrib
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Update sources & upgrade
|
|
||||||
apt:
|
|
||||||
update_cache: true
|
|
||||||
upgrade: dist
|
|
||||||
|
|
||||||
- name: Install some standard packages
|
- name: Install some standard packages
|
||||||
apt:
|
apt:
|
||||||
pkg:
|
pkg:
|
||||||
|
@ -54,9 +49,3 @@
|
||||||
user:
|
user:
|
||||||
name: fern
|
name: fern
|
||||||
shell: /usr/bin/fish
|
shell: /usr/bin/fish
|
||||||
|
|
||||||
- name: Set sudo rules
|
|
||||||
community.general.sudoers:
|
|
||||||
name: sudo
|
|
||||||
commands: ALL
|
|
||||||
user: fern
|
|
11
plays/tasks/provisioning/lxc.yml
Normal file
11
plays/tasks/provisioning/lxc.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
- name: Add SSH Key
|
||||||
|
ansible.posix.authorized_key:
|
||||||
|
user: fern
|
||||||
|
state: present
|
||||||
|
key: "{{ lookup('file', '/home/fern/.ssh/id_ed25519.pub') }}"
|
||||||
|
|
||||||
|
- name: Set sudo rules
|
||||||
|
community.general.sudoers:
|
||||||
|
name: sudo
|
||||||
|
commands: ALL
|
||||||
|
user: fern
|
|
@ -18,13 +18,3 @@
|
||||||
path: /export/misc
|
path: /export/misc
|
||||||
state: mounted
|
state: mounted
|
||||||
fstype: ext4
|
fstype: ext4
|
||||||
|
|
||||||
# - name: Set up NFS exports
|
|
||||||
# vars:
|
|
||||||
# nfs_exports: [
|
|
||||||
# "/export/film 10.0.1.0/24(rw,subtree_check,insecure,no_root_squash,anonuid=100,anongid=100)",
|
|
||||||
# "/export/tv 10.0.1.0/24(rw,subtree_check,insecure,no_root_squash,anonuid=100,anongid=100)",
|
|
||||||
# "/export/misc 10.0.1.0/24(rw,subtree_check,insecure,no_root_squash,anonuid=100,anongid=100)"
|
|
||||||
# ]
|
|
||||||
# include_role:
|
|
||||||
# name: ansible-role-nfs
|
|
|
@ -1,45 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: all:!template-lxc
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Provision a Debian installation
|
|
||||||
hosts: all
|
|
||||||
tasks:
|
|
||||||
- import_tasks: ./tasks/provisioning/distro/debian.yml
|
|
||||||
|
|
||||||
- name: Provision a VM
|
|
||||||
hosts: [ vm ]
|
|
||||||
tasks:
|
|
||||||
- import_tasks: ./tasks/provisioning/guest/vm.yml
|
|
||||||
|
|
||||||
- name: Provision an LXC Container
|
|
||||||
hosts: [ lxc ]
|
|
||||||
tasks:
|
|
||||||
- import_tasks: ./tasks/provisioning/guest/lxc.yml
|
|
||||||
|
|
||||||
- name: Install Docker
|
|
||||||
hosts: [ docker ]
|
|
||||||
tasks:
|
|
||||||
- import_tasks: ./tasks/provisioning/extras/docker.yml
|
|
||||||
|
|
||||||
- name: Add NFS Mount
|
|
||||||
hosts: [ nfs-client ]
|
|
||||||
tasks:
|
|
||||||
- import_tasks: ./tasks/provisioning/nfs/client.yml
|
|
||||||
|
|
||||||
- name: Install an NFS Server
|
|
||||||
hosts: [ nfs-server ]
|
|
||||||
tasks:
|
|
||||||
- import_tasks: ./tasks/provisioning/nfs/server.yml
|
|
||||||
|
|
||||||
- name: Secure SSH
|
|
||||||
hosts: all
|
|
||||||
vars:
|
|
||||||
sshd_config_file: /etc/ssh/sshd_config
|
|
||||||
tasks:
|
|
||||||
- import_tasks: ./tasks/provisioning/post-install/ssh.yml
|
|
||||||
handlers:
|
|
||||||
- name: restart sshd
|
|
||||||
service:
|
|
||||||
name: sshd
|
|
||||||
state: restarted
|
|
|
@ -1,31 +0,0 @@
|
||||||
- name: Install prerequisite packages
|
|
||||||
apt:
|
|
||||||
pkg:
|
|
||||||
- ca-certificates
|
|
||||||
- gnupg
|
|
||||||
|
|
||||||
- name: Add Docker GPG Key
|
|
||||||
apt_key:
|
|
||||||
url: https://download.docker.com/linux/ubuntu/gpg
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Add Docker repo
|
|
||||||
apt_repository:
|
|
||||||
repo: deb https://download.docker.com/linux/ubuntu focal stable
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Install Docker
|
|
||||||
apt:
|
|
||||||
update_cache: true
|
|
||||||
pkg:
|
|
||||||
- docker-ce
|
|
||||||
- docker-ce-cli
|
|
||||||
- containerd.io
|
|
||||||
- docker-buildx-plugin
|
|
||||||
- docker-compose-plugin
|
|
||||||
|
|
||||||
- name: Add '{{ ansible_user }}' to docker group
|
|
||||||
user:
|
|
||||||
name: fern
|
|
||||||
groups: docker
|
|
||||||
append: yes
|
|
|
@ -1,5 +0,0 @@
|
||||||
- name: Add YubiKey SSH Key
|
|
||||||
ansible.posix.authorized_key:
|
|
||||||
user: fern
|
|
||||||
state: present
|
|
||||||
key: "{{ lookup('file', '/home/fern/.ssh/id_ed25519_sk.pub') }}"
|
|
Loading…
Add table
Add a link
Reference in a new issue