13 Commits

7 changed files with 101 additions and 73 deletions
+6
View File
@@ -14,9 +14,11 @@
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
- name: General | Facts | Package | Parrot OS Fixes
set_fact:
@@ -44,6 +46,7 @@
cron: cronie
encfs: encfs
dig: bind
base_devel: base-devel
when: ansible_pkg_mgr == "pacman"
- name: General | Facts | Package | FreeBSD
@@ -72,6 +75,8 @@
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
@@ -82,6 +87,7 @@
microcode_intel: ucode-intel
cron: cronie
encfs: encfs
dig: bind-utils
when: ansible_pkg_mgr == "zypper"
+1 -1
View File
@@ -21,7 +21,7 @@
set_fact:
crond: cronie
crond_pattern: cronie
when: ansible_distribution in ("Archlinux")
when: ansible_pkg_mgr == "pacman"
- name: General | Facts | Service | Fedora
set_fact:
-2
View File
@@ -27,7 +27,6 @@
sassc: sassc
ffmpeg: ffmpeg
wireless_tools: wireless-tools
base_devel: htop # Placeholder for Arch package.
macbook_wifi_driver: broadcom-sta-dkms
xz: xz
mesa: mesa
@@ -105,7 +104,6 @@
- name: Workstation | Facts | Package | pacman (All Distros)
set_fact:
base_devel: base-devel
macbook_wifi_driver: broadcom-wl-dkms
android_jdk: jdk-openjdk
android_fastboot: android-tools
+37 -22
View File
@@ -7,12 +7,23 @@ DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
LOCAL=$DIR/local.yml
URL="https://git.hyperling.com/me/env-ansible"
BRANCH="main"
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=""
## Functions ##
@@ -45,10 +56,10 @@ while getopts ":lb:gwsfh" arg; do
case $arg in
l) local="Y" && echo "Running $LOCAL as the playbook." ;;
b) branch="$OPTARG" && echo "Using branch $branch instead of $BRANCH." ;;
g) create_general="Y" && echo "Requested '$general_config'." ;;
w) create_workstation="Y" && echo "Requested '$workstation_config'." ;;
s) create_server="Y" && echo "Requested '$server_config'." ;;
f) show_facts="Y" ;;
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
@@ -60,9 +71,13 @@ if [[ ! -z $1 && $1 != "-"* ]]; then
usage 1
fi
if [[ -z "$local" && "$branch" == "" ]]; then
echo "Using default branch $BRANCH."
if [[ "$branch" == "" ]]; then
branch="$BRANCH"
if [[ -z "$local" ]]; then
echo "Running against default branch '$branch'."
else
echo "Set branch to '$branch'."
fi
fi
if [[ -n "$create_general" && -f "$general_config" ]]; then
@@ -92,41 +107,41 @@ 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
sudo mkdir -p /usr/local/etc/ansible
sudo sh -c 'echo "localhost ansible_connection=local" > /usr/local/etc/ansible/hosts'
HOSTS_DIR="$FREEBSD_HOSTS_DIR"
HOSTS_FILE="$FREEBSD_HOSTS_FILE"
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 detected."
echo -e "ERROR: OS not recognized."
echo -e "$os"
exit 1
fi
fi
echo "Installed!"
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 "Hosts file created successfully!"
fi
if [[ "$show_facts" == "Y" ]]; then
echo "Showing Ansible Facts"
ansible localhost -m setup --connection=local
+14 -5
View File
@@ -16,12 +16,12 @@
backup: yes
create: no
state: present
when: ansible_distribution == "Archlinux"
when: ansible_pkg_mgr == "pacman"
#- name: General | Account Management | Users | Use ZSH (Arch+Manjaro)
# set_fact:
# user_shell: "{{ zsh_exec.stdout }}"
# when: ansible_distribution == "Archlinux"
# when: ansible_pkg_mgr == "pacman"
#
#- name: General | Account Management | Users | Allow ZSH (Arch)
# lineinfile:
@@ -32,7 +32,7 @@
# backup: yes
# create: no
# state: present
# when: ansible_distribution == "Archlinux"
# when: ansible_pkg_mgr == "pacman"
## Root ##
@@ -128,8 +128,17 @@
export_path_sbin: export PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
#export_terminal: export TERMINAL="alacritty" # colors look weird.
export_terminal: export TERMINAL="kitty"
export_browser: export BROWSER="`which firefox || which firefox-esr || which firefox-flatpak`"
keyboard_settings: setxkbmap -layout us -variant altgr-intl
export_browser: |
function find-firefox {
which firefox 2>/dev/null ||
which firefox-esr 2>/dev/null ||
which firefox-flatpak 2>/dev/null
}
export BROWSER="`find-firefox`"
keyboard_settings: |
if [[ -n "$XDG_SESSION_ID" ]]; then
setxkbmap -layout us -variant altgr-intl
fi
- name: General | Account Management | Users | Files | RC Variables
set_fact:
+43 -42
View File
@@ -40,37 +40,38 @@
- name: General | Software | Packages | Install Software
package:
name:
- bash
- sudo
- nmap
- "{{ neofetch }}"
- "{{ sshfs }}"
- "{{ locate }}"
- zsh
- "{{ opensshd }}"
- "{{ tar }}"
- curl
- at
- gcc
- vim
- "{{ cron }}"
- "{{ encfs }}"
- rsync
- "{{ iftop }}"
- "{{ nethogs }}"
- "{{ ntp_server }}"
- "{{ dig }}"
- "{{ tmux }}"
- "{{ sendmail }}"
- "{{ sendmail_mta }}"
- "{{ ca_certificates }}"
- 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 }}"
state: present
- name: General | Software | Packages | Install Software (DEV)
package:
name:
- "{{ microcode_amd }}"
- "{{ microcode_intel }}"
- "{{ microcode_amd }}"
- "{{ microcode_intel }}"
state: present
when: branch == "dev"
ignore_errors: yes
@@ -78,10 +79,10 @@
- name: General | Software | Packages | Add Generic Kernel + Tools (Ubuntu)
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: yes
@@ -89,8 +90,8 @@
- name: General | Software | Packages | Add Generic Kernel + Headers (Debian)
package:
name:
- linux-image-amd64
- linux-headers-amd64
- linux-image-amd64
- linux-headers-amd64
state: present
when: ansible_distribution == "Debian"
ignore_errors: yes
@@ -104,10 +105,10 @@
- name: General | Software | Packages | Install "Bloat" (Looking at you, Arch Base)
package:
name:
- which
- "{{ cron }}"
- which
- "{{ cron }}"
state: present
when: ansible_distribution == "Archlinux"
when: ansible_pkg_mgr == "pacman"
- name: General | Software | Packages | Install Fix (Looking at you, openSUSE)
package:
@@ -124,17 +125,17 @@
- name: General | Software | Packages | Update Software (Disabled)
package:
name:
- ansible
- git
- ansible
- git
state: latest
when: 1 == 0
- name: General | Software | Packages | Remove Software
package:
name:
- cowsay # Sorry ;)
- chromium
- chromium-browser
- cowsay # Sorry ;)
- chromium
- chromium-browser
state: absent
# Ubuntu still uses snap for critical components like GNOME, must keep.
@@ -150,7 +151,7 @@
- name: General | Software | Packages | Remove Snap (Besides Ubuntu)
package:
name:
- snapd
- snapd
state: absent
when: ansible_distribution != "Ubuntu"
ignore_errors: yes
@@ -158,7 +159,7 @@
- name: General | Software | Packages | Other Debian Packages
package:
name:
- usbutils
- usbutils
state: present
when: ansible_distribution in ("Debian")
ignore_errors: yes
@@ -38,7 +38,6 @@
- "{{ appimagelauncher }}"
- gparted
- hugo
- "{{ base_devel }}"
- "{{ firefox }}"
- "{{ firefox_esr }}"
- "{{ wireless_tools }}"