Ansible variables for multiple inventories

14 views
Skip to first unread message

J F

unread,
Sep 27, 2019, 6:38:13 AM9/27/19
to Ansible Project
Hello.
I have following host file:
[main:children]
group_1
group_2
[group_1:vars]
testvar
='testval1'
[group_2:vars]
testvar
='testval2'

Running playbook below I am getting value 'testval1'
group_2

Could, please, someone explain how can I get right value?

Stefan Hornburg (Racke)

unread,
Sep 27, 2019, 6:40:50 AM9/27/19
to ansible...@googlegroups.com
Maybe, but please provide the playbook :-).

Regards
Racke

>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4e87a357-eae4-4b63-a003-59d77c8515b8%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4e87a357-eae4-4b63-a003-59d77c8515b8%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

J F

unread,
Sep 27, 2019, 7:03:15 AM9/27/19
to Ansible Project
Ahh. Sorry. Playbook is following:
---
- hosts: group_2
  connection: local
  tasks: 
    - name: print var
      debug:
       msg: "{{ testvar }}"



On Friday, September 27, 2019 at 1:40:50 PM UTC+3, Stefan Hornburg (Racke) wrote:
On 9/27/19 12:38 PM, J F wrote:
> Hello.
> I have following host file:
> |
> [main:children]
> group_1
> group_2
> [group_1:vars]
> testvar='testval1'
> [group_2:vars]
> testvar='testval2'
> |
>
> Running playbook below I am getting value 'testval1'
> |group_2|
>
> Could, please, someone explain how can I get right value?

Maybe, but please provide the playbook :-).

Regards
        Racke

>
> --
> 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
Reply all
Reply to author
Forward
0 new messages