env-ansible/local.yml
Chad 392294fb45
General Enhancements, NixOS Support (#47)
* Begin adding Nix.

* Install LBRY from Nix since its Flatpak is no longer supported..

* Got the global install to work, now just figuring out why LBRY won't work.

* Add alias to blow away dev branch and start back up from remote or main.

* Nix install not really working, requires manual intervention, maybe add to setup.sh or just try NixOS and see if it can 'replace' this entire Ansible project and cease the use of multiple operating systems.

* Start working on having a path for NixOS.

* Add NixOS.

* Skip the installer portion if using NixOS.

* Start including more tasks. ALl work besides GNOME due to psutil, even though it is included in configuration.nix.

* This should have never been added. Was an accident if it snuck though.

* Test using env rather than hard-coded bash path.

* Use variables, start thinking about future.

* Add file to manage setting up NixOS for the first or any subsequent times.

* Use the new nixos.sh script.

* Ensure /usr/local/bin is in PATH.

* Do not use * inside of "" for ls.

* Add filename cleanup shortcut.

* Add a clean option as well as a few bugfixes and checking that convert is installed.

* Use underscores in filenames and remove plurality.

* Bring the file into better column compliance.

* Stop running the dconf psutil failures against NixOS for now.

* Ensure the old names of scripts are removed from bin.

* Clean filename fixes as well as a traversing version.

* Remove extra spacing.

* Begin adding swapfile creation.

* Add dangerous code reset command.

* Add some cleaning for NixOS package manager.

* The ~ was being taken literally and created as a new folder.

* More work on swap files, and a new ansible.nix file.

* Fix the swap confuration line.

* Finish the swap configuration by checking if it already exists. Always keep the fstab line in existence.

* Reorder and enhance the update function for NixOS.

* Add comment.

* Start working on dconf for NixOS since don't have home-manager working yet in configration.nix.

* Add notes.

* If the file was created, make sure the user owns it and can edit by default.

* Favorites are working and only need maintained in one place! :)

* Add .zshrc for GNOME settings on NixOS.

* Add most other settings that are done manually post-install. Report any failures with their placement.

* FINALLY! Keyboard shortcuts and some final Gnome Tweak settings!

* Add night light settings.

* Move around some comments.

* Pull first then deal with any merge issues, rather than trying to push when there are things to pull.

* Test removing the dconf commands for non-NixOS.

* Alter output; remove extra newlines and add cache verbosity.

* dconf in rc files is working on Ubuntu!

* Add delete. Fix filename quotes. Other enhancements.

* Create new folder chain if clean changed directory names.

* Add TBD about changing the directory structure.

* Only say success if the file really exists. Skip if conversion fails.

* Only say success if the file really exists. Skip if conversion fails.

* Add quotes around dirname.

* Add quotes around the entire directory tree.

* Add quotes to comment in case it ever gets used.

* Add a bittorrent client.

* Disable Bluetooth on all devices, it's normally off anyways.

* Fix comments, this enables not disables.

* Create new services report.

* Add services report to main area and move all reports to NixOS area.

* Fix swap file variable name for non-NixOS distros.

* Add godot editor.

* Re-add extra programs Geary and OpenShot for variety.

* Shorten the output for 80 char terminals.

* Add Code-OSS for when Codium is having issues.

* Allow code-oss to be installed.

* Add the full desktop entry for Code-OSS.

* Ansible handles the newlines, prevent the -e from getting into the file.

* Enhance newlines in nmap report.

* Add NixOS.
2023-10-17 04:30:36 -07:00

245 lines
7.8 KiB
YAML

