commit e8f348bc362b4fa354f0eb3172769c5bd4fcbdf9 Author: Simon Bernier St-Pierre Date: Thu Apr 30 22:22:14 2026 -0400 initial commit diff --git a/.woodpecker/lint.yml b/.woodpecker/lint.yml new file mode 100644 index 0000000..d5fad4d --- /dev/null +++ b/.woodpecker/lint.yml @@ -0,0 +1,11 @@ +when: + - event: push + +steps: + - name: lint + image: alpine + commands: + - export PATH=$PATH:/root/.local/bin + - apk add --no-cache make pipx + - make setup + - make lint diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0837c06 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +.PHONY: setup +setup: + pipx install --include-deps yamllint + pipx install --include-deps ansible + pipx inject --include-apps ansible molecule + pipx inject --include-apps ansible ansible-lint + pipx inject ansible "molecule-plugins[docker,podman]" + +.PHONY: lint +lint: + yamllint -d "{extends: relaxed, rules: {line-length: disable}}" . + ansible-lint diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..1fb7fef --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,8 @@ +[defaults] +inventory = inventory.ini +host_key_checking = False +timeout = 60 +interpreter_python = auto + +[ssh_connection] +ssh_args=-o ControlMaster=auto -o ControlPersist=60s -o ControlPath=/tmp/ansible-ssh-%h-%p-%r -o ForwardAgent=yes diff --git a/hometheater.yml b/hometheater.yml new file mode 100755 index 0000000..0782f60 --- /dev/null +++ b/hometheater.yml @@ -0,0 +1,17 @@ +#!/usr/bin/env -S ansible-playbook --ask-pass --ask-become-pass +- name: Kubuntu Ansible + hosts: htpc + become: true + roles: + - role: firefox + tags: firefox + - role: network_shares + tags: network_shares + - role: nosnap + tags: nosnap + tasks: + - name: Install VLC + ansible.builtin.apt: + name: vlc + update_cache: true + cache_valid_time: 3600 diff --git a/inventory.ini b/inventory.ini new file mode 100644 index 0000000..9c4adf6 --- /dev/null +++ b/inventory.ini @@ -0,0 +1,5 @@ +[local] +127.0.0.1 ansible_connection=local + +[htpc] +aragorn.local ansible_user=simon diff --git a/roles/chrome/tasks/main.yml b/roles/chrome/tasks/main.yml new file mode 100644 index 0000000..d159f2b --- /dev/null +++ b/roles/chrome/tasks/main.yml @@ -0,0 +1,27 @@ +- name: Add Google apt repository key. + ansible.builtin.get_url: + url: https://dl.google.com/linux/linux_signing_key.pub + dest: /etc/apt/keyrings/google.asc + mode: "0644" + force: true + +- name: Add Google Repository + ansible.builtin.apt_repository: + repo: deb [arch=amd64 signed-by=/etc/apt/keyrings/google.asc] https://dl.google.com/linux/chrome/deb/ stable main + filename: google-chrome-ansible + state: present + +# https://support.google.com/chrome/a/answer/9052345?hl=en#zippy=%2Cstep-turn-off-chrome-browser-updates +- name: Disable google-chrome-stable sources + ansible.builtin.copy: + dest: /etc/default/google-chrome + content: | + repo_add_once="false" + repo_reenable_on_distupgrade="false" + mode: "0644" + +- name: Update apt and install google-chrome-stable + ansible.builtin.apt: + name: google-chrome-stable + state: present + update_cache: true diff --git a/roles/firefox/files/mozilla.pref b/roles/firefox/files/mozilla.pref new file mode 100644 index 0000000..ae0a1f9 --- /dev/null +++ b/roles/firefox/files/mozilla.pref @@ -0,0 +1,3 @@ +Package: * +Pin: origin packages.mozilla.org +Pin-Priority: 1000 diff --git a/roles/firefox/tasks/main.yml b/roles/firefox/tasks/main.yml new file mode 100644 index 0000000..4119a42 --- /dev/null +++ b/roles/firefox/tasks/main.yml @@ -0,0 +1,24 @@ +- name: Add Mozilla apt repository key. + ansible.builtin.get_url: + url: https://packages.mozilla.org/apt/repo-signing-key.gpg + dest: /etc/apt/keyrings/packages.mozilla.org.asc + mode: "0644" + force: true + +- name: Add Mozilla Repository + ansible.builtin.apt_repository: + repo: deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main + filename: mozilla + state: present + +- name: Copy Mozilla apt preferences + ansible.builtin.copy: + src: mozilla.pref + dest: /etc/apt/preferences.d/mozilla.pref + mode: "0644" + +- name: Update apt and install Firefox + ansible.builtin.apt: + name: firefox + state: present + update_cache: true diff --git a/roles/network_shares/files/mnt-tank.automount b/roles/network_shares/files/mnt-tank.automount new file mode 100644 index 0000000..f498fe0 --- /dev/null +++ b/roles/network_shares/files/mnt-tank.automount @@ -0,0 +1,9 @@ +[Unit] +Description=\\neo\tank automount + +[Automount] +Where=/mnt/tank +TimeoutIdleSec=300 + +[Install] +WantedBy=multi-user.target diff --git a/roles/network_shares/tasks/main.yml b/roles/network_shares/tasks/main.yml new file mode 100644 index 0000000..b19e565 --- /dev/null +++ b/roles/network_shares/tasks/main.yml @@ -0,0 +1,38 @@ +- name: Install cifs-utils + ansible.builtin.apt: + name: cifs-utils + update_cache: true + state: present + +- name: Lookup user name + ansible.builtin.set_fact: + network_shares_user_name: "{{ lookup('env', 'USER') }}" + +- name: Get user passwd info for {{ network_shares_user_name }} + ansible.builtin.getent: + database: passwd + key: "{{ network_shares_user_name }}" + +- name: Extract user id and gid + ansible.builtin.set_fact: + network_shares_user_id: "{{ ansible_facts.getent_passwd[network_shares_user_name].1 }}" + network_shares_user_gid: "{{ ansible_facts.getent_passwd[network_shares_user_name].2 }}" + +- name: Copy mount file + ansible.builtin.template: + src: mnt-tank.mount.j2 + dest: /etc/systemd/system/mnt-tank.mount + mode: "0644" + +- name: Copy automount file + ansible.builtin.copy: + src: mnt-tank.automount + dest: /etc/systemd/system/mnt-tank.automount + mode: "0644" + +- name: Enable automount + ansible.builtin.systemd_service: + name: mnt-tank.automount + enabled: true + daemon-reload: true + state: started diff --git a/roles/network_shares/templates/mnt-tank.mount.j2 b/roles/network_shares/templates/mnt-tank.mount.j2 new file mode 100644 index 0000000..f358560 --- /dev/null +++ b/roles/network_shares/templates/mnt-tank.mount.j2 @@ -0,0 +1,10 @@ +[Unit] +Description=\\neo\tank mount + +[Mount] +What=//192.168.0.200/tank +Where=/mnt/tank +Type=cifs +Options=guest,uid={{ network_shares_user_id }},gid={{ network_shares_user_gid }},iocharset=utf8,ro +LazyUnmount=true +TimeoutSec=10 diff --git a/roles/nosnap/files/nosnap.pref b/roles/nosnap/files/nosnap.pref new file mode 100644 index 0000000..6c5a93b --- /dev/null +++ b/roles/nosnap/files/nosnap.pref @@ -0,0 +1,7 @@ +# To prevent repository packages from triggering the installation of Snap, +# this file forbids snapd from being installed by APT. +# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html + +Package: snapd +Pin: release a=* +Pin-Priority: -10 diff --git a/roles/nosnap/tasks/main.yml b/roles/nosnap/tasks/main.yml new file mode 100644 index 0000000..2cf5274 --- /dev/null +++ b/roles/nosnap/tasks/main.yml @@ -0,0 +1,12 @@ +- name: Remove snapd + ansible.builtin.apt: + name: snapd + state: absent + autoremove: true + purge: true + +- name: Copy nosnap apt preferences + ansible.builtin.copy: + src: nosnap.pref + dest: /etc/apt/preferences.d/nosnap.pref + mode: "0644" diff --git a/roles/vscodium/tasks/main.yml b/roles/vscodium/tasks/main.yml new file mode 100644 index 0000000..c2b90e3 --- /dev/null +++ b/roles/vscodium/tasks/main.yml @@ -0,0 +1,17 @@ +- name: Add debian repo + ansible.builtin.deb822_repository: + name: vscodium + architectures: + - amd64 + - arm64 + types: deb + uris: https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs + suites: vscodium + components: main + signed_by: https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg + +- name: Install vscodium + ansible.builtin.apt: + name: codium + state: present + update_cache: true diff --git a/workstation.yml b/workstation.yml new file mode 100755 index 0000000..9012f90 --- /dev/null +++ b/workstation.yml @@ -0,0 +1,14 @@ +#!/usr/bin/env -S ansible-playbook --ask-become-pass +- name: Kubuntu Ansible + hosts: local + become_exe: "{{ 'sudo.ws' if ansible_facts.packages['sudo-rs'] is defined else 'sudo' }}" + become: true + roles: + - role: firefox + tags: firefox + - role: network_shares + tags: network_shares + - role: nosnap + tags: nosnap + - role: vscodium + tags: vscodium