From 319a717e68d48a084398ea6644fd11f49bfd153e Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 31 Jan 2021 13:11:40 -0600 Subject: [PATCH] Adjust for FreeBSD root group being wheel. --- facts/user_names.yml | 17 +++++++++++++++++ local.yml | 3 ++- tasks/users.yml | 6 +++--- 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 facts/user_names.yml diff --git a/facts/user_names.yml b/facts/user_names.yml new file mode 100644 index 0000000..648feab --- /dev/null +++ b/facts/user_names.yml @@ -0,0 +1,17 @@ +--- +# Define users and groups for each OS + +- name: Set Linux User Variables + ansible.builtin.set_fact: + root: root + root_group: root + ansible: ansible + when: ansible_distribution == "Pop!_OS" or + ansible_distribution == "Ubuntu" + +- name: Set FreeBSD User Variables + ansible.builtin.set_fact: + root: root + root_group: wheel + ansible: ansible + when: ansible_distribution == "FreeBSD" \ No newline at end of file diff --git a/local.yml b/local.yml index 97cd938..8c9bb40 100644 --- a/local.yml +++ b/local.yml @@ -11,11 +11,12 @@ - include: facts/filesystem_names.yml - include: facts/package_names.yml - include: facts/service_names.yml + - include: facts/user_names.yml tasks: + - include: tasks/packages.yml - include: tasks/users.yml - include: tasks/cron.yml - - include: tasks/packages.yml - include: tasks/harden.yml diff --git a/tasks/users.yml b/tasks/users.yml index 88acf3b..b2eb9d5 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -8,13 +8,13 @@ - name: Create Ansible User user: - name: ansible + name: "{{ ansible }}" system: yes - name: Add Ansible Sudoers File copy: src: sudoers_ansible dest: "{{ sudoers_install_dir }}" - owner: root - group: root + owner: "{{ root }}" + group: "{{ root_group }}" mode: 0440