assemble delimiter does not resolve attributes

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?

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.

do you have ansible_managed set in ansible.cfg?

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

Hi

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.