assemble delimiter does not resolve attributes

83 views
Skip to first unread message

Barry Kaplan

unread,
Jun 7, 2015, 12:09:32 AM6/7/15
to ansible...@googlegroups.com
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?

Barry Kaplan

unread,
Jun 7, 2015, 12:20:03 AM6/7/15
to ansible...@googlegroups.com
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.

Brian Coca

unread,
Jun 8, 2015, 10:05:02 AM6/8/15
to ansible...@googlegroups.com
do you have ansible_managed set in ansible.cfg?
> --
> 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-proje...@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

JB

unread,
Jul 17, 2015, 11:20:13 AM7/17/15
to ansible...@googlegroups.com
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

Karl E. Jorgensen

unread,
Jul 17, 2015, 11:30:23 AM7/17/15
to ansible...@googlegroups.com
Hi

On Fri, 2015-07-17 at 08:17 -0700, JB wrote:
> 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}
>

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


Brian Coca

unread,
Jul 17, 2015, 11:32:51 AM7/17/15
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages