Discussion:
[ansible-project] assemble delimiter does not resolve attributes
Barry Kaplan
2015-06-07 04:09:32 UTC
Permalink
I am using assemble like so:

- name: Assemble the final kibana.yml
assemble:
src: "{{kibana_confd_dir}}"
dest: "{{kibana_config_dir}}/kibana.yml"
delimiter: "# {{ansible_managed}}"
owner: "{{kibana_user}}"
group: "{{kibana_group}}"
mode: 0644


Which yields:

TASK: [kibana | Assemble the final kibana.yml]
********************************
fatal: [10.0.196.100] => One or more undefined variables: 'ansible_managed'
is undefined


It seems that the value in 'delimiter' does not get processed by jinja. Is
it the responsibility of each module to process each of its arguments, or
does the ansible framework handle that?
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a59ca9fc-2262-47d4-b6f4-d78bc237dd0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Barry Kaplan
2015-06-07 04:20:02 UTC
Permalink
I guess this has nothing to with assemble, as this has the same problem

copy:
content: "# {{ansible_managed}}\n\n"
dest: "{{kibana_confd_dir}}/00-kibana-header.yml"


So there is something I do not understand about the scope of
ansible_managed.
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/edd57b27-f9ee-4ae5-b5f8-55d847e42a55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-06-08 14:04:55 UTC
Permalink
do you have ansible_managed set in ansible.cfg?
Post by Barry Kaplan
I guess this has nothing to with assemble, as this has the same problem
content: "# {{ansible_managed}}\n\n"
dest: "{{kibana_confd_dir}}/00-kibana-header.yml"
So there is something I do not understand about the scope of
ansible_managed.
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/edd57b27-f9ee-4ae5-b5f8-55d847e42a55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Brian Coca
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8k5YkULt34N84051qP7EBTuN0Y98YmaBYTh%2B73yyaSRyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
JB
2015-07-17 15:17:58 UTC
Permalink
I have the same issue.
fatal: [localhost] => One or more undefined variables: 'ansible_managed' is
undefined

ansible_managed IS defined in ansible.cfg
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d
%H:%M:%S by {uid} on {host}

I also have the additional issue in that even the directive, # {{
ansible_managed }}, which is specified as the first line in the first
fragment is also not getting replaced.
I get the literal # {{ ansible_managed }} in the destination file.

RUNNING: ansible-1.9.1-1.el6.noarch on CentOS release 6.6

- JB
Post by Brian Coca
do you have ansible_managed set in ansible.cfg?
Post by Barry Kaplan
I guess this has nothing to with assemble, as this has the same problem
content: "# {{ansible_managed}}\n\n"
dest: "{{kibana_confd_dir}}/00-kibana-header.yml"
So there is something I do not understand about the scope of
ansible_managed.
--
You received this message because you are subscribed to the Google
Groups
Post by Barry Kaplan
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send
an
<javascript:>.
Post by Barry Kaplan
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/edd57b27-f9ee-4ae5-b5f8-55d847e42a55%40googlegroups.com.
Post by Barry Kaplan
For more options, visit https://groups.google.com/d/optout.
--
Brian Coca
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/eefc2429-7c63-47f3-b045-e22931896b27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Karl E. Jorgensen
2015-07-17 15:30:12 UTC
Permalink
Hi
Post by JB
I have the same issue.
'ansible_managed' is undefined
ansible_managed IS defined in ansible.cfg
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %
H:%M:%S by {uid} on {host}
Isn't "ansible_managed" only set for templates ? I.e. in the template
module, and thus doesn't apply to the copy module?
--
Karl E. Jorgensen
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1437147012.32323.3.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-17 15:32:46 UTC
Permalink
Karl is correct,

ansible_managed only exists for the template module, it is not
available in plays so you cannot pass it as a parameter.

copy: content was never meant to substitute the template module,
content= does not do templating, it happens at the play level, which
does not have the variable available.
--
Brian Coca
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8nk8ei4jYaZFQi6UFw9%3D3gZLq5Hz%3DU0KCkwNR4iEjEKsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...