Compare commits

...
6 Commits
4 changed files with 175 additions and 146 deletions

No files matched your search

+2 -2
View File
@@ -8,13 +8,13 @@ skip_list:
- yaml[colons]
- jinja[spacing]
- fqcn[action]
- name[missing]
- yaml[comments]
warn_list:
- literal-compare
- ignore-errors
- no-changed-when
- yaml[indentation]
- yaml[comments]
- risky-file-permissions
- name[missing]
- risky-shell-pipe
+149 -143
View File
@@ -14,8 +14,8 @@
- name: Main | Lock
block:
- include_tasks: tasks/general/tests/lock_check.yml
- include_tasks: tasks/general/tests/lock_create.yml
- include_tasks: tasks/general/tests/lock_check.yml
- include_tasks: tasks/general/tests/lock_create.yml
####### Gather #######
@@ -23,24 +23,24 @@
- name: Main | Gather
block:
- include_tasks: facts/general/gather.yml
- include_tasks: tasks/general/acct_mgmt/provision_config.yml
- 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
- include_tasks: facts/general/system.yml
- include_tasks: facts/general/package.yml
- include_tasks: facts/general/service.yml
- include_tasks: facts/general/user.yml
- include_tasks: tasks/general/tests/internet_check.yml
####### Start #######
- name: Main | Start
block:
- name: Main | Start | Notify | Touch File
include_tasks: tasks/general/acct_mgmt/notify.yml
- name: Main | Start | Notify | Add Message
shell : echo "'Ansible' 'Provisioning started @ `date`'" >> "{{ notify_log_file }}"
- include_tasks: tasks/general/acct_mgmt/notify.yml
vars:
notify_message: "Provisioning Started"
when: workstation
@@ -49,37 +49,37 @@
- name: Main | NixOS Setup
block:
- include_tasks: tasks/general/software/nixos.yml
- 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
# 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/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/scripts/root.yml
- include_tasks: tasks/general/scripts/user.yml
- include_tasks: tasks/general/scripts/install.yml
- include_tasks: tasks/general/cron/ansible.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
# 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
# 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
# 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
- name: NixOS | Complete
meta: end_play
when: ansible_distribution == "NixOS"
@@ -89,36 +89,36 @@
- 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"
- 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"
- include_tasks: tasks/general/software/aur.yml
when: ansible_pkg_mgr == "pacman"
- include_tasks: tasks/general/software/aur.yml
when: internet and ansible_pkg_mgr == "pacman"
# Gather again in case missing programs have now been installed.
- include_tasks: facts/general/gather.yml
# Gather again in case missing programs have now been installed.
- include_tasks: facts/general/gather.yml
- include_tasks: tasks/general/settings/keyboard.yml
- include_tasks: tasks/general/settings/keyboard.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/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/scripts/root.yml
- include_tasks: tasks/general/scripts/user.yml
- include_tasks: tasks/general/scripts/install.yml
- include_tasks: tasks/general/cron/ansible.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"
# 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
- include_tasks: tasks/general/software/metasploit.yml
when: provision
@@ -128,77 +128,81 @@
- name: Main | Workstation Setup
block:
- include_tasks: facts/workstation/package.yml
- include_tasks: facts/workstation/package.yml
## Desktop Environments ##
- include_tasks: tasks/workstation/freebsd/software/gpu.yml
when: ansible_system == "FreeBSD" and bsd_gpu
## Desktop Environments ##
- include_tasks: tasks/workstation/freebsd/software/gpu.yml
when: ansible_system == "FreeBSD" and bsd_gpu
# Window Managers without true Desktop Environments #
- include_tasks: tasks/workstation/shared/software/dwm.yml
- include_tasks: tasks/workstation/shared/software/i3.yml
# Window Managers without true Desktop Environments #
- include_tasks: tasks/workstation/shared/software/dwm.yml
- include_tasks: tasks/workstation/shared/software/i3.yml
# Polished Desktop Environments #
- include_tasks: tasks/workstation/freebsd/software/gnome.yml
when: ansible_system == "FreeBSD"
# Polished Desktop Environments #
- include_tasks: tasks/workstation/freebsd/software/gnome.yml
when: ansible_system == "FreeBSD"
- name: Main | Workstation | Fancy Desktop Environments
block:
- include_tasks: tasks/workstation/linux/software/gnome.yml
when: ansible_service_mgr == "systemd"
- include_tasks: tasks/workstation/linux/software/cinnamon.yml
- include_tasks: tasks/workstation/linux/software/lxqt.yml
when: ansible_system == "Linux"
# TBD: Implement this: and extra_desktops
## Software Tasks ##
- block:
- include_tasks: tasks/workstation/linux/software/packages.yml
- include_tasks: tasks/workstation/linux/software/tlp.yml
- include_tasks: tasks/workstation/linux/software/lutris.yml
- include_tasks: tasks/workstation/linux/software/vscodium.yml
- include_tasks: tasks/workstation/linux/software/vpn.yml
- include_tasks: tasks/workstation/linux/software/nodejs.yml
- include_tasks: tasks/workstation/linux/software/hugo.yml
- include_tasks: tasks/workstation/linux/software/brave.yml
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
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 ##
- block:
- include_tasks: tasks/workstation/shared/settings/gnome.yml
- include_tasks: tasks/workstation/shared/settings/cinnamon.yml
- include_tasks: tasks/workstation/shared/settings/xdg_autostart.yml
- include_tasks: tasks/workstation/linux/cron/ansible.yml
- name: Main | Workstation | Fancy Desktop Environments
block:
- include_tasks: tasks/workstation/linux/software/gnome.yml
when: ansible_service_mgr == "systemd"
- include_tasks: tasks/workstation/linux/software/cinnamon.yml
- include_tasks: tasks/workstation/linux/software/lxqt.yml
when: ansible_system == "Linux"
when: not mobile
# TBD: Implement this: and extra_desktops
- include_tasks: tasks/workstation/shared/settings/nfs.yml
## Software Tasks ##
- include_tasks: tasks/workstation/shared/settings/rdp.yml
when: rdp
- name: Main | Workstation Setup | Linux
block:
- include_tasks: tasks/workstation/linux/software/packages.yml
- include_tasks: tasks/workstation/linux/software/tlp.yml
- include_tasks: tasks/workstation/linux/software/lutris.yml
- include_tasks: tasks/workstation/linux/software/vscodium.yml
- include_tasks: tasks/workstation/linux/software/vpn.yml
- include_tasks: tasks/workstation/linux/software/nodejs.yml
- include_tasks: tasks/workstation/linux/software/hugo.yml
- include_tasks: tasks/workstation/linux/software/brave.yml
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
when: ansible_system == "Linux"
- include_tasks: tasks/workstation/shared/settings/vnc.yml
when: vnc
- include_tasks: tasks/workstation/freebsd/software/packages.yml
when: ansible_system == "FreeBSD"
- include_tasks: tasks/workstation/shared/settings/services.yml
- include_tasks: tasks/workstation/shared/settings/templates.yml
- include_tasks: tasks/workstation/mac-os/software/brew.yml
when: ansible_system == "Darwin"
## Final Tasks (SLOW) ##
- block:
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
when: flatpak_distro
- include_tasks: tasks/workstation/linux/software/java.yml
- include_tasks: tasks/workstation/linux/software/flutter.yml
- include_tasks: tasks/workstation/linux/software/android.yml
when: ansible_system == "Linux"
## Configuration Tasks ##
- name: Main | Workstation Setup | Configuration
block:
- include_tasks: tasks/workstation/shared/settings/gnome.yml
- include_tasks: tasks/workstation/shared/settings/cinnamon.yml
- include_tasks: tasks/workstation/shared/settings/xdg_autostart.yml
- include_tasks: tasks/workstation/linux/cron/ansible.yml
when: ansible_system == "Linux"
when: not mobile
- include_tasks: tasks/workstation/shared/settings/nfs.yml
- include_tasks: tasks/workstation/shared/settings/rdp.yml
when: rdp
- include_tasks: tasks/workstation/shared/settings/vnc.yml
when: vnc
- include_tasks: tasks/workstation/shared/settings/services.yml
- include_tasks: tasks/workstation/shared/settings/templates.yml
## Final Tasks (SLOW) ##
- name: Main | Workstation Setup | Linux [Slow]
block:
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
when: flatpak_distro
- include_tasks: tasks/workstation/linux/software/java.yml
- include_tasks: tasks/workstation/linux/software/flutter.yml
- include_tasks: tasks/workstation/linux/software/android.yml
when: ansible_system == "Linux"
when: workstation
@@ -249,26 +253,26 @@
- name: Main | Server Setup
block:
- include_tasks: tasks/server/software/services.yml
- include_tasks: tasks/server/software/services.yml
- block:
- include_tasks: tasks/server/software/certbot.yml
- include_tasks: tasks/server/cron/certbot.yml
when: certbot
- block:
- include_tasks: tasks/server/software/certbot.yml
- include_tasks: tasks/server/cron/certbot.yml
when: certbot
- block:
- include_tasks: tasks/server/software/onlyoffice.yml
when: onlyoffice
- include_tasks: tasks/server/software/influxdb1.yml
when: influxdb1
- include_tasks: tasks/server/software/influxdb2.yml
when: influxdb2
- include_tasks: tasks/server/software/grafana.yml
when: grafana
when: ansible_pkg_mgr == "apt"
- block:
- include_tasks: tasks/server/software/onlyoffice.yml
when: onlyoffice
- include_tasks: tasks/server/software/influxdb1.yml
when: influxdb1
- include_tasks: tasks/server/software/influxdb2.yml
when: influxdb2
- include_tasks: tasks/server/software/grafana.yml
when: grafana
when: ansible_pkg_mgr == "apt"
- include_tasks: tasks/server/software/hugo.yml
when: hugo
- include_tasks: tasks/server/software/hugo.yml
when: hugo
when: server
@@ -278,17 +282,19 @@
- name: Main | Reporting
block:
- include_tasks: tasks/general/software/telegraf.yml
- 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
- include_tasks: tasks/general/tests/services.yml
- include_tasks: tasks/general/tests/lynis.yml
- include_tasks: tasks/general/tests/nmap.yml
####### Finish #######
- name: Main | Finish
block:
- include_tasks: tasks/general/acct_mgmt/notify.yml
- include_tasks: tasks/general/acct_mgmt/notify.yml
vars:
notify_message: "Provisioning Finished"
- include_tasks: tasks/general/tests/lock_remove.yml
- include_tasks: tasks/general/tests/lock_remove.yml
+5 -1
View File
@@ -6,6 +6,10 @@
loop:
- touch "{{ notify_log_file }}"
- chmod 777 "{{ notify_log_file }}"
register: shell_check
changed_when: shell_check.rc != 0
- name: General | Notify | Add Message
shell : echo "'Ansible' 'Provisioning finished @ `date`'" >> "{{ notify_log_file }}"
shell : echo "'Ansible' '{{ notify_message }} @ `date`'" >> "{{ notify_log_file }}"
register: shell_check
changed_when: shell_check.rc != 0
+19
View File
@@ -0,0 +1,19 @@
---
# 20261002 - Hyperling
# Check whether we're connected to the internet and skip certain playbooks if not.
- name: General | Tests | Internet | Facts
ansible.builtin.set_fact:
internet: true
- name: General | Tests | Internet | Check
ansible.builtin.wait_for:
host: archlinux.org.com
port: 443
state: started
timeout: 15
register: internet_check
- name: General | Tests | Internet | Facts
ansible.builtin.set_fact:
internet: "{{ internet_check is success }}"