Reorganize and simplify users. Move Downloads folder creation from miner plays.

This commit is contained in:
Hyperling 2021-02-15 10:11:46 -06:00
parent f6e06fb34c
commit 3ed9b83d44
3 changed files with 63 additions and 74 deletions

View File

@ -1,8 +1,32 @@
--- ---
# Create users for both desktop and server machines. # 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
## Scheduler ## ## Scheduler ##
- name: General | Account Management | User | Ansible
- name: General | Account Management | Users | Ansible
user: user:
name: ansible name: ansible
comment: Ansible comment: Ansible
@ -10,16 +34,8 @@
## Superuser ## ## Superuser ##
- name: General | Account Management | User | use BASH (Default)
set_fact:
ling_shell: "{{ bash_exec.stdout }}"
- name: General | Account Management | User | Use ZSH (Arch+Manjaro) - name: General | Account Management | Users | Hyperling
set_fact:
ling_shell: "{{ zsh_exec.stdout }}"
when: ansible_distribution == "Archlinux"
- name: General | Account Management | User | Hyperling
user: user:
name: ling name: ling
comment: Hyperling comment: Hyperling
@ -33,67 +49,47 @@
generate_ssh_key: yes generate_ssh_key: yes
register: user_ling register: user_ling
- name: General | Account Management | User | Hyperling | bin Folder - name: General | Account Management | Users | Hyperling | Test Logging In
file:
path: "{{ user_ling.home }}/bin"
state: directory
mode: '0755'
become_user: ling
when: user_ling.home != ""
- name: General | Account Management | User | Hyperling | TRASH Folder
file:
path: "{{ user_ling.home }}/TRASH"
state: directory
mode: '0755'
become_user: ling
when: user_ling.home != ""
- name: General | Account Management | User | Hyperling | Log In
shell: "echo SUCCESS" shell: "echo SUCCESS"
args:
executable: "{{ ling_shell }}"
become_user: ling become_user: ling
- name: General | Account Management | User | Hyperling | .bashrc Entries
blockinfile: ## Folders ##
path: "{{ user_ling.home }}/.bashrc"
block: | - name: General | Account Management | Users | Folders | Root | Create bin, Downloads, TRASH
alias cp='cp -v' file:
alias mv='mv -v' path: "{{ item }}"
alias rm='echo "Use mv ~/TRASH/ instead!"' state: directory
export PATH=".:~/bin:$PATH" mode: '0755'
marker: '# {mark} MANAGED BY ANSIBLE | Aliases' loop:
state: present - "{{ user_root.home }}/bin"
backup: yes - "{{ user_root.home }}/Downloads"
ignore_errors: yes - "{{ user_root.home }}/TRASH"
when: user_root.home != ""
- name: General | Account Management | Users | Folders | Hyperling | Create bin, LBRY, TRASH
file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- "{{ user_ling.home }}/bin"
- "{{ user_ling.home }}/LBRY"
- "{{ user_ling.home }}/TRASH"
become_user: ling
when: user_ling.home != "" when: user_ling.home != ""
- name: General | Account Management | Users | Folders | Home Directories 700
shell: "chmod 700 {{ user_ling.home }}/../*"
## Root ##
- name: General | Account Management | User | Root
user:
name: root
shell: "{{ bash_exec.stdout }}"
create_home: yes
generate_ssh_key: yes
register: user_root
- name: General | Account Management | User | Root | bin Folder ## Files ##
file:
path: "{{ user_root.home }}/bin"
state: directory
mode: '0755'
when: user_root.home != ""
- name: General | Account Management | User | Root | TRASH Folder - name: General | Account Management | Users | Files | .bashrc
file:
path: "{{ user_root.home }}/TRASH"
state: directory
mode: '0755'
when: user_root.home != ""
- name: General | Account Management | User | Root | .bashrc Entries
blockinfile: blockinfile:
path: "{{ user_root.home }}/.bashrc" path: "{{ item }}/.bashrc"
block: | block: |
alias cp='cp -v' alias cp='cp -v'
alias mv='mv -v' alias mv='mv -v'
@ -103,5 +99,8 @@
state: present state: present
create: yes create: yes
backup: yes backup: yes
loop:
- "{{ user_root.home }}"
- "{{ user_ling.home }}"
ignore_errors: yes ignore_errors: yes
when: user_root.home != "" when: user_root.home != "" and user_ling.home != ""

View File

@ -160,10 +160,6 @@
## Step 3/3: Install AMD PRO Driver ## ## Step 3/3: Install AMD PRO Driver ##
- name: AMDGPU | Create Downloads Folder
shell: 'mkdir -p /root/Downloads'
when: amdgpu_install.failed
- name: AMDGPU | Download Driver - name: AMDGPU | Download Driver
shell: 'scp ling@leet:InstallFiles/Drivers/amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz /root/Downloads/' shell: 'scp ling@leet:InstallFiles/Drivers/amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz /root/Downloads/'
when: amdgpu_install.failed when: amdgpu_install.failed

View File

@ -33,12 +33,6 @@
## Download ## ## Download ##
- name: Ethminer | Create Downloads Folder
shell: mkdir -p Downloads
args:
chdir: /root
when: ethminer_install.failed
- name: Ethminer | Remove Git Repo - name: Ethminer | Remove Git Repo
shell: rm -rf ethminer shell: rm -rf ethminer
args: args: