Skip to content

Commit

Permalink
DLPX-86524 Update path in /etc/security/pam_env.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
dbshah12 committed Sep 18, 2024
1 parent 1a0b53f commit a369448
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,21 @@
when: not ansible_is_chroot

#
# Ensure /snap/bin is removed from PATH in /etc/environment
# Add the correct path to /etc/security/pam_env.conf and remove any invalid
# paths from /etc/environment to ensure that non-existent paths are not
# included in the global PATH.
#
- lineinfile:
path: /etc/security/pam_env.conf
state: present
regexp: '^\s*PATH\s+DEFAULT='
line: 'PATH DEFAULT=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin'

#
# MIN_UPGRADE_VERSION(28.0.0.0)
# This can be removed once the minimum upgrade version is 28.0.0.0.
#
- lineinfile:
path: /etc/environment
regexp: '^PATH='
line: "{{ lookup('file', '/etc/environment') | regex_search('^PATH=.*') | regex_replace(':/snap/bin', '') }}"
when: "'/snap/bin' in lookup('file', '/etc/environment')"
state: absent
regexp: '^\s*PATH\s*='

0 comments on commit a369448

Please sign in to comment.