---
# Harmonize systems rather than doing everything manually. :)
# Setup of any device connected to this repo.
- name: Main | Default Setup
hosts: localhost
connection: local
become: true
tasks:
####### Gather #######
# Load facts for all systems.
- include_tasks: facts/general/gather.yml
- include_tasks: tasks/general/acct_mgmt/provision_config.yml
- include_tasks: facts/general/system.yml
- include_tasks: facts/general/package.yml
- include_tasks: facts/general/service.yml
- include_tasks: facts/general/user.yml
####### NixOS #######
# Install the .nix files and do a little data setup.
- name: Main | NixOS Setup
block:
- 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.
- include_tasks: tasks/general/software/swap.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
- include_tasks: tasks/general/scripts/root.yml
- include_tasks: tasks/general/scripts/user.yml
- include_tasks: tasks/general/scripts/install.yml
- 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!
- include_tasks: tasks/workstation/shared/settings/gnome.yml
when: workstation == true
# 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
- name: NixOS | Complete
meta: end_play
when: ansible_distribution == "NixOS"
####### General #######
# Basic setup for all enabled systems.
- name: Main | General Setup
block:
- 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"
# Gather again in case missing programs have now been installed.
- include_tasks: facts/general/gather.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
- include_tasks: tasks/general/scripts/root.yml
- include_tasks: tasks/general/scripts/user.yml
- include_tasks: tasks/general/scripts/install.yml
- include_tasks: tasks/general/cron/ansible.yml
# TODO Need to refactor. Maybe tasks/general/cron/freebsd.yml
- include_tasks: tasks/workstation/freebsd/cron/ansible.yml
when: ansible_system == "FreeBSD"
- include_tasks: tasks/general/software/metasploit.yml
when: pentesting == true
when: provision == true
####### Workstations #######
# Additional setup for systems with GUI.
- name: Main | Workstation Setup
block:
- include_tasks: facts/workstation/package.yml
# Set Up Desktop Environments #
- include_tasks: tasks/workstation/freebsd/software/gpu.yml
when: ansible_system == "FreeBSD" and bsd_gpu == true
- include_tasks: tasks/workstation/freebsd/software/gnome.yml
when: ansible_system == "FreeBSD"
- include_tasks: tasks/workstation/linux/software/gnome.yml
when: ansible_system == "Linux"
- include_tasks: tasks/workstation/shared/software/dwm.yml
# Software Tasks #
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
when: ansible_system == "Linux" and flatpak_distro
- include_tasks: tasks/workstation/linux/software/packages.yml
when: ansible_system == "Linux"
- include_tasks: tasks/workstation/linux/software/brave.yml
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
- include_tasks: tasks/workstation/freebsd/software/packages.yml
when: ansible_system == "FreeBSD"
- include_tasks: tasks/workstation/mac-os/software/brew.yml
when: ansible_system == "Darwin"
# Configuration Tasks #
- include_tasks: tasks/workstation/shared/settings/gnome.yml
when: not mobile
- include_tasks: tasks/workstation/linux/cron/ansible.yml
when: ansible_system == "Linux" and not mobile
- include_tasks: tasks/workstation/shared/settings/nfs.yml
- include_tasks: tasks/workstation/shared/settings/rdp.yml
when: rdp == true
- include_tasks: tasks/workstation/shared/settings/vnc.yml
when: vnc == true
- include_tasks: tasks/workstation/shared/settings/services.yml
when: workstation == true
# No longer mining, this is now considered deprecated.
# ####### Miners #######
#
# # Additional setup for miners.
# - name: Main | Miner Setup
# block:
#
# ##### Setup #####
# - include_tasks: tasks/miner/debug.yml
#
# - include_tasks: tasks/miner/acct_mgmt/users.yml
#
# - include_tasks: facts/miner/system.yml
# - include_tasks: facts/miner/config.yml
# - include_tasks: facts/miner/pool.yml
#
# ##### Installations #####
# ### CPU SECTION ###
# # Monero #
# - include_tasks: tasks/miner/software/xmr-stak-cpu.yml
# when: xmr_stak_cpu is defined
#
# ### GPU Section ###
# ## Drivers ##
# - include_tasks: tasks/miner/drivers/amdgpu.yml
# when: ansible_distribution == "Ubuntu" and amdgpu == true
#
# # Ethereum #
# - include_tasks: tasks/miner/software/ethminer.yml
# when: ethminer == true
#
# - include_tasks: tasks/miner/software/nanominer.yml
# when: nanominer == true
#
# ##### Scheduling #####
# - include_tasks: tasks/miner/cron/ansible.yml
# - include_tasks: tasks/miner/cron/mfn.yml
#
# when: miner == true
####### Servers #######
# Easy to deploy server configurations.
- name: Main | Server Setup
block:
- include_tasks: tasks/server/software/services.yml
- include_tasks: tasks/server/software/certbot.yml
when: certbot == true
- include_tasks: tasks/server/cron/certbot.yml
when: certbot == true
- include_tasks: tasks/server/software/onlyoffice.yml
when: onlyoffice == true and ansible_pkg_mgr == "apt"
- include_tasks: tasks/server/software/influxdb1.yml
when: influxdb1 == true and ansible_pkg_mgr == "apt"
- include_tasks: tasks/server/software/influxdb2.yml
when: influxdb2 == true and ansible_pkg_mgr == "apt"
- include_tasks: tasks/server/software/grafana.yml
when: grafana == true and ansible_pkg_mgr == "apt"
- include_tasks: tasks/server/software/hugo.yml
when: hugo == true
- include_tasks: tasks/server/software/gitlab.yml
when: gitlab and ansible_pkg_mgr in ("apt", "dnf") and ansible_distribution not in ("Fedora")
- include_tasks: tasks/server/software/git.yml
when: git and ansible_pkg_mgr in ("apt")
when: server == true
####### Reporting #######
# Provide information for analysis.
- include_tasks: tasks/general/software/telegraf.yml
- include_tasks: tasks/general/tests/services.yml
- include_tasks: tasks/general/tests/lynis.yml
- include_tasks: tasks/general/tests/nmap.yml