【发布时间】:2013-10-30 16:44:28
【问题描述】:
我希望这很简单。我正在使用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。
【问题讨论】:
标签: ansible