refactor: clean up directories and start standardized role names

main
Jef Roosens 2025-04-24 17:01:03 +02:00
parent e2ef196a62
commit 2ae759025c
No known key found for this signature in database
GPG Key ID: 21FD3D77D56BAF49
25 changed files with 160 additions and 0 deletions

View File

@ -1,3 +1,4 @@
[defaults]
vault_password_file = .ansible-password
inventory = hosts.ini
roles_path = roles

View File

@ -0,0 +1,14 @@
; [nas]
; 213.119.99.214 ansible_ssh_port=2223 static_ip=192.168.0.3
[ruby]
213.119.99.214 ansible_ssh_port=2222 static_ip=192.168.0.2
[gitea]
213.119.99.214 ansible_ssh_port=2222 static_ip=192.168.0.2
[web]
213.119.99.214 ansible_ssh_port=2223 static_ip=192.168.0.3
; [actual]
; 213.119.99.214 ansible_ssh_port=2223 static_ip=192.168.0.3

View File

@ -0,0 +1,2 @@
[pearl]
192.168.56.2 ansible_ssh_user=vagrant ansible_ssh_private_key_file='.vagrant/machines/pearl/virtualbox/private_key'

14
plays/pearl.yml 100644
View File

@ -0,0 +1,14 @@
---
- hosts: pearl
gather_facts: false
become: true
roles:
- 'any.common.python'
tags: base
- hosts: pearl
become: true
roles:
# - 'any.common.enable-testing'
- 'any.common.debian-user'
tags: base

View File

@ -0,0 +1,5 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCkDjXuZn+blanbJAhte8KttrpeCPeT5CGcZ5mlAZv724wTa4qebpwCnf4SK4aFuDQEuCusnia3+X7YWAyCDReNURznAWCtq+b8LGxyIm2hTBbLA1m8sj0xidR/djlUtOwDp9VpSNamUWyiPWJ+WNsPd9xLJ6BK3qRsoFiMN87sO12L7DHHDaMze628Oc+IxFd+VZnH0dPVgitis31f+lXCr8w5qSiEepDJ8Nde8M+Ev1RrPQbR5Q5C+wYxlbY0oPNlGqSrs5i1jJl0BVMI4DlibxatTfuteU5IwcDMQObJr3xJGKNTPswSdzpfJFrLfUBZvsDs94BXEHR2CtxZ4aLQPeLfosWe4zuGvX22p7TzSPx1LkuqIF85Tw1PvK3f7u3l9sozHORAo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cCTP0IE/ANIXJJIMWEg4f5riS8uv3KuypkzQC47XN roosensjef@gmail.com

View File

@ -0,0 +1,38 @@
---
- name: Install sudo.
apt:
name: sudo
state: present
- name: Create data group.
group:
name: data
gid: 1002
- name: Create debian user.
user:
name: debian
groups:
- sudo
- data
append: true
create_home: yes
shell: /bin/bash
password: "{{ debian_pass | password_hash('sha512') }}"
update_password: on_create
- name: Create SSH directory.
file:
path: /home/debian/.ssh/
state: directory
owner: debian
group: debian
mode: '700'
- name: Add authorized SSH keys.
copy:
src: authorized_keys
dest: /home/debian/.ssh/authorized_keys
owner: debian
group: debian
mode: '600'

View File

@ -0,0 +1,10 @@
deb http://deb.debian.org/debian/ trixie main non-free-firmware
deb-src http://deb.debian.org/debian/ trixie main non-free-firmware
deb http://security.debian.org/debian-security trixie-security main non-free-firmware
deb-src http://security.debian.org/debian-security trixie-security main non-free-firmware
# trixie-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://deb.debian.org/debian/ trixie-updates main non-free-firmware
deb-src http://deb.debian.org/debian/ trixie-updates main non-free-firmware

View File

@ -0,0 +1,17 @@
---
- ansible.builtin.copy:
src: 'sources.list'
dest: '/etc/apt/sources.list'
owner: 'root'
group: 'root'
mode: '0644'
- name: Upgrade all packages to the latest version in testing
ansible.builtin.apt:
upgrade: dist
update_cache: yes
cache_valid_time: 3600
- name: Clean up unused packages
ansible.builtin.apt:
autoremove: yes

View File

@ -0,0 +1,5 @@
---
- name: Update package database
raw: apt update
- name: Install Python
raw: apt install --yes python3

View File

@ -0,0 +1,14 @@
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
import *.Caddyfile
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

View File

@ -0,0 +1,5 @@
---
- name: reload caddy
service:
name: caddy
state: reloaded

View File

@ -0,0 +1,35 @@
---
- name: Add Caddy GPG key
apt_key:
url: "https://dl.cloudsmith.io/public/caddy/stable/gpg.key"
state: present
- name: Add Caddy repositories
apt_repository:
repo: "{{ item }} https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main"
filename: 'caddy-stable'
state: present
with_items:
- deb
- deb-src
- name: Install Caddy
apt:
name: caddy
state: present
- name: Copy over Caddyfile
copy:
src: Caddyfile
dest: '/etc/caddy/Caddyfile'
owner: root
group: root
mode: '644'
notify: 'reload caddy'
- name: Ensure Caddy service is running & enabled
service:
name: caddy
state: started
enabled: true