hi all.
I figured out why I was having that issue.
The problem was into the jinja2 templates where I found out that if I line
starts with # it's not interpreted as a comment  and so why ansible kept
throwing errors on undefined variable.


ISSUE

[control:vars]

*#kolla_external_vip_interface="{{ network_interface }}"    <-------------
WRONG *
so here the playbook had issues with undefined variable (network_interface)
but cause for me was commented I couldn't understand the error.


FIX
[control:vars]

*{#kolla_external_vip_interface="{{ network_interface }}"##}   <---------
RIGHT*
This is a proper comment which now doesn't appear in the target file.

Cheers





On Sun, May 10, 2020 at 7:26 PM Dick Visser <dick.vis...@geant.org> wrote:

> So far you only provided bits of information, like variables without
> values etc.
> We can't magically guess what your environment looks like.
> Please come up with a clear isolated, reproducible playbook, including
> templates, inventory, etc.
>
>
>
>
> On Sun, 10 May 2020 at 19:13, Alfredo De Luca <alfredo.del...@gmail.com>
> wrote:
>
>> I thought about writing to the community and ask...but before doing that
>> I took the playbook and the template and create a simple project with
>> molecule.
>> Then the same issue. no kolla-ansible/kolla involved at all.
>> So must be something else.
>>
>>
>>
>>
>> On Sun, May 10, 2020 at 1:33 PM Dick Visser <dick.vis...@geant.org>
>> wrote:
>>
>>> This list is about ansible itself, but your issue seems to be highly
>>> specific to the "kolla" framework:
>>> https://docs.openstack.org/project-deploy-guide/kolla-ansible/latest/
>>> I would start by reaching out to that community for support first as
>>> their users will have much more experience with the mechanics of "kolla".
>>>
>>>
>>>
>>> On Sat, 9 May 2020 at 18:25, Alfredo De Luca <alfredo.del...@gmail.com>
>>> wrote:
>>>
>>>> Apologies if it wasn't clear.
>>>> So it's a playbook that create an inventory file from a template for
>>>> kolla-ansible so it can install Openstack.
>>>>
>>>> here is the playbook
>>>>
>>>> ---
>>>> - name: TEMPLATES
>>>>   file:
>>>>       path: "{{ deploy_env }}/my_envs/openstack/{{ deploy_env }}"
>>>>       state: directory
>>>>       mode: 0755
>>>>
>>>> - name: Create inventory file from a template
>>>>   template:
>>>>       src: templates/osk_inventory.j2
>>>>       dest: "{{ deploy_env }}/my_envs/openstack/{{ deploy_env
>>>> }}/osk_inventory_{{ deploy_env }}"
>>>>       owner: root
>>>>       group: root
>>>>
>>>>
>>>> On Sat, May 9, 2020 at 3:55 PM Alfredo De Luca <
>>>> alfredo.del...@gmail.com> wrote:
>>>>
>>>>> Hi all.
>>>>> I have ansible 2.9.7 running on ubuntu. I am just running some test
>>>>> and one is to create an inventory by a template.
>>>>> All good except when I use the template it says
>>>>>
>>>>>
>>>>> *fatal: [instance]: FAILED! => {"changed": false, "msg":
>>>>> "AnsibleUndefinedVariable: 'network_interface' is undefined"}*
>>>>>
>>>>> Now here is the inventory.j2 snip
>>>>>
>>>>> <SNIP>
>>>>> [control]
>>>>> {{ osk_nodes.split(',')[0] }}
>>>>>
>>>>> [compute]
>>>>> {% for node_ip in osk_nodes.split(',') %}
>>>>> {{node_ip}}
>>>>> {% endfor %}
>>>>>
>>>>> [all:vars]
>>>>> *network_interface=eno1*
>>>>> <SNIP>
>>>>>
>>>>> Not sure why it keep saying undefined variable. where I specifically
>>>>> set the network_interface to eno1.
>>>>>
>>>>> Any ideas/suggestions?
>>>>> Cheers
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> */Alfredo*
>>>>>
>>>>>
>>>>
>>>> --
>>>> */Alfredo*
>>>>
>>>> --
>>>> 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+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CAAWpFTFzh%2B_sJf8vBU%3DKga-M6MwyXOcH8pxVDL-9xn4rmqneig%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CAAWpFTFzh%2B_sJf8vBU%3DKga-M6MwyXOcH8pxVDL-9xn4rmqneig%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> Sent from a mobile device - please excuse the brevity, spelling and
>>> punctuation.
>>>
>>> --
>>> 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+unsubscr...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwOQNuiTvWOyNeEoDXZ7ug-M14Q0v4%2BUL9CW8s8-T7Fd7w%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwOQNuiTvWOyNeEoDXZ7ug-M14Q0v4%2BUL9CW8s8-T7Fd7w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> */Alfredo*
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAAWpFTHhuakL1wu6hmeVbzaj5OpaTdHTBD6n52Qf7w4vDdhWzA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAAWpFTHhuakL1wu6hmeVbzaj5OpaTdHTBD6n52Qf7w4vDdhWzA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwOzUqU9p1n%3DXQWLcqOfUpkCi2T3Pk0Jxi4mQ9wk%3DdrE2A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwOzUqU9p1n%3DXQWLcqOfUpkCi2T3Pk0Jxi4mQ9wk%3DdrE2A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
*/Alfredo*

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAWpFTHBus3i5LemiSiRbfgxt%3DtMZdFLpVqx_e2dFKFf07T_%3DQ%40mail.gmail.com.

Reply via email to