I’m a Rubyist by day (with three years of Python once upon a time) and I’m struggling with getting the following task to only run once with the regular expression below. According to Pythex it should be matching (see: http://bit.ly/1dGw2GV).
My task looks as follows and should add the following line to ~/.bashrc if it doesn’t already exist:
export PATH=${STOW}/…/bin:${PATH}
- name: Ensure $STOW is in $PATH
lineinfile:
dest={{HOME.stdout}}/.bashrc
regexp=“^export PATH=${STOW}.*”
line=“export PATH=${STOW}/…/bin:${PATH}”
state=present
insertafter=EOF
create=True
With this version of it the line is added properly, with each and every run instead of just the initial run even though I get a full match on pythex…
I’m wondering if I should be testing against a different regular expression parser (I realize there are slight variations between languages) or if I’m just missing something blatantly obvious?
Any help appreciated,
Steven
PS - “${STOW}” in the above is a previously exported environment variable, not an attempt to insert an ansible variable of some kind.