On 07. feb. 2017 17:14, Jonty Needham wrote:
I need to update the PATH variable on the target machine. Yet I have no
idea how to do it.

I could update /etc/environment with an ansible play, but does that do what
I want without overwriting the user's PATH instead of appending to it?

What's the best way of doing this?

It depends on your shell, interactive or non interactive shell, your distribution and for which user you would like to change the path for.

Interactive Bash support files in /etc/profile.d/ and this will be added to all users.

To add to the path just create a file like this.

- name: My custom path
  copy:
    dest: /etc/profile.d/my_custom_path.sh
    content: "PATH=PATH:/my/custom/path"

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b3044a17-962c-78c5-e249-382ab992157b%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to