Change system-wide $PATH
To change the $PATH system-wide with Ansible, an acceptable approach is to create a dedicated file with a meaningful name in /etc/profile.d.
/etc/profile.d/*.share the global initialization scripts that are equivalent to~/.profilefor each user
- name: Add a path to system-wide $PATH.
ansible.builtin.copy:
dest: /etc/profile.d/custom-path.sh
content: "PATH=$PATH:{{ path_var }}"
mode: "0644"
Refs