Joined May 2021
·

JeanCarlos Chavarría Hughes

Costa Rica
·
·

I had to modify your task in order to make it compile.

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

My ansible version:
ansible 2.9.21 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0]

Achievements
1 Karma
0 Total ProTip Views