Re: [ansible-project] Re: Why playbook take wrong values for group variables?

2018-05-06 Thread Олег Боровых
Hi Markos,
 my playbook looks like:

- hosts: group_B
  roles:
- dse_agent_full_install



пятница, 4 мая 2018 г., 17:04:06 UTC+2 пользователь Marcos Alano написал:
>
> Interesting. Could you show us what yours "hosts:" line on playbook.yml? 
> On Fri, May 4, 2018 at 10:43 AM Brian Coca > 
> wrote: 
>
> > The `hosts:` keyword is only used to select which hosts get targeted, 
> > it has no influence on group membership, any host is ALWAYS a member 
> > of ALL the groups as defined in inventory, so the variables for a host 
> > always reflect ALL GROUPS. 
>
>
>
>
>
> > -- 
> > -- 
> > Brian Coca 
>
> > -- 
> > 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/CACVha7d8CM6kwVi0ESJdQMNb%3DgkdzQh0eGSg-FcA5p%3DNPOH3_A%40mail.gmail.com
>  
> . 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> Marcos H. Alano 
> Linux System Administrator 
> marcos...@gmail.com  
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ac3d2dba-966d-44f6-bf22-246d9780fb3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Why playbook take wrong values for group variables?

2018-05-04 Thread Олег Боровых
hi Tony,
   i have no files at all:  
 /group_vars/all.yml
 /inventories/group_vars/all.yml
  and i try to put   "hosts: *group_B",  *but it not resole this issue.  
Playbook  apply changes to the servers from right group but, variables  it 
take from neighborhood group_vars/file.  

I have included ANSIBLE_DEBUG , and what i have found:

2018-05-03 15:23:23,663 p=129458 u=user | 129458 1525353803.66336: Loading 
data from /ansible/inventories/prod/group_vars/*group_B.yml* 

2018-05-03 15:23:23,663 p=129458 u=user | 129661 1525353803.66060: in run() 
- task 00505680-eccc-d94e-2b1b-00f4 

2018-05-03 15:23:23,664 p=129458 u=user | 129661 1525353803.66458: calling 
self._execute()

2018-05-03 15:23:23,665 p=129458 u=user | 129458 1525353803.66589: Loading 
data from /ansible/inventories/prod/group_vars/*group_A.yml*

*it is look like on playbook execution ansible scan all files with  
variables in folder group_vars which have variable "var_port", last will 
win.*



вторник, 1 мая 2018 г., 22:35:41 UTC+2 пользователь Tony Chia написал:
>
> Do you have the following files defined?
> /group_vars/group_A.yml
> /group_vars/group_B.yml
> /group_vars/all.yml
> /inventories/group_vars/all.yml
>
> also, maybe try using "hosts: *group_B" in *playbooks/playbook.yml 
> instead of "hosts:*all"*
>
>
> On Sunday, April 29, 2018 at 1:39:59 AM UTC-7, Олег Боровых wrote:
>>
>> Hi,
>> favorite 
>> <https://stackoverflow.com/questions/50084758/why-playbook-take-wrong-values-for-group-variables#>
>>
>> I have a problem with groups variables.
>>
>> Example: I have two inventory groups group_A and group_B, and also have 
>> the same name files in group_vars:
>>
>> inventories/ 
>>hosts.inv
>>  [group_A]
>>server1
>>server2
>>  [group_B]
>>server3
>>server4
>>  group_vars/
>>   group_A - file
>> var_port: 9001
>>   group_B - file
>> var_port: 9002 
>>
>> The problem is when i execute playbook :
>>
>>  ansible-playbook  playbooks/playbook.yml -i inventories/hosts.inv -l 
>> *group_B*
>>
>> playbook was executed for proper scope of servers (server3, server4) but 
>> it takes variables from group variables file group_A.
>>
>> expected result:var_port: 9002
>> in realty : var_port: 9001
>>
>> ansible 2.4.2.0
>>
>>  I can't understand what I am doing wrong?
>>
>> BR Oleg
>>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7ad3a6fe-2d5e-4d48-8454-056959ff6fae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Why playbook take wrong values for group variables?

2018-04-29 Thread Олег Боровых
Hi,
favorite 


I have a problem with groups variables.

Example: I have two inventory groups group_A and group_B, and also have the 
same name files in group_vars:

inventories/ 
   hosts.inv
 [group_A]
   server1
   server2
 [group_B]
   server3
   server4
 group_vars/
  group_A - file
var_port: 9001
  group_B - file
var_port: 9002 

The problem is when i execute playbook :

 ansible-playbook  playbooks/playbook.yml -i inventories/hosts.inv -l *group_B*

playbook was executed for proper scope of servers (server3, server4) but it 
takes variables from group variables file group_A.

expected result:var_port: 9002
in realty : var_port: 9001

ansible 2.4.2.0

 I can't understand what I am doing wrong?

BR Oleg

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/45692a5d-6043-4538-a44f-56aa3bfe8c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.