I want to add new hosts to an http configuration file. When I use
blockinfile it's replacing the last block and not appending to the end.
What I'd like to do is keep adding to the file but blockfile doesn't seem
to be doing what I want.
<VirtualHost *:*>
ServerAdmin someone
DocumentRoot /var/www/html/prod/liver
ServerName liver
ServerAlias www.liver
</VirtualHost>
<VirtualHost *:*>
ServerAdmin someone
DocumentRoot /var/www/html/prod/liver
ServerName liver
ServerAlias www.liver
</VirtualHost>
My code
---
- hosts: web
vars_prompt:
- name: "site"
prompt: "Enter application"
private: no
tasks:
- name: "append"
blockinfile:
dest: /tmp/xxxyyy
insertafter: "# {mark} ANSIBLE MANAGED BLOCK"
block: |
<VirtualHost *:*>
ServerAdmin someone
DocumentRoot /var/www/html/prod/{{site}}
ServerName {{site}}
ServerAlias www.{{site}}
</VirtualHost>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/921fa940-8e89-4070-96b6-d5b4910ed545%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.