2021-01-31 17:21:39 -06:00
|
|
|
---
|
2021-02-15 10:11:46 -06:00
|
|
|
# Create users for all machines.
|
|
|
|
|
|
|
|
## Variables ##
|
|
|
|
|
|
|
|
- name: General | Account Management | Users | use BASH (Default)
|
|
|
|
set_fact:
|
|
|
|
ling_shell: "{{ bash_exec.stdout }}"
|
|
|
|
|
|
|
|
- name: General | Account Management | Users | Use ZSH (Arch+Manjaro)
|
|
|
|
set_fact:
|
|
|
|
ling_shell: "{{ zsh_exec.stdout }}"
|
|
|
|
when: ansible_distribution == "Archlinux"
|
|
|
|
|
|
|
|
|
|
|
|
## Root ##
|
|
|
|
|
|
|
|
- name: General | Account Management | Users | Root
|
|
|
|
user:
|
|
|
|
name: root
|
|
|
|
shell: "{{ bash_exec.stdout }}"
|
|
|
|
create_home: yes
|
|
|
|
generate_ssh_key: yes
|
|
|
|
register: user_root
|
|
|
|
|
2020-12-31 18:13:15 -06:00
|
|
|
|
2021-02-12 06:29:10 -06:00
|
|
|
## Scheduler ##
|
2021-02-15 10:11:46 -06:00
|
|
|
|
|
|
|
- name: General | Account Management | Users | Ansible
|
2020-12-21 04:50:02 -06:00
|
|
|
user:
|
2021-01-31 15:43:08 -06:00
|
|
|
name: ansible
|
2021-01-31 17:46:59 -06:00
|
|
|
comment: Ansible
|
2020-12-21 04:50:02 -06:00
|
|
|
system: yes
|
2021-01-31 18:02:37 -06:00
|
|
|
|
2020-12-21 04:50:02 -06:00
|
|
|
|
2021-02-12 06:29:10 -06:00
|
|
|
## Superuser ##
|
2021-02-14 16:36:31 -06:00
|
|
|
|
2021-02-15 10:11:46 -06:00
|
|
|
- name: General | Account Management | Users | Hyperling
|
2021-01-31 17:46:59 -06:00
|
|
|
user:
|
|
|
|
name: ling
|
|
|
|
comment: Hyperling
|
|
|
|
groups:
|
|
|
|
- sudo
|
2021-02-14 18:32:50 -06:00
|
|
|
- video
|
|
|
|
- render
|
2021-01-31 17:46:59 -06:00
|
|
|
append: yes
|
2021-02-14 16:36:31 -06:00
|
|
|
shell: "{{ ling_shell }}"
|
2021-01-31 17:46:59 -06:00
|
|
|
create_home: yes
|
2021-01-31 18:02:37 -06:00
|
|
|
generate_ssh_key: yes
|
2021-02-03 21:17:48 -06:00
|
|
|
register: user_ling
|
|
|
|
|
2021-02-15 10:11:46 -06:00
|
|
|
- name: General | Account Management | Users | Hyperling | Test Logging In
|
2021-02-11 13:06:59 -06:00
|
|
|
shell: "echo SUCCESS"
|
2021-02-15 10:11:46 -06:00
|
|
|
args:
|
|
|
|
executable: "{{ ling_shell }}"
|
2021-02-11 13:06:59 -06:00
|
|
|
become_user: ling
|
|
|
|
|
2021-02-12 06:29:10 -06:00
|
|
|
|
2021-02-15 10:11:46 -06:00
|
|
|
## Folders ##
|
2021-02-12 06:29:10 -06:00
|
|
|
|
2021-02-15 10:11:46 -06:00
|
|
|
- name: General | Account Management | Users | Folders | Root | Create bin, Downloads, TRASH
|
2021-02-12 07:47:22 -06:00
|
|
|
file:
|
2021-02-15 10:11:46 -06:00
|
|
|
path: "{{ item }}"
|
2021-02-12 07:47:22 -06:00
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
2021-02-15 10:11:46 -06:00
|
|
|
loop:
|
|
|
|
- "{{ user_root.home }}/bin"
|
|
|
|
- "{{ user_root.home }}/Downloads"
|
|
|
|
- "{{ user_root.home }}/TRASH"
|
2021-02-12 07:47:22 -06:00
|
|
|
when: user_root.home != ""
|
2021-02-12 06:29:10 -06:00
|
|
|
|
2021-02-15 10:11:46 -06:00
|
|
|
- name: General | Account Management | Users | Folders | Hyperling | Create bin, LBRY, TRASH
|
2021-02-12 06:29:10 -06:00
|
|
|
file:
|
2021-02-15 10:11:46 -06:00
|
|
|
path: "{{ item }}"
|
2021-02-12 06:29:10 -06:00
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
2021-02-15 10:11:46 -06:00
|
|
|
loop:
|
|
|
|
- "{{ user_ling.home }}/bin"
|
|
|
|
- "{{ user_ling.home }}/LBRY"
|
|
|
|
- "{{ user_ling.home }}/TRASH"
|
|
|
|
become_user: ling
|
|
|
|
when: user_ling.home != ""
|
|
|
|
|
|
|
|
- name: General | Account Management | Users | Folders | Home Directories 700
|
|
|
|
shell: "chmod 700 {{ user_ling.home }}/../*"
|
2021-02-12 06:29:10 -06:00
|
|
|
|
2021-02-15 10:11:46 -06:00
|
|
|
|
|
|
|
## Files ##
|
|
|
|
|
2021-03-02 06:06:27 -06:00
|
|
|
- name: General | Account Management | Users | Files | RC Variables
|
|
|
|
set_fact:
|
|
|
|
alias_cp: alias cp='cp -v'
|
|
|
|
alias_mv: alias mv='mv -v'
|
|
|
|
alias_rm: alias rm='echo "Use mv ~/TRASH/ instead!"'
|
|
|
|
path_additions: export PATH="~/bin:$PATH"
|
|
|
|
function_wttr: |
|
|
|
|
function weather() {
|
2021-03-02 06:39:39 -06:00
|
|
|
if [[ "$1" == "-"* || $2 != "" ]]; then
|
2021-03-02 06:29:21 -06:00
|
|
|
echo 'USAGE: weather [location]
|
2021-03-02 06:39:39 -06:00
|
|
|
Any "-" paramaters call the usage since this function does not take any options.
|
2021-03-02 06:42:52 -06:00
|
|
|
Location is optional since the API can determine your connection'"'"'s location.
|
2021-03-02 06:25:24 -06:00
|
|
|
Useful location types:
|
2021-03-02 06:39:39 -06:00
|
|
|
$zip_code | Ex: 12345
|
|
|
|
$city,$state | Ex: Austin,Texas
|
|
|
|
@$domain_dot_extension | Ex: @github.com
|
|
|
|
~$attraction_or_special_location | Ex: ~Manitou Incline
|
2021-03-02 06:29:21 -06:00
|
|
|
Full documentation: https://github.com/chubin/wttr.in'
|
2021-03-02 06:25:24 -06:00
|
|
|
return
|
|
|
|
fi
|
2021-03-02 06:39:39 -06:00
|
|
|
curl "https://wttr.in/${1//\ /+}"
|
2021-03-02 06:06:27 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
- name: General | Account Management | Users | Files | Common Variable
|
|
|
|
set_fact:
|
|
|
|
rc_common: |
|
2021-03-02 06:25:24 -06:00
|
|
|
{{ path_additions }}
|
2021-03-02 06:06:27 -06:00
|
|
|
{{ alias_cp }}
|
|
|
|
{{ alias_mv }}
|
|
|
|
{{ alias_rm }}
|
|
|
|
{{ function_wttr }}
|
|
|
|
|
2021-02-15 10:11:46 -06:00
|
|
|
- name: General | Account Management | Users | Files | .bashrc
|
2021-02-12 06:29:10 -06:00
|
|
|
blockinfile:
|
2021-02-15 10:11:46 -06:00
|
|
|
path: "{{ item }}/.bashrc"
|
2021-02-12 06:29:10 -06:00
|
|
|
block: |
|
2021-03-02 06:06:27 -06:00
|
|
|
{{ rc_common }}
|
2021-03-02 06:25:24 -06:00
|
|
|
echo "`date` - Ansible .bashrc preferences loaded successfully!"
|
2021-03-02 06:06:27 -06:00
|
|
|
marker: '# {mark} MANAGED BY ANSIBLE | Aliases'
|
|
|
|
state: present
|
|
|
|
create: yes
|
|
|
|
backup: yes
|
|
|
|
loop:
|
|
|
|
- "{{ user_root.home }}"
|
|
|
|
- "{{ user_ling.home }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
when: user_root.home != "" and user_ling.home != ""
|
|
|
|
|
|
|
|
- name: General | Account Management | Users | Files | .zshrc
|
|
|
|
blockinfile:
|
|
|
|
path: "{{ item }}/.zshrc"
|
|
|
|
block: |
|
|
|
|
{{ rc_common }}
|
2021-03-02 06:25:24 -06:00
|
|
|
echo "`date` - Ansible .zshrc preferences loaded successfully!"
|
2021-02-12 06:29:10 -06:00
|
|
|
marker: '# {mark} MANAGED BY ANSIBLE | Aliases'
|
|
|
|
state: present
|
|
|
|
create: yes
|
|
|
|
backup: yes
|
2021-02-15 10:11:46 -06:00
|
|
|
loop:
|
|
|
|
- "{{ user_root.home }}"
|
|
|
|
- "{{ user_ling.home }}"
|
2021-02-12 06:29:10 -06:00
|
|
|
ignore_errors: yes
|
2021-02-15 10:11:46 -06:00
|
|
|
when: user_root.home != "" and user_ling.home != ""
|