Updates to many roles, including main user role to allow setting an alternate home directory
This commit is contained in:
@@ -24,6 +24,11 @@
|
||||
user_groups: [root]
|
||||
when: user == 'root'
|
||||
|
||||
# Home directory, use /home/username if undefined
|
||||
# - set_fact:
|
||||
# home: "/home/{{ user }}"
|
||||
# when: (home is undefined or home == "")
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
- include_tasks: debug.yml
|
||||
@@ -39,6 +44,7 @@
|
||||
user_groups: ""
|
||||
add_groups: ""
|
||||
ssh_info: ""
|
||||
home: ""
|
||||
add_sudo: no
|
||||
create: yes
|
||||
ssh_keys: no
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
---
|
||||
- name: Check if ~/.bashrc exists
|
||||
stat:
|
||||
path: '{{ "~" + user | expanduser }}/.bashrc'
|
||||
register: bashrc
|
||||
|
||||
# Comment out ~/.bashrc HIST stuff
|
||||
# So it obeys /etc/profile.d/bash_history.sh instead
|
||||
- name: Commenting out ~/.bashrc HIST stuff
|
||||
@@ -6,14 +11,21 @@
|
||||
path: '{{ "~" + user | expanduser }}/.bashrc'
|
||||
regexp: '^HISTCONTROL=ignoreboth'
|
||||
line: '# HISTCONTROL=ignoreboth'
|
||||
- lineinfile:
|
||||
when: bashrc.stat.exists == true
|
||||
|
||||
- name: Commenting out ~/.bashrc HIST stuff
|
||||
lineinfile:
|
||||
path: '{{ "~" + user | expanduser }}/.bashrc'
|
||||
regexp: '^HISTSIZE=1000'
|
||||
line: '# HISTSIZE=1000'
|
||||
- lineinfile:
|
||||
when: bashrc.stat.exists == true
|
||||
|
||||
- name: Commenting out ~/.bashrc HIST stuff
|
||||
lineinfile:
|
||||
path: '{{ "~" + user | expanduser }}/.bashrc'
|
||||
regexp: '^HISTFILESIZE=2000'
|
||||
line: '# HISTFILESIZE=2000'
|
||||
when: bashrc.stat.exists == true
|
||||
|
||||
# Debian has these by default in ~/.bashrc
|
||||
#HISTCONTROL=ignoreboth
|
||||
|
||||
@@ -7,4 +7,5 @@
|
||||
- "ID: {{ users[user]['id'] }}"
|
||||
- "GID: {{ users[user]['gid'] }}"
|
||||
- "Groups: {{ user_groups }}"
|
||||
- "Home: {{ home }}"
|
||||
#- "Password: {{ users[user]['password'] }}"
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
groups: '{{ user_groups }}'
|
||||
password: "{{ users[user]['password'] }}"
|
||||
update_password: always
|
||||
home: "{{ home }}"
|
||||
create_home: "{{ create_home | default('yes') }}"
|
||||
shell: "{{ shell | default('/bin/bash') }}"
|
||||
|
||||
Reference in New Issue
Block a user