local, refactor the necessary portions into subfiles header and footer.

This commit is contained in:
me
2026-10-10 10:29:17 -07:00
parent 8970b14e31
commit 69b1e62c82
3 changed files with 161 additions and 151 deletions
+6 -151
View File
@@ -9,147 +9,9 @@
tasks:
####### 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 Setup
block:
- name: Main | NixOS Setup | NixOS
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 Setup | 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: NixOS | Complete
ansible.builtin.meta: end_play
when: ansible_distribution == "NixOS"
####### General #######
# Basic setup for all enabled systems.
- name: Main | General Setup
block:
- name: Main | General Setup | Swap
ansible.builtin.include_tasks: tasks/general/software/swap.yml
- name: Main | General Setup | runit
ansible.builtin.include_tasks: tasks/general/software/runit.yml
- name: Main | General Setup | Packages
ansible.builtin.include_tasks: tasks/general/software/packages.yml
when: internet
- name: Main | General Setup | Services
ansible.builtin.include_tasks: tasks/general/software/services.yml
- name: Main | General Setup | Sendmail
ansible.builtin.include_tasks: tasks/general/software/sendmail.yml
when: ansible_system == "FreeBSD"
and internet
- ansible.builtin.include_tasks: tasks/general/software/aur.yml
when: internet and ansible_pkg_mgr == "pacman"
# Gather again in case missing programs have now been installed.
- ansible.builtin.include_tasks: facts/general/gather.yml
- ansible.builtin.include_tasks: tasks/general/settings/keyboard.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
when: internet
- ansible.builtin.include_tasks: tasks/general/software/env-shared.yml
when: internet
- 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
# TODO Need to refactor. Maybe tasks/general/cron/freebsd.yml
- ansible.builtin.include_tasks: tasks/workstation/freebsd/cron/ansible.yml
when: ansible_system == "FreeBSD"
- ansible.builtin.include_tasks: tasks/general/software/metasploit.yml
when: internet
when: provision
####### Header #######
- name: Main | Header
ansible.builtin.include_tasks: tasks/header.yml
####### Workstations #######
@@ -345,13 +207,6 @@
- ansible.builtin.include_tasks: tasks/general/tests/nmap.yml
####### Finish #######
- name: Main | Finish
block:
- name: Main | Finish | Notify
ansible.builtin.include_tasks: tasks/general/acct_mgmt/notify.yml
vars:
notify_message: "Provisioning Finished"
- ansible.builtin.include_tasks: tasks/general/tests/lock_remove.yml
####### Footer #######
- name: Main | Footer
ansible.builtin.include_tasks: tasks/footer.yml
+12
View File
@@ -0,0 +1,12 @@
---
####### Footer #######
- name: Footer
block:
- name: Footer | Notify
ansible.builtin.include_tasks: tasks/general/acct_mgmt/notify.yml
vars:
notify_message: "Provisioning Finished"
- ansible.builtin.include_tasks: tasks/general/tests/lock_remove.yml
+143
View File
@@ -0,0 +1,143 @@
---
####### 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 Setup
block:
- name: Main | NixOS Setup | NixOS
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 Setup | 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: NixOS | Complete
ansible.builtin.meta: end_play
when: ansible_distribution == "NixOS"
####### General #######
# Basic setup for all enabled systems.
- name: Main | General Setup
block:
- name: Main | General Setup | Swap
ansible.builtin.include_tasks: tasks/general/software/swap.yml
- name: Main | General Setup | runit
ansible.builtin.include_tasks: tasks/general/software/runit.yml
- name: Main | General Setup | Packages
ansible.builtin.include_tasks: tasks/general/software/packages.yml
when: internet
- name: Main | General Setup | Services
ansible.builtin.include_tasks: tasks/general/software/services.yml
- name: Main | General Setup | Sendmail
ansible.builtin.include_tasks: tasks/general/software/sendmail.yml
when: ansible_system == "FreeBSD"
and internet
- ansible.builtin.include_tasks: tasks/general/software/aur.yml
when: internet and ansible_pkg_mgr == "pacman"
# Gather again in case missing programs have now been installed.
- ansible.builtin.include_tasks: facts/general/gather.yml
- ansible.builtin.include_tasks: tasks/general/settings/keyboard.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
when: internet
- ansible.builtin.include_tasks: tasks/general/software/env-shared.yml
when: internet
- 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
# TODO Need to refactor. Maybe tasks/general/cron/freebsd.yml
- ansible.builtin.include_tasks: tasks/workstation/freebsd/cron/ansible.yml
when: ansible_system == "FreeBSD"
- ansible.builtin.include_tasks: tasks/general/software/metasploit.yml
when: internet
when: provision