On torsdag 31. august 2017 18.24.14 CEST Anfield wrote:
> textfile -
> 
> giraffe
> This is my text to add
> Noooooooooooooo
> penguin
> robot
> 
> #BEGIN ANSIBLE MANAGED BLOCK
> tree
> #BEGIN ANSIBLE MANAGED BLOCK
> 
> 
> Tried the following playbook and it just deleted the last wrapper
> 
> Playbook
> 
> ---
> - hosts: local
>   tasks:
>     - name: Use blockinfile
>       blockinfile:
>         path: /home/ansible/blockexample.txt
>         marker: "#BEGIN ANSIBLE MANAGED BLOCK"
>         block :
>            tree
>         state: absent

The problem is that the start marker and end marker is the same and 
blockinfile doesn't now where to start and stop.

If you take a look at the blockinfile documentation under marker you will see 
that it contain the template sign {mark} that will be changed for START or END

That way the start and end marker differ.

Just run your test without marker: and you'll see how it work since marker has 
a default value that only need to be changed if your are using more than one 
blockinfile on a file.


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5535148.nNrGHjinMz%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to