我希望这很简单。我正在使用这样的lineinfile
模块:
- name: Update bashrc for PythonBrew for foo user
lineinfile:
dest=/home/foo/.bashrc
backup=yes
line="[[ -s ${pythonbrew.bashrc_path} ]] && source ${pythonbrew.bashrc_path}"
owner=foo
regexp='^'
state=present
insertafter=EOF
create=True
我遇到的问题是它fi
用我的新行替换文件中的最后一行(即 ),而不是附加该行。这会产生语法错误。
我的参数是否正确?我尝试将正则表达式设置为'^'
和''
(空白)。还有其他方法可以解决这个问题吗?
我正在使用 Ansible 1.3.3。