Compare commits

..

5 Commits

Author SHA1 Message Date
e8fe024b77 roles/git: ssh known_hosts is now idempotent
- roles/git now uses blockinfile to ensure the github ssh keypairs are trusted, and to allow subsequent ssh keypairs to be trusted and not overwritten by future runs.
- this commit marks idempotency for all roles. after a successful run of this playbook, subsequent runs will result in a change=0 !!!!!
2023-01-19 20:50:30 -06:00
3d75ac18e7 roles/gitea: better gitea installation condition 2023-01-19 18:03:49 -06:00
c6ea8eaf38 roles: minor idempotency changes 2023-01-19 18:02:55 -06:00
e3d3ec37fd roles/gitea: installing gitea is now idempotent 2023-01-19 15:11:22 -06:00
2d3fbfe484 removed stale github workflow 2023-01-18 20:36:30 -06:00
5 changed files with 41 additions and 53 deletions

View File

@ -1,27 +0,0 @@
# name: Run Playbook
# on:
# push:
# tags:
# - "v*.*.*"
# jobs:
# deploy:
# runs-on: ubuntu-latest
# steps:
# - name: Set up Git repository
# uses: actions/checkout@v3
# with:
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
# submodules: recursive
# - name: Run Ansible-Playbook
# uses: dawidd6/action-ansible-playbook@v2
# with:
# playbook: run.yml
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# inventory: |
# [hosts]
# openpunk-vps ansible_host=96.30.199.68 ansible_user=root ansible_connection=ssh
# vault_password: ${{ secrets.VAULT_PASSWORD }}
# options: |
# --extra-vars domain=openpunk.com

View File

@ -1,17 +1,4 @@
--- ---
# TODO: make idempotent
- 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
# TODO: make idempotent
- name: Set key perms
shell: sudo chmod 644 /etc/apt/trusted.gpg.d/morph027-gitea.gpg
- name: Add Gitea repo
apt_repository:
filename: morph027-gitea
repo: deb https://packaging.gitlab.io/gitea gitea main
- name: Upgrade Packages - name: Upgrade Packages
apt: apt:
update_cache: yes update_cache: yes
@ -21,7 +8,6 @@
package: package:
name: name:
- hugo - hugo
- gitea
- git - git
- nginx - nginx
- tor - tor
@ -32,9 +18,10 @@
- zsh # :D - zsh # :D
- python3-certbot-nginx - python3-certbot-nginx
# TODO: make idempotent - name: Setup zsh
- name: Setup default shell (zsh) user:
shell: chsh -s /usr/bin/zsh name: "{{ ansible_user }}"
shell: /usr/bin/zsh
- name: Clone Powerlevel10k theme - name: Clone Powerlevel10k theme
git: git:

View File

@ -9,21 +9,22 @@
# 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
changed_when: false
- name: Update known_hosts - name: Update .ssh/known_hosts
copy: blockinfile:
content: "{{ ssh_scan.stdout_lines|join('\n') }}" path: /root/.ssh/known_hosts
dest: /root/.ssh/known_hosts block: "{{ ssh_scan.stdout_lines|join('\n') }}"
insertbefore: BOF
create: yes
owner: root owner: root
mode: u=rw,g=,o= mode: u=rw,g=,o=
force: no # if we already have a known_hosts file, ignore!
# this keypair is trusted under my github account, so it allows my vps to make pushes # this keypair is trusted under my github account, so it allows my vps to make pushes
# to the main branch of my openpunk repository. (for my deadswitch: see static/blog/imdead.sh) # to the main branch of my openpunk repository. (see roles/deadswitchfiles/imdead.sh)
- name: Install ssh priv key - name: Install ssh priv key
copy: copy:

View File

@ -1,7 +1,34 @@
--- ---
- name: Check if Gitea is installed
shell: gitea --version
register: validate_gitea
changed_when: no
- name: Add Gitea key && repository
block:
- name: Check for Gitea gpg key
stat:
path: /etc/apt/trusted.gpg.d/morph027-gitea.gpg
register: gitea_key
- name: Import Gitea 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 && sudo chmod 644 /etc/apt/trusted.gpg.d/morph027-gitea.gpg
when: gitea_key.stat.exists == false or gitea_key.stat.mode != "0644"
- name: Add Gitea repository
apt_repository:
filename: morph027-gitea
repo: deb https://packaging.gitlab.io/gitea gitea main
when: '"not found" in validate_gitea.stdout'
- name: Install Gitea
package:
name:
- gitea
- name: Configure Gitea - name: Configure Gitea
template: template:
src: app.ini src: templates/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,7 +1,7 @@
--- ---
- name: Install torrc - name: Install torrc
template: template:
src: torrc src: templates/torrc
dest: /etc/tor/torrc dest: /etc/tor/torrc
owner: root owner: root
group: root group: root