Compare commits
19
Commits
dev
..
8829d1d574
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8829d1d574 | ||
|
|
1b10ee0cbe | ||
|
|
734bc70c1d | ||
|
|
5b67610fca | ||
|
|
cb27764a5b | ||
|
|
b8e5382601 | ||
|
|
a985059401 | ||
|
|
1a83508f90 | ||
|
|
38882a9940 | ||
|
|
040e37e2d8 | ||
|
|
8c0dd0f96c | ||
|
|
ee73f5321a | ||
|
|
bd5f44f4a0 | ||
|
|
2b743dbff6 | ||
|
|
76bdc4660f | ||
|
|
f659b2482b | ||
|
|
47be01ed29 | ||
|
|
ff8af7f799 | ||
|
|
598c2bb15f |
No files matched your search
@@ -1,23 +0,0 @@
|
||||
# .ansible-lint
|
||||
---
|
||||
skip_list:
|
||||
- command-instead-of-shell
|
||||
- key-order[task]
|
||||
- yaml[line-length]
|
||||
- yaml[colons]
|
||||
- jinja[spacing]
|
||||
- name[missing]
|
||||
- yaml[comments]
|
||||
- yaml[commas]
|
||||
- var-naming[pattern]
|
||||
- yaml[braces]
|
||||
|
||||
warn_list:
|
||||
- literal-compare
|
||||
- ignore-errors
|
||||
- no-changed-when
|
||||
- yaml[indentation]
|
||||
- risky-file-permissions
|
||||
- risky-shell-pipe
|
||||
- fqcn[action-core]
|
||||
- fqcn[action]
|
||||
@@ -1,5 +1,4 @@
|
||||
# ansible
|
||||
|
||||
Getting real with system management via ansible-pull.
|
||||
|
||||
Per-system configuration is handled via local files to the provisioned machine,
|
||||
@@ -11,144 +10,59 @@ accessed via the show-config and edit-config aliases.
|
||||
This setup is specific to the maintainer's devices and needs. You're welcome to
|
||||
use it as an example for your needs, but do not expect it to work as-is.
|
||||
|
||||
## Currently Supported Systems
|
||||
|
||||
This information is as of 2025-11-21.
|
||||
|
||||
### Primary
|
||||
|
||||
These are the operating systems used as my dailies.
|
||||
|
||||
#### Artix (`runit`)
|
||||
|
||||
2026-08-04: Completed adapting playbooks and now using this as a daily driver.
|
||||
|
||||
2026-07-31: Began experimenting and adapting playbooks using VMs.
|
||||
|
||||
#### Debian Trixie
|
||||
|
||||
This has been used as my primary server and workstation OS since at least 2024.
|
||||
|
||||
The `apt` version of `ansible` in both Bookworm and Trixie are sufficient,
|
||||
no longer need to use `ansible` out of `pip`.
|
||||
|
||||
Stopped using as a workstation on all devices by August 2026, still using as a server.
|
||||
|
||||
### Secondary
|
||||
|
||||
These are tested via my Docker project's `ProvisionsTests` containers
|
||||
but not currently used as daily drivers. [TBD: Link]()
|
||||
|
||||
#### Arch
|
||||
|
||||
TBD
|
||||
|
||||
#### Fedora
|
||||
|
||||
TBD
|
||||
|
||||
#### OpenSUSE
|
||||
|
||||
TBD
|
||||
|
||||
#### Ubuntu
|
||||
|
||||
TBD
|
||||
|
||||
## Previusly Supported Systems
|
||||
|
||||
## Currently Supported Linux Systems
|
||||
### Debian Family
|
||||
|
||||
#### Debian
|
||||
|
||||
100%, but only if using a recent enough version of Ansible. `pip` usually has a
|
||||
better version than `apt`.
|
||||
|
||||
#### Devuan (`runit`)
|
||||
|
||||
2026-09-14: Abandoned, did not support virtualization on runit and felt slow / clunky to Artix.
|
||||
|
||||
2026-08-13: Distribution is nearly fully dunctional.
|
||||
|
||||
2026-07-30: Distribution has beed added with a few caveats:
|
||||
|
||||
#### Ubuntu
|
||||
|
||||
100%, both server and desktop.
|
||||
|
||||
#### Pop!_OS
|
||||
|
||||
100%, have not used for a while though.
|
||||
|
||||
#### Mint
|
||||
|
||||
100%, but not really used, just tested once for fun.
|
||||
|
||||
#### Parrot Security OS (MATE)
|
||||
|
||||
100% for a while, but OS did not serve maintainer's needs and 404 errors were
|
||||
terrible while updating. Ubuntu Rolling Rhino filled the gap.
|
||||
|
||||
### Arch Family
|
||||
|
||||
#### Arch
|
||||
|
||||
100% at some point, including installation and configuration of a Desktop Environment.
|
||||
|
||||
#### Manjaro
|
||||
|
||||
100% at some point.
|
||||
|
||||
### Fedora Family
|
||||
|
||||
#### Fedora 35
|
||||
|
||||
Workstation: 100%,
|
||||
Workstation: 100%
|
||||
Server: 100%
|
||||
|
||||
### Suse Family
|
||||
|
||||
#### openSUSE Tumbleweed v2022-02-17
|
||||
|
||||
Generic: 100%,
|
||||
## Suse Family
|
||||
### openSUSE Tumbleweed v2022-02-17
|
||||
Generic: 100%
|
||||
Workstation: 100%
|
||||
|
||||
#### openSUSE Leap 15.4
|
||||
|
||||
### openSUSE Leap 15.4
|
||||
Generic: 100%
|
||||
Workstation: Currently failing at `[Workstation | Linux | Flatpak Distro | Package Manager | Install From Repo]` with message `Problem: nothing provides libedataserver-1.2.so.24 needed by the to be installed evolution-data-server-32bit-3.34.4-3.3.1.x86_64`.
|
||||
|
||||
### NixOS
|
||||
|
||||
99%, still need to get Telegraf going and refactor local.yml but everything else
|
||||
is working well. It is automatically implementing git.hyperling.com/me/env-nixos.
|
||||
|
||||
## Currently Supported Unix Systems
|
||||
### FreeBSD 12, 13
|
||||
|
||||
100%, although GUI is not working completely on 13 yet (dash-to-dock doesn't compile).
|
||||
Software choices are slightly more limited since not `flatpak`-enabled and not feeling a `ports` setup.
|
||||
|
||||
## Waiting To Be Tested
|
||||
|
||||
### Kali Linux
|
||||
|
||||
### Arch Linux ARM
|
||||
|
||||
Specifically for the Pinephone.
|
||||
|
||||
### Arch Linux x86
|
||||
|
||||
Would be great to have Arch get built up by this. Used for many years but left
|
||||
after update problems due to a long computer hiatus.
|
||||
|
||||
### Fedora Mobile
|
||||
|
||||
Specifically for the Pinephone.
|
||||
|
||||
## Unsupported
|
||||
|
||||
## Future Goals
|
||||
|
||||
Eventually some of the scripts and install files will be put into the files
|
||||
folder. This will allow initializing systems outside of the maintainer's home
|
||||
network.
|
||||
@@ -160,8 +74,6 @@ benefit has yet to be seen for some tasks. Shared facts will definitely continue
|
||||
to exist under the facts tree.
|
||||
|
||||
## Other Notes
|
||||
|
||||
### Get Setup Values
|
||||
|
||||
Use this command to see the variables for a system:
|
||||
`ansible localhost -m setup --connection=local`.
|
||||
@@ -1,7 +1,6 @@
|
||||
[defaults]
|
||||
inventory=hosts
|
||||
interpreter_python=auto_silent
|
||||
inject_facts_as_vars=True
|
||||
|
||||
[inventory]
|
||||
localhost_warning=False
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
# Facts that must be gathered after running tasks.
|
||||
|
||||
- name: General | Facts | Gather | Locate bash
|
||||
ansible.builtin.shell: which bash
|
||||
shell: which bash
|
||||
register: bash_exec
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Facts | Gather | Locate ansible-pull
|
||||
ansible.builtin.shell: which ansible-pull
|
||||
shell: which ansible-pull
|
||||
register: ansible_pull_exec
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Facts | Gather | Locate zsh
|
||||
ansible.builtin.shell: which zsh
|
||||
shell: which zsh
|
||||
register: zsh_exec
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
+37
-101
@@ -2,61 +2,39 @@
|
||||
# Define program names for package builtin.
|
||||
# This file is for ALL systems and should not include UI components.
|
||||
|
||||
- name: General | Facts | Package | Shared Defaults
|
||||
ansible.builtin.set_fact:
|
||||
- name: General | Facts | Packages | Shared Defaults
|
||||
set_fact:
|
||||
sshfs: sshfs
|
||||
tar: tar
|
||||
iftop: iftop
|
||||
nethogs: nethogs
|
||||
ntp_server: chrony
|
||||
dig: dig
|
||||
neofetch: fastfetch
|
||||
lightdm: lightdm
|
||||
sddm: sddm
|
||||
tmux: tmux
|
||||
base_devel: htop # Placeholder for Arch package.
|
||||
sendmail: msmtp
|
||||
sendmail_mta: msmtp-mta
|
||||
ca_certificates: ca-certificates
|
||||
locate: mlocate
|
||||
alsa: alsa-utils
|
||||
stress: stress
|
||||
jq: jq
|
||||
btop: btop
|
||||
xkb: x11-xkb-utils
|
||||
|
||||
- name: General | Facts | Package | Parrot OS Fixes
|
||||
ansible.builtin.set_fact:
|
||||
- name: General | Facts | Packages | Parrot OS Fixes
|
||||
set_fact:
|
||||
ansible_pkg_mgr: "apt"
|
||||
ansible_python_interpreter: "/usr/bin/python3"
|
||||
when: ansible_distribution == "Parrot OS"
|
||||
|
||||
- name: General | Facts | Package | apt
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
locate: locate
|
||||
opensshd: openssh-server
|
||||
microcode_amd: amd64-microcode
|
||||
microcode_intel: intel-microcode
|
||||
cron: cron
|
||||
encfs: encfs
|
||||
dig: dnsutils
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: General | Facts | Package | pacman
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
locate: mlocate
|
||||
opensshd: openssh
|
||||
microcode_amd: linux-firmware
|
||||
microcode_intel: intel-ucode
|
||||
cron: cronie
|
||||
encfs: encfs
|
||||
dig: bind
|
||||
base_devel: base-devel
|
||||
xkb: xorg-setxkbmap
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
|
||||
- name: General | Facts | Package | FreeBSD
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
sshfs: fusefs-sshfs
|
||||
locate: htop # Placeholder to prevent errors, locate built into FreeBSD.
|
||||
opensshd: htop # sshd comes installed on FreeBSD
|
||||
@@ -67,55 +45,48 @@
|
||||
encfs: fusefs-encfs
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
- name: General | Facts | Package | dnf (Fixes)
|
||||
ansible.builtin.set_fact:
|
||||
ansible_pkg_mgr: dnf
|
||||
when: ansible_pkg_mgr in ("dnf5")
|
||||
|
||||
- name: General | Facts | Package | dnf
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
sshfs: fuse-sshfs
|
||||
locate: plocate
|
||||
locate: mlocate
|
||||
opensshd: openssh
|
||||
microcode_amd: microcode_ctl
|
||||
microcode_intel: microcode_ctl
|
||||
cron: cronie
|
||||
encfs: fuse-encfs
|
||||
dig: bind-utils
|
||||
sendmail_mta: msmtp
|
||||
when: ansible_pkg_mgr == "dnf"
|
||||
|
||||
- name: General | Facts | Package | zypper
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
locate: plocate
|
||||
opensshd: openssh
|
||||
microcode_amd: ucode-amd
|
||||
microcode_intel: ucode-intel
|
||||
cron: cronie
|
||||
encfs: encfs
|
||||
dig: bind-utils
|
||||
when: ansible_pkg_mgr == "zypper"
|
||||
|
||||
|
||||
- name: General | Facts | Package | Update Command | Helpers
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
update_accept_var: '$accept'
|
||||
nix_days: 14
|
||||
ansible_distribution_file: "{{ prov_dir }}/ansible_distribution.txt"
|
||||
ansible_pkg_mgr_file: "{{ prov_dir }}/ansible_pkg_mgr.txt"
|
||||
|
||||
- name: General | Facts | Package | Update Command | Helpers | pacman
|
||||
set_fact:
|
||||
update_accept_var: '--noconfirm'
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
|
||||
- name: General | Facts | Package | Update Command | Store Variables
|
||||
ansible.builtin.shell: |
|
||||
set -o pipefail
|
||||
{{ item }}
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "echo '{{ ansible_distribution }}' > {{ ansible_distribution_file }}"
|
||||
- "echo '{{ ansible_pkg_mgr }}' > {{ ansible_pkg_mgr_file }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
|
||||
- name: General | Facts | Package | Update Command
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
update_package_manager: |
|
||||
|
||||
distribution="`cat {{ ansible_distribution_file }}`"
|
||||
@@ -124,59 +95,39 @@
|
||||
case $pkg_mgr in
|
||||
apt)
|
||||
if [[ $distribution != "ParrotOS" ]]; then
|
||||
echo -e "******* Apt *******\n*** Update Cache ***" &&
|
||||
echo "*** Apt ***" &&
|
||||
sudo apt update &&
|
||||
echo -e "\n*** Auto Remove ***" &&
|
||||
sudo apt autoremove --purge {{ update_accept_var }} &&
|
||||
echo -e "\n*** Clean ***" &&
|
||||
sudo apt autoremove {{ update_accept_var }} &&
|
||||
sudo apt clean {{ update_accept_var }} &&
|
||||
echo -e "Cleaned!\n\n*** Configure DPKG ***" &&
|
||||
sudo dpkg --configure -a &&
|
||||
echo -e "\n*** Fix Broken/Missing ***" &&
|
||||
sudo apt --fix-broken --fix-missing install &&
|
||||
echo -e "\n*** Upgrade ***" &&
|
||||
sudo apt dist-upgrade --allow-downgrades --fix-broken \
|
||||
--fix-missing {{ update_accept_var }} ||
|
||||
return 1
|
||||
else
|
||||
echo -e "******* Parrot *******\n*** Update Cache ***" &&
|
||||
echo "*** Parrot ***"
|
||||
sudo apt update &&
|
||||
echo -e "\n*** Auto Remove ***" &&
|
||||
sudo apt autoremove --purge {{ update_accept_var }} &&
|
||||
sudo apt autoremove {{ update_accept_var }} &&
|
||||
parrot_mirrors_suck=true &&
|
||||
while [[ $parrot_mirrors_suck ]]; do
|
||||
unset parrot_mirrors_suck
|
||||
echo -e "\n*** Upgrade ***"
|
||||
sudo parrot-upgrade
|
||||
if [[ $? != 0 ]]; then
|
||||
parrot_mirrors_suck=true
|
||||
echo -e "*** Update Cache, Again ***"
|
||||
sudo apt update --fix-missing
|
||||
fi
|
||||
done ||
|
||||
return 1
|
||||
fi
|
||||
echo -e "\n******* Mission Complete!! *******"
|
||||
;;
|
||||
|
||||
pacman)
|
||||
echo "*** Pacman ***"
|
||||
auto_accept="{{ update_accept_var }}"
|
||||
if [[ "$auto_accept" == "-y" ]]; then
|
||||
auto_accept="--noconfirm"
|
||||
if [[ "$accept" == "Y" ]]; then
|
||||
auto_accept="{{ update_accept_var }}"
|
||||
fi
|
||||
|
||||
sudo pacman -Syu $auto_accept --overwrite '/usr/lib/node_modules/*' ||
|
||||
sudo pacman -Syyu $auto_accept ||
|
||||
return 1
|
||||
echo -e "\n"
|
||||
|
||||
if [[ "$LOGNAME" != "root" ]]; then
|
||||
echo "*** AUR (yay) ***"
|
||||
yay --sudoloop -Syu $auto_accept || return 2
|
||||
else
|
||||
echo "*** User is root, skipping AUR (yay) ***"
|
||||
fi
|
||||
echo -e "\n"
|
||||
;;
|
||||
|
||||
pkg | pkgng)
|
||||
@@ -267,55 +218,40 @@
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
update_npm: |
|
||||
## Let's let the distro package managers handle this, otherwise may end up
|
||||
## breaking dependencies or causing other system weirdness. No thanks! :)
|
||||
if [[ `which npm` && 1 == 0 ]]; then
|
||||
echo "*** NPM ***" &&
|
||||
sudo npm update -g
|
||||
echo -e "\n"
|
||||
else
|
||||
echo -e "*** Skipping NPM ***\n\n"
|
||||
fi
|
||||
# End of update_package_manager
|
||||
|
||||
# Flatpaks
|
||||
- name: General | Facts | Package | Update Command | Flatpak | Check
|
||||
ansible.builtin.shell: |
|
||||
set -o pipefail
|
||||
which flatpak
|
||||
shell: which flatpak
|
||||
register: flatpak_exec
|
||||
changed_when: flatpak_exec.rc == 0
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Facts | Package | Update Command | Flatpak | Exists
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
update_flatpak: |
|
||||
echo "*** Flatpak ***"
|
||||
[[ -n "$accept" ]] && sudo flatpak repair
|
||||
sudo flatpak uninstall --unused $accept &&
|
||||
sudo flatpak update $accept ||
|
||||
[[ -n {{ update_accept_var }} ]] && sudo flatpak repair
|
||||
sudo flatpak uninstall --unused {{ update_accept_var }} &&
|
||||
sudo flatpak update {{ update_accept_var }} ||
|
||||
return 1
|
||||
when: flatpak_exec is defined
|
||||
and flatpak_exec.failed is defined
|
||||
and not flatpak_exec.failed
|
||||
|
||||
- name: General | Facts | Package | Update Command | Flatpak | Missing
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
update_flatpak: |
|
||||
echo "*** Flatpak Not Installed ***"
|
||||
when: update_flatpak is not defined
|
||||
|
||||
# Firmware
|
||||
- name: General | Facts | Package | Update Command | Firmware | Check
|
||||
ansible.builtin.shell: |
|
||||
set -o pipefail
|
||||
which fwupdmgr
|
||||
shell: which fwupdmgr
|
||||
register: fwupdmgr_exec
|
||||
changed_when: fwupdmgr_exec.rc == 0
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Facts | Package | Update Command | Firmware | Exists
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
update_firmware: |
|
||||
echo "*** Firmware ***"
|
||||
sudo fwupdmgr refresh --force &&
|
||||
@@ -327,7 +263,7 @@
|
||||
and not fwupdmgr_exec.failed
|
||||
|
||||
- name: General | Facts | Package | Update Command | Firmware | Missing
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
update_firmware: |
|
||||
echo "*** Firmware Updater (fwupdmgr) Not Installed ***"
|
||||
when: update_firmware is not defined
|
||||
@@ -2,7 +2,7 @@
|
||||
# Definitions for service management.
|
||||
|
||||
- name: General | Facts | Service | All
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
cups: cups
|
||||
cups_pattern: cupsd
|
||||
cups_browse: cups-browsed
|
||||
@@ -18,19 +18,19 @@
|
||||
bluetooth_pattern: bluetooth
|
||||
|
||||
- name: General | Facts | Service | Arch Linux
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
crond: cronie
|
||||
crond_pattern: cronie
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
when: ansible_distribution in ("Archlinux")
|
||||
|
||||
- name: General | Facts | Service | Fedora
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
crond: crond
|
||||
crond_pattern: crond
|
||||
when: ansible_distribution in ("Fedora")
|
||||
|
||||
- name: General | Facts | Service | Ubuntu Linux
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
sshd: ssh
|
||||
sshd_pattern: ssh
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
+14
-59
@@ -1,86 +1,41 @@
|
||||
---
|
||||
# Define file, folder, and other facts per OS.
|
||||
|
||||
- name: General | Facts | System | Global 01
|
||||
ansible.builtin.set_fact:
|
||||
global_src: /usr/local/src
|
||||
- name: General | Facts | System | Global
|
||||
set_fact:
|
||||
lynis_install_dir: /usr/local/src/lynis
|
||||
dwm_install_dir: /usr/local/src/dwm
|
||||
st_install_dir: /usr/local/src/st
|
||||
global_bin: /usr/local/bin
|
||||
x_desktops: /usr/share/xsessions
|
||||
git_repo_http: "https://{{ git_host }}/{{ git_user }}/{{ git_project }}"
|
||||
git_repo_ssh: "ssh://git@{{ git_host }}:{{ git_ssh_port }}/{{ git_user }}/{{ git_project }}"
|
||||
notify_log: "ansible.notify.log"
|
||||
runit_script_dir: /etc/runit/sv
|
||||
runit_service_dir: /etc/runit/runsvdir/default
|
||||
runit_service_script: run
|
||||
runit_log_dir: log
|
||||
global_log: /var/log
|
||||
global_log_config: config
|
||||
runit_finish_sleep: |
|
||||
#!/bin/sh
|
||||
exec 2>&1
|
||||
# $1 is the exit code, $2 is the exit status byte (signal number if killed)
|
||||
echo "FINISH: Service returned with exit code: $1 and status: $2"
|
||||
git_repo_http: http://{{ git_host }}/{{ git_user }}/{{ git_project }}
|
||||
git_repo_ssh: ssh://git@{{ git_host }}:{{ git_ssh_port }}/{{ git_user }}/{{ git_project }}
|
||||
|
||||
sleep_long=10
|
||||
sleep_short=1
|
||||
if [[ "$1" != 0 ]]; then
|
||||
echo "FINISH: Sleeping for $sleep_long seconds due to error..."
|
||||
sleep $sleep_long
|
||||
else
|
||||
echo "FINISH: Sleeping for $sleep_short seconds."
|
||||
sleep $sleep_short
|
||||
fi
|
||||
runit_log_config_1mb: |
|
||||
s1000000 # rotate at 1 MB
|
||||
n2 # keep 2 old files
|
||||
runit_log_config_10mb: |
|
||||
s10000000 # rotate at 10 MB
|
||||
n2 # keep 2 old files
|
||||
runit_log_config_100mb: |
|
||||
s100000000 # rotate at 100 MB
|
||||
n2 # keep 2 old files
|
||||
|
||||
- name: General | Facts | System | Global 02
|
||||
ansible.builtin.set_fact:
|
||||
shared_rc_install_dir: "{{ global_src }}/env-shared"
|
||||
notify_log_file: "/var/log/{{ notify_log }}"
|
||||
notify_log_file_wip: "/tmp/{{ notify_log }}.wip"
|
||||
lynis_install_dir: "{{ global_src }}/lynis"
|
||||
dwm_install_dir: "{{ global_src }}/dwm"
|
||||
st_install_dir: "{{ global_src }}/st"
|
||||
runit_log_script: "{{ runit_service_script }}"
|
||||
|
||||
- name: General | Facts | System | Global 03
|
||||
ansible.builtin.set_fact:
|
||||
shared_rc_bin: "{{ shared_rc_install_dir }}/bin-shared"
|
||||
|
||||
- name: General | Facts | System | Linux
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
rc_conf: /dev/null
|
||||
sudoers_install_dir: /etc/sudoers.d/
|
||||
sudoers_config: /etc/sudoers
|
||||
shutdown_command: sudo shutdown -h now
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
|
||||
- name: General | Facts | System | FreeBSD
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
rc_conf: /etc/rc.conf
|
||||
sudoers_install_dir: /usr/local/etc/sudoers.d/
|
||||
shutdown_command: sudo shutdown -p now
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
|
||||
- name: General | Facts | System | Report File Names
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
lynis_report: "lynis_hardness_check.txt"
|
||||
nmap_report: "nmap_port_check.txt"
|
||||
|
||||
|
||||
- name: General | Facts | System | Ansible Branch
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
branch: main
|
||||
when: branch is not defined
|
||||
|
||||
- name: General | Facts | System | runit (Devuan)
|
||||
ansible.builtin.set_fact:
|
||||
runit_script_dir: /etc/sv
|
||||
runit_service_dir: /etc/service
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
@@ -2,12 +2,12 @@
|
||||
# Define users and groups per OS type.
|
||||
|
||||
- name: General | Facts | User | Linux
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
root_group: root
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
|
||||
- name: General | Facts | User | FreeBSD
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
root_group: wheel
|
||||
when: ansible_system == "FreeBSD"
|
||||
@@ -4,10 +4,10 @@
|
||||
## Load Config File ##
|
||||
|
||||
- name: Miner | Facts | Config File | Download
|
||||
ansible.builtin.shell: "scp {{ file_server }}:{{ config_file_remote }} {{ config_file_local }}; chmod 700 {{ config_file_local }}"
|
||||
shell: "scp {{ file_server }}:{{ config_file_remote }} {{ config_file_local }}; chmod 700 {{ config_file_local }}"
|
||||
|
||||
- name: Miner | Facts | Config File | Load Wallets
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
wallet_xmr: "{{ lookup('ini', 'xmr section={{config_section_wallet}} file={{config_file_local}}') }}"
|
||||
wallet_eth: "{{ lookup('ini', 'eth section={{config_section_wallet}} file={{config_file_local}}') }}"
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
## Verify ##
|
||||
|
||||
- name: Miner | Facts | Config File | DEBUG
|
||||
ansible.builtin.debug:
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
loop:
|
||||
loop:
|
||||
- wallet_xmr
|
||||
- wallet_eth
|
||||
|
||||
@@ -25,4 +25,4 @@
|
||||
## Clean Up ##
|
||||
|
||||
- name: Miner | Facts | Config File | Delete
|
||||
ansible.builtin.shell: "mv {{ config_file_local }} ~/TRASH/"
|
||||
shell: "mv {{ config_file_local }} ~/TRASH/"
|
||||
@@ -2,7 +2,7 @@
|
||||
# Create arrays of pools per coin.
|
||||
|
||||
- name: Miner | Facts | Pools
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nanopool_xmr:
|
||||
- { "priority": 1, "name": "xmr-us-east1.nanopool.org:14433" }
|
||||
- { "priority": 2, "name": "xmr-us-west1.nanopool.org:14433" }
|
||||
@@ -34,7 +34,7 @@
|
||||
# CPU #
|
||||
|
||||
- name: Miner | Facts | Pools | Set GPU to Nanopool Eth
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
cpu_pool: "{{ nanopool_xmr }}"
|
||||
when: nanominer_cpu == "xmr" and nanominer_cpu_pool == "nanopool"
|
||||
|
||||
@@ -42,26 +42,26 @@
|
||||
# GPU #
|
||||
|
||||
- name: Miner | Facts | Pools | Set GPU to Nanopool Eth
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
gpu_pool: "{{ nanopool_eth }}"
|
||||
when: nanominer_gpu == "eth" and nanominer_gpu_pool == "nanopool"
|
||||
|
||||
- name: Miner | Facts | Pools | Set GPU to Etherpool Eth
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
gpu_pool: "{{ ethermine_eth }}"
|
||||
when: nanominer_gpu == "eth" and nanominer_gpu_pool == "etherpool"
|
||||
|
||||
- name: Miner | Facts | Pools | Set GPU to F2Pool Eth
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
gpu_pool: "{{ f2pool_eth }}"
|
||||
when: nanominer_gpu == "eth" and nanominer_gpu_pool == "f2pool"
|
||||
|
||||
|
||||
|
||||
|
||||
## Validate ##
|
||||
|
||||
- name: Miner | Facts | Pools | DEBUG
|
||||
ansible.builtin.debug:
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
loop:
|
||||
- cpu_pool
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
## Global ##
|
||||
|
||||
- name: Miner | Facts | System | Global 1
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
file_server: '{{ user }}@leet'
|
||||
check_alive_start: "[[ `ps -ef | grep -v 'grep' | grep -v '/bin/sh -c' | grep -v $$ | grep -c '"
|
||||
check_alive_end: "'` == '0' ]] &&"
|
||||
combined_log_file: "{{ user_mfn.home }}/log.txt"
|
||||
|
||||
- name: Miner | Facts | System | Global 2
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
use_combined_log_file: ">> {{ combined_log_file }} 2>&1"
|
||||
|
||||
|
||||
## Config File ##
|
||||
|
||||
- name: Miner | Facts | System | My Config File
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
config_file_remote: "InstallFiles/Miners/miner.ini"
|
||||
config_file_local: "{{ user_mfn.home }}/miner.ini"
|
||||
config_section_wallet: wallet
|
||||
@@ -31,20 +31,20 @@
|
||||
## Nanominer ##
|
||||
|
||||
- name: Miner | Facts | System | nanominer 1
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nanominer_home: "{{ user_mfn.home }}/nanominer"
|
||||
nanominer_version: "3.4.3" # Download link: https://github.com/nanopool/nanominer/releases
|
||||
nanominer_script: "{{ user_mfn.home }}/nanominer.sh"
|
||||
|
||||
- name: Miner | Facts | System | nanominer 2
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nanominer_bin: "{{ nanominer_home }}/nanominer-linux-{{ nanominer_version }}"
|
||||
nanominer_tar_remote: "InstallFiles/Miners/nanominer/*{{ nanominer_version }}*.tar.gz"
|
||||
nanominer_config: "{{ nanominer_home }}/config.ini"
|
||||
nanominer_logs: "{{ nanominer_home}}/logs"
|
||||
|
||||
- name: Miner | Facts | System | nanominer 3
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nanominer_tar_local: "{{ nanominer_bin }}.tar.gz"
|
||||
nanominer_exec: "{{ nanominer_bin }}/nanominer"
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
## Miner Array ##
|
||||
|
||||
- name: Miner | Facts | System | Miner Array
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
miners:
|
||||
- { "name": "xmr_stak_cpu", "enabled": '{{ (xmr_stak_cpu != false) }}', "command": "{{ user_mfn.home }}/xmr_stak_cpu.sh {{ use_combined_log_file }}" }
|
||||
- { "name": "ethminer", "enabled": '{{ (ethminer != false) }}', "command": "{{ user_mfn.home }}/ethminer.sh {{ use_combined_log_file }}" }
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
# System related variables.
|
||||
|
||||
- name: Facts | Server | System | FreeBSD
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
ansible_python_interpreter: "/usr/local/bin/python3.8"
|
||||
when: ansible_system == "FreeBSD"
|
||||
@@ -3,14 +3,14 @@
|
||||
# This is only for Workstation devices with UIs.
|
||||
|
||||
- name: Workstation | Facts | Packages | Parrot OS Fixes
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
ansible_pkg_mgr: "apt"
|
||||
ansible_python_interpreter: "/usr/bin/python3"
|
||||
when: ansible_distribution == "Parrot OS"
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | Consistent
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
firefox: firefox
|
||||
firefox_esr: firefox-esr
|
||||
thunderbird: thunderbird
|
||||
@@ -26,124 +26,55 @@
|
||||
dmenu: dmenu
|
||||
sassc: sassc
|
||||
ffmpeg: ffmpeg
|
||||
wireless_tools: wireless-tools
|
||||
macbook_wifi_driver: broadcom-sta-dkms
|
||||
xz: xz
|
||||
mesa: mesa
|
||||
mesa_utils: mesa-utils
|
||||
ninja: ninja
|
||||
notify_send: libnotify
|
||||
fyi: fyi
|
||||
gtk3: gtk3
|
||||
xz_libs: xz
|
||||
cpp: libstdc++
|
||||
c_libs: glibc
|
||||
cpp_libs: libstdc++
|
||||
z_libs: zlib
|
||||
bzip: bzip2
|
||||
dunst: dunst
|
||||
android_jdk: openjdk
|
||||
ncurses: ncurses
|
||||
android_fastboot: fastboot
|
||||
android_adb: adb
|
||||
android_sdkmanager: sdkmanager
|
||||
android_udev: android-udev
|
||||
gnome_boxes: gnome-boxes
|
||||
rhythmbox: rhythmbox
|
||||
vlc: vlc
|
||||
vlc_plugins: vlc-plugins-all
|
||||
blueman: blueman
|
||||
mpv: mpv
|
||||
transmission_gtk: transmission-gtk
|
||||
transmission_qt: transmission-qt
|
||||
libreoffice: libreoffice
|
||||
strawberry: strawberry
|
||||
dict_en: hunspell-en_us
|
||||
dict_es: hunspell-es_any
|
||||
xset: xorg-xset
|
||||
xlock: xss-lock
|
||||
|
||||
- name: Workstation | Facts | Package | apt (All Distros)
|
||||
ansible.builtin.set_fact:
|
||||
xz: xz-utils
|
||||
mesa: libglu1-mesa
|
||||
mesa_utils: libglu1-mesa
|
||||
ninja: ninja-build
|
||||
notify_send: libnotify-bin
|
||||
gtk3: libgtk-3-dev
|
||||
xz_libs: liblzma-dev
|
||||
cpp: libstdc++-12-dev
|
||||
c_libs: libc6:amd64
|
||||
cpp_libs: libstdc++6
|
||||
z_libs: lib32z1
|
||||
bzip: libbz2-1.0
|
||||
android_jdk: default-jdk
|
||||
ncurses: libncurses-dev
|
||||
android_udev: android-udev-rules
|
||||
vlc_plugins: libavcodec-extra
|
||||
xset: x11-server-utils
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: Workstation | Facts | Package | Pop_OS!
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
firefox_esr: firefox
|
||||
when: ansible_distribution == "Pop!_OS"
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | Ubuntu
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
firefox_esr: firefox
|
||||
dmenu: suckless-tools
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
|
||||
- name: Workstation | Facts | Package | Debian & Devuan
|
||||
ansible.builtin.set_fact:
|
||||
|
||||
- name: Workstation | Facts | Package | Debian
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
dmenu: suckless-tools
|
||||
firefox: firefox-esr
|
||||
when: ansible_distribution in ("Debian", "Devuan")
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | Mint
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
firefox_esr: firefox
|
||||
when: ansible_distribution == "Linux Mint"
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | Parrot OS
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
firefox_esr: firefox-esr
|
||||
when: ansible_distribution == "Parrot OS"
|
||||
|
||||
- name: Workstation | Facts | Package | Apt w/o LibVirt
|
||||
ansible.builtin.set_fact:
|
||||
gnome_boxes: htop
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
and ansible_service_mgr not in ("systemd", "sysvinit")
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | pacman (All Distros)
|
||||
ansible.builtin.set_fact:
|
||||
macbook_wifi_driver: broadcom-wl-dkms
|
||||
android_jdk: jdk-openjdk
|
||||
android_fastboot: android-tools
|
||||
android_adb: android-tools
|
||||
libreoffice: libreoffice-still
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
|
||||
- name: Workstation | Facts | Package | Arch / Manjaro / Artix
|
||||
ansible.builtin.set_fact:
|
||||
- name: Workstation | Facts | Package | Arch + Manjaro
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
firefox_esr: firefox
|
||||
psutil: python-psutil
|
||||
#appimagelauncher: appimagelauncher # No longer in the repos, AUR.
|
||||
font_awesome: ttf-font-awesome
|
||||
wireless_tools: wireless_tools
|
||||
nfs: nfs-utils
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
appimagelauncher: appimagelauncher
|
||||
when: ansible_distribution == "Archlinux"
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | FreeBSD
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: false
|
||||
psutil: py38-psutil
|
||||
ansible_python_interpreter: "/usr/local/bin/python3.8"
|
||||
@@ -153,7 +84,7 @@
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | Fedora
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
firefox_esr: firefox
|
||||
font_awesome: python3-XStatic-Font-Awesome
|
||||
@@ -163,7 +94,7 @@
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | openSUSE
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: true
|
||||
firefox_esr: firefox-esr-branding-openSUSE
|
||||
font_awesome: fontawesome-fonts
|
||||
@@ -172,6 +103,6 @@
|
||||
|
||||
|
||||
- name: Workstation | Facts | Package | NixOS
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
flatpak_distro: false
|
||||
when: ansible_distribution == "NixOS"
|
||||
+7
-14
@@ -20,7 +20,7 @@ static const char *colors[][3] = {
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1 : ", "2 : ", "3 : ", "4 : ", "5 : ", "6 : ", "7 : ", "8 : ", "9 : " };
|
||||
static const char *tags[] = { "1:", "2:", "3:", "4:", "5:", "6:", "7:", "8:", "9:" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
@@ -46,7 +46,7 @@ static const Layout layouts[] = {
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod4Mask
|
||||
#define MODKEY Mod1Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
@@ -69,16 +69,13 @@ static const char *raisevolcmd[] = {"amixer","-q","sset","Master","1%+",NULL};
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_b, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_space, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
//{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
//{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
@@ -87,8 +84,8 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
//{ MODKEY, XK_space, setlayout, {0} },
|
||||
//{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
@@ -107,11 +104,7 @@ static Key keys[] = {
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
// Mine
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
// extra search shortcut
|
||||
{ MODKEY, XK_s, spawn, {.v = dmenucmd } },
|
||||
// fullscreen shortcut for m onocle
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
|
||||
// Volume (https://varunbpatil.github.io/2013/09/28/dwm.html)
|
||||
// Volume (https://varunbpatil.github.io/2013/09/28/dwm.html)
|
||||
{ 0, 0x1008ff12,spawn, {.v = mutecmd } },
|
||||
{ 0, 0x1008ff11,spawn, {.v = lowervolcmd } },
|
||||
{ 0, 0x1008ff13,spawn, {.v = raisevolcmd } },
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-11-10 Hyperling
|
||||
# Icons: https://fontawesome.com/v4/cheatsheet/
|
||||
|
||||
source "`which status.function`"
|
||||
|
||||
function dwm-status {
|
||||
status-display --dwm
|
||||
}
|
||||
+12
-11
@@ -5,17 +5,17 @@
|
||||
## Load System Libs ##
|
||||
|
||||
if [ -d /etc/X11/xinit/xinitrc.d ]; then
|
||||
for f in /etc/X11/xinit/xinitrc.d/*; do
|
||||
[ -x "$f" ] && . "$f"
|
||||
done
|
||||
unset f
|
||||
for f in /etc/X11/xinit/xinitrc.d/*; do
|
||||
[ -x "$f" ] && . "$f"
|
||||
done
|
||||
unset f
|
||||
fi
|
||||
|
||||
if [ -d /usr/local/etc/X11/xinit/xinitrc.d ]; then
|
||||
for f in /usr/local/etc/X11/xinit/xinitrc.d/*; do
|
||||
[ -x "$f" ] && . "$f"
|
||||
done
|
||||
unset f
|
||||
for f in /usr/local/etc/X11/xinit/xinitrc.d/*; do
|
||||
[ -x "$f" ] && . "$f"
|
||||
done
|
||||
unset f
|
||||
fi
|
||||
|
||||
|
||||
@@ -34,9 +34,10 @@ xsetroot -solid "$purple"
|
||||
# slstatus, from Suckless #
|
||||
#exec slstatus &
|
||||
|
||||
# Custom Setup #
|
||||
source "`which dwm-status.function`"
|
||||
dwm-status &
|
||||
# Custom #
|
||||
while true; do
|
||||
xsetroot -name "`whoami`@`hostname` `date +"%Y-%m-%d %H:%M:%S"`"
|
||||
done &
|
||||
|
||||
|
||||
## Start ##
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-11-10 Hyperling
|
||||
|
||||
function battery-display {
|
||||
detailed="N"
|
||||
if [[ -n $1 ]]; then
|
||||
detailed="Y"
|
||||
fi
|
||||
|
||||
if [[ "$detailed" == "Y" ]]; then
|
||||
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | grep -o "[0-9.%]*"
|
||||
else
|
||||
int="`upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | grep -o "[0-9]*" | head -n 1`"
|
||||
echo "${int}%"
|
||||
fi
|
||||
}
|
||||
alias show-battery="battery-display"
|
||||
alias battery="battery-display"
|
||||
alias battery-use="battery-display"
|
||||
alias battery-usage="battery-display"
|
||||
alias battery-level="battery-display"
|
||||
alias battery-levels="battery-display"
|
||||
@@ -1,3 +0,0 @@
|
||||
#/usr/local/bin env
|
||||
|
||||
# TBD/TODO
|
||||
@@ -1,3 +0,0 @@
|
||||
#/usr/local/bin env
|
||||
|
||||
# TBD/TODO
|
||||
@@ -1,85 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-11-10 Hyperling
|
||||
# Icons: https://fontawesome.com/v4/cheatsheet/
|
||||
|
||||
source "`which volume.function`"
|
||||
source "`which battery.function`"
|
||||
source "`which storage.function`"
|
||||
|
||||
function datetime {
|
||||
date +"%Y-%m-%d %H:%M:%S"
|
||||
}
|
||||
function status-display {
|
||||
# Defaults
|
||||
cmd="echo"
|
||||
sleep=0.2
|
||||
if [[ "`storage-root`" == "`storage-home`" ]]; then
|
||||
function status-display-storage {
|
||||
echo "`storage-root`"
|
||||
}
|
||||
else
|
||||
function status-display-storage {
|
||||
echo "Root (`storage-root`), Home (`storage-home`)"
|
||||
}
|
||||
fi
|
||||
|
||||
# Test Config
|
||||
if [[ $1 == "-t" || $1 == "--test" || $1 == "test" ]]; then
|
||||
sleep=5
|
||||
fi
|
||||
|
||||
# DWM Config
|
||||
if [[ $1 == "-d" || $1 == "--dwm" || $1 == "dwm" ]]; then
|
||||
cmd="xsetroot -name"
|
||||
if [[ "`storage-root`" == "`storage-home`" ]]; then
|
||||
function status-display-storage {
|
||||
echo "`storage-root-dwm`)"
|
||||
}
|
||||
else
|
||||
function status-display-storage {
|
||||
echo "(Root `storage-root-dwm`, Home `storage-home-dwm`)"
|
||||
}
|
||||
fi
|
||||
fi
|
||||
battery=""; storage=""; volume=""; datetime="";
|
||||
userhost="`whoami`@`hostname`"
|
||||
while true; do
|
||||
# Exit if parent process is gone.
|
||||
#TBD/TODO
|
||||
|
||||
# Reset Variables
|
||||
if [[ $datetime == *"00" ]]; then
|
||||
unset battery
|
||||
unset storage
|
||||
fi
|
||||
if [[ $datetime != "`datetime`" ]]; then
|
||||
unset volume
|
||||
unset datetime
|
||||
fi
|
||||
|
||||
# Set Variables
|
||||
if [[ -z $battery ]]; then
|
||||
battery="`battery-display`"
|
||||
fi
|
||||
if [[ -z $storage ]]; then
|
||||
storage="`status-display-storage`"
|
||||
fi
|
||||
if [[ -z $volume ]]; then
|
||||
volume="`volume-display`"
|
||||
fi
|
||||
if [[ -z $datetime ]]; then
|
||||
datetime="`datetime`"
|
||||
fi
|
||||
|
||||
# Display Variables
|
||||
readout="$readout $battery"
|
||||
readout="$readout | $storage"
|
||||
readout="$readout | $volume"
|
||||
readout="$readout | $userhost"
|
||||
readout="$readout | $datetime"
|
||||
$cmd "$readout"
|
||||
readout=""
|
||||
sleep $sleep
|
||||
done
|
||||
}
|
||||
alias status="status-display --test"
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-11-10 Hyperling
|
||||
|
||||
function storage-display {
|
||||
location="$1"
|
||||
style="$2"
|
||||
|
||||
if [[ -z "$location" ]]; then
|
||||
echo "ERROR: Location must be passed. $location"
|
||||
fi
|
||||
|
||||
if [[ "$style" == "%" || "$style" == "pct" || "$style" == "percent" ]]; then
|
||||
df -h "$location" | tail -n 1 | awk '{print $5" Used"}'
|
||||
elif [[ "$style" == "/" || "$style" == "use" || "$style" == "usage" ]]; then
|
||||
df -h "$location" | tail -n 1 | awk '{print $4"/"$2" Free"}'
|
||||
elif [[ "$style" == "G" || "$style" == "S" || "$style" == "F" ]]; then
|
||||
df -h "$location" | tail -n 1 | awk '{print $4" Free"}'
|
||||
else
|
||||
df -h "$location" | tail -n 1 | awk '{print $5" Used - "$4"/"$2" Free"}'
|
||||
fi
|
||||
}
|
||||
alias storage='echo -n "Root: " && storage-display "/" "F" && echo -n "Home: " && storage-display "/home" "F"'
|
||||
|
||||
export dwm_storage_style="F"
|
||||
|
||||
function storage-root {
|
||||
storage-display / "$1"
|
||||
}
|
||||
function storage-root-dwm {
|
||||
storage-root "$dwm_storage_style"
|
||||
}
|
||||
|
||||
function storage-home {
|
||||
storage-display /home "$1"
|
||||
}
|
||||
function storage-home-dwm {
|
||||
storage-home "$dwm_storage_style"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
#/usr/local/bin env
|
||||
|
||||
# TBD/TODO
|
||||
@@ -1,173 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2025-11-10 Hyperling
|
||||
# Volume management for systems without working volume buttons.
|
||||
# Written for ease of use in terminal and simple window management systems.
|
||||
|
||||
function volume-usage {
|
||||
cat <<- EOF
|
||||
Usage: volume [%int] [(+/-)%int] [-d] [-r] [-t] [-h]
|
||||
|
||||
Set to a static value:
|
||||
volume 100, volume 65
|
||||
|
||||
Increment or decrement. Passing only + or - and no number defaults to 5.
|
||||
volume -5, volume 5-, volume - 5, volume 5 -
|
||||
volume +20, volume 20+, volume + 20, volume 20 +
|
||||
|
||||
Display the current volume:
|
||||
volume,
|
||||
volume-display, volume display, volume --display, volume -d,
|
||||
volume +d
|
||||
|
||||
Set volume to a random number between 0 and 100.
|
||||
volume-random, volume random, volume --random, volume -r
|
||||
|
||||
Be silly and oscillate volume in a loop:
|
||||
volume-trip, volume trip, volume --trip, volume -t
|
||||
|
||||
Display this help text:
|
||||
volume-usage,
|
||||
volume-help volume help, volume --help, volume -h
|
||||
EOF
|
||||
return $1
|
||||
}
|
||||
#alias volume-help="volume-usage"
|
||||
#alias vol-h="volume-help"
|
||||
|
||||
function volume {
|
||||
|
||||
## Check Params ##
|
||||
|
||||
if [[ "$1" == "--help" || "$1" == "help" || "$1" == "-h" ]]; then
|
||||
volume-usage 1
|
||||
return 1
|
||||
fi
|
||||
if [[ (-z "$1" && -z "$2")
|
||||
|| "$1" == "--display" || "$1" == "display" || "$1" == "-d" || "$1" == "+d"
|
||||
]]; then
|
||||
volume-display
|
||||
return 0
|
||||
fi
|
||||
|
||||
## Parse Params ##
|
||||
|
||||
dir=""
|
||||
amt=""
|
||||
|
||||
# Remove percent signs.
|
||||
if [[ "$1" == *"%"* || "$2" == *"%"* ]]; then
|
||||
set -- "${1//%/}" "${2//%/}"
|
||||
fi
|
||||
|
||||
# Check if format is written text.
|
||||
if [[ "$1" == "full" || "$1" == "max" ]]; then
|
||||
amt=100
|
||||
fi
|
||||
if [[ "$1" == "mute" || "$1" == "none" ]]; then
|
||||
amt=0
|
||||
fi
|
||||
|
||||
# Check if the format is "volume +/- %int"
|
||||
if [[ -z "$amt" && -z "$dir" ]]; then
|
||||
if [[ "$1" == "+" || "$1" == "-" ]]; then
|
||||
dir="$1"
|
||||
amt="$2"
|
||||
if [[ -z "$2" ]]; then
|
||||
amt="5"
|
||||
else
|
||||
amt="$2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the format is "volume +/- %int".
|
||||
if [[ -z "$amt" && -z "$dir" ]]; then
|
||||
if [[ "$2" == "+" || "$2" == "-" ]]; then
|
||||
amt="$1"
|
||||
dir="$2"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if amount and direction are adjacent, and if so, pull the values.
|
||||
if [[ -z "$amt" && -z "$dir" ]]; then
|
||||
if [[ "$1" == *"+"* ]]; then
|
||||
dir="+"
|
||||
elif [[ "$1" == *"-"* ]]; then
|
||||
dir="-"
|
||||
fi
|
||||
if [[ -n "$dir" && -z "$amt" ]]; then
|
||||
amt="$1"
|
||||
amt=${amt//-/}
|
||||
amt=${amt//+/}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if format is direct volume.
|
||||
if [[ -z "$dir" && -z "$amt" && -n "$1" && -z "$2" ]]; then
|
||||
amt="$1"
|
||||
fi
|
||||
|
||||
## Error Checking ##
|
||||
regex='^[0-9]+$'
|
||||
if ! [[ $amt =~ $regex ]]; then
|
||||
echo "> ERROR: Amount '$amt' does not seem like a integer."
|
||||
volume-usage 2
|
||||
return 2
|
||||
fi
|
||||
|
||||
## Main ##
|
||||
|
||||
if [[ -n "$dir" && -n "$amt" ]]; then
|
||||
echo "> Changing volume by '$dir$amt%'."
|
||||
amixer -q sset Master ${amt}%${dir}
|
||||
echo "> Volume is now '`volume-display`'."
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ -z "$dir" && -n "$1" ]]; then
|
||||
echo "> Setting volume to '$amt'."
|
||||
amixer -q sset Master ${amt}%
|
||||
echo "> Volume has been set to '`volume-display`'."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "> ERROR: Should not have made it here. Please report this to the developer."
|
||||
echo "$0 $1 $2"
|
||||
return 7
|
||||
}
|
||||
#alias vol="volume "
|
||||
#alias vol-="volume - "
|
||||
#alias vol+="volume + "
|
||||
|
||||
function volume-display {
|
||||
if [[ "$1" == "-v" || "$1" == "--verbose" || "$1" == "verbose" ]]; then
|
||||
amixer sget Master
|
||||
else
|
||||
amixer sget Master | egrep -o '[0-9]{1,3}%' | head -n 1
|
||||
fi
|
||||
}
|
||||
#alias "vol-d"="volume-display"
|
||||
|
||||
## TBD/TODO ##
|
||||
|
||||
# Go up and down until cancelled.
|
||||
#function volume-trip {
|
||||
# curr eq amixer current readout
|
||||
# if curr lt 50 then dir eq + else dir eq -
|
||||
# while true; do
|
||||
# if vol is 0 then dir eq +
|
||||
# if vol is 100 then dir eq -
|
||||
# curr eq \$curr $dir 1
|
||||
# amixer set volume to curr
|
||||
# sleep 0.1
|
||||
# done
|
||||
#}
|
||||
#alias vol-t="volume-trip"
|
||||
#alias volume-wub="volume-trip"
|
||||
#alias vol-w="volume-wub"
|
||||
|
||||
#function volume-random {
|
||||
# v eq $RANDOM % 101
|
||||
# amixer set volume eq v
|
||||
#}
|
||||
#alias vol-r="volume-random"
|
||||
@@ -1,3 +0,0 @@
|
||||
#/usr/local/bin env
|
||||
|
||||
# TBD/TODO
|
||||
@@ -1,3 +0,0 @@
|
||||
#/usr/local/bin env
|
||||
|
||||
# TBD/TODO
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Variables ##
|
||||
|
||||
if [[ -z "$HOSTNAME" ]]; then
|
||||
echo "*** Pulling Hostname From Command ***"
|
||||
export HOSTNAME="`hostname`"
|
||||
fi
|
||||
if [[ -z "$HOSTNAME" ]]; then
|
||||
echo "*** Pulling Hostname From /etc/ File ***"
|
||||
export HOSTNAME="`cat /etc/hostname`"
|
||||
fi
|
||||
|
||||
EXTRA="$1"
|
||||
DATE="`date "+%Y%m%d-%H%M%S"`"
|
||||
BACKUP_DIR="/srv/backup"
|
||||
BASENAME="Backup"
|
||||
|
||||
TAG="System"
|
||||
BACKUP="$BACKUP_DIR/$BASENAME.$DATE.$HOSTNAME.$TAG.zip"
|
||||
|
||||
TAG2="Data"
|
||||
BACKUP2="${BACKUP//$TAG/$TAG2}"
|
||||
|
||||
## Initialization ##
|
||||
|
||||
echo "*** Creating Backup Directory ***"
|
||||
sudo mkdir -pv "$BACKUP_DIR"
|
||||
sudo mkdir -pv "$BACKUP_DIR/TRASH"
|
||||
sudo chmod -Rv 775 "$BACKUP_DIR"
|
||||
sudo chown -Rv root:root "$BACKUP_DIR"
|
||||
|
||||
## Cleanup ##
|
||||
|
||||
echo "*** Removing Old Backups ***"
|
||||
cd "$BACKUP_DIR"
|
||||
sudo mv -v "$BASENAME"*"$TAG"* TRASH/
|
||||
sudo mv -v "$BASENAME"*"$TAG2"* TRASH/
|
||||
sudo rm -v TRASH/*
|
||||
|
||||
## Main
|
||||
|
||||
# System Backup
|
||||
|
||||
echo "*** Creating backup at '$BACKUP' ***"
|
||||
sudo zip -rv "$BACKUP" \
|
||||
/etc /var/{log,mail,spool} /srv /boot \
|
||||
/usr/local/etc $EXTRA \
|
||||
-x "/srv/backup/*" -x "/srv/sftp/*" \
|
||||
-x "*/.gradle/" -x "*/app/build/*"
|
||||
status="$?"
|
||||
|
||||
if [[ "$status" != 0 ]]; then
|
||||
echo "*** ERROR: Failed to create '$BACKUP', file may be incorrect. ***"
|
||||
fi
|
||||
|
||||
if [[ -e "$BACKUP" ]]; then
|
||||
ls -alh "$BACKUP"
|
||||
echo "*** '$BACKUP' created successfully! ***"
|
||||
else
|
||||
echo "*** '$BACKUP' not found! ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "\n\n"
|
||||
sleep 5
|
||||
|
||||
# Data Backup
|
||||
|
||||
echo "*** Creating backup at '$BACKUP2' ***"
|
||||
sudo zip -rv "$BACKUP2" \
|
||||
/root /home \
|
||||
-x "*/.gradle/" -x "*/app/build/*"
|
||||
status="$?"
|
||||
|
||||
if [[ "$status" != 0 ]]; then
|
||||
echo "*** ERROR: Failed to create '$BACKUP2', file may be incorrect. ***"
|
||||
fi
|
||||
|
||||
if [[ -e "$BACKUP2" ]]; then
|
||||
ls -alh "$BACKUP2"
|
||||
echo "*** '$BACKUP2' created successfully! ***"
|
||||
else
|
||||
echo "*** '$BACKUP2' not found! ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,115 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 20260819 - Hyperling
|
||||
# Alert the user every so often once the battery is low.
|
||||
|
||||
## Setup ##
|
||||
|
||||
echo "`date` - Checking Active Programs"
|
||||
|
||||
ps -ef | grep battery_nag.sh | grep -v grep | grep -v "sh -c" | grep -v kill | grep -v $$
|
||||
|
||||
active=`ps -ef | grep battery_nag.sh | grep -v grep | grep -v "sh -c" | grep -v kill | grep -vc $$`
|
||||
if (( "$active" >= 1 )); then
|
||||
echo "Program already running, exiting. Number of processes: $active"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "`date` - Loading Functions"
|
||||
|
||||
which battery.function || {
|
||||
echo "ERROR: Battery function not found, exiting."
|
||||
exit 2
|
||||
}
|
||||
source battery.function
|
||||
|
||||
## Params ##
|
||||
|
||||
echo "`date` - Parsing Parameters"
|
||||
|
||||
typeset -i alert sleep
|
||||
|
||||
# Default to 20%.
|
||||
alert=20
|
||||
if [[ -n "$1" ]]; then
|
||||
echo -n "alert changed from '$alert' "
|
||||
alert="$1"
|
||||
echo "to '$alert'"
|
||||
fi
|
||||
|
||||
# Default to 5 minutes.
|
||||
sleep=300
|
||||
if [[ -n "$2" ]]; then
|
||||
echo -n "sleep changed from '$sleep' "
|
||||
sleep="$2"
|
||||
echo "to '$sleep'"
|
||||
fi
|
||||
|
||||
# Default to true.
|
||||
accelerate="Y"
|
||||
if [[ -n "$3" ]]; then
|
||||
echo -n "accelerate changed from '$accelerate' "
|
||||
accelerate="$3"
|
||||
echo "to '$accelerate'"
|
||||
fi
|
||||
|
||||
echo "Alerting when under ${alert}%."
|
||||
echo "Notifying every ${sleep} seconds."
|
||||
if [[ "$accelerate" == "Y" ]]; then
|
||||
echo -n "Speeding up notifications as % gets lower."
|
||||
else
|
||||
echo -n "Notifcations staying persistent."
|
||||
fi
|
||||
echo " (accelerate == $accelerate)"
|
||||
|
||||
## Main ##
|
||||
|
||||
echo "`date` - Starting Loop"
|
||||
|
||||
while true; do
|
||||
|
||||
batt=`battery-display`
|
||||
batt=${batt//%/}
|
||||
|
||||
if (( batt <= alert )); then
|
||||
title="Battery is below ${alert}%"
|
||||
message="Currently at ${batt}%"
|
||||
cmd="`which fyi 2>/dev/null || which notify-send 2>/dev/null`"
|
||||
if [[ -z "$cmd" ]]; then
|
||||
echo "ERROR: No command found to send notification, exiting."
|
||||
echo "Please install 'fyi' or 'notify-send' to use this script."
|
||||
echo "If not using a DE, also ensure 'dunst' or similar is running."
|
||||
exit 3
|
||||
fi
|
||||
echo "`date` - Attempting to report battery level at ${batt}."
|
||||
|
||||
$cmd "$title" "$message"
|
||||
status="$?"
|
||||
|
||||
if [[ "$status" == 0 ]]; then
|
||||
echo -n "`date` - Success! "
|
||||
else
|
||||
echo -n "`date` - ERROR: "
|
||||
fi
|
||||
echo "Nag returned status ${status}."
|
||||
else
|
||||
echo "`date` - Battery at ${batt}%, did not nag."
|
||||
fi
|
||||
|
||||
time=$sleep
|
||||
if [[ "$accelerate" == "Y" && $batt -lt $alert ]]; then
|
||||
# Bash only returns whole numbers, so things like 20/11 only provide 1.
|
||||
# Likewise, if the battery is full, 20/100 returns 0, which is bad. :)
|
||||
if (( batt > 0 )); then
|
||||
time=$(( time / (alert / batt) ))
|
||||
else
|
||||
time=10
|
||||
fi
|
||||
fi
|
||||
# Showing a notification every 10 seconds makes it persistent.
|
||||
# Any more than that casues multiple to stack which is unnecessary.
|
||||
if (( time < 10 )); then
|
||||
time=10
|
||||
fi
|
||||
echo "`date` - Sleeping for ${time}."
|
||||
sleep $time
|
||||
done
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
# 2023-12-04 Hyperling
|
||||
# Lower the resolution of audio and convert to mp3.
|
||||
# Lower resolution of audio and convert to mp3. Also
|
||||
# Also see: compress-video.sh
|
||||
|
||||
## Setup ##
|
||||
@@ -36,8 +36,7 @@ function usage() {
|
||||
Compress audio to mp3. Can handle folders and work recursively.
|
||||
|
||||
Parameters:
|
||||
-q QUALITY : Integer for audio bitrate to transcode to.
|
||||
Defaults to 256k. No lower than 192k suggested.
|
||||
-q QUALITY : Integer for the maximum length of either media dimension.
|
||||
-l LOCATION : The specific media or folder which needs compressed.
|
||||
-r : Recursively shrink media based on the location passed.
|
||||
-f : Force the media to be shrunk even if a file already exists for it.
|
||||
@@ -182,8 +181,8 @@ $search "$location" | sort | while read media; do
|
||||
|
||||
if [[ -n "$delete" ]]; then
|
||||
echo -n " DELETE: "
|
||||
if [[ -d $HOME/TRASH ]]; then
|
||||
mv -v "$media" $HOME/TRASH/
|
||||
if [[ -d ~/TRASH ]]; then
|
||||
mv -v "$media" ~/TRASH/
|
||||
else
|
||||
rm -v "$media"
|
||||
fi
|
||||
|
||||
@@ -15,7 +15,6 @@ size=2000
|
||||
|
||||
# Strings
|
||||
tag="shrunk"
|
||||
use_tag="Y"
|
||||
date_YYYYMMDD="`date "+%Y%m%d"`"
|
||||
location="."
|
||||
search="ls"
|
||||
@@ -29,46 +28,37 @@ function usage() {
|
||||
# Parameters:
|
||||
# 1) The exit status to use.
|
||||
status=$1
|
||||
echo "Usage: $PROG [-s SIZE] [-l LOCATION] [-A | [-r] [-f] [-d] [-c] [-e | -t] [-h] [-x] [-n]" >&2
|
||||
echo "Usage: $PROG [-s SIZE] [-l LOCATION] [-A | [-r] [-f] [-d] [-c]] [-h] [-x]" >&2
|
||||
cat <<- EOF
|
||||
Compress JPG or PNG image(s). Can handle folders and work recursively.
|
||||
|
||||
Parameters:
|
||||
-s SIZE : Integer for the maximum length of either image dimension.
|
||||
Default size is 2000.
|
||||
-l LOCATION : The specific image or folder which needs images shrunk.
|
||||
Default location is the current directory.
|
||||
-r : Recursively shrink images based on the location passed.
|
||||
-f : Force the image to be shrunk even if a file already exists for it.
|
||||
-F : FORCE the image to be shrunk even if the file is already shrunk.
|
||||
-d : Delete the original image if the compressed image is smaller.
|
||||
-c : Clean the filename of underscores, dashes, 'IMG', etc.
|
||||
-e | -t : Format timestamp to the expanded model.
|
||||
-A : Resursively Force, Delete, and Clean.
|
||||
-h : Display this usage text.
|
||||
-x : Enable BASH debugging.
|
||||
-n : No file extension.
|
||||
EOF
|
||||
exit $status
|
||||
}
|
||||
|
||||
## Parameters ##
|
||||
|
||||
while getopts ":s:l:rfFdcetAhxn" opt; do
|
||||
while getopts ":s:l:rfdcAhx" opt; do
|
||||
case $opt in
|
||||
s) in_size="$OPTARG" && size="$in_size" ;;
|
||||
l) location="$OPTARG" ;;
|
||||
r) recurse="Y" && search="find" ;;
|
||||
f) force="Y" ;;
|
||||
F) super_force="Y" ;;
|
||||
d) delete="Y" ;;
|
||||
c) clean="Y" ;;
|
||||
e) expand="Y" ;;
|
||||
t) expand="Y" ;;
|
||||
A) recurse="Y" && search="find" && force="Y" && delete="Y" ;;
|
||||
A) recurse="Y" && search="find" && force="Y" && delete="Y" && clean="Y" ;;
|
||||
h) usage 0 ;;
|
||||
x) set -x ;;
|
||||
n) use_tag="N" ;;
|
||||
*) echo "ERROR: Option $OPTARG not recognized." >&2 && usage 1 ;;
|
||||
esac
|
||||
done
|
||||
@@ -80,7 +70,7 @@ if [[ -n "$in_size" && "$size" != "$in_size" ]]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
convert_exe="`which convert` -strip"
|
||||
convert_exe="`which convert`"
|
||||
if [[ "$convert_exe" == "" ]]; then
|
||||
echo "ERROR: 'convert' command could not be found, "
|
||||
echo "please install 'imagemagick'."
|
||||
@@ -100,8 +90,8 @@ $search "$location" | sort | while read image; do
|
||||
# Avoid processing directories no matter the name.
|
||||
[ -d "$image" ] && continue
|
||||
|
||||
# Avoid processing files previously shrunk, unless we are FORCEing.
|
||||
[[ "$image" == *"$tag"* && -z "$super_force" ]] && continue
|
||||
# Avoid processing files previously shrunk.
|
||||
[[ "$image" == *"$tag"* ]] && continue
|
||||
|
||||
echo -e "\n$image"
|
||||
|
||||
@@ -116,13 +106,8 @@ $search "$location" | sort | while read image; do
|
||||
continue
|
||||
fi
|
||||
|
||||
new_image="${image//.$extension/}.$tag-$date_YYYYMMDD.$size.$extension"
|
||||
if [[ "$use_tag" == "N" ]]; then
|
||||
new_image="$image"
|
||||
new_image="${new_image//.$extension/}"
|
||||
new_image="${new_image//.$tag/}"
|
||||
new_image="$new_image.$tag.$extension"
|
||||
fi
|
||||
|
||||
new_image="${image//.$extension/}.$tag-$date_YYYYMMDD.$extension"
|
||||
|
||||
## Clean Filename ##
|
||||
# Prevent directory from having its name cleaned too.
|
||||
@@ -135,47 +120,25 @@ $search "$location" | sort | while read image; do
|
||||
new_image_clean="${new_image_clean//-/}"
|
||||
new_image_clean="${new_image_clean// /}"
|
||||
|
||||
## Expanded Filename ##
|
||||
# Add back in the dashes so that the year, month, date, and time are exposed.
|
||||
TEMP="$new_image_clean"
|
||||
# Date Data
|
||||
new_image_exp="${TEMP:0:4}-${TEMP:4:2}-${TEMP:6:2}"
|
||||
# Time Data
|
||||
new_image_exp="${new_image_exp}_${TEMP:8:2}-${TEMP:10:2}-${TEMP:12:2}"
|
||||
# Remainder Data
|
||||
if [[ "${TEMP:14:1}" == "." ]]; then
|
||||
SEP=""
|
||||
else
|
||||
SEP="_"
|
||||
fi
|
||||
new_image_exp="${new_image_exp}${SEP}${TEMP:14}"
|
||||
unset TEMP SEP
|
||||
|
||||
# Add directory back to the full paths.
|
||||
# Add directory back to the full path.
|
||||
new_image_clean="$image_dirname/$new_image_clean"
|
||||
new_image_exp="$image_dirname/$new_image_exp"
|
||||
|
||||
# Delete the existing shrunk image if we are forcing a new compression.
|
||||
if [[ -n "$force" &&
|
||||
(-e "$new_image" || -e $new_image_clean || -e $new_image_exp ) ]]; then
|
||||
if [[ -n "$force" && (-e "$new_image" || -e $new_image_clean) ]]; then
|
||||
echo -n " FORCE: "
|
||||
rm -v "$new_image" "$new_image_clean" "$new_image_exp" 2>/dev/null
|
||||
rm -v "$new_image" "$new_image_clean" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Skip if a compressed image was already created today.
|
||||
if [[ (-e "$new_image" || -e $new_image_clean) && $use_tag == "Y" ]]; then
|
||||
if [[ -e "$new_image" || -e $new_image_clean ]]; then
|
||||
echo " SKIP: Image has already been shrunk previously, moving on."
|
||||
continue
|
||||
fi
|
||||
|
||||
# Whether or not to use the cleaned version.
|
||||
# Whether or not to use the cleaned version or the normal version.
|
||||
if [[ -n $clean ]]; then
|
||||
new_image="$new_image_clean"
|
||||
# Whether or not to use the expanded version.
|
||||
elif [[ -n $expand ]]; then
|
||||
new_image="$new_image_exp"
|
||||
fi
|
||||
# Otherwise uses the same name as before.
|
||||
|
||||
###### TBD Instead of this, only alter the file names, and set a dirname var?
|
||||
#### Create a new directory if the directory names were altered.
|
||||
@@ -215,8 +178,8 @@ $search "$location" | sort | while read image; do
|
||||
|
||||
if [[ -n "$delete" ]]; then
|
||||
echo -n " DELETE: "
|
||||
if [[ -d $HOME/TRASH ]]; then
|
||||
mv -v "$image" $HOME/TRASH/
|
||||
if [[ -d ~/TRASH ]]; then
|
||||
mv -v "$image" ~/TRASH/
|
||||
else
|
||||
rm -v "$image"
|
||||
fi
|
||||
|
||||
@@ -32,14 +32,7 @@ function usage {
|
||||
-i input : The input file or folder with which to search for video files.
|
||||
If nothing is provided, current directory (.) is assumed.
|
||||
-v bitrate : The video bitrate to convert to.
|
||||
Defaults are based on the size passed.
|
||||
>= 2160: '30M'
|
||||
>= 1440: '12M'
|
||||
>= 1080: '5M'
|
||||
>= 720: '2000k'
|
||||
>= 480: '750k'
|
||||
>= 360: '250k'
|
||||
< 360: '100k'
|
||||
Defaults to '2000k'.
|
||||
-a bitrate : The audio bitrate to convert to.
|
||||
Defaults to '192k'.
|
||||
-c vcodec : The video codec you'd like to use, such as libopenh264.
|
||||
@@ -48,8 +41,7 @@ function usage {
|
||||
-r : Recurse the entire directory structure, compressing all video files.
|
||||
-f : Force recompressing any files by deleting it if it already exists.
|
||||
-d : Delete the original video if the compressed version is smaller.
|
||||
-l : Clean the filename of dashes and underscores so dates line up.
|
||||
-A : Recursively Force, Delete, and Clean.
|
||||
-A : Recursively Force and Delete.
|
||||
-m : Measure the time it takes to compress each video and do the loop.
|
||||
-V : Add verbosity, such as printing all the variable values.
|
||||
-x : Set the shell's x flag to display every action which is taken.
|
||||
@@ -60,7 +52,7 @@ function usage {
|
||||
|
||||
## Parameters ##
|
||||
|
||||
while getopts ":i:v:a:c:s:rfdlAmVxh" opt; do
|
||||
while getopts ":i:v:a:c:s:rfdAmVxh" opt; do
|
||||
case $opt in
|
||||
i) input="$OPTARG"
|
||||
;;
|
||||
@@ -78,9 +70,7 @@ while getopts ":i:v:a:c:s:rfdlAmVxh" opt; do
|
||||
;;
|
||||
d) delete="Y"
|
||||
;;
|
||||
l) clean="Y"
|
||||
;;
|
||||
A) search_command="find" && force="Y" && delete="Y" #&& clean="Y"
|
||||
A) search_command="find" && force="Y" && delete="Y"
|
||||
;;
|
||||
m) time_command="`which time`"
|
||||
;;
|
||||
@@ -105,44 +95,14 @@ if [[ -z "$input" ]]; then
|
||||
input="."
|
||||
fi
|
||||
|
||||
if [[ -z $size ]]; then
|
||||
size="720"
|
||||
fi
|
||||
typeset -i size_int
|
||||
size_int="$size"
|
||||
|
||||
# Ensure the filenames sort properly between 3 and 4 digit resolutions.
|
||||
while (( ${#size} < 4 )); do
|
||||
size="0$size"
|
||||
done
|
||||
compress_tags="$size"
|
||||
size="-filter:v scale=-2:$size"
|
||||
|
||||
if [[ -z "$video_bitrate" ]]; then
|
||||
# Based roughly on the 2.5 step iteration used for 720 and 1080.
|
||||
if (( size_int >= 2160 )); then
|
||||
video_bitrate="30M"
|
||||
elif (( size_int >= 1440 )); then
|
||||
video_bitrate="12M"
|
||||
elif (( size_int >= 1080 )); then
|
||||
video_bitrate="5M"
|
||||
elif (( size_int >= 720 )); then
|
||||
video_bitrate="2000k"
|
||||
elif (( size_int >= 480 )); then
|
||||
video_bitrate="750k"
|
||||
elif (( size_int >= 360 )); then
|
||||
video_bitrate="250k"
|
||||
else
|
||||
video_bitrate="100k"
|
||||
fi
|
||||
video_bitrate="2000k"
|
||||
fi
|
||||
compress_tags="$compress_tags-$video_bitrate"
|
||||
video_bitrate="-b:v $video_bitrate -minrate 0 -maxrate $video_bitrate -bufsize $video_bitrate"
|
||||
|
||||
if [[ -z "$audio_bitrate" ]]; then
|
||||
audio_bitrate="192k"
|
||||
fi
|
||||
compress_tags="$compress_tags-$audio_bitrate"
|
||||
audio_bitrate="-b:a $audio_bitrate"
|
||||
|
||||
if [[ -z "$codec" ]]; then
|
||||
@@ -161,6 +121,11 @@ else
|
||||
time_command="$time_command -p"
|
||||
fi
|
||||
|
||||
if [[ -z $size ]]; then
|
||||
size="720"
|
||||
fi
|
||||
size="-filter:v scale=-1:$size"
|
||||
|
||||
## Main ##
|
||||
|
||||
if [[ "$verbose" == "Y" ]]; then
|
||||
@@ -207,41 +172,26 @@ $search_command "$input" | sort | while read file; do
|
||||
# Build the new filename to signify it is different than the original.
|
||||
newfile="${file//$extension/$filename_flag-$date_YYYYMMDD.$extension_lower}"
|
||||
|
||||
# Add the size, video, and audio quality it was converted to.
|
||||
newfile="${newfile//\.$extension_lower/_$compress_tags.$extension_lower}"
|
||||
|
||||
if [[ $newfile == $file ]]; then
|
||||
echo "ERROR: The new calculated filename matches the old, skipping." >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
# TBD / TODO: Test this functionality!
|
||||
new_video_clean="${newfile}"
|
||||
new_video_clean="${new_video_clean//_/}"
|
||||
new_video_clean="${new_video_clean//-/}"
|
||||
new_video_clean="${new_video_clean// /}"
|
||||
|
||||
# More exception checks based on the new file.
|
||||
if [[ -e "$newfile" || -e "$new_video_clean" ]]; then
|
||||
if [[ -e "$newfile" ]]; then
|
||||
if [[ "$force" == "Y" ]]; then
|
||||
echo "FORCE: Removing '$newfile'."
|
||||
if [[ -d $HOME/TRASH ]]; then
|
||||
mv -v "$newfile" "$new_video_clean" $HOME/TRASH/ 2>/dev/null
|
||||
if [[ -d ~/TRASH ]]; then
|
||||
mv -v "$newfile" ~/TRASH/
|
||||
else
|
||||
rm -v "$newfile" "$new_video_clean" 2>/dev/null
|
||||
rm -v "$newfile"
|
||||
fi
|
||||
else
|
||||
echo "SKIP: Already has a compressed version."
|
||||
ls -sh "$newfile" "$new_video_clean" 2>/dev/null
|
||||
echo "SKIP: Already has a compressed version ($newfile)."
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# Whether or not to use the cleaned version or the normal version.
|
||||
if [[ -n $clean ]]; then
|
||||
newfile="$new_video_clean"
|
||||
fi
|
||||
|
||||
# Convert the file.
|
||||
echo "Converting to '$newfile'."
|
||||
echo "*** `date` ***"
|
||||
@@ -279,8 +229,8 @@ $search_command "$input" | sort | while read file; do
|
||||
|
||||
if [[ -n "$delete" ]]; then
|
||||
echo -n "Original has been deleted: "
|
||||
if [[ -d $HOME/TRASH ]]; then
|
||||
mv -v "$file" $HOME/TRASH/
|
||||
if [[ -d ~/TRASH ]]; then
|
||||
mv -v "$file" ~/TRASH/
|
||||
else
|
||||
rm -v "$file"
|
||||
fi
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# 2026-10-10 Hyperling
|
||||
# Stop a system from going into swap due to LLMs.
|
||||
|
||||
### Tuning ###
|
||||
|
||||
typeset -i sleep=10 full_pct=98 high_pct=90
|
||||
|
||||
### Functions ###
|
||||
|
||||
restart_service() {
|
||||
if [ -z $1 ]; then
|
||||
echo "ERROR: Service name must be passed to restart_service()."
|
||||
return 1
|
||||
fi
|
||||
sv restart $1
|
||||
status=$?
|
||||
if [[ $status != 0 ]]; then
|
||||
echo "$1 failed to restart, returned $status."
|
||||
return $status
|
||||
fi
|
||||
}
|
||||
|
||||
# While we could loop over `ollama ps` and stop them, this ensures that the UIs
|
||||
# do not sit around waiting for responses from the dead LLMs. It bring them up
|
||||
# in a fresh state so that work can continue from a more clean slate.
|
||||
restart_llms() {
|
||||
restart_service ollama || killall ollama
|
||||
#restart_service zeroclaw
|
||||
#restart_service open-webui
|
||||
#restart_service qwen-code
|
||||
}
|
||||
|
||||
### Main ###
|
||||
|
||||
typeset -i {total,used}_{ram,swap}=0 \
|
||||
used_{ram,swap}_pct=0 \
|
||||
last_{ram,swap}_pct=100 \
|
||||
count=0
|
||||
|
||||
while [[ true ]]; do
|
||||
|
||||
count=$(expr $count + 1 )
|
||||
echo "$(date +'%Y-%m-%d @ %H:%M:%S') - Loop $count"
|
||||
|
||||
# RAM #
|
||||
|
||||
total_ram=$(free | awk '/^Mem:/ {print $2}')
|
||||
used_ram=$(free | awk '/^Mem:/ {print $3}')
|
||||
used_ram_pct=$( \
|
||||
awk -v used="$used_ram" -v total="$total_ram" \
|
||||
'BEGIN {printf "%d",(used/total)*100}' \
|
||||
)
|
||||
|
||||
echo "Current RAM usage is $used_ram_pct%, was $last_ram_pct% last loop."
|
||||
|
||||
# Swap #
|
||||
|
||||
total_swap=$(free | awk '/^Swap:/ {print $2}')
|
||||
used_swap=$(free | awk '/^Swap:/ {print $3}')
|
||||
used_swap_pct=$( \
|
||||
awk -v used="$used_swap" -v total="$total_swap" \
|
||||
'BEGIN {printf "%d",(used/total)*100}' \
|
||||
)
|
||||
|
||||
echo "Current swap usage is $used_swap_pct%, was $last_swap_pct% last loop."
|
||||
|
||||
# If RAM is full and swap is growing then restart LLM services.
|
||||
if [ $used_ram_pct -gt $full_pct ] &&
|
||||
[ $used_swap_pct -gt $last_swap_pct ]
|
||||
then
|
||||
echo "WARNING: RAM full and swap is growing. Restarting LLMs."
|
||||
restart_llms
|
||||
continue
|
||||
fi
|
||||
|
||||
# If both are high then restart LLM services.
|
||||
if [ $used_ram_pct -ge $high_pct ] &&
|
||||
[ $used_swap_pct -ge $high_pct ]
|
||||
then
|
||||
echo "WARNING: RAM and swap both high. Restarting LLMs."
|
||||
restart_llms
|
||||
continue
|
||||
fi
|
||||
|
||||
# Finish #
|
||||
|
||||
echo -e "Check finished, sleeping for ${sleep}...\n"
|
||||
|
||||
last_ram_pct=$used_ram_pct
|
||||
last_swap_pct=$used_swap_pct
|
||||
|
||||
sleep $sleep
|
||||
done
|
||||
@@ -7,7 +7,7 @@
|
||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
|
||||
nixos_working_dir=$HOME/nixos-config-deleteme
|
||||
nixos_working_dir=~/nixos-config-deleteme
|
||||
nixos_working_exe=activate.sh
|
||||
|
||||
## Functions ##
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /usr/local/bin/volume.function
|
||||
|
||||
volume $@
|
||||
@@ -1,451 +0,0 @@
|
||||
# This file has been auto-generated by i3-config-wizard(1).
|
||||
# It will not be overwritten, so edit it as you like.
|
||||
#
|
||||
# Should you change your keyboard layout some time, delete
|
||||
# this file and re-run i3-config-wizard(1).
|
||||
#
|
||||
|
||||
# i3 config file (v4)
|
||||
#
|
||||
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
|
||||
|
||||
set $FIREFOX "sh -c '(firefox || firefox-esr || firefox-flatpak)'"
|
||||
set $TRANSMISSION "sh -c '(transmission || transmission-qt || transmission-gtk || transmission-flatpak)'"
|
||||
|
||||
# Use the `xev` command to see the name and code of a keyboard key.
|
||||
|
||||
set $mod Mod4
|
||||
set $alt Mod1
|
||||
set $ctrl Control
|
||||
set $shift Shift
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
font pango:monospace 8
|
||||
|
||||
# This font is widely installed, provides lots of unicode glyphs, right-to-left
|
||||
# text rendering and scalability on retina/hidpi displays (thanks to pango).
|
||||
#font pango:DejaVu Sans Mono 8
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# move tiling windows via drag & drop by left-clicking into the title bar,
|
||||
# or left-clicking anywhere into the window while holding the floating modifier.
|
||||
tiling_drag modifier titlebar
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec i3-sensible-terminal
|
||||
#bindsym $mod+Return exec st
|
||||
|
||||
# kill focused window
|
||||
#bindsym $mod+Shift+q kill
|
||||
bindsym $mod+q kill
|
||||
|
||||
# start dmenu (a program launcher)
|
||||
bindsym $mod+d exec --no-startup-id dmenu_run
|
||||
bindsym $mod+b exec --no-startup-id dmenu_run
|
||||
bindsym $mod+space exec --no-startup-id dmenu_run
|
||||
# A more modern dmenu replacement is rofi:
|
||||
# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
|
||||
# There also is i3-dmenu-desktop which only displays applications shipping a
|
||||
# .desktop file. It is a wrapper around dmenu, so you need that installed.
|
||||
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
|
||||
|
||||
# change focus
|
||||
#bindsym $mod+j focus left
|
||||
#bindsym $mod+k focus down
|
||||
#bindsym $mod+l focus up
|
||||
#bindsym $mod+semicolon focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move focused window
|
||||
#bindsym $mod+Shift+j move left
|
||||
#bindsym $mod+Shift+k move down
|
||||
#bindsym $mod+Shift+l move up
|
||||
#bindsym $mod+Shift+semicolon move right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
# split in horizontal orientation
|
||||
bindsym $mod+h split h
|
||||
|
||||
# split in vertical orientation
|
||||
bindsym $mod+v split v
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
#bindsym $mod+space focus mode_toggle
|
||||
|
||||
# focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# focus the child container
|
||||
#bindsym $mod+d focus child
|
||||
|
||||
|
||||
## Extra Program Shortcuts ##
|
||||
|
||||
# Theming.
|
||||
bindsym $mod+t exec lxappearance
|
||||
|
||||
# Manage files.
|
||||
bindsym $mod+m exec thunar
|
||||
|
||||
# Internet.
|
||||
bindsym $mod+i exec $FIREFOX
|
||||
|
||||
# Code.
|
||||
bindsym $mod+c exec codium-flatpak
|
||||
|
||||
|
||||
## Brightness ##
|
||||
# light requires sudo privileges unless video group and udev are configured.
|
||||
|
||||
set $b_time 3000
|
||||
set $b_micro 5
|
||||
set $b_small 10
|
||||
set $b_large 20
|
||||
|
||||
# Use the bracket keys to change the brightness.
|
||||
bindsym $ctrl+bracketleft exec --no-startup-id "light -U $b_micro && notify-send -t $b_time 'Brightness - ' $(light -G)"
|
||||
bindsym $ctrl+bracketright exec --no-startup-id "light -A $b_micro && notify-send -t $b_time 'Brightness + ' $(light -G)"
|
||||
bindsym $mod+bracketleft exec --no-startup-id "light -U $b_small && notify-send -t $b_time 'Brightness -- ' $(light -G)"
|
||||
bindsym $mod+bracketright exec --no-startup-id "light -A $b_small && notify-send -t $b_time 'Brightness ++ ' $(light -G)"
|
||||
bindsym $shift+$mod+bracketleft exec --no-startup-id "light -U $b_large && notify-send -t $b_time 'Brightness ---' $(light -G)"
|
||||
bindsym $shift+$mod+bracketright exec --no-startup-id "light -A $b_large && notify-send -t $b_time 'Brightness +++' $(light -G)"
|
||||
|
||||
# Also get the actual brightness keys to work!!
|
||||
bindsym $ctrl+XF86MonBrightnessUp exec --no-startup-id "light -A $b_micro && notify-send -t $b_time 'Brightness + ' $(light -G)"
|
||||
bindsym $ctrl+XF86MonBrightnessDown exec --no-startup-id "light -U $b_micro && notify-send -t $b_time 'Brightness - ' $(light -G)"
|
||||
bindsym XF86MonBrightnessUp exec --no-startup-id "light -A $b_small && notify-send -t $b_time 'Brightness ++ ' $(light -G)"
|
||||
bindsym XF86MonBrightnessDown exec --no-startup-id "light -U $b_small && notify-send -t $b_time 'Brightness -- ' $(light -G)"
|
||||
bindsym $shift+XF86MonBrightnessUp exec --no-startup-id "light -A $b_large && notify-send -t $b_time 'Brightness +++' $(light -G)"
|
||||
bindsym $shift+XF86MonBrightnessDown exec --no-startup-id "light -U $b_large && notify-send -t $b_time 'Brightness ---' $(light -G)"
|
||||
|
||||
|
||||
## Keyboard Brightness ##
|
||||
|
||||
# Use same timing and step size settings as above.
|
||||
|
||||
# Macbooks tend to use 'sysfs/leds/smc::kbd_backlight'
|
||||
# NovaCustom laptop is 'sysfs/leds/system76_acpi::kbd_backlight'
|
||||
# Some other laptops may be 'sysfs/class/leds/...', use ìght -L`to find out.
|
||||
bindsym $ctrl+XF86KbdBrightnessUp exec "light -s sysfs/leds/smc::kbd_backlight -A $b_micro && notify-send -t $b_time 'Keyboard Brightness + ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $ctrl+XF86KbdBrightnessDown exec "light -s sysfs/leds/smc::kbd_backlight -U $b_micro && notify-send -t $b_time 'Keyboard Brightness - ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym XF86KbdBrightnessUp exec "light -s sysfs/leds/smc::kbd_backlight -A $b_small && notify-send -t $b_time 'Keyboard Brightness ++ ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym XF86KbdBrightnessDown exec "light -s sysfs/leds/smc::kbd_backlight -U $b_small && notify-send -t $b_time 'Keyboard Brightness -- ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $shift+XF86KbdBrightnessUp exec "light -s sysfs/leds/smc::kbd_backlight -A $b_large && notify-send -t $b_time 'Keyboard Brightness +++' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $shift+XF86KbdBrightnessDown exec "light -s sysfs/leds/smc::kbd_backlight -U $b_large && notify-send -t $b_time 'Keyboard Brightness ---' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
|
||||
bindsym $ctrl+apostrophe exec "light -s sysfs/leds/smc::kbd_backlight -A $b_micro && notify-send -t $b_time 'Keyboard Brightness + ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $ctrl+semicolon exec "light -s sysfs/leds/smc::kbd_backlight -U $b_micro && notify-send -t $b_time 'Keyboard Brightness - ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $mod+apostrophe exec "light -s sysfs/leds/smc::kbd_backlight -A $b_small && notify-send -t $b_time 'Keyboard Brightness ++ ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $mod+semicolon exec "light -s sysfs/leds/smc::kbd_backlight -U $b_small && notify-send -t $b_time 'Keyboard Brightness -- ' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $shift+$mod+apostrophe exec "light -s sysfs/leds/smc::kbd_backlight -A $b_large && notify-send -t $b_time 'Keyboard Brightness +++' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
bindsym $shift+$mod+semicolon exec "light -s sysfs/leds/smc::kbd_backlight -U $b_large && notify-send -t $b_time 'Keyboard Brightness ---' $(light -s sysfs/leds/smc::kbd_backlight -G)"
|
||||
|
||||
|
||||
## Volume ##
|
||||
# The volume function is from https://git.hyperling.com/me/env-ansible
|
||||
|
||||
set $v_time 1500
|
||||
set $v_micro 5
|
||||
set $v_small 10
|
||||
set $v_large 25
|
||||
|
||||
# Use the comma and period keys to change volume.
|
||||
bindsym $ctrl+comma exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume -$v_micro && notify-send -t $v_time "Volume - " $(volume)'
|
||||
bindsym $ctrl+period exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume +$v_micro && notify-send -t $v_time "Volume + " $(volume)'
|
||||
bindsym $mod+comma exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume -$v_small && notify-send -t $v_time "Volume -- " $(volume)'
|
||||
bindsym $mod+period exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume +$v_small && notify-send -t $v_time "Volume ++ " $(volume)'
|
||||
bindsym $shift+$mod+comma exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume -$v_large && notify-send -t $v_time "Volume ---" $(volume)'
|
||||
bindsym $shift+$mod+period exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume +$v_large && notify-send -t $v_time "Volume +++" $(volume)'
|
||||
|
||||
# Actual volume keys.
|
||||
bindsym XF86AudioMute exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume mute && notify-send -t $v_time "Volume Muted" $(volume)'
|
||||
bindsym $ctrl+XF86AudioRaiseVolume exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume +$v_micro && notify-send -t $v_time "Volume + " $(volume)'
|
||||
bindsym $ctrl+XF86AudioLowerVolume exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume -$v_micro && notify-send -t $v_time "Volume - " $(volume)'
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume +$v_small && notify-send -t $v_time "Volume ++ " $(volume)'
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume -$v_small && notify-send -t $v_time "Volume -- " $(volume)'
|
||||
bindsym $shift+XF86AudioRaiseVolume exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume +$v_large && notify-send -t $v_time "Volume +++ " $(volume)'
|
||||
bindsym $shift+XF86AudioLowerVolume exec --no-startup-id bash -c 'source /usr/local/bin/volume.function && volume -$v_large && notify-send -t $v_time "Volume --- " $(volume)'
|
||||
|
||||
bindsym $mod+slash exec pavucontrol
|
||||
|
||||
|
||||
## Workspaces ##
|
||||
|
||||
# Define names for default workspaces for which we configure key bindings later on.
|
||||
# We use variables to avoid repeating the names in multiple places.
|
||||
# Command Line
|
||||
set $ws1 "1 - CMD"
|
||||
# Web Surfing
|
||||
set $ws2 "2 - WEB"
|
||||
# Programming
|
||||
set $ws3 "3 - PRG"
|
||||
# Android (Flutter, Qt, Kivy, etc)
|
||||
set $ws4 "4 - AND"
|
||||
# Chats
|
||||
set $ws5 "5 - CHT"
|
||||
# Other
|
||||
set $ws6 "6 - OTH"
|
||||
# Torrents
|
||||
set $ws7 "7 - TOR"
|
||||
# Music
|
||||
set $ws8 "8 - MUS"
|
||||
# Videos
|
||||
set $ws9 "9 - VID"
|
||||
# VPNs
|
||||
set $ws0 "10 - VPN"
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace number $ws1
|
||||
bindsym $mod+2 workspace number $ws2
|
||||
bindsym $mod+3 workspace number $ws3
|
||||
bindsym $mod+4 workspace number $ws4
|
||||
bindsym $mod+5 workspace number $ws5
|
||||
bindsym $mod+6 workspace number $ws6
|
||||
bindsym $mod+7 workspace number $ws7
|
||||
bindsym $mod+8 workspace number $ws8
|
||||
bindsym $mod+9 workspace number $ws9
|
||||
bindsym $mod+0 workspace number $ws0
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace number $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace number $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace number $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace number $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace number $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace number $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace number $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace number $ws0
|
||||
|
||||
## Keep certain programs in certain tabs. ##
|
||||
# Use the `xprop` command to find the class of a program.
|
||||
# (?i) makes the regex case insensitive.
|
||||
|
||||
assign [class="Navigator"] $ws2
|
||||
assign [class="(?i).*navigator.*"] $ws2
|
||||
assign [class="(?i).*firefox.*"] $ws2
|
||||
assign [class="(?i).*librewolf.*"] $ws2
|
||||
assign [class="(?i).*brave.*"] $ws2
|
||||
|
||||
assign [class="(?i).*codium.*"] $ws3
|
||||
assign [class="(?i).*code.*"] $ws3
|
||||
|
||||
assign [class="(?i).*flutter.*"] $ws4
|
||||
assign [class="(?i).*jetbrains.*"] $ws4
|
||||
|
||||
assign [class="(?i).*signal.*"] $ws5
|
||||
assign [class="(?i).*telegram.*"] $ws5
|
||||
assign [class="(?i).*session.*"] $ws5
|
||||
assign [class="(?i).*dino.*"] $ws5
|
||||
|
||||
assign [class="(?i).*pavucontrol.*"] $ws6
|
||||
assign [class="(?i).*blueman.*"] $ws6
|
||||
assign [class="(?i).*boxes.*"] $ws6
|
||||
assign [class="(?i).*waydroid.*"] $ws6
|
||||
|
||||
assign [class="(?i).*transmission.*"] $ws7
|
||||
|
||||
assign [class="(?i).*rhythmbox.*"] $ws8
|
||||
assign [class="(?i).*strawberry.*"] $ws8
|
||||
|
||||
assign [class="(?i).*vlc.*"] $ws9
|
||||
assign [class="(?i).*mpv.*"] $ws9
|
||||
|
||||
assign [class="(?i).*vpn.*"] $ws0
|
||||
assign [class="(?i).*mullvad.*"] $ws0
|
||||
assign [class="(?i).*gnome-system-monitor.*"] $ws0
|
||||
|
||||
|
||||
## Workspace Specific Workflows ##
|
||||
#bindsym $ctrl+$shift+1 workspace $ws1; exec "i3-sensible-terminal & gnome-system-monitor"
|
||||
bindsym $ctrl+$shift+1 workspace $ws1; exec "i3-sensible-terminal & i3-sensible-terminal btop -u 500"
|
||||
bindsym $ctrl+$shift+2 workspace $ws2; exec $FIREFOX
|
||||
bindsym $ctrl+$shift+3 workspace $ws3; exec "(codium || vscodium || codium-flatpak || vscodium-flatpak)"
|
||||
bindsym $ctrl+$shift+4 workspace $ws4; exec "android-studio || android-studio-flatpak"
|
||||
bindsym $ctrl+$shift+5 workspace $ws5; exec "(signal || signal-flatpak) & (dino || dino-flatpak)"
|
||||
bindsym $alt+$shift+5 workspace $ws5; exec "(session || session-flatpak) & (forkgram || forkgram-flatpak || telegram || telegram-flatpak)"
|
||||
bindsym $ctrl+$shift+6 workspace $ws6; exec "pavucontrol & blueman-manager"
|
||||
bindsym $ctrl+$shift+7 workspace $ws7; exec $TRANSMISSION
|
||||
bindsym $ctrl+$shift+8 workspace $ws8; exec strawberry
|
||||
bindsym $ctrl+$shift+9 workspace $ws9; exec thunar
|
||||
bindsym $ctrl+$shift+0 workspace $ws0; exec "mullvad-vpn & gnome-system-monitor"
|
||||
|
||||
|
||||
## Reloads, Restarts, Exit ##
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
|
||||
# exit i3 (logs you out of your X session)
|
||||
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
|
||||
bindsym $mod+Shift+q exec "i3-msg exit"
|
||||
|
||||
# lock
|
||||
#set $LOCK_CMD "i3lock -c 333333 -e -f && sleep 1 && xset dpms force off"
|
||||
set $LOCK_CMD "loginctl lock-session"
|
||||
bindsym $ctrl+$alt+l exec $LOCK_CMD
|
||||
bindsym $ctrl+$mod+l exec $LOCK_CMD
|
||||
bindsym $shift+$mod+l exec $LOCK_CMD
|
||||
|
||||
# shutdown entire system.
|
||||
#bindsym $ctrl+$shift+q exec dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
|
||||
bindsym $ctrl+$alt+$mod+q exec sudo shutdown -h now
|
||||
bindsym $shift+$alt+$mod+q exec sudo shutdown -h now
|
||||
bindsym $shift+$ctrl+$mod+q exec sudo shutdown -h now
|
||||
|
||||
# restart entire system.
|
||||
bindsym $ctrl+$alt+$mod+r exec sudo shutdown -r now
|
||||
bindsym $shift+$alt+$mod+r exec sudo shutdown -r now
|
||||
bindsym $shift+$ctrl+$mod+r exec sudo shutdown -r now
|
||||
|
||||
# restart LLM programs
|
||||
set $RESTART_LLMS "sudo sv restart ollama; sudo sv restart zeroclaw; sudo sv restart open-webui"
|
||||
bindsym $ctrl+$alt+delete exec $RESTART_LLMS
|
||||
bindsym $shift+$alt+delete exec $RESTART_LLMS
|
||||
bindsym $shift+$ctrl+delete exec $RESTART_LLMS
|
||||
|
||||
|
||||
## Resizing (Disabled) ##
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
#mode "resize" {
|
||||
# # These bindings trigger as soon as you enter the resize mode
|
||||
#
|
||||
# # Pressing left will shrink the window’s width.
|
||||
# # Pressing right will grow the window’s width.
|
||||
# # Pressing up will shrink the window’s height.
|
||||
# # Pressing down will grow the window’s height.
|
||||
# bindsym j resize shrink width 10 px or 10 ppt
|
||||
# bindsym k resize grow height 10 px or 10 ppt
|
||||
# bindsym l resize shrink height 10 px or 10 ppt
|
||||
# bindsym semicolon resize grow width 10 px or 10 ppt
|
||||
#
|
||||
# # same bindings, but for the arrow keys
|
||||
# bindsym Left resize shrink width 10 px or 10 ppt
|
||||
# bindsym Down resize grow height 10 px or 10 ppt
|
||||
# bindsym Up resize shrink height 10 px or 10 ppt
|
||||
# bindsym Right resize grow width 10 px or 10 ppt
|
||||
#
|
||||
# # back to normal: Enter or Escape or $mod+r
|
||||
# bindsym Return mode "default"
|
||||
# bindsym Escape mode "default"
|
||||
# bindsym $mod+r mode "default"
|
||||
#}
|
||||
#
|
||||
#bindsym $mod+r mode "resize"
|
||||
|
||||
|
||||
## Taskbar ##
|
||||
|
||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||
# finds out, if available)
|
||||
bar {
|
||||
status_command i3status
|
||||
}
|
||||
|
||||
|
||||
## Startup Applications ##
|
||||
|
||||
# Workspace 1
|
||||
exec --no-startup-id i3-sensible-terminal
|
||||
exec --no-startup-id i3-sensible-terminal btop -u 500
|
||||
|
||||
# Respective Workspaces
|
||||
exec --no-startup-id mullvad-vpn
|
||||
exec --no-startup-id $TRANSMISSION
|
||||
exec --no-startup-id gnome-system-monitor
|
||||
|
||||
# Set defaults for laptop backlights.
|
||||
exec --no-startup-id "light -S 20; light -N 5; light -O"
|
||||
|
||||
# Set the correct keymap.
|
||||
exec_always --no-startup-id setxkbmap -layout us -variant altgr-intl
|
||||
|
||||
# Notifications (allows fyi and notify-send to work)
|
||||
exec_always --no-startup-id "killall dunst; dunst"
|
||||
|
||||
# Audio
|
||||
exec --no-startup-id "sleep 00; dbus-launch --exit-with-session i3"
|
||||
exec_always --no-startup-id "sleep 00; killall pipewire wireplumber pipewire-pulse"
|
||||
exec_always --no-startup-id "sleep 01; pipewire >~/Reports/pipewire.log 2>&1 &"
|
||||
exec_always --no-startup-id "sleep 02; wireplumber >~/Reports/wireplumber.log 2>&1 &"
|
||||
exec_always --no-startup-id "sleep 03; pipewire-pulse >~/Reports/pipewire-pulse.log 2>&1 &"
|
||||
exec --no-startup-id "sleep 04; bash -c 'source /usr/local/bin/volume.function && volume 75'"
|
||||
|
||||
# Wallpaper
|
||||
exec_always --no-startup-id feh --recursive --randomize --bg-fill ~/Pictures/Wallpapers
|
||||
|
||||
# Compositor
|
||||
exec_always --no-startup-id "killall picom; picom -f --backend xrender"
|
||||
|
||||
# Battery
|
||||
exec_always --no-startup-id bash -c 'pkill -ef "bash `which battery_nag.sh`" >~/Reports/battery_nag.log 2>&1; battery_nag.sh >>~/Reports/battery_nag.log 2>&1'
|
||||
|
||||
# Redshift
|
||||
#exec_always --no-startup-id "killall redshift-gtk; redshift-gtk"
|
||||
#exec_always --no-startup-id "killall redshift; redshift -l 35.19540:-111.65720 -t 6500K:1100K"
|
||||
exec_always --no-startup-id "killall redshift; killall redshift-gtk; sleep 1; redshift -x; redshift-gtk -l 32:-111 -t 6500K:1100K"
|
||||
|
||||
# Allow locking the session.
|
||||
#set $AGENT pkttyagent
|
||||
set $AGENT lxqt-policykit-agent
|
||||
exec_always --no-startup-id "killall $AGENT; $AGENT"
|
||||
|
||||
# Start XDG autostart .desktop files using dex. See also
|
||||
# https://wiki.archlinux.org/index.php/XDG_Autostart
|
||||
exec --no-startup-id dex --autostart --environment i3
|
||||
|
||||
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
|
||||
# they are included here as an example. Modify as you see fit.
|
||||
|
||||
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
|
||||
# screen before suspend. Use loginctl lock-session to lock your screen.
|
||||
#exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
|
||||
#exec_always --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 111111 -e -f --nofork
|
||||
exec_always --no-startup-id xss-lock --transfer-sleep-lock -- sh -c 'i3lock -c 111111 -e -f --nofork & sleep 1; xset dpms force off; wait'
|
||||
|
||||
# NetworkManager is the most popular way to manage wireless networks on Linux,
|
||||
# and nm-applet is a desktop environment-independent system tray GUI for it.
|
||||
exec --no-startup-id nm-applet
|
||||
|
||||
# Use pactl to adjust volume in PulseAudio.
|
||||
set $refresh_i3status killall -SIGUSR1 i3status
|
||||
#bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
|
||||
#bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
|
||||
#bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
|
||||
#bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
|
||||
|
||||
# Sunset Alarm
|
||||
#exec_always --no-startup-id "killall sunset-alarm; /home/ling/Code/sunset_alarm_cli/sunset-alarm -t 20:00 -m 30 > ~/Reports/sunset-alarm.log 2>&1"
|
||||
exec_always --no-startup-id "killall sunset-alarm; /home/ling/Code/sunset_alarm_cli/sunset-alarm -l 32:-111 -m 30 > ~/Reports/sunset-alarm.log 2>&1"
|
||||
|
||||
# Bedtime ;)
|
||||
exec --no-startup-id "while true; do if [[ `date +'%H'` -ge 20 ]]; then fyi -w -u critical 'Bedtime' 'Go to sleep! >:)'; fi; sleep 600; done"
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -3,46 +3,13 @@
|
||||
"save_loc1": "~/.var/app/com.visualstudio.code-oss/config/Code - OSS/{{ user_desc }}/settings.json",
|
||||
"save_loc2": "~/.var/app/com.vscodium.codium/config/VSCodium/{{ user_desc }}/settings.json",
|
||||
"END_COMMENTS": "",
|
||||
|
||||
"update.showReleaseNotes": false,
|
||||
"workbench.startupEditor": "none",
|
||||
"git.confirmSync": false,
|
||||
"workbench.editor.openPositioning": "last",
|
||||
|
||||
"editor.rulers": [
|
||||
80, 120, 200,
|
||||
80, 120, 200
|
||||
],
|
||||
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true,
|
||||
|
||||
"editor.tabSize": 3,
|
||||
"editor.insertSpaces": false,
|
||||
|
||||
"editor.autoClosingBrackets": "never",
|
||||
"editor.autoClosingQuotes": "never",
|
||||
|
||||
"files.insertFinalNewline": true,
|
||||
"[html]": {
|
||||
"files.insertFinalNewline": false,
|
||||
},
|
||||
|
||||
"[dart]": {
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true,
|
||||
"editor.selectionHighlight": false,
|
||||
"editor.tabCompletion": "onlySnippets",
|
||||
"editor.wordBasedSuggestions": "off",
|
||||
},
|
||||
|
||||
"json.schemas": [
|
||||
{
|
||||
"fileMatch": ["*.json", "*.jsonc"],
|
||||
"schema": {
|
||||
"allowTrailingCommas": true,
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"redhat.telemetry.enabled": false,
|
||||
"files.trimFinalNewlines": true
|
||||
}
|
||||
@@ -1,8 +1,2 @@
|
||||
|
||||
%sudo ALL=(ALL) ALL
|
||||
|
||||
# Allow anyone in the sudo group to shutdown or reboot without a password.
|
||||
%sudo ALL=(ALL) NOPASSWD: /sbin/shutdown, /usr/sbin/shutdown, /sbin/reboot, /usr/sbin/reboot
|
||||
|
||||
# Allow the sudo group to manage runit services.
|
||||
%sudo ALL=(ALL) NOPASSWD: /sbin/sv, /usr/sbin/sv, /sbin/sv, /usr/sbin/sv
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Whitespace-only changes.
Whitespace-only changes.
@@ -1,22 +0,0 @@
|
||||
# title
|
||||
|
||||
NAME
|
||||
|
||||
# desc
|
||||
|
||||
CONTENT
|
||||
|
||||
---
|
||||
|
||||
Recorded and edited YYYY-MM-DD.
|
||||
Recorded YYYY-MM-DD, edited YYYY-MM-DD.
|
||||
|
||||
[blog.hyperling.com/TBD](https://blog.hyperling.com/TBD)
|
||||
|
||||
# tags
|
||||
|
||||
-
|
||||
,
|
||||
,
|
||||
,
|
||||
,
|
||||
@@ -2,238 +2,241 @@
|
||||
# Harmonize systems rather than doing everything manually. :)
|
||||
|
||||
# Setup of any device connected to this repo.
|
||||
- name: Local | Main
|
||||
- name: Main | Default Setup
|
||||
hosts: localhost
|
||||
connection: local
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
|
||||
####### Header #######
|
||||
####### Gather #######
|
||||
# Load facts for all systems.
|
||||
|
||||
- name: Main | Header
|
||||
ansible.builtin.include_tasks: tasks/header.yml
|
||||
- include_tasks: facts/general/gather.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/provision_config.yml
|
||||
|
||||
####### Workstations #######
|
||||
- include_tasks: facts/general/system.yml
|
||||
- include_tasks: facts/general/package.yml
|
||||
- include_tasks: facts/general/service.yml
|
||||
- include_tasks: facts/general/user.yml
|
||||
|
||||
# Additional setup for systems with GUI.
|
||||
- name: Main | Workstation
|
||||
|
||||
####### NixOS #######
|
||||
# Install the .nix files and do a little data setup.
|
||||
|
||||
- name: Main | NixOS Setup
|
||||
block:
|
||||
|
||||
- ansible.builtin.include_tasks: facts/workstation/package.yml
|
||||
- include_tasks: tasks/general/software/nixos.yml
|
||||
|
||||
## Desktop Environments ##
|
||||
- ansible.builtin.include_tasks: tasks/workstation/freebsd/software/gpu.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
and bsd_gpu
|
||||
and internet
|
||||
|
||||
# Window Managers without true Desktop Environments #
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/software/dwm.yml
|
||||
when: internet
|
||||
# TBD if we are going to use this many, then just have IF statements
|
||||
# and use blocks within the General area for NixOS vs not-NixOS.
|
||||
- include_tasks: tasks/general/software/swap.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/software/i3.yml
|
||||
when: internet
|
||||
- include_tasks: tasks/general/acct_mgmt/groups.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/users.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/sudo.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/doas.yml
|
||||
|
||||
# Polished Desktop Environments #
|
||||
- ansible.builtin.include_tasks: tasks/workstation/freebsd/software/gnome.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
and internet
|
||||
- include_tasks: tasks/general/scripts/root.yml
|
||||
- include_tasks: tasks/general/scripts/user.yml
|
||||
- include_tasks: tasks/general/scripts/install.yml
|
||||
|
||||
- name: Main | Workstation | Fancy Desktop Environments
|
||||
block:
|
||||
- include_tasks: tasks/general/cron/ansible.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/gnome.yml
|
||||
when: ansible_service_mgr == "systemd"
|
||||
# psutil does not work in NixOS. Cannot figure out how to fix it. Maybe
|
||||
# time to start looking into home-manager but still not wanting to
|
||||
# maintain two different GNOME setups. HMMMM!
|
||||
- include_tasks: tasks/workstation/shared/settings/gnome.yml
|
||||
when: workstation == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/cinnamon.yml
|
||||
# Try including these. Really need to get NixOS working with the rest!
|
||||
#- include_tasks: tasks/general/software/telegraf.yml # "Could not find a module for unknown.""
|
||||
- include_tasks: tasks/general/tests/services.yml
|
||||
- include_tasks: tasks/general/tests/lynis.yml
|
||||
- include_tasks: tasks/general/tests/nmap.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/lxqt.yml
|
||||
- name: NixOS | Complete
|
||||
meta: end_play
|
||||
|
||||
when: ansible_system == "Linux"
|
||||
and internet
|
||||
# TBD: Implement this: and extra_desktops
|
||||
when: ansible_distribution == "NixOS"
|
||||
|
||||
## Software Tasks ##
|
||||
|
||||
- name: Main | Workstation | Linux
|
||||
block:
|
||||
####### General #######
|
||||
# Basic setup for all enabled systems.
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/packages.yml
|
||||
- name: Main | General Setup
|
||||
block:
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/tlp.yml
|
||||
- include_tasks: tasks/general/software/swap.yml
|
||||
- include_tasks: tasks/general/software/packages.yml
|
||||
- include_tasks: tasks/general/software/services.yml
|
||||
- include_tasks: tasks/general/software/sendmail.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/lutris.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/vscodium.yml
|
||||
# Gather again in case missing programs have now been installed.
|
||||
- include_tasks: facts/general/gather.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/vpn.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/groups.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/users.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/sudo.yml
|
||||
- include_tasks: tasks/general/acct_mgmt/doas.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/nodejs.yml
|
||||
- include_tasks: tasks/general/scripts/root.yml
|
||||
- include_tasks: tasks/general/scripts/user.yml
|
||||
- include_tasks: tasks/general/scripts/install.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/hugo.yml
|
||||
- include_tasks: tasks/general/cron/ansible.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/brave.yml
|
||||
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
|
||||
# TODO Need to refactor. Maybe tasks/general/cron/freebsd.yml
|
||||
- include_tasks: tasks/workstation/freebsd/cron/ansible.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
when: ansible_system == "Linux"
|
||||
and internet
|
||||
- include_tasks: tasks/general/software/metasploit.yml
|
||||
when: pentesting == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/freebsd/software/packages.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
and internet
|
||||
when: provision == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/mac-os/software/brew.yml
|
||||
when: ansible_system == "Darwin"
|
||||
and internet
|
||||
|
||||
## Configuration Tasks ##
|
||||
####### Workstations #######
|
||||
# Additional setup for systems with GUI.
|
||||
|
||||
- name: Main | Workstation | Configuration
|
||||
block:
|
||||
- name: Main | Workstation Setup
|
||||
block:
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/gnome.yml
|
||||
- include_tasks: facts/workstation/package.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/cinnamon.yml
|
||||
# Set Up Desktop Environments #
|
||||
- include_tasks: tasks/workstation/freebsd/software/gpu.yml
|
||||
when: ansible_system == "FreeBSD" and bsd_gpu == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/xdg_autostart.yml
|
||||
- include_tasks: tasks/workstation/freebsd/software/gnome.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/cron/ansible.yml
|
||||
when: ansible_system == "Linux"
|
||||
- include_tasks: tasks/workstation/linux/software/gnome.yml
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
when: not mobile
|
||||
- include_tasks: tasks/workstation/shared/software/dwm.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/nfs.yml
|
||||
# Software Tasks #
|
||||
- include_tasks: tasks/workstation/linux/software/packages.yml
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/rdp.yml
|
||||
when: rdp
|
||||
- include_tasks: tasks/workstation/linux/software/brave.yml
|
||||
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/vnc.yml
|
||||
when: vnc
|
||||
- include_tasks: tasks/workstation/linux/software/vpn.yml
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/services.yml
|
||||
- include_tasks: tasks/workstation/freebsd/software/packages.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/templates.yml
|
||||
- include_tasks: tasks/workstation/mac-os/software/brew.yml
|
||||
when: ansible_system == "Darwin"
|
||||
|
||||
## Final Tasks (SLOW) ##
|
||||
# Configuration Tasks #
|
||||
- include_tasks: tasks/workstation/shared/settings/gnome.yml
|
||||
when: not mobile
|
||||
|
||||
- name: Main | Workstation | Linux [Slow]
|
||||
block:
|
||||
- include_tasks: tasks/workstation/linux/cron/ansible.yml
|
||||
when: ansible_system == "Linux" and not mobile
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/flatpaks.yml
|
||||
when: flatpak_distro
|
||||
- include_tasks: tasks/workstation/shared/settings/nfs.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/java.yml
|
||||
- include_tasks: tasks/workstation/shared/settings/rdp.yml
|
||||
when: rdp == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/flutter.yml
|
||||
- include_tasks: tasks/workstation/shared/settings/vnc.yml
|
||||
when: vnc == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/android.yml
|
||||
- include_tasks: tasks/workstation/shared/settings/services.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/docker.yml
|
||||
# Final Tasks (SLOW) #
|
||||
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
|
||||
when: ansible_system == "Linux" and flatpak_distro
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/workstation/linux/software/ai/llm.yml
|
||||
when: workstation == true
|
||||
|
||||
when: ansible_system == "Linux"
|
||||
and internet
|
||||
|
||||
when: workstation
|
||||
|
||||
# No longer mining, this is now considered deprecated.
|
||||
# ####### Miners #######
|
||||
#
|
||||
# # Additional setup for miners.
|
||||
# - name: Main | Miner
|
||||
# - name: Main | Miner Setup
|
||||
# block:
|
||||
#
|
||||
# ##### Setup #####
|
||||
# - ansible.builtin.include_tasks: tasks/miner/debug.yml
|
||||
# - include_tasks: tasks/miner/debug.yml
|
||||
#
|
||||
# - ansible.builtin.include_tasks: tasks/miner/acct_mgmt/users.yml
|
||||
# - include_tasks: tasks/miner/acct_mgmt/users.yml
|
||||
#
|
||||
# - ansible.builtin.include_tasks: facts/miner/system.yml
|
||||
# - ansible.builtin.include_tasks: facts/miner/config.yml
|
||||
# - ansible.builtin.include_tasks: facts/miner/pool.yml
|
||||
# - include_tasks: facts/miner/system.yml
|
||||
# - include_tasks: facts/miner/config.yml
|
||||
# - include_tasks: facts/miner/pool.yml
|
||||
#
|
||||
# ##### Installations #####
|
||||
# ### CPU SECTION ###
|
||||
# # Monero #
|
||||
# - ansible.builtin.include_tasks: tasks/miner/software/xmr-stak-cpu.yml
|
||||
# - include_tasks: tasks/miner/software/xmr-stak-cpu.yml
|
||||
# when: xmr_stak_cpu is defined
|
||||
#
|
||||
# ### GPU Section ###
|
||||
# ## Drivers ##
|
||||
# - ansible.builtin.include_tasks: tasks/miner/drivers/amdgpu.yml
|
||||
# when: ansible_distribution == "Ubuntu" and amdgpu
|
||||
# - include_tasks: tasks/miner/drivers/amdgpu.yml
|
||||
# when: ansible_distribution == "Ubuntu" and amdgpu == true
|
||||
#
|
||||
# # Ethereum #
|
||||
# - ansible.builtin.include_tasks: tasks/miner/software/ethminer.yml
|
||||
# when: ethminer
|
||||
# - include_tasks: tasks/miner/software/ethminer.yml
|
||||
# when: ethminer == true
|
||||
#
|
||||
# - ansible.builtin.include_tasks: tasks/miner/software/nanominer.yml
|
||||
# when: nanominer
|
||||
# - include_tasks: tasks/miner/software/nanominer.yml
|
||||
# when: nanominer == true
|
||||
#
|
||||
# ##### Scheduling #####
|
||||
# - ansible.builtin.include_tasks: tasks/miner/cron/ansible.yml
|
||||
# - ansible.builtin.include_tasks: tasks/miner/cron/mfn.yml
|
||||
# - include_tasks: tasks/miner/cron/ansible.yml
|
||||
# - include_tasks: tasks/miner/cron/mfn.yml
|
||||
#
|
||||
# when: miner
|
||||
# when: miner == true
|
||||
|
||||
|
||||
####### Servers #######
|
||||
|
||||
# Easy to deploy server configurations.
|
||||
- name: Main | Server
|
||||
|
||||
- name: Main | Server Setup
|
||||
block:
|
||||
|
||||
- name: Main | Server | Services
|
||||
ansible.builtin.include_tasks: tasks/server/software/services.yml
|
||||
- include_tasks: tasks/server/software/services.yml
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/server/software/certbot.yml
|
||||
when: certbot == true
|
||||
- include_tasks: tasks/server/cron/certbot.yml
|
||||
when: certbot == true
|
||||
|
||||
- name: Main | Server | Certbot
|
||||
ansible.builtin.include_tasks: tasks/server/software/certbot.yml
|
||||
- include_tasks: tasks/server/software/onlyoffice.yml
|
||||
when: onlyoffice == true and ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: Main | Server | Certbot Cron
|
||||
ansible.builtin.include_tasks: tasks/server/cron/certbot.yml
|
||||
when: certbot
|
||||
- include_tasks: tasks/server/software/influxdb1.yml
|
||||
when: influxdb1 == true and ansible_pkg_mgr == "apt"
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/server/software/influxdb2.yml
|
||||
when: influxdb2 == true and ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: Main | Server | OnlyOffice
|
||||
ansible.builtin.include_tasks: tasks/server/software/onlyoffice.yml
|
||||
when: onlyoffice
|
||||
- include_tasks: tasks/server/software/grafana.yml
|
||||
when: grafana == true and ansible_pkg_mgr == "apt"
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/server/software/influxdb1.yml
|
||||
when: influxdb1
|
||||
- include_tasks: tasks/server/software/hugo.yml
|
||||
when: hugo == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/server/software/influxdb2.yml
|
||||
when: influxdb2
|
||||
when: server == true
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/server/software/grafana.yml
|
||||
when: grafana
|
||||
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/server/software/hugo.yml
|
||||
when: hugo
|
||||
|
||||
when: server
|
||||
|
||||
####### Reporting #######
|
||||
|
||||
# Provide information for analysis.
|
||||
- name: Main | Reporting
|
||||
block:
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/software/telegraf.yml
|
||||
when: internet
|
||||
- include_tasks: tasks/general/software/telegraf.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/tests/services.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/tests/lynis.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/tests/nmap.yml
|
||||
|
||||
####### Footer #######
|
||||
|
||||
- name: Main | Footer
|
||||
ansible.builtin.include_tasks: tasks/footer.yml
|
||||
- include_tasks: tasks/general/tests/services.yml
|
||||
- include_tasks: tasks/general/tests/lynis.yml
|
||||
- include_tasks: tasks/general/tests/nmap.yml
|
||||
@@ -5,26 +5,9 @@
|
||||
|
||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
LOCAL="$DIR/local.yml"
|
||||
TEST="$DIR/test.yml"
|
||||
LOCAL=$DIR/local.yml
|
||||
URL="https://git.hyperling.com/me/env-ansible"
|
||||
if [[ -z $BRANCH ]]; then
|
||||
export BRANCH="main"
|
||||
fi
|
||||
|
||||
LINUX_HOSTS_DIR=/etc/ansible
|
||||
LINUX_HOSTS_FILE="$LINUX_HOSTS_DIR/hosts"
|
||||
FREEBSD_HOSTS_DIR="/usr/local/etc/ansible"
|
||||
FREEBSD_HOSTS_FILE="$FREEBSD_HOSTS_DIR/hosts"
|
||||
|
||||
HOSTS_DIR="$LINUX_HOSTS_DIR"
|
||||
HOSTS_FILE="$LINUX_HOSTS_FILE"
|
||||
|
||||
config_dir="/usr/local/etc/hyperling-scm"
|
||||
general_config="$config_dir/general.ini"
|
||||
workstation_config="$config_dir/workstation.ini"
|
||||
server_config="$config_dir/server.ini"
|
||||
branch=""
|
||||
BRANCH="main"
|
||||
|
||||
## Functions ##
|
||||
|
||||
@@ -32,7 +15,7 @@ branch=""
|
||||
function usage {
|
||||
cat <<- EOF
|
||||
|
||||
$PROG [-l | -t] [-b branch_name] [-g] [-w] [-s] [-f] [-h]
|
||||
$PROG [-l] [-b branch_name] [-h]
|
||||
Program to initialize synchronization with Hyperling's Ansible configuration.
|
||||
$URL
|
||||
|
||||
@@ -40,13 +23,8 @@ function usage {
|
||||
-l : Run the local playbook associated with this $PROG.
|
||||
This is helpful for development or just saving bandwidth.
|
||||
It also provides prettier colors than the plaintext from ansible-pull. ;)
|
||||
-t : Run the test playbook which has a much smaller set of includes.
|
||||
-b branch_name : Download and run a specific branch. Default is $BRANCH.
|
||||
-g : Enable the General config with test contents.
|
||||
-w : Enable the Workstation config with test contents.
|
||||
-s : Enable the Server config with test contents.
|
||||
-f : Display this system's facts.
|
||||
-h : Display this help text.
|
||||
-b branch_name: Download and run a specific branch. Default is $BRANCH.
|
||||
-h : Display this help text
|
||||
|
||||
EOF
|
||||
exit $1
|
||||
@@ -54,15 +32,10 @@ function usage {
|
||||
|
||||
## Parameter Parsing ##
|
||||
|
||||
while getopts ":ltb:gwsfh" arg; do
|
||||
while getopts ":lb:h" arg; do
|
||||
case $arg in
|
||||
l) local="Y" && echo "Running $LOCAL as the playbook." ;;
|
||||
t) test="Y" && echo "Running $TEST as the playbook." ;;
|
||||
b) branch="$OPTARG" && echo "Using branch $branch instead of $BRANCH." ;;
|
||||
g) create_general="Y" && echo "Generating test '$general_config'." ;;
|
||||
w) create_workstation="Y" && echo "Generating test '$workstation_config'." ;;
|
||||
s) create_server="Y" && echo "Generating test '$server_config'." ;;
|
||||
f) show_facts="Y" && echo "Displaying ansible facts then exiting." ;;
|
||||
h) usage ;;
|
||||
*) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;;
|
||||
esac
|
||||
@@ -74,189 +47,73 @@ if [[ ! -z $1 && $1 != "-"* ]]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [[ "$branch" == "" ]]; then
|
||||
if [[ $branch == "" ]]; then
|
||||
echo "Using default branch $BRANCH."
|
||||
branch="$BRANCH"
|
||||
if [[ -z "$local" ]]; then
|
||||
echo "Running against default branch '$branch'."
|
||||
else
|
||||
echo "Set branch to '$branch'."
|
||||
fi
|
||||
echo " "
|
||||
fi
|
||||
|
||||
if [[ -n "$create_general" && -f "$general_config" ]]; then
|
||||
echo "WARNING: General configuration already exists, will not overwrite."
|
||||
ls -lh "$general"
|
||||
fi
|
||||
if [[ -n "$create_workstation" && -f "$workstation_config" ]]; then
|
||||
echo "WARNING: Workstation configuration already exists, will not overwrite."
|
||||
ls -lh "$workstation_config"
|
||||
fi
|
||||
if [[ -n "$create_server" && -f "$server_config" ]]; then
|
||||
echo "WARNING: Server configuration already exists, will not overwrite."
|
||||
ls -lh "$server_config"
|
||||
fi
|
||||
|
||||
## Main ##
|
||||
|
||||
os="$(cat /etc/os-release)"
|
||||
if [[ ! -f /.dockerenv ]]; then
|
||||
# If we are not in a Docker container, also check what the kernel says.
|
||||
os="$os $(uname -a)"
|
||||
# Docker containers use the host kernel which gives an incorrect reading.
|
||||
fi
|
||||
os="$os $(uname -a)"
|
||||
|
||||
echo "Making sure all necessary packages are installed..."
|
||||
if [[ `which ansible > /dev/null; echo $?` != 0 ]]; then
|
||||
if [[ $os == *Debian* || $os == *Ubuntu* || $os == *"Pop!_OS"* || $os == *Mint* || $os == *Parrot* ]]; then
|
||||
sudo apt update
|
||||
sudo apt install -y ansible git <<< N
|
||||
sudo mkdir -p /etc/ansible
|
||||
sudo sh -c 'echo "localhost ansible_connection=local" > /etc/ansible/hosts'
|
||||
elif [[ $os == *FreeBSD* ]]; then
|
||||
sudo pkg install -y -g py*-ansible git
|
||||
HOSTS_DIR="$FREEBSD_HOSTS_DIR"
|
||||
HOSTS_FILE="$FREEBSD_HOSTS_FILE"
|
||||
sudo pkg install -y py38-ansible git
|
||||
sudo mkdir -p /usr/local/etc/ansible
|
||||
sudo sh -c 'echo "localhost ansible_connection=local" > /usr/local/etc/ansible/hosts'
|
||||
elif [[ $os == *Arch* || $os == *Manjaro* || $os == *Artix* ]]; then
|
||||
sudo pacman -Sy --noconfirm ansible git
|
||||
sudo mkdir -p /etc/ansible
|
||||
sudo sh -c 'echo "localhost ansible_connection=local" > /etc/ansible/hosts'
|
||||
elif [[ $os == *Darwin* ]]; then
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
echo "TESTING - EXIT!"
|
||||
exit 0
|
||||
brew install ansible git
|
||||
HOSTS_DIR=""
|
||||
HOSTS_FILE=""
|
||||
elif [[ $os == *Fedora* ]]; then
|
||||
sudo dnf install -y ansible git python3-libselinux
|
||||
sudo mkdir -p /etc/ansible
|
||||
sudo sh -c 'echo "localhost ansible_connection=local" > /etc/ansible/hosts'
|
||||
elif [[ $os == *openSUSE* ]]; then
|
||||
sudo zypper install -y ansible git
|
||||
sudo mkdir -p /etc/ansible
|
||||
sudo sh -c 'echo "localhost ansible_connection=local" > /etc/ansible/hosts'
|
||||
elif [[ $os == *NixOS* ]]; then
|
||||
$DIR/files/scripts/nixos.sh -b $branch
|
||||
sudo mkdir -p /etc/ansible
|
||||
sudo sh -c 'echo "localhost ansible_connection=local" > /etc/ansible/hosts'
|
||||
else
|
||||
echo -e "ERROR: OS not recognized."
|
||||
echo -e "ERROR: OS not detected."
|
||||
echo -e "$os"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo -e "- Installed!\n"
|
||||
|
||||
if [[ -n $HOSTS_DIR && -n $HOSTS_FILE ]]; then
|
||||
echo "Ensuring hosts file exists..."
|
||||
if [[ ! -e $HOSTS_FILE ]]; then
|
||||
sudo mkdir -pv $HOSTS_DIR
|
||||
sudo sh -c "echo 'localhost ansible_connection=local' > $HOSTS_FILE"
|
||||
fi
|
||||
echo "$HOSTS_FILE: '`cat $HOSTS_FILE`'"
|
||||
echo -e "- Hosts file created successfully!\n"
|
||||
fi
|
||||
|
||||
if [[ "$show_facts" == "Y" ]]; then
|
||||
echo "Showing Ansible Facts"
|
||||
ansible localhost -m setup --connection=local
|
||||
exit 0
|
||||
fi
|
||||
echo "Installed!"
|
||||
|
||||
#echo "Adding Ansible Collections..."
|
||||
#ansible-galaxy collection install community.general
|
||||
#echo "- Added!"
|
||||
|
||||
# Create basic layouts if configs do not exist and are requested.
|
||||
if [[ -n "$create_general"
|
||||
|| -n "$create_workstation"
|
||||
|| -n "$create_server" ]]
|
||||
then
|
||||
sudo mkdir -pv "$config_dir"
|
||||
MARK1="BEGIN"
|
||||
MARK2="END"
|
||||
echo "Creating placeholder config files..."
|
||||
fi
|
||||
if [[ -n "$create_general" && ! -f "$general_config" ]]; then
|
||||
function print_general_contents {
|
||||
cat <<- EOF
|
||||
; $MARK1 MANAGED BY ANSIBLE | Generic Config
|
||||
; $MARK2 MANAGED BY ANSIBLE | Generic Config
|
||||
; TEST DATA
|
||||
enable=true
|
||||
user=test
|
||||
user_desc=Test
|
||||
branch=$branch
|
||||
; TEST DATA
|
||||
EOF
|
||||
}
|
||||
print_general_contents | sudo tee "$general_config"
|
||||
ls -lh "$general_config"
|
||||
fi
|
||||
if [[ -n "$create_workstation" && ! -f "$workstation_config" ]]; then
|
||||
function print_workstation_contents {
|
||||
cat <<- EOF
|
||||
; $MARK1 MANAGED BY ANSIBLE | Workstation Config
|
||||
; $MARK2 MANAGED BY ANSIBLE | Workstation Config
|
||||
; TEST DATA
|
||||
enable=true
|
||||
coding=true
|
||||
editing=false
|
||||
gaming=false
|
||||
; TEST DATA
|
||||
EOF
|
||||
}
|
||||
print_workstation_contents | sudo tee "$workstation_config"
|
||||
ls -lh "$workstation_config"
|
||||
fi
|
||||
if [[ -n "$create_server" && ! -f "$server_config" ]]; then
|
||||
function print_server_contents {
|
||||
cat <<- EOF
|
||||
; $MARK1 MANAGED BY ANSIBLE | Server Config
|
||||
; $MARK2 MANAGED BY ANSIBLE | Server Config
|
||||
; TEST DATA
|
||||
enable=true
|
||||
; TEST DATA
|
||||
EOF
|
||||
}
|
||||
print_server_contents | sudo tee "$server_config"
|
||||
ls -lh "$server_config"
|
||||
fi
|
||||
if [[ -n "$create_general"
|
||||
|| -n "$create_workstation"
|
||||
|| -n "$create_server" ]]
|
||||
then
|
||||
echo " "
|
||||
fi
|
||||
|
||||
echo "Verifying this is the only run..."
|
||||
ps -ef | grep ansible-playbook | grep -v grep
|
||||
ansible_exists="$?"
|
||||
lock_file=/tmp/ansible-playbook.lock
|
||||
if [[ "$ansible_exists" == 0 ]]; then
|
||||
echo "- Playbook is already being executed. Exiting."
|
||||
exit 0
|
||||
elif [[ -e "$lock_file" ]]; then
|
||||
echo "- Removing lock file."
|
||||
sudo mv -v "$lock_file" "${lock_file}.disabled"
|
||||
else
|
||||
echo "- No processes or lockfile found."
|
||||
fi
|
||||
echo " "
|
||||
#echo "Added!"
|
||||
|
||||
echo "Provisioning Ansible..."
|
||||
status=""
|
||||
if [[ "$test" == "Y" ]]; then
|
||||
sudo ansible-playbook $TEST
|
||||
status=$?
|
||||
elif [[ "$local" == "Y" ]]; then
|
||||
if [[ $local == "Y" ]]; then
|
||||
sudo ansible-playbook $LOCAL
|
||||
status=$?
|
||||
else
|
||||
sudo ansible-pull -U $URL.git --checkout $branch
|
||||
status=$?
|
||||
fi
|
||||
if [[ "$status" == 0 ]]; then
|
||||
echo -e "- Provisioned!\n"
|
||||
else
|
||||
echo -e "\nERROR: Playbook failed with status $status, exiting."
|
||||
exit $status
|
||||
fi
|
||||
echo "Provisioned!"
|
||||
|
||||
echo "Mounting all drives..."
|
||||
mount -a
|
||||
echo -e "- Mounted!\n"
|
||||
echo "Mounted!"
|
||||
|
||||
echo -e "Don't forget to set any new users' passwords!\n"
|
||||
echo "Don't forget to set any new users' passwords!"
|
||||
|
||||
## Finish ##
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
# All the tasks which need run to successfully end the playbook.
|
||||
|
||||
####### Footer #######
|
||||
- name: Footer
|
||||
block:
|
||||
|
||||
- name: Footer | Notify
|
||||
ansible.builtin.include_tasks: tasks/general/acct_mgmt/notify.yml
|
||||
vars:
|
||||
notify_message: "Provisioning Finished"
|
||||
|
||||
- name: Footer | Lock | Remove
|
||||
ansible.builtin.include_tasks: tasks/general/tests/lock_remove.yml
|
||||
@@ -2,7 +2,7 @@
|
||||
# Install and configure doas.
|
||||
|
||||
- name: General | Software | DoAs | Facts
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
doas_config: |
|
||||
permit persist :wheel as root
|
||||
permit persist :admin as root
|
||||
@@ -11,47 +11,44 @@
|
||||
doas_conf_file_bsd: /usr/local/etc/doas.conf
|
||||
|
||||
- name: General | Software | DoAs | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- doas
|
||||
register: doas_install
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Software | DoAs | Configure [Linux]
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ doas_conf_file_linux }}"
|
||||
block: |
|
||||
{{ doas_config }}
|
||||
marker: '# {mark} MANAGED BY ANSIBLE | doas Linux'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
create: yes
|
||||
backup: yes
|
||||
when: not doas_install.failed and ansible_system in ("Linux")
|
||||
|
||||
- name: General | Software | DoAs | Configure [BSD]
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ doas_conf_file_linux }}"
|
||||
block: |
|
||||
{{ doas_config }}
|
||||
marker: '# {mark} MANAGED BY ANSIBLE | doas BSD'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
create: yes
|
||||
backup: yes
|
||||
when: not doas_install.failed and ansible_system in ("FreeBSD")
|
||||
|
||||
- name: General | Software | DoAs | Configure [Other]
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ item }}"
|
||||
block: |
|
||||
{{ doas_config }}
|
||||
marker: '# {mark} MANAGED BY ANSIBLE | doas Other'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
create: yes
|
||||
backup: yes
|
||||
loop:
|
||||
- "{{ doas_conf_file_linux }}"
|
||||
- "{{ doas_conf_file_bsd }}"
|
||||
when: not doas_install.failed and ansible_system not in ("Linux", "FreeBSD")
|
||||
when: not doas_install.failed and ansible_system not in ("Linux", "FreeBSD")
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
# Groups that do not come to all distros by default.
|
||||
|
||||
- name: General | Account Management | System Groups
|
||||
- name: General | Account Management | System Groups
|
||||
group:
|
||||
name: "{{ item }}"
|
||||
system: true
|
||||
system: yes
|
||||
state: present
|
||||
loop:
|
||||
- sudo
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
# Create and manage permissions for notify log.
|
||||
|
||||
- name: General | Notify | Update File
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
loop:
|
||||
- touch "{{ notify_log_file }}"
|
||||
- chmod 777 "{{ notify_log_file }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
|
||||
- name: General | Notify | Add Message
|
||||
ansible.builtin.shell : echo "'Ansible' '{{ notify_message }} @ `date`'" >> "{{ notify_log_file }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
@@ -2,19 +2,19 @@
|
||||
# Set up directory and files for specifying software needs rather than using hosts file.
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Variables 1
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
prov_dir: "/usr/local/etc/hyperling-scm"
|
||||
provision_variables: []
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Variables 2
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
gen_file: "{{ prov_dir }}/general.ini"
|
||||
wrk_file: "{{ prov_dir }}/workstation.ini"
|
||||
mnr_file: "{{ prov_dir }}/miner.ini"
|
||||
srv_file: "{{ prov_dir }}/server.ini"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Create Directory
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ prov_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
@@ -23,11 +23,11 @@
|
||||
## General ##
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Create
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ gen_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
|
||||
block: |
|
||||
[global]
|
||||
; Please note that all potions require lowercase keys and values.
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;; Basic Options ;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; enable : Provide true for the provision to occur.
|
||||
@@ -35,11 +35,11 @@
|
||||
;
|
||||
; user : Provide the name of the user account.
|
||||
; Example: tom, jerry, kim, sarah
|
||||
; Default: user
|
||||
; Default: ling
|
||||
;
|
||||
; user_desc : Provide the description of the user account.
|
||||
; Example: Thomas, Jerry, Kimberly, Sarah
|
||||
; Default: User
|
||||
; Default: Hyperling
|
||||
;
|
||||
; sshd_port : Determine the port which SSHD should listen on.
|
||||
; Example: 12345
|
||||
@@ -49,17 +49,6 @@
|
||||
; nmap is already provided for reporting
|
||||
; Default: false
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Create | Git Polling
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ gen_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config | Git Polling'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;; Git Polling ;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; For syncing this machine to a Git repository of this Ansible project
|
||||
@@ -85,17 +74,6 @@
|
||||
; Example: Ansible, ansible-setup, my-env
|
||||
; Default: env-ansible
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Create | Swap File
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ gen_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config | Swap File'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;; Swap File ;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; swap_block : Set to the block size if dd should create a swapfile.
|
||||
@@ -112,17 +90,6 @@
|
||||
; Example: /usr/local/swap
|
||||
; Default: /swapfile
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Create | Sync Frequency
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ gen_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config | Sync Frequency'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;; Sync Frequency ;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; no_telem : Set to true to avoid setting up telemetry services.
|
||||
@@ -134,150 +101,32 @@
|
||||
; Slows down the rate of services such as telegraf and cron.
|
||||
; Default: false
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Create | Server Shortcuts
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ gen_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config | Server Shortcuts'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;; Server Shortcuts ;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; For typing `prod` and getting straight to a server, like in env-termux.
|
||||
;
|
||||
; Imagine the command:
|
||||
; `ssh prod_user@prod_host:prod_port`
|
||||
;
|
||||
; prod_host : Hostname for the production server.
|
||||
; Example: myserver.com, mywebhost.net
|
||||
; Default: hyperling.com
|
||||
;
|
||||
; prod_port : Port for the production server.
|
||||
; Example: 22, 222, 2222
|
||||
; Default: 22
|
||||
;
|
||||
; prod_user : Username for accessing the production server.
|
||||
; Example: jim, bob, jeff, anne
|
||||
; Default: user
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Create | Sync Shortcuts
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ gen_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config | Sync Shortcuts'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;;; Sync Shortcuts ;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; Imagine the command:
|
||||
; `rsync -auPhz --delete -e 'ssh -p prod_data_port' ./mydata-MASTER/ \
|
||||
; prod_data_user@prod_data_host:/prod_data_dir/mydata-clone
|
||||
; `
|
||||
;
|
||||
; prod_data_host : Branch to use on this machine.
|
||||
; Example: sftp.myserver.com, sftp.mywebhost.net
|
||||
; Default: hyperling.com
|
||||
;
|
||||
; prod_data_port : Provide the git host that the machine should poll.
|
||||
; Example: 22, 222, 2222
|
||||
; Default: 22
|
||||
;
|
||||
; prod_data_user : Port of the server host to use for SSH requests.
|
||||
; Example: jim, bob, jeff, anne
|
||||
; Default: user
|
||||
;
|
||||
; prod_data_dir : Port of the server host to use for SSH requests.
|
||||
; Example: /srv/sftp/
|
||||
; Default: /srv/sftp/
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Create | Tunnel
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ gen_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config | Tunnel'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Tunnel ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; Create a runit script which maintains an SSH tunnel to a remote server.
|
||||
;
|
||||
; ssh -v -H -R tunnel_remote_port:localhost:tunnel_local_port \
|
||||
; [-p tunnel_ssh_port] tunnel_remote_host
|
||||
;
|
||||
; tunnel_local_port (default=8080)
|
||||
; Local HTTP port which need forwarded to a remote server.
|
||||
; Example: http://localhost:8080
|
||||
;
|
||||
; tunnel_remote_host (default=false)
|
||||
; Remote server including username (such as user@example.com) which will
|
||||
; serve the port. Server should preferably have a reverse proxy in order
|
||||
; to encrypt the traffic, otherwise the local server should use HTTPS.
|
||||
;
|
||||
; tunnel_remote_port (default=8080)
|
||||
; Port which should host the service on the remote server. This is what
|
||||
; will get typed into web browsers or used by the reverse proxy. Should
|
||||
; be > 1024. Also, /etc/ssh/sshd_config will need AllowTcpForwarding and
|
||||
; GatewayPorts set to yes, then sshd will need to be reloaded.
|
||||
; Example: http://example.com:8080
|
||||
;
|
||||
; tunnel_ssh_port (default=22)
|
||||
; Port which the remote server exposes ssh.
|
||||
; Example: ssh -p 2222 user@example.com
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
create: yes
|
||||
backup: yes
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Load
|
||||
ansible.builtin.set_fact:
|
||||
provision: "{{ lookup('ini', 'enable file={{gen_file}} default=false') | bool }}"
|
||||
user: "{{ lookup('ini', 'user file={{gen_file}} default=user' ) }}"
|
||||
user_desc: "{{ lookup('ini', 'user_desc file={{gen_file}} default=User' ) }}"
|
||||
branch: "{{ lookup('ini', 'branch file={{gen_file}} default=main' ) }}"
|
||||
pentesting: "{{ lookup('ini', 'pentesting file={{gen_file}} default=false') | bool }}"
|
||||
no_telem: "{{ lookup('ini', 'no_telem file={{gen_file}} default=false') | bool }}"
|
||||
battery: "{{ lookup('ini', 'battery file={{gen_file}} default=false') | bool }}"
|
||||
swap_block: "{{ lookup('ini', 'swap_block file={{gen_file}} default=false') }}"
|
||||
swap_count: "{{ lookup('ini', 'swap_count file={{gen_file}} default=1' ) | int }}"
|
||||
swap_file: "{{ lookup('ini', 'swap_file file={{gen_file}} default=/swapfile') }}"
|
||||
sshd_port: "{{ lookup('ini', 'sshd_port file={{gen_file}} default=22' ) | int }}"
|
||||
set_fact:
|
||||
provision: "{{ lookup('ini', 'enable file={{gen_file}} default=false') }}"
|
||||
user: "{{ lookup('ini', 'user file={{gen_file}} default=ling') }}"
|
||||
user_desc: "{{ lookup('ini', 'user_desc file={{gen_file}} default=Hyperling') }}"
|
||||
branch: "{{ lookup('ini', 'branch file={{gen_file}} default=main') }}"
|
||||
pentesting: "{{ lookup('ini', 'pentesting file={{gen_file}} default=false') }}"
|
||||
no_telem: "{{ lookup('ini', 'no_telem file={{gen_file}} default=false') }}"
|
||||
battery: "{{ lookup('ini', 'battery file={{gen_file}} default=false') }}"
|
||||
swap_block: "{{ lookup('ini', 'swap_block file={{gen_file}} default=false') }}"
|
||||
swap_count: "{{ lookup('ini', 'swap_count file={{gen_file}} default=1') }}"
|
||||
swap_file: "{{ lookup('ini', 'swap_file file={{gen_file}} default=/swapfile') }}"
|
||||
sshd_port: "{{ lookup('ini', 'sshd_port file={{gen_file}} default=22') }}"
|
||||
git_host: "{{ lookup('ini', 'git_host file={{gen_file}} default=git.hyperling.com') }}"
|
||||
git_user: "{{ lookup('ini', 'git_user file={{gen_file}} default=me') }}"
|
||||
git_project: "{{ lookup('ini', 'git_project file={{gen_file}} default=env-ansible') }}"
|
||||
git_ssh_port: "{{ lookup('ini', 'git_ssh_port file={{gen_file}} default=22') | int }}"
|
||||
prod_host: "{{ lookup('ini', 'prod_host file={{gen_file}} default=hyperling.com') }}"
|
||||
prod_port: "{{ lookup('ini', 'prod_port file={{gen_file}} default=22') | int }}"
|
||||
prod_user: "{{ lookup('ini', 'prod_user file={{gen_file}} default=user') }}"
|
||||
prod_data_host: "{{ lookup('ini', 'prod_data_host file={{gen_file}} default=hyperling.com') }}"
|
||||
prod_data_port: "{{ lookup('ini', 'prod_data_port file={{gen_file}} default=22') | int }}"
|
||||
prod_data_user: "{{ lookup('ini', 'prod_data_user file={{gen_file}} default=user') }}"
|
||||
prod_data_dir: "{{ lookup('ini', 'prod_data_dir file={{gen_file}} default=/srv/sftp') }}"
|
||||
tunnel_local_port: "{{ lookup('ini', 'tunnel_local_port file={{gen_file}} default=8080' ) | int }}"
|
||||
tunnel_remote_host: "{{ lookup('ini', 'tunnel_remote_host file={{gen_file}} default=false') }}"
|
||||
tunnel_remote_port: "{{ lookup('ini', 'tunnel_remote_port file={{gen_file}} default=8080' ) | int }}"
|
||||
tunnel_ssh_port: "{{ lookup('ini', 'tunnel_ssh_port file={{gen_file}} default=22' ) | int }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | Boolean Check | swap_block
|
||||
ansible.builtin.set_fact:
|
||||
swap_block: "{{ swap_block | bool }}"
|
||||
when: swap_block in ("false")
|
||||
git_ssh_port: "{{ lookup('ini', 'git_ssh_port file={{gen_file}} default=22') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | List
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- { 'provision': "{{ provision }}" }
|
||||
@@ -295,150 +144,24 @@
|
||||
- { 'git_user': "{{ git_user }}" }
|
||||
- { 'git_project': "{{ git_project }}" }
|
||||
- { 'git_ssh_port': "{{ git_ssh_port }}" }
|
||||
- { 'prod_host': "{{ prod_host }}" }
|
||||
- { 'prod_port': "{{ prod_port }}" }
|
||||
- { 'prod_user': "{{ prod_user }}" }
|
||||
- { 'prod_data_host': "{{ prod_data_host }}" }
|
||||
- { 'prod_data_port': "{{ prod_data_port }}" }
|
||||
- { 'prod_data_user': "{{ prod_data_user }}" }
|
||||
- { 'prod_data_dir': "{{ prod_data_dir }}" }
|
||||
- { 'tunnel_local_port': "{{ tunnel_local_port }}" }
|
||||
- { 'tunnel_remote_host': "{{ tunnel_remote_host }}" }
|
||||
- { 'tunnel_remote_port': "{{ tunnel_remote_port }}" }
|
||||
- { 'tunnel_ssh_port': "{{ tunnel_ssh_port }}" }
|
||||
|
||||
|
||||
## Workstation ##
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Create | Main Options
|
||||
ansible.builtin.blockinfile:
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Create
|
||||
blockinfile:
|
||||
path: "{{ wrk_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Workstation Config'
|
||||
block: |
|
||||
[global]
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;; Main Options ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;; Available options - all require lowercase values ;;;;;;
|
||||
;
|
||||
; enable : Set to true for system to be considered a workstation.
|
||||
;
|
||||
; coding : Set to true for installation of code editors (VSCode, PyCharm, Android Studio)
|
||||
; - sdks : Set to true to download additional SDKs to test against.
|
||||
;
|
||||
; editing : Set to true for installation of Audio/Video editors (Shotcut, Audacity, OBS Stdio, GIMP)
|
||||
; Set to video for only the video related portions.
|
||||
; - Shotcut, OpenShot, OBS Studio, etc.
|
||||
; Set to audio for only the music related portions.
|
||||
; - Audacity (or similar), LMMS, VMPK, etc.
|
||||
;
|
||||
; gaming : Set to true for installation of gaming software (Steam, Lutris)
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Create | LLMs
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ wrk_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Workstation Config | LLMs'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LLMs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; ollama (default=true)
|
||||
; Install and enable the ollama LLM manager.
|
||||
; API: http://127.0.0.1:11434
|
||||
;
|
||||
; manage_models (default=true)
|
||||
; Automatically choose and pull the models to use based on system
|
||||
; resources. Otherwise leaves images alone but still handles config.
|
||||
;
|
||||
; hf_token (default=false)
|
||||
; Token from Hugging Face which allows faster download speeds than anon.
|
||||
; May help with ollama and also supposed to help with open-webui. Token
|
||||
; needs set to something like hf_kjBCCLABEEABUVAKbjadbvkaksvBAVKBkjsDVK.
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Create | LLMs | GUIs
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ wrk_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Workstation Config | LLMs | GUIs'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LLMs: GUIs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; zeroclaw (default=true)
|
||||
; Install and enable the Zeroclaw web daemon, a minimalistic interface
|
||||
; for many models and providers with negligible resource usage. Also
|
||||
; installs the CLI tool zerocode as an alternative to the web GUI.
|
||||
; URL: http://127.0.0.1:42617
|
||||
;
|
||||
; open_webui (default=false)
|
||||
; Install and enable open-webui as a Docker container. Very polished web
|
||||
; frontend for ollama and also handles other web LLMs through API calls.
|
||||
; Container is over 1GB in size and consumes substantial resources!
|
||||
; URL: http://localhost:3000
|
||||
;
|
||||
; open_webui_port (default=3000)
|
||||
; Port on which to run the open-webui Docker instance.
|
||||
;
|
||||
; open_webui_key (default=PleaseEnsureTheKeyIsAtLeast32To64Characters)
|
||||
; Secret key, allows persistence between runs. If not a public-facing
|
||||
; system, then not critical. Use `openssl rand -hex 32` to create one.
|
||||
;
|
||||
; codium_config (default=true)
|
||||
; Manage the config files for and Codium plugins. Cline and Continue are
|
||||
; the recommended Codium extensions but need installed through the GUI.
|
||||
; Currently handles:
|
||||
; ~/.continue/config.yml
|
||||
;
|
||||
; qwen_code (default=true)
|
||||
; Install and enable qwen-code as a daemon.
|
||||
; URL: http://127.0.0.1:4170
|
||||
;
|
||||
; qwen_code_key (default='')
|
||||
; API key for accessing the web GUI. Optional, not used if left blank.
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Create | LLMs | MCPs
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ wrk_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Workstation Config | LLMs | MCPs'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;; LLMs: MCPs / Sandboxes ;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; open_terminal (default=false)
|
||||
; Docker container to be used with GUIs like open-webui so that agents
|
||||
; have somewhere safe to execute commands. Also allows file read/writes.
|
||||
; URL: http://127.0.0.1:8000
|
||||
;
|
||||
; open_terminal_port (default=8000)
|
||||
; Port on which to run the open-terminal Docker instance.
|
||||
;
|
||||
; open_terminal_key (default=open-terminal-key)
|
||||
; API key, needed in order to access the server. Required.
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Create | Other Options
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ wrk_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Workstation Config | Other Options'
|
||||
block: |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;; Other Options ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; rdp : Set to true for installation of RDP protocol
|
||||
; CURRENTLY FREEBSD-ONLY
|
||||
;
|
||||
@@ -451,97 +174,43 @@
|
||||
; mobile : Set to true if not using an amd64 processor.
|
||||
; Also used to disable tasks not helpful for Pinephone.
|
||||
;
|
||||
; redmode : Set to true/false for automatially using Night Light in GNOME.
|
||||
; Default: true
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Workstation Config'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
create: yes
|
||||
backup: yes
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Load
|
||||
ansible.builtin.set_fact:
|
||||
# Main
|
||||
workstation: "{{ lookup('ini', 'enable file={{wrk_file}} default=false') | bool }}"
|
||||
coding: "{{ lookup('ini', 'coding file={{wrk_file}} default=false') | bool }}"
|
||||
sdks: "{{ lookup('ini', 'sdks file={{wrk_file}} default=false') | bool }}"
|
||||
set_fact:
|
||||
workstation: "{{ lookup('ini', 'enable file={{wrk_file}} default=false') }}"
|
||||
coding: "{{ lookup('ini', 'coding file={{wrk_file}} default=false') }}"
|
||||
editing: "{{ lookup('ini', 'editing file={{wrk_file}} default=false') }}"
|
||||
gaming: "{{ lookup('ini', 'gaming file={{wrk_file}} default=false') | bool }}"
|
||||
# Other
|
||||
rdp: "{{ lookup('ini', 'rdp file={{wrk_file}} default=false') | bool }}"
|
||||
vnc: "{{ lookup('ini', 'vnc file={{wrk_file}} default=false') | bool }}"
|
||||
bsd_gpu: "{{ lookup('ini', 'bsd_gpu file={{wrk_file}} default=false') | bool }}"
|
||||
mobile: "{{ lookup('ini', 'mobile file={{wrk_file}} default=false') | bool }}"
|
||||
redmode: "{{ lookup('ini', 'redmode file={{wrk_file}} default=true' ) | bool }}"
|
||||
# LLMs
|
||||
ollama_enabled: "{{ lookup('ini', 'ollama file={{wrk_file}} default=true' ) | bool }}"
|
||||
manage_models: "{{ lookup('ini', 'manage_models file={{wrk_file}} default=true' ) | bool }}"
|
||||
hf_token: "{{ lookup('ini', 'hf_token file={{wrk_file}} default=false') }}"
|
||||
# LLM GUIs
|
||||
zeroclaw_enabled: "{{ lookup('ini', 'zeroclaw file={{wrk_file}} default=true ') | bool }}"
|
||||
open_webui_enabled: "{{ lookup('ini', 'open_webui file={{wrk_file}} default=false') | bool }}"
|
||||
open_webui_port: "{{ lookup('ini', 'open_webui_port file={{wrk_file}} default=3000' ) | int }}"
|
||||
open_webui_key: "{{ lookup('ini', 'open_webui_key file={{wrk_file}} default=PleaseEnsureTheKeyIsAtLeast32To64Characters') }}"
|
||||
codium_config: "{{ lookup('ini', 'codium_config file={{wrk_file}} default=true' ) | bool }}"
|
||||
qwen_code_enabled: "{{ lookup('ini', 'qwen_code file={{wrk_file}} default=true' ) | bool }}"
|
||||
qwen_code_key : "{{ lookup('ini', 'qwen_code_key file={{wrk_file}} default=false') }}"
|
||||
# LLM MCPs
|
||||
open_terminal_enabled: "{{ lookup('ini', 'open_terminal file={{wrk_file}} default=false') | bool }}"
|
||||
open_terminal_port: "{{ lookup('ini', 'open_terminal_port file={{wrk_file}} default=8000' ) | int }}"
|
||||
open_terminal_key: "{{ lookup('ini', 'open_terminal_key file={{wrk_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Boolean Check | editing
|
||||
ansible.builtin.set_fact:
|
||||
editing: "{{ editing | bool }}"
|
||||
when: editing in ("true", "false")
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Boolean Check | qwen_code_key
|
||||
ansible.builtin.set_fact:
|
||||
qwen_code_key: "{{ qwen_code_key | bool }}"
|
||||
when: qwen_code_key in ("false")
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | Boolean Check | open_terminal_key
|
||||
ansible.builtin.set_fact:
|
||||
open_terminal_key: "{{ open_terminal_key | bool }}"
|
||||
when: open_terminal_key in ("false")
|
||||
gaming: "{{ lookup('ini', 'gaming file={{wrk_file}} default=false') }}"
|
||||
rdp: "{{ lookup('ini', 'rdp file={{wrk_file}} default=false') }}"
|
||||
vnc: "{{ lookup('ini', 'vnc file={{wrk_file}} default=false') }}"
|
||||
bsd_gpu: "{{ lookup('ini', 'bsd_gpu file={{wrk_file}} default=false') }}"
|
||||
mobile: "{{ lookup('ini', 'mobile file={{wrk_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Workstation | List
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- { 'workstation': "{{ workstation }}" }
|
||||
- { 'coding': "{{ coding }}" }
|
||||
- { 'sdks': "{{ sdks }}" }
|
||||
- { 'editing': "{{ editing }}" }
|
||||
- { 'gaming': "{{ gaming }}" }
|
||||
- { 'rdp': "{{ rdp }}" }
|
||||
- { 'vnc': "{{ vnc }}" }
|
||||
- { 'bsd_gpu': "{{ bsd_gpu }}" }
|
||||
- { 'mobile': "{{ mobile }}" }
|
||||
- { 'redmode': "{{ redmode }}" }
|
||||
- { 'ollama_enabled': "{{ ollama_enabled }}" }
|
||||
- { 'manage_models': "{{ manage_models }}" }
|
||||
- { 'hf_token': "{{ hf_token }}" }
|
||||
- { 'zeroclaw_enabled': "{{ zeroclaw_enabled }}" }
|
||||
- { 'open_webui_enabled': "{{ open_webui_enabled }}" }
|
||||
- { 'open_webui_port': "{{ open_webui_port }}" }
|
||||
- { 'open_webui_key': "{{ open_webui_key }}" }
|
||||
- { 'codium_config': "{{ codium_config }}" }
|
||||
- { 'qwen_code_enabled': "{{ qwen_code_enabled }}" }
|
||||
- { 'qwen_code_key': "{{ qwen_code_key }}" }
|
||||
- { 'open_terminal_enabled': "{{ open_terminal_enabled }}" }
|
||||
- { 'open_terminal_port': "{{ open_terminal_port }}" }
|
||||
- { 'open_terminal_key': "{{ open_terminal_key }}" }
|
||||
|
||||
# No longer mining, this is now considered deprecated.
|
||||
### Miner ##
|
||||
#
|
||||
#- name: General | Account Management | Provisioning Configuration | Miner | Create
|
||||
# ansible.builtin.blockinfile:
|
||||
# blockinfile:
|
||||
# path: "{{ mnr_file }}"
|
||||
# block: |
|
||||
# [global]
|
||||
# ;;;;;;; Available options - all require lowercase values ;;;;;;
|
||||
# ;
|
||||
# ; enable : Set to true for system to be considered a miner.
|
||||
@@ -577,30 +246,29 @@
|
||||
# ; xmr_stak_cpu : Set to true for istallation
|
||||
# ; UNFINISHED/UNTESTED
|
||||
# ;
|
||||
# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
# [global]
|
||||
# marker: '; {mark} MANAGED BY ANSIBLE | Miner Config'
|
||||
# state: present
|
||||
# create: true
|
||||
# backup: true
|
||||
# mode: "0644"
|
||||
# create: yes
|
||||
# backup: yes
|
||||
#
|
||||
#- name: General | Account Management | Provisioning Configuration | Miner | Load
|
||||
# ansible.builtin.set_fact:
|
||||
# miner: "{{ lookup('ini', 'enable file={{mnr_file}} default=false') | bool }}"
|
||||
# amdgpu: "{{ lookup('ini', 'amdgpu file={{mnr_file}} default=false') | bool }}"
|
||||
# nanominer: "{{ lookup('ini', 'nanominer file={{mnr_file}} default=false') | bool }}"
|
||||
# nanominer_cpu: "{{ lookup('ini', 'nanominer_cpu file={{mnr_file}} default=false') | bool }}"
|
||||
# nanominer_cpu_pool: "{{ lookup('ini', 'nanominer_cpu_pool file={{mnr_file}} default=false') | bool }}"
|
||||
# nanominer_gpu: "{{ lookup('ini', 'nanominer_gpu file={{mnr_file}} default=false') | bool }}"
|
||||
# nanominer_gpus: "{{ lookup('ini', 'nanominer_gpus file={{mnr_file}} default=false') | bool }}"
|
||||
# nanominer_gpu_pool: "{{ lookup('ini', 'nanominer_gpu_pool file={{mnr_file}} default=false') | bool }}"
|
||||
# eth_minhashrate: "{{ lookup('ini', 'eth_minhashrate file={{mnr_file}} default=false') | bool }}"
|
||||
# ethminer: "{{ lookup('ini', 'ethminer file={{mnr_file}} default=false') | bool }}"
|
||||
# nvidia: "{{ lookup('ini', 'nvidia file={{mnr_file}} default=false') | bool }}"
|
||||
# xmr_stak_cpu: "{{ lookup('ini', 'xmr_stak_cpu file={{mnr_file}} default=false') | bool }}"
|
||||
# set_fact:
|
||||
# miner: "{{ lookup('ini', 'enable file={{mnr_file}} default=false') }}"
|
||||
# amdgpu: "{{ lookup('ini', 'amdgpu file={{mnr_file}} default=false') }}"
|
||||
# nanominer: "{{ lookup('ini', 'nanominer file={{mnr_file}} default=false') }}"
|
||||
# nanominer_cpu: "{{ lookup('ini', 'nanominer_cpu file={{mnr_file}} default=false') }}"
|
||||
# nanominer_cpu_pool: "{{ lookup('ini', 'nanominer_cpu_pool file={{mnr_file}} default=false') }}"
|
||||
# nanominer_gpu: "{{ lookup('ini', 'nanominer_gpu file={{mnr_file}} default=false') }}"
|
||||
# nanominer_gpus: "{{ lookup('ini', 'nanominer_gpus file={{mnr_file}} default=false') }}"
|
||||
# nanominer_gpu_pool: "{{ lookup('ini', 'nanominer_gpu_pool file={{mnr_file}} default=false') }}"
|
||||
# eth_minhashrate: "{{ lookup('ini', 'eth_minhashrate file={{mnr_file}} default=false') }}"
|
||||
# ethminer: "{{ lookup('ini', 'ethminer file={{mnr_file}} default=false') }}"
|
||||
# nvidia: "{{ lookup('ini', 'nvidia file={{mnr_file}} default=false') }}"
|
||||
# xmr_stak_cpu: "{{ lookup('ini', 'xmr_stak_cpu file={{mnr_file}} default=false') }}"
|
||||
#
|
||||
#- name: General | Account Management | Provisioning Configuration | Miner | List
|
||||
# ansible.builtin.set_fact:
|
||||
# set_fact:
|
||||
# provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
# loop:
|
||||
# - { 'miner': "{{ miner }}" }
|
||||
@@ -620,11 +288,9 @@
|
||||
## Server ##
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Server | Create
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ srv_file }}"
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Server Config'
|
||||
block: |
|
||||
[global]
|
||||
;;;;;;; Parameters ;;;;;;
|
||||
;
|
||||
; enable : Set to true for system to be considered a server.
|
||||
@@ -649,24 +315,25 @@
|
||||
; hugo : Set to true to install HUGO static website generator.
|
||||
;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Server Config'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
create: yes
|
||||
backup: yes
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Server | Load
|
||||
ansible.builtin.set_fact:
|
||||
server: "{{ lookup('ini', 'enable file={{srv_file}} default=false') | bool }}"
|
||||
set_fact:
|
||||
server: "{{ lookup('ini', 'enable file={{srv_file}} default=false') }}"
|
||||
domain: "{{ lookup('ini', 'domain file={{srv_file}} default=hyperling.com') }}"
|
||||
onlyoffice: "{{ lookup('ini', 'onlyoffice file={{srv_file}} default=false') | bool }}"
|
||||
grafana: "{{ lookup('ini', 'grafana file={{srv_file}} default=false') | bool }}"
|
||||
influxdb1: "{{ lookup('ini', 'influxdb1 file={{srv_file}} default=false') | bool }}"
|
||||
influxdb2: "{{ lookup('ini', 'influxdb2 file={{srv_file}} default=false') | bool }}"
|
||||
certbot: "{{ lookup('ini', 'certbot file={{srv_file}} default=false') | bool }}"
|
||||
hugo: "{{ lookup('ini', 'hugo file={{srv_file}} default=false') | bool }}"
|
||||
onlyoffice: "{{ lookup('ini', 'onlyoffice file={{srv_file}} default=false') }}"
|
||||
grafana: "{{ lookup('ini', 'grafana file={{srv_file}} default=false') }}"
|
||||
influxdb1: "{{ lookup('ini', 'influxdb1 file={{srv_file}} default=false') }}"
|
||||
influxdb2: "{{ lookup('ini', 'influxdb2 file={{srv_file}} default=false') }}"
|
||||
certbot: "{{ lookup('ini', 'certbot file={{srv_file}} default=false') }}"
|
||||
hugo: "{{ lookup('ini', 'hugo file={{srv_file}} default=false') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Server | List
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
provision_variables: "{{ provision_variables | combine(item) }}"
|
||||
loop:
|
||||
- { 'server': "{{ server }}" }
|
||||
@@ -682,17 +349,12 @@
|
||||
## Exit if not turned on yet ##
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Exit Check
|
||||
block:
|
||||
- name: General | Account Management | Provisioning Configuration | Exit Check | Message
|
||||
ansible.builtin.debug:
|
||||
msg: "Please configure the config files in {{ prov_dir }} then try again."
|
||||
- name: General | Account Management | Provisioning Configuration | Exit Check | Exit
|
||||
ansible.builtin.meta: end_play
|
||||
when: not provision
|
||||
shell: echo "Please configure the config files in {{ prov_dir }} then try again." && exit 1
|
||||
when: provision != true
|
||||
|
||||
|
||||
## Display values ##
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | Print
|
||||
ansible.builtin.debug:
|
||||
debug:
|
||||
var: provision_variables
|
||||
@@ -2,33 +2,32 @@
|
||||
# Ensure the proper users have sudo access.
|
||||
|
||||
- name: General | Account Management | Sudo | Copy Ansible
|
||||
ansible.builtin.copy:
|
||||
copy:
|
||||
src: sudo/sudoers_ansible
|
||||
dest: "{{ sudoers_install_dir }}"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: "0440"
|
||||
mode: 0440
|
||||
|
||||
- name: General | Account Management | Sudo | Copy Sudo Group
|
||||
ansible.builtin.copy:
|
||||
copy:
|
||||
src: sudo/sudoers_sudo
|
||||
dest: "{{ sudoers_install_dir }}"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: "0440"
|
||||
mode: 0440
|
||||
|
||||
# Disable these two lines in openSUSE default configuration.
|
||||
#Defaults targetpw # ask for the password of the target user i.e. root
|
||||
#ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!
|
||||
- name: General | Account Management | Sudo | Disable openSUSE Root PW Prompt
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: "{{ sudoers_config }}"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "644"
|
||||
create: yes
|
||||
backup: yes
|
||||
loop:
|
||||
- { "key": '^[\#]?Defaults targetpw', "value": '#Defaults targetpw'}
|
||||
- { "key": '^[\#]?ALL ALL\=\(ALL\) ALL', "value": '#ALL ALL=(ALL) ALL'}
|
||||
+145
-930
File diff suppressed because it is too large.
Load diff
@@ -1,56 +1,20 @@
|
||||
---
|
||||
# Jobs relating to the ansible user.
|
||||
|
||||
# $RANDOM is anywhere from 0 to 32767 in BASH. This would be up to ~9 hours.
|
||||
# $RANDOM / 10 can be up to about 3200 seconds, or ~55 minutes.
|
||||
# $RANDOM / 20 can be up to about 1600 seconds, or ~27 minutes.
|
||||
# $RANDOM / 50 can be up to about 650 seconds, or ~11 minutes.
|
||||
# $RANDOM / 100 can be up to about 320 seconds, or ~5 minutes.
|
||||
# This prevents multiple systems from hitting it at the exact same time.
|
||||
|
||||
- name: General | Cron | Ansible | Facts 01
|
||||
ansible.builtin.set_fact:
|
||||
#ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.`date +'%Y%m%d-%H%M%S'`.log"
|
||||
ansible_cron_log: "~/{{ ansible_hostname }}.ansible-pull.log"
|
||||
|
||||
- name: General | Cron | Ansible | Facts 02
|
||||
ansible.builtin.set_fact:
|
||||
ansible_cron_log_old: "{{ ansible_cron_log }}.old"
|
||||
|
||||
|
||||
- name: General | Cron | Ansible | Log | Delete Old
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_cron_log_old }}"
|
||||
state: absent
|
||||
|
||||
- name: General | Cron | Ansible | Log | Check
|
||||
ansible.builtin.stat:
|
||||
path: "{{ ansible_cron_log }}"
|
||||
register: ansible_cron_log_check
|
||||
|
||||
- name: General | Cron | Ansible | Log | Rename [if >1MB]
|
||||
ansible.builtin.copy:
|
||||
src: "{{ ansible_cron_log }}"
|
||||
dest: "{{ ansible_cron_log_old }}"
|
||||
mode: "0755"
|
||||
when: ansible_cron_log_check.stat.exists
|
||||
and ansible_cron_log_check.stat.size > 1000000
|
||||
|
||||
|
||||
- name: General | Cron | Ansible | Create Subscriber Job
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: ansible
|
||||
name: "Ansible Sync"
|
||||
minute: "*/30"
|
||||
job: "bash -c 'sleep $(( $RANDOM / 20 )); sudo {{ ansible_pull_exec.stdout }} -v -o -U {{ git_repo_http }} --checkout {{ branch }} >>{{ ansible_cron_log }} 2>&1'"
|
||||
job: "sudo {{ ansible_pull_exec.stdout }} -o -U {{ git_repo_http }} --checkout {{ branch }}"
|
||||
state: present
|
||||
disabled: "{{ 'yes' if no_telem else 'no' }}"
|
||||
|
||||
- name: General | Cron | Ansible | Create Forced Weekly Subscriber Job
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: ansible
|
||||
name: "Ansible Weekly Forced Sync"
|
||||
special_time: weekly
|
||||
job: "bash -c 'sleep $(( $RANDOM / 1 )); sudo {{ ansible_pull_exec.stdout }} -v -U {{ git_repo_http }} --checkout {{ branch }} >>{{ ansible_cron_log }} 2>&1'"
|
||||
job: "{{ user_root.home }}/bin/scm.sh"
|
||||
state: present
|
||||
disabled: "{{ 'yes' if no_telem else 'no' }}"
|
||||
@@ -1,52 +0,0 @@
|
||||
---
|
||||
# 20261002 - Hyperling
|
||||
# Move internet requiring code out of users.yml.
|
||||
|
||||
# Shared Environment Setup #
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Download / Update
|
||||
ansible.builtin.git:
|
||||
repo: https://git.hyperling.com/me/env-shared
|
||||
version: "{{ branch }}"
|
||||
dest: "{{ shared_rc_install_dir }}"
|
||||
clone: true
|
||||
force: true
|
||||
update: true
|
||||
#ignore_errors: true
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Install | .rc_shared
|
||||
copy:
|
||||
src: "{{ shared_rc_install_dir }}/rc_shared.sh"
|
||||
dest: "{{ item }}/.rc_shared"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
#ignore_errors: true
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Install | .vimrc
|
||||
copy:
|
||||
src: "{{ shared_rc_install_dir }}/vimrc.vim"
|
||||
dest: "{{ item }}/.vimrc"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ user_root.home }}"
|
||||
- "{{ user_user.home }}"
|
||||
#ignore_errors: true
|
||||
when: user_root.home != "" and user_user.home != ""
|
||||
|
||||
- name: General | Account Management | Users | env-shared | Permissions
|
||||
ansible.builtin.file:
|
||||
path: "{{ user_user.home }}/{{ item }}"
|
||||
owner: "{{ user }}"
|
||||
group: "{{ user }}"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- .rc_shared
|
||||
- .vimrc
|
||||
#ignore_errors: true
|
||||
@@ -8,7 +8,7 @@
|
||||
mode: '0755'
|
||||
|
||||
- name: General | Scripts | Install | Copy Files
|
||||
ansible.builtin.copy:
|
||||
copy:
|
||||
src: 'scripts/'
|
||||
dest: "{{ global_bin }}/"
|
||||
owner: root
|
||||
@@ -16,12 +16,10 @@
|
||||
mode: '0755'
|
||||
|
||||
- name: General | Scripts | Install | Remove Old Scripts
|
||||
ansible.builtin.shell: |
|
||||
shell: |
|
||||
if [[ -e {{ global_bin }}/{{ item }} ]]; then
|
||||
rm -v {{ global_bin }}/{{ item }}
|
||||
fi
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
loop:
|
||||
- compress-video.sh
|
||||
- compress-images.sh
|
||||
|
||||
@@ -2,20 +2,27 @@
|
||||
# Create file to easily push git changes and call SCM.
|
||||
|
||||
- name: General | Scripts | Root | scm.sh
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ user_root.home }}/bin/scm.sh"
|
||||
block: |
|
||||
# 20210211 - Make life easier!
|
||||
time {{ ansible_pull_exec.stdout }} -U {{ git_repo_http }}
|
||||
git clone {{ git_repo_http }} ansible-pull
|
||||
ansible-pull/setup.sh
|
||||
mv ansible-pull ~/TRASH/
|
||||
marker: '{mark}'
|
||||
marker_begin: "#!{{ bash_exec.stdout }}"
|
||||
marker_end: "exit 0"
|
||||
state: present
|
||||
create: true
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | Root | scm.sh Permissions
|
||||
file:
|
||||
path: "{{ user_root.home }}/bin/scm.sh"
|
||||
mode: '0755'
|
||||
|
||||
|
||||
- name: General | Scripts | Root | scm-dev.sh
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ user_root.home }}/bin/scm-dev.sh"
|
||||
block: |
|
||||
# 20210713 - Make life easier for development!
|
||||
@@ -36,5 +43,9 @@
|
||||
marker_begin: "#!{{ bash_exec.stdout }}"
|
||||
marker_end: "exit 0"
|
||||
state: present
|
||||
create: true
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | Root | scm-dev.sh Permissions
|
||||
file:
|
||||
path: "{{ user_root.home }}/bin/scm-dev.sh"
|
||||
mode: '0755'
|
||||
@@ -2,25 +2,27 @@
|
||||
# Create file to easily push git changes and call SCM.
|
||||
|
||||
- name: General | Scripts | User | scm.sh
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ user_user.home }}/bin/scm.sh"
|
||||
block: |
|
||||
# 20210211 - Make life easier!
|
||||
time {{ ansible_pull_exec.stdout }} -U {{ git_repo_http }}
|
||||
git clone {{ git_repo_http }} ansible-pull
|
||||
ansible-pull/setup.sh
|
||||
mv ansible-pull ~/TRASH/
|
||||
marker: '{mark}'
|
||||
marker_begin: "#!{{ bash_exec.stdout }}"
|
||||
marker_end: "exit 0"
|
||||
state: present
|
||||
create: true
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | User | scm.sh Permissions
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ user_user.home }}/bin/scm.sh"
|
||||
mode: '0755'
|
||||
|
||||
|
||||
- name: General | Scripts | User | scm-dev.sh
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ user_user.home }}/bin/scm-dev.sh"
|
||||
block: |
|
||||
# 20210713 - Make life easier for development!
|
||||
@@ -41,9 +43,9 @@
|
||||
marker_begin: "#!{{ bash_exec.stdout }}"
|
||||
marker_end: "exit 0"
|
||||
state: present
|
||||
create: true
|
||||
create: yes
|
||||
|
||||
- name: General | Scripts | User | scm-dev.sh Permissions
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ user_user.home }}/bin/scm-dev.sh"
|
||||
mode: '0755'
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
# 20260716 - Hyperling
|
||||
# Ensure the correct International AltGr keyboard setting is always chosen.
|
||||
|
||||
- name: General | Settings | Keyboard | Default Config
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/default/keyboard"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }}'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
loop:
|
||||
#- { "key": '^[\#]?XKBMODEL', "value": 'XKBMODEL="pc105"'}
|
||||
- { "key": '^[\#]?XKBLAYOUT', "value": 'XKBLAYOUT="us"'}
|
||||
- { "key": '^[\#]?XKBVARIANT', "value": 'XKBVARIANT="altgr-intl"'}
|
||||
@@ -1,151 +0,0 @@
|
||||
---
|
||||
# Enable and disable services.
|
||||
|
||||
## Cron ##
|
||||
|
||||
- name: General | Software | Services | CROND | Enable
|
||||
ansible.builtin.service:
|
||||
name: "{{ crond }}"
|
||||
pattern: "{{ crond_pattern }}"
|
||||
state: started
|
||||
enabled: true
|
||||
when: ansible_virtualization_type != 'docker'
|
||||
and ansible_service_mgr != "runit"
|
||||
register: cron_status
|
||||
until: cron_status.state == "started"
|
||||
retries: 3
|
||||
delay: 3
|
||||
|
||||
- name: General | Software | Services | CROND | Enable (runit)
|
||||
ansible.builtin.service:
|
||||
name: "{{ crond }}"
|
||||
state: started
|
||||
enabled: true
|
||||
when: ansible_virtualization_type != 'docker'
|
||||
and ansible_service_mgr == "runit"
|
||||
ignore_errors: true # Service module seems experimental for this init system.
|
||||
|
||||
## SSHD ##
|
||||
|
||||
- name: General | Software | Services | SSHD | Configure
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ sshd_config }}"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
loop:
|
||||
- { "key": '^[\#]?AllowUsers', "value": 'AllowUsers {{ user }}'}
|
||||
- { "key": '^[\#]?PermitRootLogin', "value": 'PermitRootLogin no'}
|
||||
- { "key": '^[\#]?AllowTcpForwarding', "value": 'AllowTcpForwarding yes'}
|
||||
- { "key": '^[\#]?ClientAliveInterval', "value": 'ClientAliveInterval 60'}
|
||||
- { "key": '^[\#]?ClientAliveCountMax', "value": 'ClientAliveCountMax 2'}
|
||||
- { "key": '^[\#]?Compression', "value": 'Compression no'}
|
||||
- { "key": '^[\#]?LogLevel', "value": 'LogLevel verbose'}
|
||||
- { "key": '^[\#]?MaxAuthTries', "value": 'MaxAuthTries 3'}
|
||||
- { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 2'}
|
||||
- { "key": '^[\#]?Port', "value": 'Port {{ sshd_port }}'}
|
||||
- { "key": '^[\#]?TCPKeepAlive', "value": 'TCPKeepAlive no'}
|
||||
- { "key": '^[\#]?X11Forwarding', "value": 'X11Forwarding no'}
|
||||
- { "key": '^[\#]?AllowAgentForwarding', "value": 'AllowAgentForwarding no'}
|
||||
- { "key": '^[\#]?PermitEmptyPasswords', "value": 'PermitEmptyPasswords no'}
|
||||
- { "key": '^[\#]?GatewayPorts', "value": 'GatewayPorts yes'}
|
||||
|
||||
- name: General | Software | Services | SSHD | Configure (PVE)
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ sshd_config }}"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
loop:
|
||||
- { "key": '^[\#]?AllowUsers', "value": 'AllowUsers root {{ user }}'}
|
||||
- { "key": '^[\#]?PermitRootLogin', "value": 'PermitRootLogin yes'}
|
||||
- { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 5'}
|
||||
when: "'pve' in ansible_kernel"
|
||||
|
||||
- name: General | Software | Services | SSHD | Enable
|
||||
ansible.builtin.service:
|
||||
name: "{{ sshd }}"
|
||||
pattern: "{{ sshd_pattern }}"
|
||||
state: reloaded
|
||||
enabled: true
|
||||
when: ansible_virtualization_type != 'docker'
|
||||
and ansible_service_mgr != "runit"
|
||||
register: sshd_status
|
||||
until: sshd_status.state == "started"
|
||||
retries: 3
|
||||
delay: 3
|
||||
|
||||
## JournalCTL ##
|
||||
|
||||
- name: General | Software | Services | JournalCTL | Reduce Log Size
|
||||
ansible.builtin.shell: journalctl --vacuum-size=100M
|
||||
when: ansible_system == "Linux"
|
||||
and ansible_service_mgr == "systemd"
|
||||
ignore_errors: true
|
||||
|
||||
## Bluetooth ##
|
||||
# Do people seriously depend on Bluetooth? Plug your devices in, silly!
|
||||
# Hehe, I use it now for a few rare things so disabling this for now.
|
||||
|
||||
#- name: General | Software | Services | Bluetooth | Disable
|
||||
# ansible.builtin.service:
|
||||
# name: "{{ bluetooth }}"
|
||||
# pattern: "{{ bluetooth_pattern }}"
|
||||
# state: stopped
|
||||
# enabled: false
|
||||
# ignore_errors: true
|
||||
|
||||
## NTP ##
|
||||
|
||||
- name: General | Software | Services | NTP | Enable
|
||||
ansible.builtin.service:
|
||||
name: "{{ ntp_server }}"
|
||||
pattern: "{{ ntp_server }}"
|
||||
state: started
|
||||
enabled: true
|
||||
when: ansible_virtualization_type != 'docker'
|
||||
and ansible_service_mgr != "runit"
|
||||
register: ntp_status
|
||||
until: ntp_status.state == "started"
|
||||
retries: 3
|
||||
delay: 3
|
||||
|
||||
## Timezone ##
|
||||
|
||||
# TBD/TODO:
|
||||
# Add a field to general.yml config file which gets applied via timedatectl and /etc/localtime.
|
||||
# Example of what to do to file:
|
||||
# /etc/localtime -> ../usr/share/zoneinfo/America/Phoenix
|
||||
|
||||
## Disable ##
|
||||
|
||||
- name: General | Software | Services | Disable
|
||||
ansible.builtin.service:
|
||||
name: "{{ item.name }}"
|
||||
pattern: "{{ item.pattern }}"
|
||||
state: stopped
|
||||
enabled: false
|
||||
ignore_errors: true
|
||||
loop:
|
||||
- {name: "{{ cups }}" , pattern: "{{ cups_pattern }}"}
|
||||
- {name: "{{ cups_browse }}", pattern: "{{ cups_browse_pattern }}"}
|
||||
when: ansible_service_mgr != "runit"
|
||||
|
||||
- name: General | Software | Services | Disable (runit)
|
||||
ansible.builtin.shell: |
|
||||
if [[ -e {{ runit_service_dir }}/{{ item.name }} ]]; then
|
||||
rm -v {{ runit_service_dir }}/{{ item.name }}
|
||||
fi
|
||||
ignore_errors: true
|
||||
loop:
|
||||
- {name: "{{ cups }}" }
|
||||
- {name: "{{ cups_pattern }}" }
|
||||
- {name: "{{ cups_browse }}" }
|
||||
- {name: "{{ cups_browse_pattern }}"}
|
||||
when: ansible_service_mgr == "runit"
|
||||
@@ -1,110 +0,0 @@
|
||||
---
|
||||
# 2026-10-17 Hyperling
|
||||
# Allow pushing a local port to a remote server automagically in a runit script.
|
||||
|
||||
# ssh -N -p SSH_PORT -R REMOTE_PORT:localhost:LOCAL_PORT USER@REMOTE_HOST -v
|
||||
|
||||
- name: General | Tunnel | Provisioned Variables
|
||||
ansible.builtin.debug:
|
||||
var: "{{ item }}"
|
||||
loop:
|
||||
- tunnel_local_port
|
||||
- tunnel_remote_host
|
||||
- tunnel_remote_port
|
||||
- tunnel_ssh_port
|
||||
|
||||
- name: General | Tunnel | Facts
|
||||
ansible.builtin.set_fact:
|
||||
tunnel_service_name: tunnel
|
||||
|
||||
- name: General | Tunnel | Packages [pacman]
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- openbsd-netcat
|
||||
state: present
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
|
||||
- name: General | Tunnel | Packages [apt]
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- netcat-openbsd
|
||||
state: present
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: General | Tunnel | runit
|
||||
block:
|
||||
|
||||
- name: General | Tunnel | runit | mkdir | /etc/sv
|
||||
ansible.builtin.file:
|
||||
path: /etc/sv/{{ tunnel_service_name }}
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: General | Tunnel | runit | mkdir | /etc/sv log
|
||||
ansible.builtin.file:
|
||||
path: /etc/sv/{{ tunnel_service_name }}/log
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: General | Tunnel | runit | mkdir | /var/log
|
||||
ansible.builtin.file:
|
||||
path: /var/log/{{ tunnel_service_name }}
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: General | Tunnel | runit | Script | Run
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/sv/{{ tunnel_service_name }}/run
|
||||
content: |
|
||||
#!/bin/sh -e
|
||||
exec 2>&1
|
||||
|
||||
# Health check to ensure connection does not go stale.
|
||||
while true; do
|
||||
sleep 300
|
||||
echo -n "RUN-LOOP: "
|
||||
nc -zv {{ tunnel_remote_host }} {{ tunnel_remote_port }}
|
||||
status="$?"
|
||||
echo "RUN-LOOP: Port check returned ${status}."
|
||||
if [[ "$status" != 0 ]]; then
|
||||
echo "RUN-LOOP: Restarting service."
|
||||
sv restart {{ tunnel_service_name }}
|
||||
fi
|
||||
echo "RUN-LOOP: Going back to sleep."
|
||||
done &
|
||||
|
||||
# Do not use `exec` here otherwise the loop may get killed.
|
||||
chpst -u {{ user }} ssh -v -N \
|
||||
-R {{ tunnel_remote_port }}:localhost:{{ tunnel_local_port }} \
|
||||
-p {{ tunnel_ssh_port }} {{ tunnel_remote_host }}
|
||||
mode: "0755"
|
||||
|
||||
- name: General | Tunnel | runit | Script | Finish
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/sv/{{ tunnel_service_name }}/finish
|
||||
content: |
|
||||
{{ runit_finish_sleep }}
|
||||
mode: "0755"
|
||||
|
||||
- name: General | Tunnel | runit | Script | Log
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/sv/{{ tunnel_service_name }}/log/run
|
||||
content: |
|
||||
#!/bin/sh -e
|
||||
exec svlogd -tt /var/log/{{ tunnel_service_name }}
|
||||
mode: "0755"
|
||||
|
||||
- name: General | Tunnel | runit | Script | Log Config
|
||||
ansible.builtin.copy:
|
||||
dest: /var/log/{{ tunnel_service_name }}/config
|
||||
content: |
|
||||
{{ runit_log_config_10mb }}
|
||||
mode: "0755"
|
||||
|
||||
- name: General | Tunnel | runit | Service | Enable
|
||||
ansible.builtin.service:
|
||||
name: "{{ tunnel_service_name }}"
|
||||
state: "{{ 'started' if tunnel_remote_host else 'stopped' }}"
|
||||
enabled: "{{ true if tunnel_remote_host else false }}"
|
||||
|
||||
when: ansible_service_mgr == "runit"
|
||||
@@ -1,54 +0,0 @@
|
||||
---
|
||||
# 20260731 - Hyperling
|
||||
# Install the AUR on pacman-related distros.
|
||||
|
||||
- name: General | Software | AUR | Facts 01
|
||||
ansible.builtin.set_fact:
|
||||
aur_user: aurbuilder
|
||||
aur_build_dir: "{{ global_src }}"
|
||||
aur_helper: yay
|
||||
aur_helper_url: https://aur.archlinux.org/yay-bin.git
|
||||
|
||||
- name: General | Software | AUR | Facts 02
|
||||
ansible.builtin.set_fact:
|
||||
aur_helper_dir: "{{ aur_build_dir }}/{{ aur_helper }}"
|
||||
aur_sudoers: "/etc/sudoers.d/sudoers_{{ aur_user }}"
|
||||
|
||||
- name: General | Software | AUR | User
|
||||
ansible.builtin.user:
|
||||
name: "{{ aur_user }}"
|
||||
groups: wheel
|
||||
create_home: true
|
||||
|
||||
- name: General | Software | AUR | Sudoers
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ aur_sudoers }}"
|
||||
line: "{{ aur_user }} ALL=(ALL) NOPASSWD: /usr/bin/pacman"
|
||||
create: true
|
||||
mode: '0440'
|
||||
validate: 'visudo -cf %s'
|
||||
|
||||
- name: General | Software | AUR | Check
|
||||
command: "which {{ aur_helper }}"
|
||||
register: yay_check
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: General | Software | AUR | Install
|
||||
block:
|
||||
|
||||
- name: General | Software | AUR | Install | Clone Repo
|
||||
ansible.builtin.git:
|
||||
repo: "{{ aur_helper_url }}"
|
||||
dest: "{{ aur_helper_dir }}"
|
||||
|
||||
- name: General | Software | AUR | Install | Change Permissions
|
||||
ansible.builtin.shell: "chown -Rc {{ aur_user }}:wheel {{ aur_helper_dir }}"
|
||||
|
||||
- name: General | Software | AUR | Install | Build & Integrate
|
||||
ansible.builtin.shell: "cd {{ aur_helper_dir }} && makepkg -si --noconfirm"
|
||||
become: true
|
||||
become_user: "{{ aur_user }}"
|
||||
changed_when: true
|
||||
|
||||
when: yay_check.rc != 0
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
# Software that I've written for personal use, to be placed in `~/bin/`.
|
||||
|
||||
# TODO TBD - Add content here and place this in local.yml! :)
|
||||
|
||||
# Refactor Music Library
|
||||
@@ -2,52 +2,17 @@
|
||||
# Install Metasploit Framework
|
||||
|
||||
- name: General | Software | Metasploit | Facts
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
metasploit_installer: msfinstall
|
||||
when: ansible_system in ("Linux", "Darwin")
|
||||
and pentesting
|
||||
|
||||
- name: General | Software | Metasploit | Check Install Status
|
||||
ansible.builtin.stat:
|
||||
path: /usr/bin/msfconsole
|
||||
register: metasploit_status
|
||||
|
||||
- name: General | Software | Metasploit | Refresh Apt Files
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
loop:
|
||||
- "mkdir -p /tmp/apt/"
|
||||
- "mv -fv /usr/share/keyrings/metasploit-framework.gpg /tmp/apt/metasploit-framework.gpg.old"
|
||||
- "mv -fv /etc/apt/sources.list.d/metasploit-framework.list /tmp/apt/metasploit-framework.list.old"
|
||||
- "mv -fv /etc/apt/preferences.d/pin-metasploit.pref /tmp/apt/pin-metasploit.pref.old"
|
||||
when: ansible_system in ("Linux") and ansible_pkg_mgr == "apt"
|
||||
and not metasploit_status.stat.exists
|
||||
and pentesting
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Software | Metasploit | Install
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "mv -fv /usr/share/keyrings/metasploit-framework.gpg /usr/share/keyrings/metasploit-framework.gpg.old"
|
||||
- "curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > {{ metasploit_installer }}"
|
||||
- "chmod 755 {{ metasploit_installer }}"
|
||||
- "mkdir -p {{ global_bin }}"
|
||||
- "mv -fv ./{{ metasploit_installer }} {{ global_bin }}/{{ metasploit_installer }}"
|
||||
- yes y | "{{ global_bin }}/{{ metasploit_installer }}"
|
||||
- "mv -fv ./msfinstall {{ global_bin }}/{{ metasploit_installer }}"
|
||||
- "{{ global_bin }}/{{ metasploit_installer }}"
|
||||
when: ansible_system in ("Linux", "Darwin")
|
||||
and not metasploit_status.stat.exists
|
||||
and pentesting
|
||||
|
||||
- name: General | Software | Metasploit | Remove (Darwin)
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
loop:
|
||||
- "/opt/metasploit-framework/bin/msfremove"
|
||||
when: ansible_system in ("Darwin")
|
||||
and not metasploit_status.stat.exists
|
||||
and pentesting == false
|
||||
|
||||
- name: General | Software | Metasploit | Remove
|
||||
ansible.builtin.package:
|
||||
name: "metasploit-framework"
|
||||
state: absent
|
||||
when: ansible_system in ("Linux")
|
||||
and metasploit_status.stat.exists
|
||||
and pentesting == false
|
||||
@@ -13,21 +13,20 @@
|
||||
###
|
||||
|
||||
- name: Nix Variables
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nix_exe: ~/.deleteme.nix.sh
|
||||
|
||||
- name: Install Nix
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "curl -L https://nixos.org/nix/install > {{ nix_exe }}"
|
||||
- "chmod 755 {{ nix_exe }}"
|
||||
- "{{ nix_exe }} --daemon --yes"
|
||||
- "rm -v {{ nix_exe }}"
|
||||
become: true
|
||||
become_user: "{{ user }}"
|
||||
|
||||
- name: Install Nix Software
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "nix-env -iA nixpkgs.lbry" # Installs, but doesnt launch?
|
||||
#$ lbry
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
# This is also done in setup.sh if ansible is not found.
|
||||
|
||||
- name: General | Software | NixOS | Facts
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nixos_working_dir: ~/nixos-config-deleteme
|
||||
nixos_working_exe: activate.sh
|
||||
|
||||
- name: General | Software | NixOS | Facts [Swap]
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nixos_swap: "swapDevices = [ { device = \"{{ swap_file }}\";} ];"
|
||||
when: swap_block != false
|
||||
|
||||
- name: General | Software | NixOS | Update Config Project
|
||||
ansible.builtin.shell: "files/scripts/nixos.sh -b {{ branch }}"
|
||||
shell: "files/scripts/nixos.sh -b {{ branch }}"
|
||||
|
||||
- name: General | Software | NixOS | Create Ansible Nix Config
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: /etc/nixos/ansible.nix
|
||||
block: |
|
||||
# This file was created by https://git.hyperling.com/me/env-ansible
|
||||
@@ -29,14 +29,14 @@
|
||||
{{ nixos_swap }}
|
||||
}
|
||||
state: present
|
||||
backup: true
|
||||
create: true
|
||||
backup: yes
|
||||
create: yes
|
||||
|
||||
|
||||
# Maybe do home manager here? Or should it be under Workstation? Or maybe
|
||||
# this is the spot where I start creating workstation.nix, server.nix, etc.
|
||||
#- name: General | Software | NixOS | Home Manager? *.nix file management?
|
||||
# ansible.builtin.shell:
|
||||
# shell:
|
||||
# loop:
|
||||
# - ???
|
||||
# - ???
|
||||
@@ -1,172 +1,99 @@
|
||||
---
|
||||
# Cross-platform package management.
|
||||
|
||||
- name: General | Software | Packages | Fix Parrot OS
|
||||
block:
|
||||
|
||||
- name: General | Software | Packages | Fix Parrot OS | zypper
|
||||
# They have zypper higher in the path, but it's really apt renamed.
|
||||
# Probably for "security", but package module does not use the ansible_pkg_mgr variable
|
||||
# so resetting the value to apt doesn't work. Just going to move it.
|
||||
ansible.builtin.shell: "mv `which zypper` `which zypper`.zz.`date +%Y%m%d`"
|
||||
register: parrotos_zypper_removed
|
||||
changed_when: parrotos_zypper_removed.rc == 0
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Software | Packages | Fix Parrot OS | zypper | Exit Incoming
|
||||
ansible.builtin.debug:
|
||||
msg: "A silly zypper file was renamed successfully. Please try running Ansible again."
|
||||
when: parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed
|
||||
|
||||
- name: General | Software | Packages | Fix Parrot OS | zypper | Exiting
|
||||
ansible.builtin.shell: exit 1
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
when: parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed
|
||||
|
||||
# More Parrot OS junk. They have a command called update in /usr/bin. Doesn't
|
||||
# have sudo or anything in it. Hide it in preference for .bashrc update function.
|
||||
- name: General | Software | Packages | Fix Parrot OS | update
|
||||
ansible.builtin.shell: "mv `which update` `which update`.zz.`date +%Y%m%d`"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Software | Packages | Fix Parrot OS (zypper)
|
||||
# They have zypper higher in the path, but it's really apt renamed.
|
||||
# Probably for "security", but package module does not use the ansible_pkg_mgr variable
|
||||
# so resetting the value to apt doesn't work. Just going to move it.
|
||||
shell: "mv `which zypper` `which zypper`.zz.`date +%Y%m%d`"
|
||||
register: parrotos_zypper_removed
|
||||
ignore_errors: yes
|
||||
when: ansible_distribution == "Parrot OS"
|
||||
|
||||
- name: General | Software | Packages | pacman
|
||||
block:
|
||||
- name: General | Software | Packages | Fix Parrot OS (zypper), Exit Incoming
|
||||
debug:
|
||||
msg: "A silly zypper file was renamed successfully. Please try running Ansible again."
|
||||
when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed
|
||||
|
||||
- name: General | Software | Packages | pacman | pacman.conf
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/pacman.conf"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }}'
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
mode: "0644"
|
||||
loop:
|
||||
- { "key": '^[\#]?ParallelDownloads', "value": 'ParallelDownloads = 3'}
|
||||
- name: General | Software | Packages | Fix Parrot OS (zypper), Exiting
|
||||
shell: exit 1
|
||||
when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed
|
||||
|
||||
# TBD / TODO: Do the mirrorlist files and distros based on facts in case ever using Arch, Manjaro, etc.
|
||||
# Same with the blocklist for sites like Berkeley which rate limit VPNs.
|
||||
- name: General | Software | Packages | pacman | Artix
|
||||
block:
|
||||
# More Parrot OS junk. They have a command called update in /usr/bin. Doesn't
|
||||
# have sudo or anything in it. Hide it in preference for .bashrc update function.
|
||||
- name: General | Software | Packages | Fix Parrot OS 2 (update)
|
||||
shell: "mv `which update` `which update`.zz.`date +%Y%m%d`"
|
||||
ignore_errors: yes
|
||||
when: ansible_distribution == "Parrot OS"
|
||||
|
||||
- name: General | Software | Packages | pacman | Artix | rate-mirrors | Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- rate-mirrors
|
||||
state: present
|
||||
|
||||
- name: General | Software | Packages | pacman | Artix | rate-mirrors | Update Lists
|
||||
ansible.builtin.shell: |
|
||||
set -o pipefail
|
||||
{{ item }}
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
loop:
|
||||
- "sudo -u {{ user }} rate-mirrors artix | grep -v berkeley | tee /etc/pacman.d/mirrorlist"
|
||||
- "sudo -u {{ user }} rate-mirrors arch | grep -v berkeley | tee /etc/pacman.d/mirrorlist-arch"
|
||||
|
||||
when: ansible_service_mgr == "runit"
|
||||
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
|
||||
- name: General | Software | Packages | Cache Refresh (Apt and Pacman)
|
||||
ansible.builtin.package:
|
||||
update_cache: true
|
||||
package:
|
||||
update_cache: yes
|
||||
name: htop
|
||||
when: ansible_pkg_mgr in ["apt", "pacman"]
|
||||
|
||||
- name: General | Software | Packages | Cache Refresh (FreeBSD)
|
||||
ansible.builtin.shell: pkg update
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
shell: pkg update
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
- name: General | Software | Packages | Install Software
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- bash
|
||||
- sudo
|
||||
- nmap
|
||||
- "{{ neofetch }}"
|
||||
- "{{ sshfs }}"
|
||||
- "{{ locate }}"
|
||||
- zsh
|
||||
- "{{ opensshd }}"
|
||||
- "{{ tar }}"
|
||||
- curl
|
||||
- at
|
||||
- gcc
|
||||
- vim
|
||||
- "{{ cron }}"
|
||||
- "{{ encfs }}"
|
||||
- rsync
|
||||
- "{{ iftop }}"
|
||||
- "{{ nethogs }}"
|
||||
- "{{ ntp_server }}"
|
||||
- "{{ dig }}"
|
||||
- "{{ tmux }}"
|
||||
- "{{ base_devel }}"
|
||||
- "{{ sendmail }}"
|
||||
- "{{ sendmail_mta }}"
|
||||
- "{{ ca_certificates }}"
|
||||
- "{{ alsa }}"
|
||||
- "{{ stress }}"
|
||||
- "{{ jq }}"
|
||||
- "{{ btop }}"
|
||||
- "{{ xkb }}"
|
||||
- bash
|
||||
- sudo
|
||||
- nmap
|
||||
- neofetch
|
||||
- "{{ sshfs }}"
|
||||
- "{{ locate }}"
|
||||
- zsh
|
||||
- "{{ opensshd }}"
|
||||
- "{{ tar }}"
|
||||
- curl
|
||||
- at
|
||||
- gcc
|
||||
- vim
|
||||
- "{{ cron }}"
|
||||
- "{{ encfs }}"
|
||||
- rsync
|
||||
state: present
|
||||
|
||||
- name: General | Software | Packages | Install Software (DEV)
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- "{{ microcode_amd }}"
|
||||
- "{{ microcode_intel }}"
|
||||
- "{{ microcode_amd }}"
|
||||
- "{{ microcode_intel }}"
|
||||
state: present
|
||||
when: branch == "dev"
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Software | Packages | Add Generic Kernel + Tools (Ubuntu)
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- linux-image-generic
|
||||
- linux-headers-generic
|
||||
- linux-tools-generic
|
||||
- linux-tools-common
|
||||
- linux-image-generic
|
||||
- linux-headers-generic
|
||||
- linux-tools-generic
|
||||
- linux-tools-common
|
||||
state: present
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Software | Packages | Add Generic Kernel + Headers (Debian)
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- linux-image-amd64
|
||||
- linux-headers-amd64
|
||||
state: present
|
||||
when: ansible_distribution == "Debian"
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Software | Packages | Install killall (Looking at you, Debian)
|
||||
ansible.builtin.package:
|
||||
- name: General | Software | Services | Install killall (Looking at you, Debian)
|
||||
package:
|
||||
name: psmisc
|
||||
state: present
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: General | Software | Packages | Install "Bloat" (Looking at you, Arch Base)
|
||||
ansible.builtin.package:
|
||||
- name: General | Software | Services | Install "Bloat" (Looking at you, Arch Base)
|
||||
package:
|
||||
name:
|
||||
- which
|
||||
- "{{ cron }}"
|
||||
- pacman-contrib
|
||||
- which
|
||||
- "{{ cron }}"
|
||||
state: present
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
when: ansible_distribution == "Archlinux"
|
||||
|
||||
- name: General | Software | Packages | Install Fix (Looking at you, openSUSE)
|
||||
ansible.builtin.package:
|
||||
- name: General | Software | Services | Install Fix (Looking at you, openSUSE)
|
||||
package:
|
||||
name:
|
||||
# openSUSE Tumbleweed comes without gnome-control-center being able to open
|
||||
# properly. Hopefully just a one-time accident but I wanted bleeding edge so I
|
||||
@@ -177,36 +104,36 @@
|
||||
state: present
|
||||
when: ansible_pkg_mgr in ("zypper")
|
||||
|
||||
- name: General | Software | Packages | Remove Software
|
||||
ansible.builtin.package:
|
||||
- name: General | Software | Packages | Update Software (Disabled)
|
||||
package:
|
||||
name:
|
||||
- cowsay # Sorry ;)
|
||||
- chromium
|
||||
- chromium-browser
|
||||
- ansible
|
||||
- git
|
||||
state: latest
|
||||
when: 1 == 0
|
||||
|
||||
- name: General | Software | Packages | Remove Software
|
||||
package:
|
||||
name:
|
||||
- cowsay # Sorry ;)
|
||||
- chromium
|
||||
- chromium-browser
|
||||
state: absent
|
||||
|
||||
# Ubuntu still uses snap for critical components like GNOME, must keep.
|
||||
- name: General | Software | Packages | Disable Snap Daemon
|
||||
ansible.builtin.service:
|
||||
- name: General | Software | Services | Disable Snap Daemon
|
||||
service:
|
||||
name: snapd
|
||||
pattern: snapd
|
||||
state: stopped
|
||||
enabled: false
|
||||
enabled: no
|
||||
when: ansible_distribution != "Ubuntu"
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Software | Packages | Remove Snap (Besides Ubuntu)
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- snapd
|
||||
- snapd
|
||||
state: absent
|
||||
when: ansible_distribution != "Ubuntu"
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Software | Packages | Other Debian Packages
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- usbutils
|
||||
state: present
|
||||
when: ansible_distribution in ("Debian")
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
@@ -1,23 +0,0 @@
|
||||
---
|
||||
# 20261006 Hyperling
|
||||
|
||||
# Allow ansible.builtin.service to be used on Artix similar to Devuan.
|
||||
- name: General | Software | runit | Fix Artix
|
||||
block:
|
||||
|
||||
- name: General | Software | runit | Fix Artix | Script Dir
|
||||
ansible.builtin.file:
|
||||
src: /etc/runit/sv
|
||||
dest: /etc/sv
|
||||
state: link
|
||||
force: true
|
||||
|
||||
- name: General | Software | runit | Fix Artix | Service Dir
|
||||
ansible.builtin.file:
|
||||
src: /etc/runit/runsvdir/default
|
||||
dest: /var/service
|
||||
state: link
|
||||
force: true
|
||||
|
||||
when: ansible_service_mgr == "runit"
|
||||
and ansible_pkg_mgr == "pacman"
|
||||
@@ -3,46 +3,46 @@
|
||||
# Preferably only on servers that don't already have postfix?
|
||||
|
||||
- name: Server | Sendmail | Variables
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
sendmail: sendmail
|
||||
sendmail_queue: sendmail_msp_queue
|
||||
|
||||
- name: Server | Sendmail | Check
|
||||
ansible.builtin.shell: which postfix
|
||||
shell: which postfix
|
||||
register: postfix
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Server | Sendmail | Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
package:
|
||||
name:
|
||||
- "{{ sendmail }}"
|
||||
state: present
|
||||
when: postfix.failed
|
||||
|
||||
- name: Server | Sendmail | Configure
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: /etc/rc.conf
|
||||
block: |
|
||||
sendmail_enable="YES"
|
||||
sendmail_msp_queue_enable="YES"
|
||||
marker: "# {mark} MANAGED BY ANSIBLE - sendmail"
|
||||
state: present
|
||||
create: true
|
||||
backup: true
|
||||
create: yes
|
||||
backup: yes
|
||||
when: postfix.failed and ansible_system == "FreeBSD"
|
||||
|
||||
- name: Server | Sendmail | Enable + Start | Main
|
||||
ansible.builtin.service:
|
||||
service:
|
||||
name: "{{ sendmail }}"
|
||||
pattern: "{{ sendmail }}"
|
||||
state: started
|
||||
enabled: true
|
||||
enabled: yes
|
||||
when: postfix.failed
|
||||
|
||||
- name: Server | Sendmail | Enable + Start | Queue
|
||||
ansible.builtin.service:
|
||||
service:
|
||||
name: "{{ sendmail_queue }}"
|
||||
pattern: "{{ sendmail_queue }}"
|
||||
state: started
|
||||
enabled: true
|
||||
enabled: yes
|
||||
when: postfix.failed and ansible_system == "FreeBSD"
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
# Enable and disable services.
|
||||
|
||||
## Cron ##
|
||||
|
||||
- name: General | Software | Services | CROND | Enable
|
||||
service:
|
||||
name: "{{ crond }}"
|
||||
pattern: "{{ crond_pattern }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
|
||||
## CUPS ##
|
||||
|
||||
- name: General | Software | Services | CUPS | Disable
|
||||
service:
|
||||
name: "{{ cups }}"
|
||||
pattern: "{{ cups_pattern }}"
|
||||
state: stopped
|
||||
enabled: no
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Software | Services | CUPS-Browse | Disable
|
||||
service:
|
||||
name: "{{ cups_browse }}"
|
||||
pattern: "{{ cups_browse_pattern }}"
|
||||
state: stopped
|
||||
enabled: no
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
## SSHD ##
|
||||
|
||||
- name: General | Software | Services | SSHD | Configure
|
||||
lineinfile:
|
||||
path: "{{ sshd_config }}"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
||||
state: present
|
||||
create: yes
|
||||
backup: yes
|
||||
loop:
|
||||
- { "key": '^[\#]?AllowUsers', "value": 'AllowUsers {{ user }}'}
|
||||
- { "key": '^[\#]?PermitRootLogin', "value": 'PermitRootLogin no'}
|
||||
- { "key": '^[\#]?AllowTcpForwarding', "value": 'AllowTcpForwarding no'}
|
||||
- { "key": '^[\#]?ClientAliveInterval', "value": 'ClientAliveInterval 60'}
|
||||
- { "key": '^[\#]?ClientAliveCountMax', "value": 'ClientAliveCountMax 2'}
|
||||
- { "key": '^[\#]?Compression', "value": 'Compression no'}
|
||||
- { "key": '^[\#]?LogLevel', "value": 'LogLevel verbose'}
|
||||
- { "key": '^[\#]?MaxAuthTries', "value": 'MaxAuthTries 3'}
|
||||
- { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 2'}
|
||||
- { "key": '^[\#]?Port', "value": 'Port {{ sshd_port }}'}
|
||||
- { "key": '^[\#]?TCPKeepAlive', "value": 'TCPKeepAlive no'}
|
||||
- { "key": '^[\#]?X11Forwarding', "value": 'X11Forwarding no'}
|
||||
- { "key": '^[\#]?AllowAgentForwarding', "value": 'AllowAgentForwarding no'}
|
||||
- { "key": '^[\#]?PermitEmptyPasswords', "value": 'PermitEmptyPasswords no'}
|
||||
|
||||
- name: General | Software | Services | SSHD | Configure (PVE)
|
||||
lineinfile:
|
||||
path: "{{ sshd_config }}"
|
||||
regexp: '{{ item.key }}'
|
||||
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
||||
state: present
|
||||
create: yes
|
||||
backup: yes
|
||||
loop:
|
||||
- { "key": '^[\#]?AllowUsers', "value": 'AllowUsers root {{ user }}'}
|
||||
- { "key": '^[\#]?PermitRootLogin', "value": 'PermitRootLogin yes'}
|
||||
- { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 5'}
|
||||
when: "'pve' in ansible_kernel"
|
||||
|
||||
- name: General | Software | Services | SSHD | Enable
|
||||
service:
|
||||
name: "{{ sshd }}"
|
||||
pattern: "{{ sshd_pattern }}"
|
||||
state: reloaded
|
||||
enabled: yes
|
||||
|
||||
|
||||
## JournalCTL ##
|
||||
|
||||
- name: General | Software | Services | JournalCTL | Reduce Log Size
|
||||
shell: journalctl --vacuum-size=100M
|
||||
when: ansible_system == "Linux"
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
## Bluetooth ##
|
||||
# Do people seriously depend on Bluetooth? Plug your devices in, silly!
|
||||
|
||||
- name: General | Software | Services | Bluetooth | Disable
|
||||
service:
|
||||
name: "{{ bluetooth }}"
|
||||
pattern: "{{ bluetooth_pattern }}"
|
||||
state: stopped
|
||||
enabled: no
|
||||
ignore_errors: yes
|
||||
@@ -7,18 +7,15 @@
|
||||
block:
|
||||
|
||||
- name: General | Software | Swap | Check For Swapfile
|
||||
ansible.builtin.stat:
|
||||
stat:
|
||||
path: "{{ swap_file }}"
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: swap_check
|
||||
|
||||
- name: General | Software | Swap | Install Block
|
||||
block:
|
||||
|
||||
- name: General | Software | Swap | Create Swapfile
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- dd if=/dev/zero of={{ swap_file }} bs={{ swap_block }}
|
||||
count={{ swap_count }} status=progress
|
||||
@@ -31,12 +28,12 @@
|
||||
|
||||
# NixOS's swap setup is handled in nixos.yml when ansible.nix is created.
|
||||
- name: General | Software | Swap | Add to FSTAB
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: /etc/fstab
|
||||
regexp: '^[\#]?{{ swap_file }}'
|
||||
line: '{{ swap_file }} none swap sw 0 0'
|
||||
state: present
|
||||
backup: true
|
||||
backup: yes
|
||||
when: ansible_distribution != "NixOS"
|
||||
|
||||
# Only run through this file if the ini has been changed from false.
|
||||
@@ -5,7 +5,7 @@
|
||||
# Variables #
|
||||
|
||||
- name: General | Telegraf | Variables 1/4
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
telegraf_tar: telegraf-1.20.3_linux_amd64.tar.gz
|
||||
telegraf_path: /usr/local/bin
|
||||
telegraf_config_path: /usr/local/etc
|
||||
@@ -13,25 +13,25 @@
|
||||
telegraf_log: "{{ user_ansible.home }}/telegraf.log"
|
||||
|
||||
- name: General | Telegraf | Variables 2/4
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
telegraf_exec: "{{ telegraf_path }}/telegraf"
|
||||
telegraf_config: "{{ telegraf_config_path }}/telegraf.conf"
|
||||
|
||||
- name: General | Telegraf | Variables 3/4
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
telegraf_cmd: "{{ telegraf_exec }} --config {{ telegraf_config }} >> {{ telegraf_log }} 2>&1"
|
||||
|
||||
- name: General | Telegraf | Variables 4/4
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
telegraf_watcher: "killall telegraf; {{ telegraf_cmd }}"
|
||||
|
||||
- name: General | Telegraf | Variables | Linux
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
telegraf_input_temp: "[[inputs.temp]]"
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
- name: General | Telegraf | Variables | FreeBSD
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
telegraf_input_temp: ""
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
@@ -40,14 +40,14 @@
|
||||
#### Dependencies #
|
||||
###
|
||||
###- name: General | Telegraf | Pre-Reqs
|
||||
### ansible.builtin.package:
|
||||
### package:
|
||||
### name: wget
|
||||
### when: ansible_system == "Linux"
|
||||
###
|
||||
#### Install #
|
||||
###
|
||||
###- name: General | Telegraf | Linux | Install
|
||||
### ansible.builtin.shell: "{{ item }}"
|
||||
### shell: "{{ item }}"
|
||||
### args:
|
||||
### chdir: "{{ ansible_env.HOME }}/Downloads/"
|
||||
### loop:
|
||||
@@ -61,22 +61,22 @@
|
||||
### when: ansible_system == "Linux"
|
||||
###
|
||||
###- name: General | Telegraf | FreeBSD | Install 1/2
|
||||
### ansible.builtin.shell: /usr/sbin/pwd_mkdb -p /etc/master.passwd
|
||||
### shell: /usr/sbin/pwd_mkdb -p /etc/master.passwd
|
||||
### when: ansible_system == "FreeBSD"
|
||||
###
|
||||
###- name: General | Telegraf | FreeBSD | Install 2/2
|
||||
### ansible.builtin.package:
|
||||
### package:
|
||||
### name: telegraf
|
||||
### when: ansible_system == "FreeBSD"
|
||||
###
|
||||
#### Configuration #
|
||||
###
|
||||
###- name: General | Telegraf | Config 1/2
|
||||
### ansible.builtin.shell: mv {{ telegraf_config }} ~/TRASH/
|
||||
### ignore_errors: true
|
||||
### shell: mv {{ telegraf_config }} ~/TRASH/
|
||||
### ignore_errors: yes
|
||||
###
|
||||
###- name: General | Telegraf | Config 2/2
|
||||
### ansible.builtin.blockinfile:
|
||||
### blockinfile:
|
||||
### path: "{{ telegraf_config }}"
|
||||
### block: |
|
||||
### [global_tags]
|
||||
@@ -158,19 +158,19 @@
|
||||
###
|
||||
### marker: '# {mark} MANAGED BY ANSIBLE - telegraf.yml'
|
||||
### state: present
|
||||
### create: true
|
||||
### create: yes
|
||||
|
||||
# Run #
|
||||
|
||||
- name: General | Telegraf | Schedule
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: "{{ telegraf_user }}"
|
||||
name: "{{ item.name }}"
|
||||
job: "{{ item.command }}"
|
||||
special_time: "{{ item.freq }}"
|
||||
state: present
|
||||
#disabled: "{{ 'yes' if no_telem else 'no' }}"
|
||||
disabled: true # 2024-01-25, Downsizing again and will not have Graphana.
|
||||
disabled: yes # 2024-01-25, Downsizing again and will not have Graphana.
|
||||
loop:
|
||||
- { "name": "Telegraf Reboot Job" , "freq": "reboot", "command": "{{ telegraf_cmd }}"}
|
||||
- { "name": "Telegraf Keep-Alive Job", "freq": "hourly", "command": "{{ telegraf_watcher }}"}
|
||||
@@ -1,32 +0,0 @@
|
||||
---
|
||||
# 20261002 - Hyperling
|
||||
# Check whether we're connected to the internet and skip certain playbooks if not.
|
||||
|
||||
- name: General | Tests | Internet | Facts 01
|
||||
ansible.builtin.set_fact:
|
||||
internet: true
|
||||
internet_time: 10
|
||||
|
||||
- name: General | Tests | Internet | Check
|
||||
ansible.builtin.wait_for:
|
||||
host: archlinux.org
|
||||
port: 443
|
||||
state: started
|
||||
timeout: "{{ internet_time }}"
|
||||
register: internet_check
|
||||
ignore_errors: true
|
||||
|
||||
- name: General | Tests | Internet | Facts 02
|
||||
ansible.builtin.set_fact:
|
||||
internet: "{{ internet_check is success }}"
|
||||
|
||||
- name: General | Tests | Internet | Message
|
||||
ansible.builtin.debug:
|
||||
msg: "WARNING: Not connected to the Internet, only running for offline playbooks."
|
||||
when: not internet
|
||||
|
||||
- name: General | Tests | Internet | Sleep
|
||||
ansible.builtin.command: "sleep {{ internet_time }}"
|
||||
register: shell_check
|
||||
changed_when: shell_check.rc == 0
|
||||
when: not internet
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
# 20260929 - Hyperling
|
||||
# Ensure an existing run is not active, otherwise bail.
|
||||
|
||||
- name: General | Tests | Existing Run | Facts
|
||||
ansible.builtin.set_fact:
|
||||
lock_file: "/tmp/ansible-playbook.lock"
|
||||
|
||||
- name: General | Tests | Existing Run | Check
|
||||
ansible.builtin.stat:
|
||||
path: "{{ lock_file }}"
|
||||
register: lock_exists
|
||||
|
||||
- name: General | Tests | Existing Run | Exit
|
||||
ansible.builtin.meta: end_play
|
||||
when: lock_exists.stat.exists
|
||||
@@ -1,22 +0,0 @@
|
||||
---
|
||||
# 20260929 - Hyperling
|
||||
# Ensure an existing run is not active, otherwise bail.
|
||||
|
||||
- name: General | Tests | Existing Run | Lock | Create
|
||||
ansible.builtin.shell: "date +'%Y-%m-%d %H:%M:%S' >> {{lock_file }}"
|
||||
|
||||
|
||||
- name: General | Tests | Existing Run | Lock | Create
|
||||
ansible.builtin.file:
|
||||
name: "{{ lock_file }}"
|
||||
mode: '0777'
|
||||
|
||||
- name: General | Tests | Existing Run | Lock | Create | Check
|
||||
ansible.builtin.stat:
|
||||
path: "{{ lock_file }}"
|
||||
register: lock_exists
|
||||
|
||||
- name: General | Tests | Existing Run | Lock | Create | Fail
|
||||
fail:
|
||||
msg: "ERROR: Lock file does not exist."
|
||||
when: not lock_exists.stat.exists
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
# 20260929 - Hyperling
|
||||
# Ensure an existing run is not active, otherwise bail.
|
||||
|
||||
- name: General | Tests | Existing Run | Lock | Remove
|
||||
ansible.builtin.file:
|
||||
name: "{{ lock_file }}"
|
||||
state: absent
|
||||
|
||||
- name: General | Tests | Existing Run | Lock | Remove | Check
|
||||
ansible.builtin.stat:
|
||||
path: "{{ lock_file }}"
|
||||
register: lock_exists
|
||||
|
||||
- name: General | Tests | Existing Run | Lock | Remove | Fail
|
||||
fail:
|
||||
msg: "ERROR: Lock file still exists!"
|
||||
when: lock_exists.stat.exists
|
||||
@@ -2,45 +2,48 @@
|
||||
# Lynis hardness check.
|
||||
|
||||
- name: General | Tests | Lynis | Set Facts
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
lynis_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.{{ lynis_report }}"
|
||||
|
||||
- name: General | Tests | Lynis | Set Facts 2
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
lynis_temp_file: "{{ lynis_file }}.tmp"
|
||||
|
||||
- name: General | Tests | Lynis | Rename Old Install
|
||||
shell: mv "/usr/local/lynis" "/usr/local/src/"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Tests | Lynis | Install
|
||||
ansible.builtin.git:
|
||||
git:
|
||||
repo: https://github.com/CISOfy/lynis
|
||||
dest: "{{ lynis_install_dir }}"
|
||||
clone: true
|
||||
force: true
|
||||
update: true
|
||||
ignore_errors: true
|
||||
clone: yes
|
||||
force: yes
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Tests | Lynis | Ensure Permissions (Looking at you Parrot OS!)
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ lynis_install_dir }}"
|
||||
state: directory
|
||||
mode: '0644'
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
recurse: true
|
||||
recurse: yes
|
||||
|
||||
- name: General | Tests | Lynis | Ensure Permissions 2
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ lynis_install_dir }}/lynis"
|
||||
mode: '0755'
|
||||
|
||||
- name: General | Tests | Lynis | Ensure Folder Permissions
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ lynis_install_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
recurse: false
|
||||
recurse: no
|
||||
|
||||
- name: General | Tests | Lynis | Run System Audit
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "./lynis audit system --no-colors > {{ lynis_temp_file }} 2>&1"
|
||||
- "mv {{ lynis_temp_file }} {{ lynis_file }}"
|
||||
@@ -49,6 +52,6 @@
|
||||
chdir: "{{ lynis_install_dir }}"
|
||||
|
||||
- name: General | Tests | Lynis | Make Report Readable
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ lynis_file }}"
|
||||
mode: '0644'
|
||||
@@ -2,16 +2,16 @@
|
||||
# Nmap port test
|
||||
|
||||
- name: General | Tests | nmap | Set Facts
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nmap_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.{{ nmap_report }}"
|
||||
nmap_separator: "\n*******************************\n"
|
||||
|
||||
- name: General | Tests | nmap | Set Facts 2
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
nmap_temp_file: "{{ nmap_file }}.tmp"
|
||||
|
||||
- name: General | Tests | nmap | Create Report
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "date > {{ nmap_temp_file }}"
|
||||
- "printf '{{ nmap_separator }}' >> {{ nmap_temp_file }}"
|
||||
@@ -25,6 +25,6 @@
|
||||
- "mv {{ nmap_temp_file }} {{ nmap_file }}"
|
||||
|
||||
- name: General | Tests | nmap | Make Viewable
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ nmap_file }}"
|
||||
mode: '0644'
|
||||
@@ -2,37 +2,26 @@
|
||||
# List all the services under the Reports folder.
|
||||
|
||||
- name: General | Tests | Services | Set Facts
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
services_report_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.services.txt"
|
||||
services_enabled_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.services-enabled.txt"
|
||||
services_command: "echo 'Service Manager {{ ansible_service_mgr }} Not Recognized'"
|
||||
|
||||
- name: General | Tests | Services | Set Facts | SystemD
|
||||
ansible.builtin.set_fact:
|
||||
services_command: "systemctl list-unit-files"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: General | Tests | Services | Set Facts | runit
|
||||
ansible.builtin.set_fact:
|
||||
services_command: 'for s in {{ runit_service_dir }}/*; do sv status "$s"; done'
|
||||
when: ansible_service_mgr == "runit"
|
||||
|
||||
- name: General | Tests | Services | Create Main Report
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "date > {{ services_report_file }}"
|
||||
- "echo '\n-= {{ services_command }} =-\n' >> {{ services_report_file }}"
|
||||
- "{{ services_command }} >> {{ services_report_file }}"
|
||||
|
||||
- name: General | Tests | Services | Create Enabled Report
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "date > {{ services_enabled_file }}"
|
||||
- "echo '\n-= Enabled + Sorted =-\n' >> {{ services_enabled_file }}"
|
||||
- "grep 'enabled' {{ services_report_file }} | sort >> {{ services_enabled_file }}"
|
||||
when: ansible_service_mgr == "systemd"
|
||||
|
||||
- name: General | Tests | Services | Make Viewable
|
||||
ansible.builtin.file:
|
||||
file:
|
||||
path: "{{ services_report_file }}"
|
||||
mode: '0644'
|
||||
@@ -1,179 +0,0 @@
|
||||
---
|
||||
|
||||
####### Lock #######
|
||||
|
||||
# Ensure a process is not already running.
|
||||
- name: Main | Lock
|
||||
block:
|
||||
|
||||
- name: Main | Lock | Check
|
||||
ansible.builtin.include_tasks: tasks/general/tests/lock_check.yml
|
||||
|
||||
- name: Main | Lock | Create
|
||||
ansible.builtin.include_tasks: tasks/general/tests/lock_create.yml
|
||||
|
||||
####### Gather #######
|
||||
|
||||
# Load facts for all systems.
|
||||
- name: Main | Gather
|
||||
block:
|
||||
|
||||
- name: Main | Gather | Facts
|
||||
ansible.builtin.include_tasks: facts/general/gather.yml
|
||||
|
||||
- name: Main | Gather | Account Management
|
||||
ansible.builtin.include_tasks: tasks/general/acct_mgmt/provision_config.yml
|
||||
|
||||
- name: Main | Gather | System
|
||||
ansible.builtin.include_tasks: facts/general/system.yml
|
||||
|
||||
- name: Main | Gather | Package
|
||||
ansible.builtin.include_tasks: facts/general/package.yml
|
||||
|
||||
- name: Main | Gather | Service
|
||||
ansible.builtin.include_tasks: facts/general/service.yml
|
||||
|
||||
- name: Main | Gather | User
|
||||
ansible.builtin.include_tasks: facts/general/user.yml
|
||||
|
||||
- name: Main | Gather | Internet Check
|
||||
ansible.builtin.include_tasks: tasks/general/tests/internet_check.yml
|
||||
|
||||
####### Start #######
|
||||
|
||||
- name: Main | Start
|
||||
block:
|
||||
|
||||
- name: Main | Start | Notify
|
||||
ansible.builtin.include_tasks: tasks/general/acct_mgmt/notify.yml
|
||||
vars:
|
||||
notify_message: "Provisioning Started"
|
||||
|
||||
when: workstation
|
||||
|
||||
####### NixOS #######
|
||||
|
||||
# Install the .nix files and do a little data setup.
|
||||
- name: Main | NixOS
|
||||
block:
|
||||
|
||||
- name: Main | NixOS | Config
|
||||
ansible.builtin.include_tasks: tasks/general/software/nixos.yml
|
||||
|
||||
# TBD if we are going to use this many, then just have IF statements
|
||||
# and use blocks within the General area for NixOS vs not-NixOS.
|
||||
- name: Main | NixOS | Swap
|
||||
ansible.builtin.include_tasks: tasks/general/software/swap.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/acct_mgmt/groups.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/acct_mgmt/users.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/acct_mgmt/sudo.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/acct_mgmt/doas.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/scripts/root.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/scripts/user.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/scripts/install.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/cron/ansible.yml
|
||||
|
||||
# psutil does not work in NixOS. Cannot figure out how to fix it. Maybe
|
||||
# time to start looking into home-manager but still not wanting to
|
||||
# maintain two different GNOME setups. HMMMM!
|
||||
- ansible.builtin.include_tasks: tasks/workstation/shared/settings/gnome.yml
|
||||
when: workstation
|
||||
|
||||
# Try including these. Really need to get NixOS working with the rest!
|
||||
#- ansible.builtin.include_tasks: tasks/general/software/telegraf.yml # "Could not find a module for unknown.""
|
||||
- ansible.builtin.include_tasks: tasks/general/tests/services.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/tests/lynis.yml
|
||||
|
||||
- ansible.builtin.include_tasks: tasks/general/tests/nmap.yml
|
||||
|
||||
- name: Main | NixOS | Complete
|
||||
ansible.builtin.meta: end_play
|
||||
|
||||
when: ansible_distribution == "NixOS"
|
||||
|
||||
####### General #######
|
||||
|
||||
# Basic setup for all enabled systems.
|
||||
- name: Main | General
|
||||
block:
|
||||
|
||||
- name: Main | General | Software | runit
|
||||
ansible.builtin.include_tasks: tasks/general/software/runit.yml
|
||||
|
||||
- name: Main | General | Software | Packages
|
||||
ansible.builtin.include_tasks: tasks/general/software/packages.yml
|
||||
when: internet
|
||||
|
||||
- name: Main | General | Software | AUR
|
||||
ansible.builtin.include_tasks: tasks/general/software/aur.yml
|
||||
when: internet and ansible_pkg_mgr == "pacman"
|
||||
|
||||
- name: Main | General | Software | Sendmail
|
||||
ansible.builtin.include_tasks: tasks/general/software/sendmail.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
and internet
|
||||
|
||||
- name: Main | General | Software | Metasploit
|
||||
ansible.builtin.include_tasks: tasks/general/software/metasploit.yml
|
||||
when: internet
|
||||
|
||||
# Gather again in case missing programs have now been installed.
|
||||
- name: Main | General | Facts [Again]
|
||||
ansible.builtin.include_tasks: facts/general/gather.yml
|
||||
|
||||
- name: Main | General | Settings | Swap
|
||||
ansible.builtin.include_tasks: tasks/general/settings/swap.yml
|
||||
|
||||
- name: Main | General | Settings | Services
|
||||
ansible.builtin.include_tasks: tasks/general/settings/services.yml
|
||||
|
||||
- name: Main | General | Settings | Tunnel
|
||||
ansible.builtin.include_tasks: tasks/general/settings/tunnel.yml
|
||||
|
||||
- name: Main | General | Settings | Keyboard
|
||||
ansible.builtin.include_tasks: tasks/general/settings/keyboard.yml
|
||||
|
||||
- name: Main | General | Accounts | Groups
|
||||
ansible.builtin.include_tasks: tasks/general/acct_mgmt/groups.yml
|
||||
|
||||
- name: Main | General | Accounts | Users
|
||||
ansible.builtin.include_tasks: tasks/general/acct_mgmt/users.yml
|
||||
|
||||
- name: Main | General | Accounts | sudo
|
||||
ansible.builtin.include_tasks: tasks/general/acct_mgmt/sudo.yml
|
||||
|
||||
- name: Main | General | Accounts | doas
|
||||
ansible.builtin.include_tasks: tasks/general/acct_mgmt/doas.yml
|
||||
when: internet
|
||||
|
||||
- name: Main | General | Scripts | Root
|
||||
ansible.builtin.include_tasks: tasks/general/scripts/root.yml
|
||||
|
||||
- name: Main | General | Scripts | User
|
||||
ansible.builtin.include_tasks: tasks/general/scripts/user.yml
|
||||
|
||||
- name: Main | General | Scripts | Local
|
||||
ansible.builtin.include_tasks: tasks/general/scripts/install.yml
|
||||
|
||||
- name: Main | General | Scripts | env-shared
|
||||
ansible.builtin.include_tasks: tasks/general/scripts/env-shared.yml
|
||||
when: internet
|
||||
|
||||
- name: Main | General | Cron | Ansible
|
||||
ansible.builtin.include_tasks: tasks/general/cron/ansible.yml
|
||||
|
||||
# TODO Need to refactor. Maybe tasks/general/cron/freebsd.yml
|
||||
- name: Main | General | Cron | Ansible [FreeBSD]
|
||||
ansible.builtin.include_tasks: tasks/workstation/freebsd/cron/ansible.yml
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
when: provision
|
||||
@@ -4,20 +4,20 @@
|
||||
## Gather ##
|
||||
|
||||
- name: Miner | Account Management | Gather | Find Root Directory
|
||||
ansible.builtin.shell: cd ~; pwd
|
||||
shell: cd ~; pwd
|
||||
register: root_home
|
||||
|
||||
|
||||
## Runner ##
|
||||
|
||||
- name: Miner | Account Management | Users | MFN
|
||||
ansible.builtin.user:
|
||||
user:
|
||||
name: mfn
|
||||
comment: Miner Forty Niner
|
||||
system: true
|
||||
groups:
|
||||
system: yes
|
||||
groups:
|
||||
- video
|
||||
- render
|
||||
append: true
|
||||
append: yes
|
||||
shell: "{{ bash_exec.stdout }}"
|
||||
register: user_mfn
|
||||
@@ -4,23 +4,23 @@
|
||||
## Performance ##
|
||||
|
||||
- name: Miner | Account Management | Cron | Ansible | Daily Performance Reboot
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: ansible
|
||||
name: Daily Performance Reboot
|
||||
job: sudo reboot
|
||||
special_time: daily
|
||||
state: present
|
||||
disabled: false
|
||||
disabled: no
|
||||
|
||||
|
||||
## Security ##
|
||||
|
||||
- name: Miner | Account Management | Cron | Ansible | Daily Security Update [apt]
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: ansible
|
||||
name: Daily Security Update
|
||||
job: sudo apt update && sudo apt dist-upgrade -y
|
||||
special_time: reboot
|
||||
state: present
|
||||
disabled: true
|
||||
disabled: yes
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
@@ -4,7 +4,7 @@
|
||||
## Mining ##
|
||||
|
||||
- name: Miner | Account Management | Cron | MFN | Stop Jobs
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: mfn
|
||||
name: "Stop {{ item.name }}"
|
||||
minute: "*/5"
|
||||
@@ -14,7 +14,7 @@
|
||||
loop: "{{ miners }}"
|
||||
|
||||
- name: Miner | Account Management | Cron | MFN | Start Jobs
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: mfn
|
||||
name: "Start {{ item.name }}"
|
||||
job: "{{ item.command }}"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Print out all inventory flags associated to mining.
|
||||
|
||||
- name: Miner | DEBUG | Inventory Variables
|
||||
ansible.builtin.debug:
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
loop:
|
||||
- amdgpu
|
||||
|
||||
@@ -3,55 +3,55 @@
|
||||
|
||||
## Step 0/3: Dependencies ##
|
||||
- name: Miner | Driver | AMDGPU | Variables
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
amdgpu_cron_job: AMDGPU - Need To Finish Installation
|
||||
amdgpu_cron_cmd: "{{ root_home.stdout }}/scm.sh"
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Install Dependencies
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- dkms
|
||||
package:
|
||||
name:
|
||||
- dkms
|
||||
- mesa-common-dev
|
||||
- clinfo
|
||||
state: present
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Set GRUB Timer
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: /etc/default/grub
|
||||
regexp: '^GRUB_TIMEOUT='
|
||||
line: 'GRUB_TIMEOUT=3'
|
||||
state: present
|
||||
backup: true
|
||||
backup: yes
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Remove Previous Run's Cron Job
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: root
|
||||
name: "{{ amdgpu_cron_job }}"
|
||||
state: absent
|
||||
|
||||
# Tests
|
||||
- name: Miner | Driver | AMDGPU | Check If GA Kernel Installed
|
||||
ansible.builtin.shell: 'uname --kernel-release | grep 5.4.0-65-generic'
|
||||
shell: 'uname --kernel-release | grep 5.4.0-65-generic'
|
||||
register: ga_kernel
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Check If HWE Kernel Installed
|
||||
ansible.builtin.shell: 'apt search linux-image-5.8.0-* | grep -c installed'
|
||||
shell: 'apt search linux-image-5.8.0-* | grep -c installed'
|
||||
register: hwe_kernel
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
#- name: Miner | Driver | AMDGPU | Check If All Driver Installed
|
||||
# ansible.builtin.shell: 'which amdgpu-uninstall'
|
||||
# shell: 'which amdgpu-uninstall'
|
||||
# register: amdgpu_install
|
||||
# ignore_errors: true
|
||||
# ignore_errors: yes
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Check If Pro Driver Installed
|
||||
ansible.builtin.shell: 'amdgpu-pro-uninstall -y'
|
||||
shell: 'amdgpu-pro-uninstall -y'
|
||||
register: amdgpu_install
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Miner | Driver | AMDGPU | DEBUG
|
||||
ansible.builtin.debug:
|
||||
debug:
|
||||
var: "{{ item }}"
|
||||
loop:
|
||||
- ga_kernel
|
||||
@@ -62,45 +62,45 @@
|
||||
|
||||
## Step 1/3: Get Correct Kernel ##
|
||||
- name: Miner | Driver | AMDGPU | Install Recommended GA Kernel
|
||||
ansible.builtin.shell: apt install --install-recommends linux-generic
|
||||
shell: apt install --install-recommends linux-generic
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0" and ga_kernel.failed
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Install Specific GA Kernel For Booting
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- linux-headers-5.4.0-65
|
||||
- linux-headers-5.4.0-65-generic
|
||||
- linux-headers-generic
|
||||
- linux-image-generic
|
||||
package:
|
||||
name:
|
||||
- linux-headers-5.4.0-65
|
||||
- linux-headers-5.4.0-65-generic
|
||||
- linux-headers-generic
|
||||
- linux-image-generic
|
||||
- linux-modules-extra-5.4.0-65-generic
|
||||
state: present
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0" and ga_kernel.failed
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Prepare GRUB To Boot GA Kernel
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: /etc/default/grub
|
||||
regexp: '^GRUB_DEFAULT='
|
||||
line: 'GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-65-generic"'
|
||||
state: present
|
||||
backup: true
|
||||
backup: yes
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0" and ga_kernel.failed
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Update GRUB
|
||||
ansible.builtin.shell: update-grub
|
||||
shell: update-grub
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0" and ga_kernel.failed
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Prepare Cron Job To SCM
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: root
|
||||
name: "{{ amdgpu_cron_job }}"
|
||||
special_time: reboot
|
||||
job: "{{ amdgpu_cron_cmd }}"
|
||||
state: present
|
||||
disabled: false
|
||||
disabled: no
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0" and ga_kernel.failed
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Reboot To GA Kernel
|
||||
ansible.builtin.shell: reboot
|
||||
shell: reboot
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0" and ga_kernel.failed
|
||||
|
||||
- pause:
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
## Step 2/3: Remove Incorrect Kernels ##
|
||||
- name: Miner | Driver | AMDGPU | Remove Bad Kernels
|
||||
ansible.builtin.shell: "apt remove --purge linux-generic-hwe-20.04 \
|
||||
shell: "apt remove --purge linux-generic-hwe-20.04 \
|
||||
linux-oem-20.04 \
|
||||
linux-hwe-* \
|
||||
linux-oem-* \
|
||||
@@ -121,36 +121,36 @@
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0"
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Update + Clean System
|
||||
ansible.builtin.shell: "apt update; apt dist-upgrade -y; apt autoremove --purge -y"
|
||||
shell: "apt update; apt dist-upgrade -y; apt autoremove -y"
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0"
|
||||
|
||||
# This is to ensure we can test adding `apt install --install-recommends linux-generic` later
|
||||
# This is to ensure we can test adding `apt install --install-recommends linux-generic` later
|
||||
- name: Miner | Driver | AMDGPU | Boot Default Kernel
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: /etc/default/grub
|
||||
regexp: '^GRUB_DEFAULT='
|
||||
line: 'GRUB_DEFAULT=0'
|
||||
state: present
|
||||
backup: true
|
||||
backup: yes
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0"
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Update GRUB
|
||||
ansible.builtin.shell: update-grub
|
||||
shell: update-grub
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0"
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Prepare Cron Job To SCM
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: root
|
||||
name: "{{ amdgpu_cron_job }}"
|
||||
special_time: reboot
|
||||
job: "{{ amdgpu_cron_cmd }}"
|
||||
state: present
|
||||
disabled: false
|
||||
disabled: no
|
||||
when: amdgpu_install.failed and hwe_kernel.stdout != "0"
|
||||
|
||||
# This reboot may not be necessary.
|
||||
#- name: Miner | Driver | AMDGPU | Reboot To Ensure GA Is 0
|
||||
# ansible.builtin.shell: reboot
|
||||
# shell: reboot
|
||||
# when: amdgpu_install.failed and hwe_kernel.stdout != "0"
|
||||
#
|
||||
#- pause:
|
||||
@@ -161,34 +161,34 @@
|
||||
|
||||
## Step 3/3: Install AMD PRO Driver ##
|
||||
- name: Miner | Driver | AMDGPU | Download Driver
|
||||
ansible.builtin.shell: 'scp {{ user }}@leet:InstallFiles/Drivers/amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz {{ root_home.stdout }}/Downloads/'
|
||||
shell: 'scp {{ user }}@leet:InstallFiles/Drivers/amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz {{ root_home.stdout }}/Downloads/'
|
||||
when: amdgpu_install.failed or "1" == "1"
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Extract Tarball
|
||||
ansible.builtin.shell: 'cd {{ root_home.stdout }}/Downloads; tar -xvf amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz'
|
||||
shell: 'cd {{ root_home.stdout }}/Downloads; tar -xvf amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz'
|
||||
when: amdgpu_install.failed or "1" == "1"
|
||||
|
||||
## Only one driver set can exist at a time! ##
|
||||
#- name: Miner | Driver | AMDGPU | Install AMDGPU All Driver
|
||||
# ansible.builtin.shell: 'cd {{ root_home.stdout }}/Downloads/amdgpu-pro-20.45-1188099-ubuntu-20.04; ./amdgpu-install -y'
|
||||
# shell: 'cd {{ root_home.stdout }}/Downloads/amdgpu-pro-20.45-1188099-ubuntu-20.04; ./amdgpu-install -y'
|
||||
# when: amdgpu_install.failed
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Install AMDGPU-Pro Driver
|
||||
ansible.builtin.shell: 'cd {{ root_home.stdout }}/Downloads/amdgpu-pro-20.45-1188099-ubuntu-20.04; ./amdgpu-pro-install -y --opencl=pal,legacy'
|
||||
shell: 'cd {{ root_home.stdout }}/Downloads/amdgpu-pro-20.45-1188099-ubuntu-20.04; ./amdgpu-pro-install -y --opencl=pal,legacy'
|
||||
when: amdgpu_install.failed or "1" == "1"
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Prepare Cron Job To SCM
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: root
|
||||
name: "{{ amdgpu_cron_job }}"
|
||||
special_time: reboot
|
||||
job: "{{ amdgpu_cron_cmd }}"
|
||||
state: present
|
||||
disabled: false
|
||||
disabled: no
|
||||
when: amdgpu_install.failed
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Reboot To GA Kernel
|
||||
ansible.builtin.shell: reboot
|
||||
shell: reboot
|
||||
when: amdgpu_install.failed
|
||||
|
||||
- pause:
|
||||
@@ -199,10 +199,10 @@
|
||||
|
||||
## We're done! ##
|
||||
- name: Miner | Driver | AMDGPU | Test Driver
|
||||
ansible.builtin.shell: clinfo -l
|
||||
shell: clinfo -l
|
||||
register: clinfo
|
||||
|
||||
- name: Miner | Driver | AMDGPU | Test Results
|
||||
ansible.builtin.debug:
|
||||
debug:
|
||||
var: clinfo
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
@@ -3,86 +3,86 @@
|
||||
|
||||
## Dependencies ##
|
||||
- name: Miner | Software | Ethminer | Install Dependencies
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- build-essential
|
||||
- dkms
|
||||
- cmake
|
||||
- perl
|
||||
- libdbus-1-dev
|
||||
package:
|
||||
name:
|
||||
- build-essential
|
||||
- dkms
|
||||
- cmake
|
||||
- perl
|
||||
- libdbus-1-dev
|
||||
- mesa-common-dev
|
||||
state: present
|
||||
|
||||
- name: Miner | Software | Ethminer | Add PPA
|
||||
apt_repository:
|
||||
apt_repository:
|
||||
repo: ppa:ethereum/ethereum
|
||||
update_cache: true
|
||||
update_cache: yes
|
||||
state: present
|
||||
|
||||
- name: Miner | Software | Ethminer | Install Ethereum
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name: ethereum
|
||||
state: present
|
||||
|
||||
|
||||
## Test ##
|
||||
- name: Miner | Software | Ethminer | Test If Installed
|
||||
ansible.builtin.shell: "which ethminer"
|
||||
shell: "which ethminer"
|
||||
register: ethminer_install
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
## Download ##
|
||||
- name: Miner | Software | Ethminer | Remove Git Repo
|
||||
ansible.builtin.shell: rm -rf ethminer
|
||||
shell: rm -rf ethminer
|
||||
args:
|
||||
chdir: "{{ root_home.stdout }}/Downloads"
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
when: ethminer_install.failed
|
||||
|
||||
- name: Miner | Software | Ethminer | Clone Git Repo
|
||||
ansible.builtin.shell: git clone https://github.com/ethereum-mining/ethminer.git
|
||||
shell: git clone https://github.com/ethereum-mining/ethminer.git
|
||||
args:
|
||||
chdir: "{{ root_home.stdout }}/Downloads"
|
||||
when: ethminer_install.failed
|
||||
|
||||
- name: Miner | Software | Ethminer | Update Repo's Repos
|
||||
ansible.builtin.shell: git submodule update --init --recursive
|
||||
shell: git submodule update --init --recursive
|
||||
args:
|
||||
chdir: "{{ root_home.stdout }}/Downloads/ethminer"
|
||||
when: ethminer_install.failed
|
||||
|
||||
- name: Miner | Software | Ethminer | Create Build Folder
|
||||
ansible.builtin.shell: mkdir -p build
|
||||
shell: mkdir -p build
|
||||
args:
|
||||
chdir: "{{ root_home.stdout }}/Downloads/ethminer"
|
||||
when: ethminer_install.failed
|
||||
|
||||
- name: Miner | Software | Ethminer | Default Flags
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
opencl_flag: "OFF"
|
||||
cuda_flag: "OFF"
|
||||
dbus_flag: "OFF"
|
||||
sys_opencl_flag: "ON"
|
||||
|
||||
- name: Miner | Software | Ethminer | Determine OPENCL Flag
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
opencl_flag: "ON"
|
||||
sys_opencl_flag: "OFF"
|
||||
when: amdgpu
|
||||
when: amdgpu == true
|
||||
|
||||
- name: Miner | Software | Ethminer | Determine CUDA Flag
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
cuda_flag: "ON"
|
||||
when: nvidia
|
||||
when: nvidia == true
|
||||
|
||||
- name: Miner | Software | Ethminer | Determine DBUS Flag
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
dbus_flag: "ON"
|
||||
when: ansible_distribution == "Pop!_OS"
|
||||
|
||||
- name: Miner | Software | Ethminer | cmake Flags
|
||||
ansible.builtin.shell: "cmake .. -DETHASHCL={{ opencl_flag }} \
|
||||
shell: "cmake .. -DETHASHCL={{ opencl_flag }} \
|
||||
-DETHASHCUDA={{ cuda_flag }} \
|
||||
-DAPICORE=ON \
|
||||
-DBINKERN=ON \
|
||||
@@ -94,13 +94,13 @@
|
||||
when: ethminer_install.failed
|
||||
|
||||
- name: Miner | Software | Ethminer | cmake Build
|
||||
ansible.builtin.shell: cmake --build .
|
||||
shell: cmake --build .
|
||||
args:
|
||||
chdir: "{{ root_home.stdout }}/Downloads/ethminer/build"
|
||||
when: ethminer_install.failed
|
||||
|
||||
- name: Miner | Software | Ethminer | make install
|
||||
ansible.builtin.shell: make install
|
||||
shell: make install
|
||||
args:
|
||||
chdir: "{{ root_home.stdout }}/Downloads/ethminer/build"
|
||||
when: ethminer_install.failed
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
## Personal Script Setup ##
|
||||
- name: Miner | Software | Ethminer | Script
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- "scp {{ user }}@leet:InstallFiles/Miners/ethminer/ethminer.sh {{ user_mfn.home }}/"
|
||||
- "chmod 755 {{ user_mfn.home }}/ethminer.sh"
|
||||
|
||||
@@ -6,18 +6,16 @@
|
||||
## Installation ##
|
||||
|
||||
- name: Miner | Software | Nanominer | Installation | Create Home
|
||||
ansible.builtin.shell: "mkdir -p {{ nanominer_home }}"
|
||||
become: true
|
||||
shell: "mkdir -p {{ nanominer_home }}"
|
||||
become_user: mfn
|
||||
|
||||
- name: Miner | Software | Nanominer | Installation | Download Tarball
|
||||
ansible.builtin.shell: "scp {{ file_server }}:{{ nanominer_tar_remote }} {{ nanominer_tar_local }}; chown mfn {{ nanominer_tar_local }}"
|
||||
shell: "scp {{ file_server }}:{{ nanominer_tar_remote }} {{ nanominer_tar_local }}; chown mfn {{ nanominer_tar_local }}"
|
||||
|
||||
- name: Miner | Software | Nanominer | Installation | Extract Tarball
|
||||
ansible.builtin.shell: "tar -xvf {{ nanominer_tar_local }}"
|
||||
shell: "tar -xvf {{ nanominer_tar_local }}"
|
||||
args:
|
||||
chdir: "{{ nanominer_home }}"
|
||||
become: true
|
||||
become_user: mfn
|
||||
|
||||
|
||||
@@ -27,13 +25,13 @@
|
||||
# Delete Old Config #
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | Reset
|
||||
ansible.builtin.shell: "mv {{ nanominer_config }} ~/TRASH/"
|
||||
ignore_errors: true
|
||||
shell: "mv {{ nanominer_config }} ~/TRASH/"
|
||||
ignore_errors: yes
|
||||
|
||||
# CPU #
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | CPU | Header Info
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ nanominer_config }}"
|
||||
block: |
|
||||
[{{ item.algorithm }}]
|
||||
@@ -50,38 +48,35 @@
|
||||
marker_begin: ';;;;;;;;;;;; BEGIN'
|
||||
marker_end: ' END'
|
||||
state: "{{ item.state }}"
|
||||
create: true
|
||||
create: yes
|
||||
loop:
|
||||
- { "algorithm": "RandomX", "wallet": '{{ wallet_xmr }}', "state": "{{ (nanominer_cpu == 'xmr') | ternary('present', 'absent') }}"}
|
||||
become: true
|
||||
become_user: mfn
|
||||
when: nanominer_cpu != false
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | CPU | Add Pools
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: "{{ nanominer_config }}"
|
||||
line: "pool{{item.priority}} = {{ item.name }}"
|
||||
state: present
|
||||
create: false
|
||||
create: no
|
||||
loop: "{{ cpu_pool }}"
|
||||
become: true
|
||||
become_user: mfn
|
||||
when: nanominer_cpu != false
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | CPU | End Section
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: "{{ nanominer_config }}"
|
||||
line: ";;;;;;;;;;;;; END CPU"
|
||||
state: present
|
||||
create: false
|
||||
become: true
|
||||
create: no
|
||||
become_user: mfn
|
||||
when: nanominer_cpu != false
|
||||
|
||||
# Add Spacing #
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | Spacing
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ nanominer_config }}"
|
||||
block: |
|
||||
;
|
||||
@@ -89,15 +84,14 @@
|
||||
;
|
||||
marker: ';'
|
||||
state: present
|
||||
create: false
|
||||
become: true
|
||||
create: no
|
||||
become_user: mfn
|
||||
when: nanominer_config is file
|
||||
|
||||
# GPU #
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | GPU | Header Info
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ nanominer_config }}"
|
||||
block: |
|
||||
[{{ item.algorithm }}]
|
||||
@@ -119,31 +113,28 @@
|
||||
marker_begin: ';;;;;;;;;;;; BEGIN'
|
||||
marker_end: ' END'
|
||||
state: "{{ item.state }}"
|
||||
create: true
|
||||
create: yes
|
||||
loop:
|
||||
- { "algorithm": "Ethash", "wallet": '{{ wallet_eth }}', "state": "{{ (nanominer_gpu == 'eth') | ternary('present', 'absent') }}"}
|
||||
become: true
|
||||
become_user: mfn
|
||||
when: nanominer_gpu != false
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | GPU | Add Pools
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: "{{ nanominer_config }}"
|
||||
line: "pool{{item.priority}} = {{ item.name }}"
|
||||
state: present
|
||||
create: false
|
||||
create: no
|
||||
loop: "{{ gpu_pool }}"
|
||||
become: true
|
||||
become_user: mfn
|
||||
when: nanominer_gpu != false
|
||||
|
||||
- name: Miner | Software | Nanominer | Configuration | GPU | End Section
|
||||
ansible.builtin.lineinfile:
|
||||
lineinfile:
|
||||
path: "{{ nanominer_config }}"
|
||||
line: ";;;;;;;;;;;;; END GPU"
|
||||
state: present
|
||||
create: false
|
||||
become: true
|
||||
create: no
|
||||
become_user: mfn
|
||||
when: nanominer_gpu != false
|
||||
|
||||
@@ -152,15 +143,15 @@
|
||||
## Executable ##
|
||||
|
||||
- name: Miner | Software | Nanominer | Executable | Reset
|
||||
ansible.builtin.shell: "mv {{ nanominer_script }} ~/TRASH/"
|
||||
ignore_errors: true
|
||||
shell: "mv {{ nanominer_script }} ~/TRASH/"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Miner | Software | Nanominer | Executable | Create
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ nanominer_script }}"
|
||||
block: |
|
||||
# 2021-02-15 - Automate nanominer script creation.
|
||||
|
||||
|
||||
date
|
||||
whoami
|
||||
pwd
|
||||
@@ -173,8 +164,7 @@
|
||||
marker_begin: "#!{{ bash_exec.stdout }} -x"
|
||||
marker_end: "exit 0"
|
||||
state: present
|
||||
create: true
|
||||
become: true
|
||||
create: yes
|
||||
become_user: mfn
|
||||
|
||||
|
||||
@@ -182,7 +172,7 @@
|
||||
## Permissions ##
|
||||
|
||||
- name: Miner | Software | Nanominer | Permissions
|
||||
ansible.builtin.shell: "chown -R mfn {{ user_mfn.home }}/nanominer*; chmod -R 755 {{ user_mfn.home }}/nanominer*"
|
||||
shell: "chown -R mfn {{ user_mfn.home }}/nanominer*; chmod -R 755 {{ user_mfn.home }}/nanominer*"
|
||||
|
||||
|
||||
|
||||
@@ -192,7 +182,6 @@
|
||||
# It should kill the miner if a user logs into an X session, such as if I'm gaming.
|
||||
# Then once I log out the job should come back within the minute.
|
||||
- name: Miner | Software | Nanominer | Reload
|
||||
ansible.builtin.shell: "killall {{ nanominer_script }}; killall {{ nanominer_exec }}; killall nanominer.sh; killall nanominer"
|
||||
become: true
|
||||
shell: "killall {{ nanominer_script }}; killall {{ nanominer_exec }}; killall nanominer.sh; killall nanominer"
|
||||
become_user: mfn
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
@@ -2,5 +2,5 @@
|
||||
# Mine monero with CPUs!
|
||||
|
||||
- name: Miner | Software | XMR-Stak-CPU
|
||||
ansible.builtin.shell: exit 0
|
||||
shell: exit 0
|
||||
when: '"1" == "0"'
|
||||
@@ -2,15 +2,15 @@
|
||||
# Ensure certbot renews certs on time.
|
||||
|
||||
- name: Server | Cron | Certbot | Find Executable
|
||||
ansible.builtin.shell: which certbot
|
||||
shell: which certbot
|
||||
register: certbot
|
||||
|
||||
- name: Server | Cron | Certbot | Monthly Renewal
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: root
|
||||
name: Monthly Renewal
|
||||
job: "{{ certbot.stdout }} renew"
|
||||
special_time: weekly
|
||||
state: present
|
||||
disabled: false
|
||||
when: certbot and certbot.stdout is defined
|
||||
disabled: no
|
||||
when: certbot == true and certbot.stdout is defined
|
||||
@@ -5,8 +5,8 @@
|
||||
## Pre-reqs ##
|
||||
|
||||
- name: Server | Grafana | Pre-Requirements | Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
package:
|
||||
name:
|
||||
- apt-transport-https
|
||||
- software-properties-common
|
||||
- wget
|
||||
@@ -16,22 +16,22 @@
|
||||
## Install ##
|
||||
|
||||
- name: Server | Grafana | Install | Add Repo
|
||||
ansible.builtin.shell: '{{ item }}'
|
||||
shell: '{{ item }}'
|
||||
loop:
|
||||
- wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
|
||||
- echo "deb https://packages.grafana.com/oss/deb stable main" | tee /etc/apt/sources.list.d/grafana.list
|
||||
- apt update
|
||||
|
||||
- name: Server | Grafana | Install | Main
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
package:
|
||||
name:
|
||||
- grafana
|
||||
state: present
|
||||
|
||||
## Configure ##
|
||||
|
||||
- name: Server | Grafana | Configure
|
||||
ansible.builtin.shell: '{{ item }}'
|
||||
shell: '{{ item }}'
|
||||
loop:
|
||||
- systemctl daemon-reload
|
||||
- systemctl enable grafana-server
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
# Install HUGO to host sites like parrotsec.org
|
||||
|
||||
- name: Server | Software | HUGO | Variables (apt)
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
hugo_package: hugo
|
||||
when: ansible_pkg_mgr == "apt"
|
||||
|
||||
- name: Server | Software | HUGO | Variables (FreeBSD)
|
||||
ansible.builtin.set_fact:
|
||||
set_fact:
|
||||
hugo_package: gohugo
|
||||
when: ansible_system == "FreeBSD"
|
||||
|
||||
|
||||
- name: Server | Software | HUGO | Variables (FreeBSD)
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name: "{{ hugo_package }}"
|
||||
state: present
|
||||
@@ -3,12 +3,12 @@
|
||||
# https://docs.influxdata.com/influxdb/v1.8/introduction/get-started/
|
||||
|
||||
- name: Server | InfluxDB1 | Check
|
||||
ansible.builtin.shell: which influxd
|
||||
shell: which influxd
|
||||
register: influxdb_check
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Server | InfluxDB1 | Install
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/Downloads/"
|
||||
loop:
|
||||
@@ -20,7 +20,7 @@
|
||||
when: influxdb_check.failed
|
||||
|
||||
- name: Server | InfluxDB1 | Config
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- influx -execute "create database main"
|
||||
- influx -execute "show databases"
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
# https://docs.influxdata.com/influxdb/v2.0/get-started/?t=Linux
|
||||
|
||||
- name: Server | InfluxDB2 | Check
|
||||
ansible.builtin.shell: which influxd
|
||||
shell: which influxd
|
||||
register: influxdb_check
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Server | InfluxDB2 | Install
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/Downloads/"
|
||||
loop:
|
||||
@@ -20,6 +20,6 @@
|
||||
when: influxdb_check.failed
|
||||
|
||||
- name: Server | InfluxDB2 | Config
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
shell: "{{ item }}"
|
||||
loop:
|
||||
- influx setup -f -u {{ user }} -p initpassword -o Hyperling -b main -r 0
|
||||
@@ -4,8 +4,8 @@
|
||||
## Pre-Reqs ##
|
||||
|
||||
- name: Server | OnlyOffice | Pre-Requirements | Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
package:
|
||||
name:
|
||||
- gnupg
|
||||
- python3-certbot-nginx
|
||||
state: present
|
||||
@@ -17,37 +17,36 @@
|
||||
# Dependencies #
|
||||
|
||||
- name: Server | OnlyOffice | Postgres | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name: postgresql
|
||||
state: present
|
||||
|
||||
- name: Server | OnlyOffice | Postgres | Configure
|
||||
ansible.builtin.shell: '{{ item }}'
|
||||
shell: '{{ item }}'
|
||||
loop:
|
||||
- psql -c "CREATE DATABASE onlyoffice;"
|
||||
- psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
|
||||
- psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
|
||||
become: true
|
||||
become_user: postgres
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Server | OnlyOffice | RabbitMQ | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name: rabbitmq-server
|
||||
state: present
|
||||
|
||||
# Actual Program #
|
||||
|
||||
- name: Server | OnlyOffice | Docs | Add Repo
|
||||
ansible.builtin.shell: '{{ item }}'
|
||||
shell: '{{ item }}'
|
||||
loop:
|
||||
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
||||
- echo "deb https://download.onlyoffice.com/repo/debian squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list
|
||||
- apt update
|
||||
|
||||
- name: Server | OnlyOffice | Docs | Install
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
package:
|
||||
name:
|
||||
- ttf-mscorefonts-installer
|
||||
- onlyoffice-documentserver
|
||||
state: present
|
||||
@@ -60,32 +59,32 @@
|
||||
# Certs #
|
||||
|
||||
#- name: Server | OnlyOffice | HTTPS | Check For Cert
|
||||
# ansible.builtin.shell: "ls -l /etc/letsencrypt/live/{{ ansible_hostname }}.{{ domain }}/{fullchain,privkey}.pem"
|
||||
# shell: "ls -l /etc/letsencrypt/live/{{ ansible_hostname }}.{{ domain }}/{fullchain,privkey}.pem"
|
||||
# register: onlyoffice_cert
|
||||
# ignore_errors: true
|
||||
# ignore_errors: yes
|
||||
#
|
||||
#- name: Server | OnlyOffice | HTTPS | Create Cert
|
||||
# ansible.builtin.shell: "certbot --nginx -d {{ ansible_hostname }}.{{ domain }}"
|
||||
# shell: "certbot --nginx -d {{ ansible_hostname }}.{{ domain }}"
|
||||
# when: onlyoffice_cert.failed
|
||||
|
||||
# Config #
|
||||
|
||||
#- name: Server | OnlyOffice | HTTPS | Check For Config
|
||||
# ansible.builtin.shell: ls -l /etc/onlyoffice/documentserver/nginx/ds.conf
|
||||
# shell: ls -l /etc/onlyoffice/documentserver/nginx/ds.conf
|
||||
# register: onlyoffice_cert
|
||||
#
|
||||
#- name: Server | OnlyOffice | HTTPS | Create Config
|
||||
# ansible.builtin.shell: cp -f /etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl /etc/onlyoffice/documentserver/nginx/ds.conf
|
||||
# shell: cp -f /etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl /etc/onlyoffice/documentserver/nginx/ds.conf
|
||||
# when: onlyoffice_cert.failed
|
||||
#
|
||||
#- name: Server | OnlyOffice | HTTPS | Modify Config
|
||||
# ansible.builtin.lineinfile:
|
||||
# lineinfile:
|
||||
# path: /etc/onlyoffice/documentserver/nginx/ds.conf
|
||||
# regexp: '{{ item.regexp }}'
|
||||
# line: '{{ item.line }}; # MANAGED BY ANSIBLE'
|
||||
# state: present
|
||||
# create: false
|
||||
# backup: true
|
||||
# create: no
|
||||
# backup: yes
|
||||
# loop:
|
||||
# - { "regexp": "ssl_certificate ", "line": " ssl_certificate /etc/letsencrypt/live/{{ ansible_hostname }}.{{ domain }}/fullchain.pem" }
|
||||
# - { "regexp": "ssl_certificate_key ", "line": " ssl_certificate_key /etc/letsencrypt/live/{{ ansible_hostname }}.{{ domain }}/privkey.pem" }
|
||||
@@ -93,7 +92,7 @@
|
||||
# Services #
|
||||
|
||||
- name: Server | OnlyOffice | HTTPS | Reload nginx
|
||||
ansible.builtin.service:
|
||||
service:
|
||||
name: nginx
|
||||
status: reloaded
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
@@ -4,17 +4,17 @@
|
||||
## ACPID ##
|
||||
|
||||
- name: Server | Software | Services | ACPID | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name: "{{ acpi }}"
|
||||
state: present
|
||||
when: ansible_system == "Linux"
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Server | Software | Services | ACPID | Enable
|
||||
ansible.builtin.service:
|
||||
service:
|
||||
name: "{{ acpi }}"
|
||||
pattern: "{{ acpi_pattern }}"
|
||||
state: started
|
||||
enabled: true
|
||||
enabled: yes
|
||||
when: ansible_system == "Linux"
|
||||
ignore_errors: true
|
||||
ignore_errors: yes
|
||||
@@ -2,10 +2,10 @@
|
||||
# Cron jobs specific to FreeBSD
|
||||
|
||||
- name: General | Cron | Ansible | FreeBSD | Enable Security Update
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: ansible
|
||||
name: "Security Update"
|
||||
special_time: weekly
|
||||
job: "sudo freebsd-update cron -t me@hyperling.com"
|
||||
state: present
|
||||
disabled: false
|
||||
disabled: no
|
||||
@@ -2,7 +2,7 @@
|
||||
# Provide FreeBSD with a DE.
|
||||
|
||||
- name: Workstation | FreeBSD | Software | GUI | Install UI Components
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- xorg
|
||||
- gnome3-lite
|
||||
@@ -16,7 +16,7 @@
|
||||
state: present
|
||||
|
||||
- name: Workstation | FreeBSD | Software | GUI | Create rc.conf Entries
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ rc_conf }}"
|
||||
marker: "# {mark} MANAGED BY ANSIBLE | GNOME Components"
|
||||
block: |
|
||||
@@ -25,19 +25,19 @@
|
||||
gnome_enable="YES"
|
||||
#gdm_enable="YES"
|
||||
lightdm_enable="YES"
|
||||
create: true
|
||||
backup: true
|
||||
create: yes
|
||||
backup: yes
|
||||
|
||||
- name: Workstation | FreeBSD | Software | GUI | Create fstab Entries
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: /etc/fstab
|
||||
block: |
|
||||
proc /proc procfs rw 0 0
|
||||
marker: '# {mark} MANAGED BY ANSIBLE | GNOME Components'
|
||||
state: present
|
||||
backup: true
|
||||
backup: yes
|
||||
|
||||
- name: Workstation | FreeBSD | Software | GUI | Mount All
|
||||
ansible.builtin.shell: mount -a
|
||||
shell: mount -a
|
||||
args:
|
||||
warn: false
|
||||
@@ -2,16 +2,16 @@
|
||||
# Provide FreeBSD with GPU driver.
|
||||
|
||||
- name: Workstation | FreeBSD | Software | GPU Driver | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- drm-kmod
|
||||
state: present
|
||||
|
||||
- name: Workstation | FreeBSD | Software | GPU Driver | Create rc.conf Entries
|
||||
ansible.builtin.blockinfile:
|
||||
blockinfile:
|
||||
path: "{{ rc_conf }}"
|
||||
marker: "# {mark} MANAGED BY ANSIBLE | GPU Components"
|
||||
block: |
|
||||
kld_list="{{ freebsd_gpu }}"
|
||||
create: true
|
||||
backup: true
|
||||
create: yes
|
||||
backup: yes
|
||||
@@ -4,7 +4,7 @@
|
||||
# General #
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | General | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- "{{ firefox_esr }}"
|
||||
- "{{ evolution }}"
|
||||
@@ -13,7 +13,7 @@
|
||||
state: present
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | General | Uninstall Bloat
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- "{{ firefox }}"
|
||||
- "{{ thunderbird }}"
|
||||
@@ -22,53 +22,53 @@
|
||||
# Coding #
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | Coding | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- vscode
|
||||
state: present
|
||||
when: coding
|
||||
when: coding == true
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | Coding | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- vscode
|
||||
state: absent
|
||||
when: not coding
|
||||
when: not coding == true
|
||||
|
||||
# Media Editors #
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | Editing | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- gimp
|
||||
- shotcut
|
||||
- obs-studio
|
||||
state: present
|
||||
when: editing in (true, "video")
|
||||
when: editing == true
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | Editing | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- gimp
|
||||
- shotcut
|
||||
- obs-studio
|
||||
state: absent
|
||||
when: not editing in (true, "video")
|
||||
when: not editing == true
|
||||
|
||||
# Gaming #
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | Gaming | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- 0ad
|
||||
- supertuxkart
|
||||
state: present
|
||||
when: gaming
|
||||
when: gaming == true
|
||||
|
||||
- name: Workstation | FreeBSD | Software | Packages | Gaming | Install
|
||||
ansible.builtin.package:
|
||||
package:
|
||||
name:
|
||||
- 0ad
|
||||
- supertuxkart
|
||||
state: absent
|
||||
when: not gaming
|
||||
when: not gaming == true
|
||||
@@ -2,21 +2,21 @@
|
||||
# Cron jobs specific to Linux
|
||||
|
||||
- name: General | Cron | Ansible | Linux | Update System Flatpaks
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: ansible
|
||||
name: "Update System Flatpaks"
|
||||
special_time: hourly
|
||||
job: "sudo flatpak update --noninteractive"
|
||||
state: present
|
||||
disabled: true # "{{ 'yes' if battery else 'no' }}"
|
||||
disabled: "{{ 'yes' if battery else 'no' }}"
|
||||
when: flatpak_distro
|
||||
|
||||
- name: General | Cron | Ansible | Linux | Update User Flatpaks
|
||||
ansible.builtin.cron:
|
||||
cron:
|
||||
user: ansible
|
||||
name: "Update User Flatpaks"
|
||||
special_time: hourly
|
||||
job: "sudo -u {{ user }} flatpak update --noninteractive"
|
||||
state: present
|
||||
disabled: true # "{{ 'yes' if battery else 'no' }}"
|
||||
disabled: "{{ 'yes' if battery else 'no' }}"
|
||||
when: flatpak_distro
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user