volanja/ansible_spec

Double reference to a variable does not work

kerherve opened this issue · 2 comments

Hello,

When doing a double reference to a variable, ansible_spec only get the first reference then the test fail:

In the playbook:

- name: foo
  hosts: server_foo
  roles:
    - foo
  vars:
    myvar: "{{ myvar_ingroupvar }}"

In group_vars:

myvar_ingroupvar: 192.168.0.0

Then when we run the test, we have the following error:

  1) File "/etc/foo/foo.conf" should contain "{{ myvar_ingroupvar }}"
     On host `server_foo'
     Failure/Error: it { should contain(property['myvar']).after(/^MY_VAR=/) }
       expected File "/etc/foo/foo.conf" to contain "{{ myvar_ingroupvar }}"

When actually "{{ myvar_ingroupvar }}" should be interpreted as 192.168.0.0:

File "/etc/foo/foo.conf" should contain "192.168.0.0"
     On host `server_foo'
...

Hi

Double reference to a variable is not support.
ansible_spec don't have a function to understand jinja notation.

I closed this issue.
If you have other question, please open new issue.