env-ansible/local.yml

243 lines
7.6 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/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/linux/software/vpn.yml
when: ansible_system == "Linux"
- 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
# Final Tasks (SLOW) #
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
when: ansible_system == "Linux" and flatpak_distro
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
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