carlessanagustin
3/4/2016 - 4:05 PM

updating PATH with ansible - system wide

updating PATH with ansible - system wide

Option 1

- name: compile sources
  shell:
    coffee -o lib -c src 
    chdir=${mysourcedir}
  environment:
    PATH: $PATH:/opt/node/bin

Option 2

- name: add {{extra_path}} to path
  lineinfile:
    dest: /etc/environment
    state: present
    backrefs: yes
    regexp: 'PATH=(["]*)((?!.*?{{extra_path}}).*?)(["]*)$'
    line: "PATH=\1\2:{{extra_path}}\3"