Mi aspetto che questo sia piuttosto semplice. Sto utilizzando il modulo lineinfile
in questo modo:In Ansible, come si aggiunge una linea alla fine di un file?
- 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
Il problema che sto avendo è che è sostituire l'ultima riga del file (che è fi
) con la mia nuova linea, piuttosto che aggiungendo la linea. Questo produce un errore di sintassi.
I parametri sono corretti? Ho provato a impostare regexp su entrambi '^'
e ''
(vuoto). C'è un altro modo per farlo?
Sto usando Ansible 1.3.3.
Sei tornato dal futuro? Ansible stable è 2.4 e devel is 2.5 ... 2.9 è probabile che sia rilasciato nel 2018-2019. – sorin
Grazie @sorin non solo che sono tornato dal futuro sto cercando Ms Connor – shlomoa