switched to roles

- all tasks/* have been moved to their own roles in roles/*
- each file && template is now oragnized per-role
- annotated each task which still isn't idempotent !TODO!
This commit is contained in:
CPunch 2023-01-14 17:26:17 -06:00
parent d435ab80ac
commit abaa4c9639
23 changed files with 33 additions and 24 deletions

View File

@ -4,6 +4,7 @@
repo: "https://github.com/CPunch/openpunk.git" repo: "https://github.com/CPunch/openpunk.git"
dest: "/var/www/{{ domain }}" dest: "/var/www/{{ domain }}"
# TODO: make idempotent
- name: Build blog - name: Build blog
command: command:
cmd: hugo cmd: hugo
@ -11,7 +12,7 @@
- name: Install updateBlog script - name: Install updateBlog script
template: template:
src: templates/blog/updateBlog src: templates/updateBlog
dest: /usr/local/bin/updateBlog dest: /usr/local/bin/updateBlog
mode: u+rx mode: u+rx

View File

@ -6,13 +6,13 @@
- name: Install deadswitch script - name: Install deadswitch script
copy: copy:
src: static/blog/deadswitch src: deadswitch
dest: /usr/local/bin/deadswitch dest: /usr/local/bin/deadswitch
mode: u+rx mode: u+rx
- name: Install imdead.sh - name: Install imdead.sh
copy: copy:
src: static/blog/imdead.sh src: imdead.sh
dest: /root/deadman/imdead.sh dest: /root/deadman/imdead.sh
mode: u+rx mode: u+rx
@ -22,6 +22,7 @@
dest: /root/deadman/dead.patch dest: /root/deadman/dead.patch
mode: u+rw mode: u+rw
# TODO: make idempotent
- name: Install deadtrigger - name: Install deadtrigger
file: file:
name: /root/.deadtrigger name: /root/.deadtrigger

View File

@ -1,7 +1,9 @@
--- ---
# TODO: make idempotent
- name: Add Gitea repo key - name: Add Gitea repo key
shell: curl -s https://packaging.gitlab.io/gitea/gpg.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/morph027-gitea.gpg --import shell: curl -s https://packaging.gitlab.io/gitea/gpg.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/morph027-gitea.gpg --import
# TODO: make idempotent
- name: Set key perms - name: Set key perms
shell: sudo chmod 644 /etc/apt/trusted.gpg.d/morph027-gitea.gpg shell: sudo chmod 644 /etc/apt/trusted.gpg.d/morph027-gitea.gpg
@ -30,6 +32,7 @@
- zsh # :D - zsh # :D
- python3-certbot-nginx - python3-certbot-nginx
# TODO: make idempotent
- name: Setup default shell (zsh) - name: Setup default shell (zsh)
shell: chsh -s /usr/bin/zsh shell: chsh -s /usr/bin/zsh
@ -41,6 +44,6 @@
- name: Install .zshrc - name: Install .zshrc
copy: copy:
src: static/.zshrc src: .zshrc
dest: /root/.zshrc dest: /root/.zshrc
force: no force: no

View File

@ -23,7 +23,7 @@
- name: Copy fail2ban jail config - name: Copy fail2ban jail config
copy: copy:
src: static/fail2ban/jails.local src: jails.local
dest: /etc/fail2ban/jail.d/jails.local dest: /etc/fail2ban/jail.d/jails.local
- name: Enable fail2ban service - name: Enable fail2ban service

View File

@ -1,7 +1,7 @@
--- ---
- name: Setup git config - name: Setup git config
copy: copy:
src: static/.gitconfig src: .gitconfig
dest: /root/.gitconfig dest: /root/.gitconfig
owner: root owner: root
mode: u=rw,g=,o= mode: u=rw,g=,o=
@ -9,6 +9,7 @@
# make sure our vps trusts the github.com key signature. we pipe the output # make sure our vps trusts the github.com key signature. we pipe the output
# of ssh-keyscan into .ssh/known_hosts # of ssh-keyscan into .ssh/known_hosts
# TODO: make idempotent
- name: Scan for SSH host keys - name: Scan for SSH host keys
command: ssh-keyscan github.com 2>/dev/null command: ssh-keyscan github.com 2>/dev/null
register: ssh_scan register: ssh_scan

View File

@ -1,7 +1,7 @@
--- ---
- name: Configure Gitea - name: Configure Gitea
template: template:
src: templates/gitea/app.ini src: app.ini
dest: /etc/gitea/app.ini dest: /etc/gitea/app.ini
owner: gitea owner: gitea
force: no # we don't want to kill our existing config D: force: no # we don't want to kill our existing config D:

View File

@ -1,5 +1,5 @@
--- ---
- name: Copy goaccess config - name: Copy goaccess config
copy: copy:
src: static/goaccess/goaccess.conf src: goaccess.conf
dest: /etc/goaccess/goaccess.conf dest: /etc/goaccess/goaccess.conf

View File

@ -1,9 +1,12 @@
--- ---
# TODO: make idempotent
- name: Remove default nginx config - name: Remove default nginx config
file: file:
name: /etc/nginx/sites-enabled name: /etc/nginx/sites-enabled
state: absent state: absent
# TODO: make idempotent
- name: Restore sites-enabled - name: Restore sites-enabled
file: file:
name: /etc/nginx/sites-enabled name: /etc/nginx/sites-enabled
@ -11,7 +14,7 @@
- name: Install system nginx config - name: Install system nginx config
copy: copy:
src: static/nginx/nginx.conf src: nginx.conf
dest: /etc/nginx/nginx.conf dest: /etc/nginx/nginx.conf
# setup our configs for each host (we don't want to # setup our configs for each host (we don't want to
@ -20,19 +23,19 @@
- name: Install nginx config for {{ domain }} - name: Install nginx config for {{ domain }}
template: template:
src: templates/nginx/site.conf src: templates/site.conf
dest: /etc/nginx/conf.d/{{ domain }}.conf dest: /etc/nginx/conf.d/{{ domain }}.conf
force: no force: no
- name: Install nginx config for git.{{ domain }} - name: Install nginx config for git.{{ domain }}
template: template:
src: templates/nginx/gitea.conf src: templates/gitea.conf
dest: /etc/nginx/conf.d/git.{{ domain }}.conf dest: /etc/nginx/conf.d/git.{{ domain }}.conf
force: no force: no
- name: Install nginx config for our Hidden Service - name: Install nginx config for our Hidden Service
template: template:
src: templates/nginx/tor.conf src: templates/tor.conf
dest: /etc/nginx/conf.d/tor-{{ domain }}.conf dest: /etc/nginx/conf.d/tor-{{ domain }}.conf
force: no force: no

View File

@ -1,7 +1,7 @@
--- ---
- name: Install torrc - name: Install torrc
template: template:
src: templates/tor/torrc src: torrc
dest: /etc/tor/torrc dest: /etc/tor/torrc
owner: root owner: root
group: root group: root
@ -23,7 +23,7 @@
group: debian-tor group: debian-tor
mode: u=rw,g=,o= mode: u=rw,g=,o=
- name: Reload Tor - name: Enable Tor Service
systemd: systemd:
name: tor name: tor
enabled: yes enabled: yes

20
run.yml
View File

@ -9,13 +9,13 @@
prompt: domain pointing to the vps prompt: domain pointing to the vps
private: no private: no
tasks: roles:
- import_tasks: tasks/essential.yml - essential
- import_tasks: tasks/firewall.yml - git
- import_tasks: tasks/blog.yml - deadswitch
- import_tasks: tasks/gitea.yml - firewall
- import_tasks: tasks/tor.yml - blog
- import_tasks: tasks/nginx.yml - gitea
- import_tasks: tasks/git.yml - nginx
- import_tasks: tasks/goaccess.yml - goaccess
- import_tasks: tasks/deadswitch.yml - tor