Skip to content

Commit

Permalink
Enable become unpriviliged user
Browse files Browse the repository at this point in the history
  • Loading branch information
waal70 committed Dec 27, 2023
1 parent eb709ca commit 0fbfeed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inventory/hosts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[proxmox_servers]
pve01 ansible_host=172.16.10.201
pve01 ansible_host=172.16.10.202
#pve02 ansible_host=172.16.10.146

[samba_primary]
Expand Down
5 changes: 4 additions & 1 deletion roles/common/tasks/color-shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
name: acl
state: present

# Note the use of "ansible_remote_tmp" - to prevent WARNINGS because of becoming an unprivileged user
- name: Force colors in .bashrc
ansible.builtin.lineinfile:
path: "{{ interactive_home }}/.bashrc" # Set the actual path to the user's home directory
path: "{{ interactive_home }}/.bashrc"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: 'present'
with_items:
- { regexp: '^#?force_color_prompt', line: 'force_color_prompt=yes' }
become: true
become_user: "{{ interactive_user }}"
vars:
ansible_remote_tmp: /tmp

0 comments on commit 0fbfeed

Please sign in to comment.