diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index 6cd2ac4..0bcf273 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -4,11 +4,11 @@ ## Variables ## - name: General | Account Management | Users | Use BASH (Default) - set_fact: + ansible.builtin.set_fact: user_shell: "{{ bash_exec.stdout }}" - name: General | Account Management | Users | Allow BASH (Arch) - lineinfile: + ansible.builtin.lineinfile: path: /etc/shells regexp: "{{ bash_exec.stdout }}" line: "{{ bash_exec.stdout }}" @@ -38,7 +38,7 @@ ## Root ## - name: General | Account Management | Users | Root - user: + ansible.builtin.user: name: root shell: "{{ bash_exec.stdout }}" create_home: true @@ -49,7 +49,7 @@ ## Scheduler ## - name: General | Account Management | Users | Ansible - user: + ansible.builtin.user: name: ansible comment: Ansible system: true @@ -59,7 +59,7 @@ ## Superuser ## - name: General | Account Management | Users | User - user: + ansible.builtin.user: name: "{{ user }}" comment: "{{ user_desc }}" groups: @@ -74,17 +74,19 @@ register: user_user - name: General | Account Management | Users | User | Test Logging In - shell: "echo SUCCESS" + ansible.builtin.shell: "echo SUCCESS" args: executable: "{{ user_shell }}" become: true become_user: "{{ user }}" + register: shell_check + changed_when: shell_check.rc == 0 ## Folders ## - name: General | Account Management | Users | Root | Create Folders - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: '0755' @@ -95,7 +97,7 @@ when: user_root.home != "" - name: General | Account Management | Users | User | Create Folders - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: '0755' @@ -111,7 +113,7 @@ when: user_user.home != "" - name: General | Account Management | Users | User | Create Folders | Coding - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: '0755' @@ -122,13 +124,15 @@ when: user_user.home != "" and coding - name: General | Account Management | Users | Home Permissions - shell: "chmod 700 {{ user_user.home }}/../*" + ansible.builtin.shell: "chmod 700 {{ user_user.home }}/../*" + register: shell_check + changed_when: shell_check.rc == 0 ## Files ## - name: General | Account Management | Users | Files | Profile Variables - set_fact: + ansible.builtin.set_fact: export_path_additions: export PATH="$HOME/bin:{{ shared_rc_bin }}:$PATH:{{ global_bin }}" export_path_sbin: export PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" #export_terminal: export TERMINAL="alacritty" # colors look weird. @@ -151,7 +155,7 @@ } - name: General | Account Management | Users | Files | RC Variables - set_fact: + ansible.builtin.set_fact: alias_cp: alias cp='cp -v' alias_mv: alias mv='mv -v' alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"' @@ -1225,7 +1229,7 @@ - name: General | Account Management | Users | Files | Common Variable - set_fact: + ansible.builtin.set_fact: profile_common: | {{ export_path_additions }} {{ export_path_sbin }} @@ -1315,7 +1319,7 @@ {{ function_reset_android_studio }} - name: General | Account Management | Users | Files | .profile + .xsessionrc - blockinfile: + ansible.builtin.blockinfile: path: "{{ user_user.home }}/{{ item }}" block: | {{ profile_common }} @@ -1326,6 +1330,7 @@ state: present create: true backup: false + mode: "0755" loop: - ".profile" - ".xprofile" @@ -1333,7 +1338,7 @@ when: user_user.home != "" - name: General | Account Management | Users | Files | .bashrc - blockinfile: + ansible.builtin.blockinfile: path: "{{ item }}/.bashrc" block: | {{ rc_common }} @@ -1347,13 +1352,14 @@ state: present create: true backup: false + mode: "0755" loop: - "{{ user_root.home }}" - "{{ user_user.home }}" when: user_root.home != "" and user_user.home != "" - name: General | Account Management | Users | Files | .zshrc - blockinfile: + ansible.builtin.blockinfile: path: "{{ item }}/.zshrc" block: | {{ rc_common }} @@ -1363,13 +1369,14 @@ state: present create: true backup: false + mode: "0755" loop: - "{{ user_root.home }}" - "{{ user_user.home }}" when: user_root.home != "" and user_user.home != "" - name: General | Account Management | Users | Files | Ownership - file: + ansible.builtin.file: path: "{{ user_user.home }}/{{ item }}" owner: "{{ user }}" mode: '0755' @@ -1382,15 +1389,17 @@ - name: General | Account Management | Users | Files | Helper Functions (Reset) - shell: "rm -v {{ global_bin }}/*.function" + ansible.builtin.shell: "rm -v {{ global_bin }}/*.function" ignore_errors: true + register: shell_check + changed_when: shell_check.rc == 0 - name: General | Account Management | Users | Files | Helper Functions - copy: + ansible.builtin.copy: src: "{{ item }}" dest: "{{ global_bin }}" owner: root group: "{{ root_group }}" - mode: 0755 + mode: "0755" with_fileglob: - "functions/*.function"