Romain's blog

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/*.sh are the global initialization scripts that are equivalent to ~/.profile for 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

#ansible #linux