From 0ed6685b30c2408cffc84837b35faca0a6ef67b8 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 6 Feb 2021 17:00:55 -0600 Subject: [PATCH] Add psutil dependency. Fix names in fact files. --- facts/general/gather.yml | 4 ++-- facts/general/package.yml | 4 ++-- facts/general/service.yml | 4 ++-- facts/general/system.yml | 16 ++++++++-------- facts/general/user.yml | 4 ++-- facts/workstation/package.yml | 18 +++++++++++++++--- tasks/freebsd/cron/ansible.yml | 4 ++-- tasks/general/software/gnome.yml | 5 +++-- 8 files changed, 36 insertions(+), 23 deletions(-) diff --git a/facts/general/gather.yml b/facts/general/gather.yml index 1c2a074..3ac24a0 100644 --- a/facts/general/gather.yml +++ b/facts/general/gather.yml @@ -1,10 +1,10 @@ --- # Facts that must be gathered after running tasks. -- name: Facts | General | Gather | Locate bash +- name: General | Facts | Gather | Locate bash shell: which bash register: bash_exec -- name: Facts | General | Gather | Locate ansible-pull +- name: General | Facts | Gather | Locate ansible-pull shell: which ansible-pull register: ansible_pull_exec diff --git a/facts/general/package.yml b/facts/general/package.yml index daf49a4..dd3dd37 100644 --- a/facts/general/package.yml +++ b/facts/general/package.yml @@ -2,14 +2,14 @@ # Define program names for package builtin. # This file is for ALL systems and should not include UI components. -- name: Facts | General | Package | apt +- name: General | Facts | Package | apt set_fact: sshfs: sshfs locate: locate when: ansible_pkg_mgr == "apt" -- name: Facts | General | Package | FreeBSD +- name: General | Facts | Package | FreeBSD set_fact: sshfs: fusefs-sshfs locate: htop # Placeholder to prevent errors. locate builtin FreeBSD. diff --git a/facts/general/service.yml b/facts/general/service.yml index a339301..426c0b6 100644 --- a/facts/general/service.yml +++ b/facts/general/service.yml @@ -1,7 +1,7 @@ --- # Define program names for service builtin. -- name: Facts | General | Service | Linux +- name: General | Facts | Service | Linux set_fact: cups: cups cups_pattern: cupsd @@ -10,7 +10,7 @@ when: ansible_system == "Linux" -- name: Facts | General | Service | FreeBSD +- name: General | Facts | Service | FreeBSD set_fact: cups: cups cups_pattern: cupsd diff --git a/facts/general/system.yml b/facts/general/system.yml index 8864663..5371e82 100644 --- a/facts/general/system.yml +++ b/facts/general/system.yml @@ -1,49 +1,49 @@ --- # Define file, folder, and other facts per OS. -- name: Facts | General | System | Pop OS +- name: General | Facts | System | Pop OS set_fact: lynis_install_dir: /usr/local/lynis sudoers_install_dir: /etc/sudoers.d/ when: ansible_distribution == "Pop!_OS" -- name: Facts | General | System | Debian and Ubuntu +- name: General | Facts | System | Debian and Ubuntu set_fact: lynis_install_dir: /usr/local/lynis sudoers_install_dir: /etc/sudoers.d/ when: ansible_distribution in ("Debian","Ubuntu") -- name: Facts | General | System | FreeBSD +- name: General | Facts | System | FreeBSD set_fact: lynis_install_dir: /usr/local/lynis sudoers_install_dir: /usr/local/etc/sudoers.d/ when: ansible_system == "FreeBSD" -- name: Facts | General | System | 1337 +- name: General | Facts | System | 1337 set_fact: leet_drive: /mnt/leet -- name: Facts | General | System | 1337 Mounted? +- name: General | Facts | System | 1337 Mounted? stat: path: "{{ leet_drive }}/Temp/ansible" register: leet_drive_details -- name: Facts | General | System | Report Location = 1337 +- name: General | Facts | System | Report Location = 1337 set_fact: report_location: "{{ leet_drive }}/Temp/ansible" when: leet_drive_details.stat.exists -- name: Facts | General | System | Report Location = /root +- name: General | Facts | System | Report Location = /root set_fact: report_location: "/root" report_scp_location: "Temp/ansible/" when: not leet_drive_details.stat.exists -- name: Facts | General | System | Reports +- name: General | Facts | System | Reports set_fact: heartbeat_report: "{{ report_location }}/{{ ansible_hostname }}.txt" lynis_report: "{{ report_location }}/{{ ansible_hostname }}_lynis.txt" diff --git a/facts/general/user.yml b/facts/general/user.yml index 149454c..242256d 100644 --- a/facts/general/user.yml +++ b/facts/general/user.yml @@ -1,13 +1,13 @@ --- # Define users and groups per OS type. -- name: Facts | General | User | Linux +- name: General | Facts | User | Linux set_fact: root_group: root when: ansible_system == "Linux" -- name: Facts | General | User | FreeBSD +- name: General | Facts | User | FreeBSD set_fact: root_group: wheel when: ansible_system == "FreeBSD" \ No newline at end of file diff --git a/facts/workstation/package.yml b/facts/workstation/package.yml index 86c86dd..83ff7ac 100644 --- a/facts/workstation/package.yml +++ b/facts/workstation/package.yml @@ -10,22 +10,34 @@ gnome_tweaks: gnome-tweaks dconf_editor: dconf-editor -- name: Facts | Workstation | Package | Pop_OS! and Ubuntu + +- name: Facts | Workstation | Package | Pop_OS! set_fact: flatpak_distro: true firefox_esr: firefox - when: ansible_distribution in ("Pop!_OS", "Ubuntu") + psutil: python3-psutil + when: ansible_distribution == "Pop!_OS" + + +- name: Facts | Workstation | Package | Ubuntu + set_fact: + flatpak_distro: true + firefox_esr: firefox + psutil: python3-psutil + when: ansible_distribution == "Ubuntu" - name: Facts | Workstation | Package | Debian set_fact: flatpak_distro: true firefox_esr: firefox-esr - when: ansible_distribution in ("Debian") + psutil: python3-psutil + when: ansible_distribution == "Debian" - name: Facts | Workstation | Package | FreeBSD set_fact: flatpak_distro: false firefox_esr: firefox-esr + psutil: py37-psutil when: ansible_system == "FreeBSD" \ No newline at end of file diff --git a/tasks/freebsd/cron/ansible.yml b/tasks/freebsd/cron/ansible.yml index 66f3c00..93269fc 100644 --- a/tasks/freebsd/cron/ansible.yml +++ b/tasks/freebsd/cron/ansible.yml @@ -1,7 +1,7 @@ --- # Cron jobs specific to FreeBSD -- name: FreeBSD | Cron | Ansible | Enable SSHFS Job +- name: General | Cron | Ansible | FreeBSD | Enable SSHFS Job cron: user: ansible name: "1337 SSHFS" @@ -10,7 +10,7 @@ state: present disabled: no -- name: FreeBSD | Cron | Ansible | Enable Security Update +- name: General | Cron | Ansible | FreeBSD | Enable Security Update cron: user: ansible name: "Security Update" diff --git a/tasks/general/software/gnome.yml b/tasks/general/software/gnome.yml index 0842264..93b7b45 100644 --- a/tasks/general/software/gnome.yml +++ b/tasks/general/software/gnome.yml @@ -2,11 +2,12 @@ # GNOME settings, extensions, and setup. # Make sure Gnome-Tweaks is installed -- name: Workstation | Account Management | GNOME | Install Settings Editors +- name: Workstation | Account Management | GNOME | Install Dependencies package: name: - "{{ gnome_tweaks }}" - "{{ dconf_editor }}" + - "{{ psutil }}" state: present @@ -26,7 +27,7 @@ - name: Workstation | Account Management | GNOME | Favorites (FreeBSD) dconf: key: /org/gnome/shell/favorite-apps - value: "['org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'firefox.desktop', 'org.mozilla.Thunderbird.desktop', 'code.desktop']" + value: "['org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'firefox.desktop', 'org.mozilla.Thunderbird.desktop', 'code-oss.desktop']" state: present become_user: ling when: ansible_system == "FreeBSD"