Re: [ansible-project] Accessing environment variables created inside shell task

2016-07-11 Thread Bence Takács
Custom module for gathering facts for the rescue!
http://docs.ansible.com/ansible/developing_modules.html#module-provided-facts
http://blog.toast38coza.me/custom-ansible-module-hello-world/
http://mcsrainbow.github.io/articles/create-an-ansible-module-and-then-use-module-provided-facts.html

2016. január 29., péntek 18:30:13 UTC+1 időpontban PixelDrift.NET Sam a 
következőt írta:
>
> To add to that, I understand I can use something similar to the following 
> to access a single value:
>
> ---
>
> - hosts: all
>
>  tasks:
>
>- name: Export environment variable
>
>  shell: /usr/local/bin/blackbox && env | grep ^ANIMAL
>
>  register: output
>
>
> But the real scenario is that I may have 5-10 environment variables 
> generated from blackbox and I am looking for a structured way to access 
> them.
>
>
> Thanks again.
>
>
>

-- 
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/cb6296b6-0073-46e9-94a8-2a93548d9732%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Loops and includes

2016-07-08 Thread Bence Takács
Which one is the recommended way, and why?


2016. július 7., csütörtök 13:59:15 UTC+2 időpontban Bence Takács a 
következőt írta:
>
> I think I messed up something :-)
> This way my examples are more easy to understand:
>
> === 1st scenario
>
>
> outside.yaml:
>
> ---
> - include: inside.yaml
>   vars:
> my_outer_item: "{{ item }}"
>   with_items: 
> - A
> - B
> - C
>  
>
> inside.yaml:
>
> ---
> - debug: msg="{{my_outer_item}} with {{ item }} is defined"
>   with_items:
> - 1
> - 2
> - 3
>
>
>
> === 2nd scenario
>
>
> outside.yaml:
>
> ---
> - include: inside.yaml
>   with_items: 
> - A
> - B
> - C
>
> inside.yaml:
>
> ---
> - set_fact
>   my_outer_item={{item}}
>
> - debug: msg="{{my_outer_item}} with {{ item }} is defined"
>   with_items:
> - 1
> - 2
> - 3
>
>
> === 3rd Scenario:
>
> outside.yaml:
>
> ---
> - include: inside.yaml my_outer_item={{item}}
>   with_items: 
> - A
> - B
> - C
>
> inside.yaml:
>
> ---
> - debug: msg="{{my_outer_item}} with {{ item }} is defined"
>   with_items:
> - 1
> - 2
> - 3
>
>
> Sources:
>
> http://docs.ansible.com/ansible/playbooks_loops.html#loops-and-includes-in-2-0
>
> http://stackoverflow.com/questions/30785281/one-loop-over-multiple-ansible-tasks
> https://github.com/ansible/ansible/issues/14146
>
> But it would be good to get some clarification about the differences.
>
>
>
> 2016. július 7., csütörtök 10:04:03 UTC+2 időpontban Bence Takács a 
> következőt írta:
>>
>> What is the difference between the following syntaxes?
>>
>>
>> === 1st scenario
>>
>>
>> outside.yaml:
>>
>> ---
>> - include: inside.yaml
>>   vars:
>> my_inner_item: "{{ item }}"
>>   with_items: 
>> - A
>> - B
>> - C
>>  
>>
>> inside.yaml:
>>
>> ---
>> - debug: msg="{{my_inner_item}} with {{ item }} is defined"
>>   with_items:
>> - 1
>> - 2
>> - 3
>>
>>
>>
>> === 2nd scenario
>>
>>
>> outside.yaml:
>>
>> ---
>> - include: inside.yaml
>>   with_items: 
>> - A
>> - B
>> - C
>>
>> inside.yaml:
>>
>> ---
>> - set_fact
>>   my_inner_item={{item}}
>>
>> - debug: msg="{{my_inner_item}} with {{ item }} is defined"
>>   with_items:
>> - 1
>> - 2
>> - 3
>>
>>
>> === 3rd Scenario:
>>
>> outside.yaml:
>>
>> ---
>> - include: inside.yaml my_inner_item={{item}}
>>   with_items: 
>> - A
>> - B
>> - C
>>
>> inside.yaml:
>>
>> ---
>> - debug: msg="{{my_inner_item}} with {{ item }} is defined"
>>   with_items:
>> - 1
>> - 2
>> - 3
>>
>>
>> ... I do not list the old "loop_control" scenario...
>>
>>
>> By the way: there is an existing issue connected to this topic:
>> https://github.com/ansible/ansible/issues/14146
>>
>

-- 
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/924ceee9-241a-46fa-b302-1cc63a31a0a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Loops and includes

2016-07-07 Thread Bence Takács
I think I messed up something :-)
This way my examples are more easy to understand:

=== 1st scenario


outside.yaml:

---
- include: inside.yaml
  vars:
my_outer_item: "{{ item }}"
  with_items: 
- A
- B
- C
 

inside.yaml:

---
- debug: msg="{{my_outer_item}} with {{ item }} is defined"
  with_items:
- 1
- 2
- 3



=== 2nd scenario


outside.yaml:

---
- include: inside.yaml
  with_items: 
- A
- B
- C

inside.yaml:

---
- set_fact
  my_outer_item={{item}}

- debug: msg="{{my_outer_item}} with {{ item }} is defined"
  with_items:
- 1
- 2
- 3


=== 3rd Scenario:

outside.yaml:

---
- include: inside.yaml my_outer_item={{item}}
  with_items: 
- A
- B
- C

inside.yaml:

---
- debug: msg="{{my_outer_item}} with {{ item }} is defined"
  with_items:
- 1
- 2
- 3


Sources:
http://docs.ansible.com/ansible/playbooks_loops.html#loops-and-includes-in-2-0
http://stackoverflow.com/questions/30785281/one-loop-over-multiple-ansible-tasks
https://github.com/ansible/ansible/issues/14146

But it would be good to get some clarification about the differences.



2016. július 7., csütörtök 10:04:03 UTC+2 időpontban Bence Takács a 
következőt írta:
>
> What is the difference between the following syntaxes?
>
>
> === 1st scenario
>
>
> outside.yaml:
>
> ---
> - include: inside.yaml
>   vars:
> my_inner_item: "{{ item }}"
>   with_items: 
> - A
> - B
> - C
>  
>
> inside.yaml:
>
> ---
> - debug: msg="{{my_inner_item}} with {{ item }} is defined"
>   with_items:
> - 1
> - 2
> - 3
>
>
>
> === 2nd scenario
>
>
> outside.yaml:
>
> ---
> - include: inside.yaml
>   with_items: 
> - A
> - B
> - C
>
> inside.yaml:
>
> ---
> - set_fact
>   my_inner_item={{item}}
>
> - debug: msg="{{my_inner_item}} with {{ item }} is defined"
>   with_items:
> - 1
> - 2
> - 3
>
>
> === 3rd Scenario:
>
> outside.yaml:
>
> ---
> - include: inside.yaml my_inner_item={{item}}
>   with_items: 
> - A
> - B
> - C
>
> inside.yaml:
>
> ---
> - debug: msg="{{my_inner_item}} with {{ item }} is defined"
>   with_items:
> - 1
> - 2
> - 3
>
>
> ... I do not list the old "loop_control" scenario...
>
>
> By the way: there is an existing issue connected to this topic:
> https://github.com/ansible/ansible/issues/14146
>

-- 
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/bf709749-6245-4141-9e48-458386255660%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Loops and includes

2016-07-07 Thread Bence Takács
What is the difference between the following syntaxes?


=== 1st scenario


outside.yaml:

---
- include: inside.yaml
  vars:
my_inner_item: "{{ item }}"
  with_items: 
- A
- B
- C
 

inside.yaml:

---
- debug: msg="{{my_inner_item}} with {{ item }} is defined"
  with_items:
- 1
- 2
- 3



=== 2nd scenario


outside.yaml:

---
- include: inside.yaml
  with_items: 
- A
- B
- C

inside.yaml:

---
- set_fact
  my_inner_item={{item}}

- debug: msg="{{my_inner_item}} with {{ item }} is defined"
  with_items:
- 1
- 2
- 3


=== 3rd Scenario:

outside.yaml:

---
- include: inside.yaml my_inner_item={{item}}
  with_items: 
- A
- B
- C

inside.yaml:

---
- debug: msg="{{my_inner_item}} with {{ item }} is defined"
  with_items:
- 1
- 2
- 3


... I do not list the old "loop_control" scenario...


By the way: there is an existing issue connected to this topic:
https://github.com/ansible/ansible/issues/14146

-- 
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/b32ee9aa-7578-4ade-92e6-0dd2599bb14c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Looping over roles ?

2016-06-22 Thread Bence Takács
I think a permanent solution is needed: many people is looking for that 
feature.
https://groups.google.com/forum/#!topic/ansible-project/B5547FiIhYA
http://phillbarber.blogspot.hu/2015/10/ansibles-for-loops.html

Is that solved in 2.0? 
Or only includes + with_items (but for tasks only not for roles)
... as written here: 
http://stackoverflow.com/questions/30785281/one-loop-over-multiple-ansible-tasks#answer-35128533

Regards:
   Bence

2015. november 27., péntek 13:04:59 UTC+1 időpontban Filias Heidt a 
következőt írta:
>
> In ansible 2.0 include will be possible with with_ -- so that would solve 
> this problem, I guess. 
>
> Am Donnerstag, 26. November 2015 18:46:12 UTC+1 schrieb Co S:
>>
>> I have the dilemma.
>> In my case the list size can vary so the above hack doesn't work.
>>
>> Does Ansible 2.0 solve this problem?
>>
>

-- 
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/4cc809fb-7f93-4ee7-845e-0d6b1c7fc16a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Is there a Docker Compose -like solution for Ansible?

2016-05-03 Thread Bence Takács
I've just that inventory with group hosts and group variables could be 
suitable for storing the description of the environmental layout:
One 'group' could be one 'environment', one 'host' could be one 'host' 
inside the environment, and every related service settings (port, queue, 
etc) could be stored in group variables  

Anybody can suggest a good exmple anywhere to check?

Regards:
   Bence


2016. május 3., kedd 13:31:53 UTC+2 időpontban Bence Takács a következőt 
írta:
>
> Hi
>
> We are mostly using ansible for creating/managing our TEST environments.
> One environment can contain the different types of services/nodes like:
> - web/application server(s)
> - windows services
> - DBs
> - JMS queues
> - etc
>
> The environment layout (the combination of the above types) can differ per 
> project and per environment.
> I would need to orchestrate the creation of an environment. 
> For docker there is Docker compose which describes the layout of an 
> environment, and in Kubernetes Pod templates they also have some kind of 
> descriptors for this.
> But I use good old VMs without containers.
>
> Is there a solution for that using Ansible?
> Roles are not for that, neither inventory (with hosts/groups).
>
> Any idea, how should I organize my scripts to achieve that goal? 
> Or a tool to do that?
>
> Regards:
> Bence
>  
>

-- 
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/e62662c0-69f9-4f2f-8553-924ed09272d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Is there a Docker Compose -like solution for Ansible?

2016-05-03 Thread Bence Takács
Hi

We are mostly using ansible for creating/managing our TEST environments.
One environment can contain the different types of services/nodes like:
- web/application server(s)
- windows services
- DBs
- JMS queues
- etc

The environment layout (the combination of the above types) can differ per 
project and per environment.
I would need to orchestrate the creation of an environment. 
For docker there is Docker compose which describes the layout of an 
environment, and in Kubernetes Pod templates they also have some kind of 
descriptors for this.
But I use good old VMs without containers.

Is there a solution for that using Ansible?
Roles are not for that, neither inventory (with hosts/groups).

Any idea, how should I organize my scripts to achieve that goal? 
Or a tool to do that?

Regards:
Bence
 

-- 
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/c78ce8a9-ac33-4665-87b5-197afcd81c38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: looping over dict elements

2015-11-04 Thread Bence Takács
Thanks, this works!

But in that case I need to put that expression everywhere I want to use 
that variable.

Is there a way to register new object variable while running the playbook?



2015. november 4., szerda 17:34:59 UTC+1 időpontban Matt Martz a következőt 
írta:
>
> Use `from_json` during the "last mile", as the set_fact is casting that 
> output back to a string.
>
> Such as:
>
> {% for env in envs|from_json|dictsort %}
>
>
> and drop `from_json` from your set_fact.  Or just use 
> `external.stdout|from_json|dictsort` where you need it, and don't use 
> set_fact.
>
> On Wed, Nov 4, 2015 at 10:03 AM, Bence Takács  > wrote:
>
>> UPDATE: Python 2.6.6
>>
>>
>> 2015. november 4., szerda 16:46:27 UTC+1 időpontban Bence Takács a 
>> következőt írta:
>>>
>>> I have the following structure:
>>>
>>> "a": {
>>>>  "v1": 1,
>>>>  "v2": "A"
>>>>  }
>>>> "b": {
>>>>  "v1": 2,
>>>>  "v2": "B"
>>>> }
>>>>
>>>
>>> It is read from an external json source using:
>>>
>>>> - set_fact: envs="{{ external.stdout | from_json }}"
>>>>
>>>>  
>>> I can loop/iterate over it only by using with_dict:
>>>
>>> - debug: msg="Item is {{ item.key }} with value {{ item.value.v1}} and{{ 
>>> item.value.v2}}"
>>>>   with_dict: envs
>>>>
>>>>
>>> but if I try anything else it throws exception:
>>>
>>> AttributeError: 'unicode' object has no attribute 'items'
>>>>
>>>
>>> I tried the following:
>>>
>>>> - set_fact: envs_list="{{ envs | dictsort }}"
>>>>
>>>>
>>> and:
>>>
>>>> - debug: var=item
>>>>   with_items: envs.items()
>>>>
>>>>
>>> and inside template:
>>>
>>>> {% for env in envs|dictsort %}
>>>>
>>>>
>>> and:
>>>
>>>> {% for env, setting in envs.iteritems() %}
>>>>
>>>>
>>> ...with the same result.
>>>
>>> I would  need to use that structure inside a template...
>>>
>>> I'm using ansible 1.9.1 on CentOS 6
>>>
>>> Any idea how to solve that?
>>>
>> -- 
>> 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/4dd854c0-f9e9-4ec1-80f1-6ad4548151f4%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/4dd854c0-f9e9-4ec1-80f1-6ad4548151f4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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/0189e281-f15c-4333-9d37-40df14ef8d2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: looping over dict elements

2015-11-04 Thread Bence Takács
UPDATE: Python 2.6.6

2015. november 4., szerda 16:46:27 UTC+1 időpontban Bence Takács a 
következőt írta:
>
> I have the following structure:
>
> "a": {
>>  "v1": 1,
>>  "v2": "A"
>>  }
>> "b": {
>>  "v1": 2,
>>  "v2": "B"
>> }
>>
>
> It is read from an external json source using:
>
>> - set_fact: envs="{{ external.stdout | from_json }}"
>>
>>  
> I can loop/iterate over it only by using with_dict:
>
> - debug: msg="Item is {{ item.key }} with value {{ item.value.v1}} and{{ 
> item.value.v2}}"
>>   with_dict: envs
>>
>>
> but if I try anything else it throws exception:
>
> AttributeError: 'unicode' object has no attribute 'items'
>>
>
> I tried the following:
>
>> - set_fact: envs_list="{{ envs | dictsort }}"
>>
>>
> and:
>
>> - debug: var=item
>>   with_items: envs.items()
>>
>>
> and inside template:
>
>> {% for env in envs|dictsort %}
>>
>>
> and:
>
>> {% for env, setting in envs.iteritems() %}
>>
>>
> ...with the same result.
>
> I would  need to use that structure inside a template...
>
> I'm using ansible 1.9.1 on CentOS 6
>
> Any idea how to solve that?
>

-- 
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/4dd854c0-f9e9-4ec1-80f1-6ad4548151f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] looping over dict elements

2015-11-04 Thread Bence Takács
I have the following structure:

"a": {
>  "v1": 1,
>  "v2": "A"
>  }
> "b": {
>  "v1": 2,
>  "v2": "B"
> }
>

It is read from an external json source using:

> - set_fact: envs="{{ external.stdout | from_json }}"
>
>  
I can loop/iterate over it only by using with_dict:

- debug: msg="Item is {{ item.key }} with value {{ item.value.v1}} and{{ 
item.value.v2}}"
>   with_dict: envs
>
>
but if I try anything else it throws exception:

AttributeError: 'unicode' object has no attribute 'items'
>

I tried the following:

> - set_fact: envs_list="{{ envs | dictsort }}"
>
>
and:

> - debug: var=item
>   with_items: envs.items()
>
>
and inside template:

> {% for env in envs|dictsort %}
>
>
and:

> {% for env, setting in envs.iteritems() %}
>
>
...with the same result.

I would  need to use that structure inside a template...

I'm using ansible 1.9.1 on CentOS 6

Any idea how to solve that?

-- 
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/df89ec91-02aa-4db0-b3a0-d56b61f96561%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible to manipulate dynamic inventory

2015-10-19 Thread Bence Takács
Upon running some tasks I need to manipulate Ansible host variables.

I created a dynamic inventory script that could support thata functionality 
and then I stucked:
- inventory modules support only add_host which works only in-memory
- I see no sign that ansible is capable of doing this: everything points to 
inventory providers like Tower, EC2, vagrant and Cobbler
- I found one suggestion to handle inventory manipulation outside ansible 

I can create a solution that could handle the new parameters in-memory and 
then call my inventory script and update it at the end of playbook run. But 
I'm thinking: is it so weird idea?
Why haven't it designed this way? Or am I missing something?



-- 
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/ec8cb47c-40a9-4bb0-b23f-54247de17aca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Switching user in playbook

2015-06-01 Thread Bence Takács
Hmmm... I cannot solve the issue, but now instead of using ssh agent I just 
set up my ~/.ssh/config correctly - and workining fine



2015. június 1., hétfő 9:51:05 UTC+2 időpontban Bence Takács a következőt 
írta:
>
> Thanks, Brian
>
> With ssh-agent I reduced my 'hosts' file radically, and removed the 
> 'ansible_ssh_private_key_file' declarations from the plays.
>
> But I still cannot use the 'remote_user' in plays, instead I need to add 
> the 'ansible_ssh_user' variable.
>
> This is my first cygwin-related issue with ansible.
>
> Regards:
>Bence
>
> 2015. május 30., szombat 3:10:21 UTC+2 időpontban Brian Coca a következőt 
> írta:
>>
>> Probably a combination of issues, there is some success running 
>> ansible on cygwin but also many problems, this is not a supported 
>> platform 
>>
>> On Fri, May 29, 2015 at 9:08 PM, Bence Takács  
>> wrote: 
>> > Well, actually it's Windows with babun (cygwin) and python 2.7.x 
>> > Do you think this is because of the OS? 
>> > 
>> > SSH agent? Is hat work for private keys too? Or just for passwords? I 
>> > suspects that more than the OS 
>> > 
>> > Regards: 
>> >Bence 
>> > 
>> > 2015.05.29. 20:40 ezt írta ("Brian Coca" ): 
>> >> 
>> >> i use an ssh agent 
>> >> 
>> >> On Fri, May 29, 2015 at 1:43 PM, Bence Takács  
>> >> wrote: 
>> >> > ... but where do you store the alternative user's credentials? 
>> >> > 
>> >> > 2015.05.29. 19:27 ezt írta ("Brian Coca" ): 
>> >> >> 
>> >> >> what version of ansible? os? python? 
>> >> >> 
>> >> >> switching users seems to be working fine for me. 
>> >> >> 
>> >> >> On Fri, May 29, 2015 at 12:37 PM, Bence Takács  
>>
>> >> >> wrote: 
>> >> >> > One question and one issue: 
>> >> >> > 
>> >> >> > 1. question (above): 
>> >> >> > How can I set the credentials for alternative user? 
>> >> >> > 
>> >> >> > 2. issue: 
>> >> >> > playbook: 
>> >> >> >> 
>> >> >> >> - name: Preparation 
>> >> >> >> 
>> >> >> >>   remote_user: root 
>> >> >> >> 
>> >> >> >>   vars: 
>> >> >> >> - ansible_ssh_private_key_file: ~/.ssh/site-root 
>> >> >> >>   ... 
>> >> >> >> 
>> >> >> >> - name: Main play 
>> >> >> >> 
>> >> >> >>   remote_user: ci 
>> >> >> >> 
>> >> >> >>   ... 
>> >> >> > 
>> >> >> > Does not work: 'Main play' will be executed as root user 
>> >> >> > 
>> >> >> > If I put the following at the end: 
>> >> >> >> 
>> >> >> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci 
>> >> >> > 
>> >> >> > 
>> >> >> > ...then I get the following error: 
>> >> >> >> 
>> >> >> >> SSH Error: Permission denied 
>> >> >> >> (publickey,gssapi-keyex,gssapi-with-mic,password). 
>> >> >> > 
>> >> >> > 
>> >> >> > So root user is stucked somehow... and one cannot authenticate 
>> root 
>> >> >> > with 
>> >> >> > ci's key. 
>> >> >> > 
>> >> >> > Regards: 
>> >> >> >Bence 
>> >> >> > 
>> >> >> > 
>> >> >> > 2015. május 29., péntek 18:15:19 UTC+2 időpontban Bence Takács a 
>> >> >> > következőt 
>> >> >> > írta: 
>> >> >> >> 
>> >> >> >> Thanks for the tip, but how can I set the credentials for 
>> >> >> >> alternative 
>> >> >> >> user? 
>> >> >> >> 
>> >> >> >> Now I have only one user set in hosts file: 
>> >> >> >> 
>> >> >> >>> ansible-sandbox ansible_ssh_host=ansible-sandbox.local 
>> >> >> >>> ans

Re: [ansible-project] Switching user in playbook

2015-06-01 Thread Bence Takács
Thanks, Brian

With ssh-agent I reduced my 'hosts' file radically, and removed the 
'ansible_ssh_private_key_file' declarations from the plays.

But I still cannot use the 'remote_user' in plays, instead I need to add 
the 'ansible_ssh_user' variable.

This is my first cygwin-related issue with ansible.

Regards:
   Bence

2015. május 30., szombat 3:10:21 UTC+2 időpontban Brian Coca a következőt 
írta:
>
> Probably a combination of issues, there is some success running 
> ansible on cygwin but also many problems, this is not a supported 
> platform 
>
> On Fri, May 29, 2015 at 9:08 PM, Bence Takács  > wrote: 
> > Well, actually it's Windows with babun (cygwin) and python 2.7.x 
> > Do you think this is because of the OS? 
> > 
> > SSH agent? Is hat work for private keys too? Or just for passwords? I 
> > suspects that more than the OS 
> > 
> > Regards: 
> >Bence 
> > 
> > 2015.05.29. 20:40 ezt írta ("Brian Coca"  >): 
> >> 
> >> i use an ssh agent 
> >> 
> >> On Fri, May 29, 2015 at 1:43 PM, Bence Takács  > 
> >> wrote: 
> >> > ... but where do you store the alternative user's credentials? 
> >> > 
> >> > 2015.05.29. 19:27 ezt írta ("Brian Coca"  >): 
> >> >> 
> >> >> what version of ansible? os? python? 
> >> >> 
> >> >> switching users seems to be working fine for me. 
> >> >> 
> >> >> On Fri, May 29, 2015 at 12:37 PM, Bence Takács  > 
> >> >> wrote: 
> >> >> > One question and one issue: 
> >> >> > 
> >> >> > 1. question (above): 
> >> >> > How can I set the credentials for alternative user? 
> >> >> > 
> >> >> > 2. issue: 
> >> >> > playbook: 
> >> >> >> 
> >> >> >> - name: Preparation 
> >> >> >> 
> >> >> >>   remote_user: root 
> >> >> >> 
> >> >> >>   vars: 
> >> >> >> - ansible_ssh_private_key_file: ~/.ssh/site-root 
> >> >> >>   ... 
> >> >> >> 
> >> >> >> - name: Main play 
> >> >> >> 
> >> >> >>   remote_user: ci 
> >> >> >> 
> >> >> >>   ... 
> >> >> > 
> >> >> > Does not work: 'Main play' will be executed as root user 
> >> >> > 
> >> >> > If I put the following at the end: 
> >> >> >> 
> >> >> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci 
> >> >> > 
> >> >> > 
> >> >> > ...then I get the following error: 
> >> >> >> 
> >> >> >> SSH Error: Permission denied 
> >> >> >> (publickey,gssapi-keyex,gssapi-with-mic,password). 
> >> >> > 
> >> >> > 
> >> >> > So root user is stucked somehow... and one cannot authenticate 
> root 
> >> >> > with 
> >> >> > ci's key. 
> >> >> > 
> >> >> > Regards: 
> >> >> >Bence 
> >> >> > 
> >> >> > 
> >> >> > 2015. május 29., péntek 18:15:19 UTC+2 időpontban Bence Takács a 
> >> >> > következőt 
> >> >> > írta: 
> >> >> >> 
> >> >> >> Thanks for the tip, but how can I set the credentials for 
> >> >> >> alternative 
> >> >> >> user? 
> >> >> >> 
> >> >> >> Now I have only one user set in hosts file: 
> >> >> >> 
> >> >> >>> ansible-sandbox ansible_ssh_host=ansible-sandbox.local 
> >> >> >>> ansible_ssh_user=ci ansible_ssh_private_key_file=~/.ssh/ci 
> >> >> >> 
> >> >> >> 
> >> >> >> 
> >> >> >> 2015. május 29., péntek 17:56:28 UTC+2 időpontban Brian Coca a 
> >> >> >> következőt 
> >> >> >> írta: 
> >> >> >>> 
> >> >> >>> the remote_user: directive can be used at play and task level to 
> >> >> >>> change this, no need to use vars: unless your hosts have those 
> set 
> >> >> >>> in 
> >> >&g

Re: [ansible-project] Switching user in playbook

2015-05-29 Thread Bence Takács
Well, actually it's Windows with babun (cygwin) and python 2.7.x
Do you think this is because of the OS?

SSH agent? Is hat work for private keys too? Or just for passwords? I
suspects that more than the OS

Regards:
   Bence
2015.05.29. 20:40 ezt írta ("Brian Coca" ):

> i use an ssh agent
>
> On Fri, May 29, 2015 at 1:43 PM, Bence Takács 
> wrote:
> > ... but where do you store the alternative user's credentials?
> >
> > 2015.05.29. 19:27 ezt írta ("Brian Coca" ):
> >>
> >> what version of ansible? os? python?
> >>
> >> switching users seems to be working fine for me.
> >>
> >> On Fri, May 29, 2015 at 12:37 PM, Bence Takács 
> >> wrote:
> >> > One question and one issue:
> >> >
> >> > 1. question (above):
> >> > How can I set the credentials for alternative user?
> >> >
> >> > 2. issue:
> >> > playbook:
> >> >>
> >> >> - name: Preparation
> >> >>
> >> >>   remote_user: root
> >> >>
> >> >>   vars:
> >> >> - ansible_ssh_private_key_file: ~/.ssh/site-root
> >> >>   ...
> >> >>
> >> >> - name: Main play
> >> >>
> >> >>   remote_user: ci
> >> >>
> >> >>   ...
> >> >
> >> > Does not work: 'Main play' will be executed as root user
> >> >
> >> > If I put the following at the end:
> >> >>
> >> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci
> >> >
> >> >
> >> > ...then I get the following error:
> >> >>
> >> >> SSH Error: Permission denied
> >> >> (publickey,gssapi-keyex,gssapi-with-mic,password).
> >> >
> >> >
> >> > So root user is stucked somehow... and one cannot authenticate root
> with
> >> > ci's key.
> >> >
> >> > Regards:
> >> >Bence
> >> >
> >> >
> >> > 2015. május 29., péntek 18:15:19 UTC+2 időpontban Bence Takács a
> >> > következőt
> >> > írta:
> >> >>
> >> >> Thanks for the tip, but how can I set the credentials for alternative
> >> >> user?
> >> >>
> >> >> Now I have only one user set in hosts file:
> >> >>
> >> >>> ansible-sandbox ansible_ssh_host=ansible-sandbox.local
> >> >>> ansible_ssh_user=ci ansible_ssh_private_key_file=~/.ssh/ci
> >> >>
> >> >>
> >> >>
> >> >> 2015. május 29., péntek 17:56:28 UTC+2 időpontban Brian Coca a
> >> >> következőt
> >> >> írta:
> >> >>>
> >> >>> the remote_user: directive can be used at play and task level to
> >> >>> change this, no need to use vars: unless your hosts have those set
> in
> >> >>> inventory (which overrides remote_user).
> >> >>>
> >> >>> On Fri, May 29, 2015 at 10:00 AM, Bence Takács  >
> >> >>> wrote:
> >> >>> > I need to switch users in a playbook: first I need to do some
> tasks
> >> >>> > as
> >> >>> > a
> >> >>> > root user then I need to change to a limited user and do the rest
> >> >>> > with
> >> >>> > that.
> >> >>> >
> >> >>> > My playbook looks like this:
> >> >>> >>
> >> >>> >> - name: Preparation
> >> >>> >>   vars:
> >> >>> >> - ansible_ssh_user: root
> >> >>> >> - ansible_ssh_private_key_file: ~/.ssh/site-root
> >> >>> >>   ...
> >> >>> >>
> >> >>> >> - name: Main play
> >> >>> >>   vars:
> >> >>> >> - ansible_ssh_user: ci
> >> >>> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci
> >> >>> >>
> >> >>> >>   ...
> >> >>> >
> >> >>> >
> >> >>> > This works but I feel that nasty (poor design):
> >> >>> > - redundant configuration (in hosts and 2 plays)
> >> >>> > - need to switch and then switch back
> >> >>> >
> >> >>> >

Re: [ansible-project] Switching user in playbook

2015-05-29 Thread Bence Takács
... but where do you store the alternative user's credentials?
2015.05.29. 19:27 ezt írta ("Brian Coca" ):

> what version of ansible? os? python?
>
> switching users seems to be working fine for me.
>
> On Fri, May 29, 2015 at 12:37 PM, Bence Takács 
> wrote:
> > One question and one issue:
> >
> > 1. question (above):
> > How can I set the credentials for alternative user?
> >
> > 2. issue:
> > playbook:
> >>
> >> - name: Preparation
> >>
> >>   remote_user: root
> >>
> >>   vars:
> >> - ansible_ssh_private_key_file: ~/.ssh/site-root
> >>   ...
> >>
> >> - name: Main play
> >>
> >>   remote_user: ci
> >>
> >>   ...
> >
> > Does not work: 'Main play' will be executed as root user
> >
> > If I put the following at the end:
> >>
> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci
> >
> >
> > ...then I get the following error:
> >>
> >> SSH Error: Permission denied
> >> (publickey,gssapi-keyex,gssapi-with-mic,password).
> >
> >
> > So root user is stucked somehow... and one cannot authenticate root with
> > ci's key.
> >
> > Regards:
> >Bence
> >
> >
> > 2015. május 29., péntek 18:15:19 UTC+2 időpontban Bence Takács a
> következőt
> > írta:
> >>
> >> Thanks for the tip, but how can I set the credentials for alternative
> >> user?
> >>
> >> Now I have only one user set in hosts file:
> >>
> >>> ansible-sandbox ansible_ssh_host=ansible-sandbox.local
> >>> ansible_ssh_user=ci ansible_ssh_private_key_file=~/.ssh/ci
> >>
> >>
> >>
> >> 2015. május 29., péntek 17:56:28 UTC+2 időpontban Brian Coca a
> következőt
> >> írta:
> >>>
> >>> the remote_user: directive can be used at play and task level to
> >>> change this, no need to use vars: unless your hosts have those set in
> >>> inventory (which overrides remote_user).
> >>>
> >>> On Fri, May 29, 2015 at 10:00 AM, Bence Takács 
> >>> wrote:
> >>> > I need to switch users in a playbook: first I need to do some tasks
> as
> >>> > a
> >>> > root user then I need to change to a limited user and do the rest
> with
> >>> > that.
> >>> >
> >>> > My playbook looks like this:
> >>> >>
> >>> >> - name: Preparation
> >>> >>   vars:
> >>> >> - ansible_ssh_user: root
> >>> >> - ansible_ssh_private_key_file: ~/.ssh/site-root
> >>> >>   ...
> >>> >>
> >>> >> - name: Main play
> >>> >>   vars:
> >>> >> - ansible_ssh_user: ci
> >>> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci
> >>> >>
> >>> >>   ...
> >>> >
> >>> >
> >>> > This works but I feel that nasty (poor design):
> >>> > - redundant configuration (in hosts and 2 plays)
> >>> > - need to switch and then switch back
> >>> >
> >>> > What is the Best practice to achieve that?
> >>> >
> >>> > --
> >>> > 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/f7a68ea4-c6a6-43e6-b415-f6d367cdb199%40googlegroups.com
> .
> >>> > For more options, visit https://groups.google.com/d/optout.
> >>>
> >>>
> >>>
> >>> --
> >>> 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-project+unsubscr...@googlegroups.com.
> > To post to this group, send email to ansible-project@googlegroups.com.
> > To view this discussion on the w

Re: [ansible-project] Switching user in playbook

2015-05-29 Thread Bence Takács
One question and one issue:

1. question (above):
How can I set the credentials for alternative user?

2. issue:
playbook:

> - name: Preparation
>
  remote_user: root 
>
  vars: 
> - ansible_ssh_private_key_file: ~/.ssh/site-root
>   ...
> 
> - name: Main play
>
  remote_user: ci
>
  ...
>
Does not work: 'Main play' will be executed as root user 

If I put the following at the end:

> - ansible_ssh_private_key_file: ~/.ssh/site-ci
>

...then I get the following error:

> SSH Error: Permission denied 
> (publickey,gssapi-keyex,gssapi-with-mic,password).
>

So root user is stucked somehow... and one cannot authenticate root with 
ci's key.

Regards:
   Bence

2015. május 29., péntek 18:15:19 UTC+2 időpontban Bence Takács a következőt 
írta:
>
> Thanks for the tip, but how can I set the credentials for alternative user?
>
> Now I have only one user set in hosts file:
>
> ansible-sandbox ansible_ssh_host=ansible-sandbox.local ansible_ssh_user=ci 
>> ansible_ssh_private_key_file=~/.ssh/ci
>>
>
>
> 2015. május 29., péntek 17:56:28 UTC+2 időpontban Brian Coca a következőt 
> írta:
>>
>> the remote_user: directive can be used at play and task level to 
>> change this, no need to use vars: unless your hosts have those set in 
>> inventory (which overrides remote_user). 
>>
>> On Fri, May 29, 2015 at 10:00 AM, Bence Takács  
>> wrote: 
>> > I need to switch users in a playbook: first I need to do some tasks as 
>> a 
>> > root user then I need to change to a limited user and do the rest with 
>> that. 
>> > 
>> > My playbook looks like this: 
>> >> 
>> >> - name: Preparation 
>> >>   vars: 
>> >> - ansible_ssh_user: root 
>> >> - ansible_ssh_private_key_file: ~/.ssh/site-root 
>> >>   ... 
>> >> 
>> >> - name: Main play 
>> >>   vars: 
>> >> - ansible_ssh_user: ci 
>> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci 
>> >> 
>> >>   ... 
>> > 
>> > 
>> > This works but I feel that nasty (poor design): 
>> > - redundant configuration (in hosts and 2 plays) 
>> > - need to switch and then switch back 
>> > 
>> > What is the Best practice to achieve that? 
>> > 
>> > -- 
>> > 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/f7a68ea4-c6a6-43e6-b415-f6d367cdb199%40googlegroups.com.
>>  
>>
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>
>>
>> -- 
>> 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-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/ad7e0252-a2ed-49f5-9ea9-e026956e5c0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Switching user in playbook

2015-05-29 Thread Bence Takács
Thanks for the tip, but how can I set the credentials for alternative user?

Now I have only one user set in hosts file:

ansible-sandbox ansible_ssh_host=ansible-sandbox.local ansible_ssh_user=ci 
> ansible_ssh_private_key_file=~/.ssh/ci
>


2015. május 29., péntek 17:56:28 UTC+2 időpontban Brian Coca a következőt 
írta:
>
> the remote_user: directive can be used at play and task level to 
> change this, no need to use vars: unless your hosts have those set in 
> inventory (which overrides remote_user). 
>
> On Fri, May 29, 2015 at 10:00 AM, Bence Takács  > wrote: 
> > I need to switch users in a playbook: first I need to do some tasks as a 
> > root user then I need to change to a limited user and do the rest with 
> that. 
> > 
> > My playbook looks like this: 
> >> 
> >> - name: Preparation 
> >>   vars: 
> >> - ansible_ssh_user: root 
> >> - ansible_ssh_private_key_file: ~/.ssh/site-root 
> >>   ... 
> >> 
> >> - name: Main play 
> >>   vars: 
> >> - ansible_ssh_user: ci 
> >> - ansible_ssh_private_key_file: ~/.ssh/site-ci 
> >> 
> >>   ... 
> > 
> > 
> > This works but I feel that nasty (poor design): 
> > - redundant configuration (in hosts and 2 plays) 
> > - need to switch and then switch back 
> > 
> > What is the Best practice to achieve that? 
> > 
> > -- 
> > 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/f7a68ea4-c6a6-43e6-b415-f6d367cdb199%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> 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-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/84fda7d8-8516-4e6f-b17f-47308764542f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Where to store global defaults?

2015-05-29 Thread Bence Takács
First I tried to put that into *hosts *file, but did not work:

[all:vars]
>
nexus_url=... 
>
app_dir=/opt
>
...but did not work

Then I came up with the following solution:
*group_vars/all*:

> ---
>
nexus_url: ... 
>
app_dir: /opt
>

And it is working and seems to be a clean colution for me

Regards:
   Bence

2015. május 29., péntek 15:43:12 UTC+2 időpontban Bence Takács a következőt 
írta:
>
> Hi, All
>
> Where should I store my global variables? Like company artifact repository 
> url, application directory (/opt), etc?
>
> Is there a proper place to put that?
>
> I was thinking about ansible.cfg but this would be overkill.
> It's not for hosts, not for groups, not for playbooks...
>
> Regards:
>Bence
>

-- 
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/bc611de9-1945-4be4-bfb6-88ea9579332e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Switching user in playbook

2015-05-29 Thread Bence Takács
I need to switch users in a playbook: first I need to do some tasks as a 
root user then I need to change to a limited user and do the rest with that.

My playbook looks like this:

> - name: Preparation
>   vars: 
> - ansible_ssh_user: root
> - ansible_ssh_private_key_file: ~/.ssh/site-root
>   ...
> 
> - name: Main play
>   vars: 
> - ansible_ssh_user: ci
> - ansible_ssh_private_key_file: ~/.ssh/site-ci
>
  ... 
>

This works but I feel that nasty (poor design):
- redundant configuration (in hosts and 2 plays)
- need to switch and then switch back

What is the Best practice to achieve that?

-- 
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/f7a68ea4-c6a6-43e6-b415-f6d367cdb199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Where to store global defaults?

2015-05-29 Thread Bence Takács
Hi, All

Where should I store my global variables? Like company artifact repository 
url, application directory (/opt), etc?

Is there a proper place to put that?

I was thinking about ansible.cfg but this would be overkill.
It's not for hosts, not for groups, not for playbooks...

Regards:
   Bence

-- 
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/c374697b-224b-4dce-a038-5c7bd6dceb1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] register shell output, set as custom fact and use it as a condition of the playbook running

2015-03-16 Thread Bence Takács
Let me highlight the solution for the posterity :-)

If you want to register a variable based on a shell script:

- name: Register git version that is installed on system
>   shell: git --version | sed 's/git\ version\ //g'
>   register: git_version_output
>   tags: register
>

You expect that the variable will store the output of the script. But this 
is not the case
This wil store a dict/struct that stores many things: 
the script itself, the timestamp of run, the exit value, etc

So if you are interested on simply the output itself, you need to address 
it like:

- name: Dump git_installed_version to file
>   debug: msg="success"
>   when: *git_version_output.stdout* == {{ git_version }}
>   tags: dump
>

Regards:
   Bence



2015. március 13., péntek 14:37:06 UTC+1 időpontban Chris Short a 
következőt írta:
>
> First facepalm of the day recorded at 9:35 AM. Thank you, Brian.
>

-- 
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/bb76b6d5-e789-48d9-917c-e461fcf47d46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Conditions based on dict (environmental variable)

2015-03-11 Thread Bence Takács
If I check a remote dict item (inside a role/playbook), that may not be 
present like:

debug msg="JAVA_HOME= {{ ansible_env.JAVA_HOME }} "


Then I get the following exception:

> TASK: [java-noinstall | debug msg="JAVA_HOME= {{ ansible_env.JAVA_HOME }} 
> "] ***
> fatal: [vm] => One or more undefined variables: 'dict object' has no 
> attribute 'JAVA_HOME'
>
> FATAL: all hosts have already failed -- aborting
>

I have two workarounds:

1. create a computed variable in /vars/main.yaml:

> ---
> actual_java_home: "{{ ansible_env.JAVA_HOME if ('JAVA_HOME' in 
> ansible_env) else ''}}"
>

...and use that instead as a condition inside the role/playbook:

debug msg="JAVA_HOME= {{ actual_java_home }} "


2. check once and then register a new variable based on the result:

- name: First conditional task
>   when: {{ ansible_env.JAVA_HOME if ('JAVA_HOME' in ansible_env) else ''}}
>   register: change_it
>
  action: ... 
>
 
>
 - name: Second conditional task
>when: not change_it|skipped
>
   action: ... 
>

Is there a better solution for that? Or those are the best practices?

-- 
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/00391449-407f-46b7-b855-0847fc3f599c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Conditinals based on remote facts

2015-03-10 Thread Bence Takács
THanks, it do work using that:

- name: Check Java Version
>   shell: $JAVA_HOME/bin/java -version 2>&1 | grep 'java version' | awk '{ 
> print substr($3, 2, length($3)-2); }'
>   register: actual_java_version
>   changed_when: FALSE
>

result:

PLAY [vm] 
> *
>
> GATHERING FACTS 
> ***
> ok: [vm]
>
> TASK: [java-noinstall | Check Java Version] 
> ***
> ok: [vm]
>
>

2015. március 10., kedd 15:17:34 UTC+1 időpontban Brian Coca a következőt 
írta:
>
> shell/command module actions are considered changed by default as 
> ansible has no way to know what transpired, there are several ways to 
> tell ansible, in your case i recommend adding the changed_when: 
> directive. 
>
>
>
> -- 
> 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-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/39880aac-17ea-4e0c-91da-74368a21cf71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Conditinals based on remote facts

2015-03-10 Thread Bence Takács
 

I created my custom facts file

/etc/ansible/facts.dcustom_facts.fact

> #!/bin/bash
> JAVA_VERSION=`"$JAVA_HOME/bin/java" -version  2>&1 | awk '/java version/{ 
> print substr($3, 2, length($3)-2); }'`
>
> cat < {
>   "java_version" : "$JAVA_VERSION"
> }
> EOF
>

If I run it on the control machine, everything is ok:
{
"java_version" : "1.7.0_45"
}

But if I run it on the remote machine:

> ansible -m setup vm | grep 'java_version' 
>
then it is not populated. Only the ordinary ansible_facts are present, my 
java_version is not there.
It's the same if I declares the fact_path:

> ansible -m setup vm -a 'fact_path=/etc/ansible/facts.d' | grep 
> 'java_version'


I'm using ansible version 1.8.2

Any tips?




2015. március 10., kedd 13:02:33 UTC+1 időpontban Bence Takács a következőt 
írta:
>
> Hi
>
> I would need to run tasks based on a remote fact - by executing a script 
> to extract the actual variable. Currently I'm doing it in the following way:
>
> - name: Check Java Version
>>
>> *  shell: $JAVA_HOME/bin/java -version 2>&1 | grep 'java version' | awk 
>> '{ print substr($3, 2, length($3)-2); }'  register: actual_java_version*
>>   
>> - name: Do Something based on Java version
>>   when: *actual_java_version.stdout* != ...
>>
>  
> Every time I run this script it says:
>
> PLAY [vm] 
>> *
>>
>> GATHERING FACTS 
>> ***
>> ok: [vm]
>>
>> TASK: [java-noinstall | Check Java Version] 
>> ***
>> *changed: [vm]*
>>
>
> Which is not the desired behaviour. Ansible should not consider that as a 
> 'change'.
> Additionally it stores the whole context into that 'actual_java_version' 
> variable (the script itself, the timestamp, wheter it was ok, etc...) and 
> if I need the actual result I need to address it like 
> 'actual_java_version.stdout'.
> So all-in-all this is not a clean solution from my point of view.
> What could I do?
>
> The most clean way would be to collect that information in the GATHERING 
> FACTS phase as it is done for e.g. $JAVA_HOME:
>
>> ansible_env.JAVA_HOME
>
> ...but for that I would need to create a new module just for that custom 
> fact (http://serverascode.com/2015/01/27/ansible-custom-facts.html).
>
> set_fact does not help me, since it just creates a new variable out of it 
> with extended scope (to "survive between plays").
>
> Is there a quick solution like considering my TASK always OK?
> Is there a clean solution without creating a new module for my custom fact?
>
> Regards:
>Bence
>

-- 
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/559fe88f-03c7-4f42-8106-32eff1c0031b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Conditinals based on remote facts

2015-03-10 Thread Bence Takács
Hi

I would need to run tasks based on a remote fact - by executing a script to 
extract the actual variable. Currently I'm doing it in the following way:

- name: Check Java Version
>
> *  shell: $JAVA_HOME/bin/java -version 2>&1 | grep 'java version' | awk '{ 
> print substr($3, 2, length($3)-2); }'  register: actual_java_version*
>   
> - name: Do Something based on Java version
>   when: *actual_java_version.stdout* != ...
>
 
Every time I run this script it says:

PLAY [vm] 
> *
>
> GATHERING FACTS 
> ***
> ok: [vm]
>
> TASK: [java-noinstall | Check Java Version] 
> ***
> *changed: [vm]*
>

Which is not the desired behaviour. Ansible should not consider that as a 
'change'.
Additionally it stores the whole context into that 'actual_java_version' 
variable (the script itself, the timestamp, wheter it was ok, etc...) and 
if I need the actual result I need to address it like 
'actual_java_version.stdout'.
So all-in-all this is not a clean solution from my point of view.
What could I do?

The most clean way would be to collect that information in the GATHERING 
FACTS phase as it is done for e.g. $JAVA_HOME:

> ansible_env.JAVA_HOME

...but for that I would need to create a new module just for that custom 
fact (http://serverascode.com/2015/01/27/ansible-custom-facts.html).

set_fact does not help me, since it just creates a new variable out of it 
with extended scope (to "survive between plays").

Is there a quick solution like considering my TASK always OK?
Is there a clean solution without creating a new module for my custom fact?

Regards:
   Bence

-- 
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/561b08a3-c2d3-4dc2-bdf8-99dbd9d594c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] managing multi-node environments

2015-02-23 Thread Bence Takács
Here is a detailed description of my original idea:
http://rosstuck.com/multistage-environments-with-ansible/
It seems that the concept was not obvious for others either. But afer a
little digging they come up with the same concept... ;-)

Regards:
Bence

On Thu, Dec 25, 2014 at 5:17 PM, Bence Takács 
wrote:

> I found that:
>
> http://stackoverflow.com/questions/18195142/safely-limiting-ansible-playbooks-to-a-single-machine
>
> 2014. december 25., csütörtök 16:41:17 UTC+1 időpontban Bence Takács a
> következőt írta:
>
>> Thanks, Brian
>>
>> ...and what if i just don't want to declare it in the playbook?
>> Can I make the environment a parameter for the playbook?
>>
>> hosts: "databases:&{{env}}"
>>
>>
>> or when calling the playbook:
>>
>> ansible-playbook example.yml --limit test1
>>
>>
>>
>> Regards:
>>   Bence
>>
>> 2014. december 23., kedd 13:35:07 UTC+1 időpontban Brian Coca a
>> következőt írta:
>>>
>>> hosts: databases:&test1
>>>
>>> ^ will make the playbook target only hosts that exist in both groups
>>> http://docs.ansible.com/intro_patterns.html#patterns
>>>
>>> On Mon, Dec 22, 2014 at 10:22 PM, Bence Takács 
>>> wrote:
>>> >
>>> > I have environments that contain different nodes of different
>>> roles/types
>>> > like: databases, webservers, load-balancers.
>>> > Sometimes I need to call every server of the same role/type, but
>>> sometimes I
>>> > need to address an environment.
>>> >
>>> > e.g.:
>>> >>
>>> >> [databases]
>>> >> test1.db.my.com  ansible_ssh_host=192.168.1.200
>>>  ansible_ssh_user=...
>>> >> test2.db.my.com   ansible_ssh_host=192.168.1.201
>>>  ansible_ssh_user=...
>>> >>
>>> >> [webservers]
>>> >> test1.web.my.com   ansible_ssh_host=192.168.1.300
>>>  ansible_ssh_user=...
>>> >> test2.web.my.com  ansible_ssh_host=192.168.1.301
>>>  ansible_ssh_user=...
>>> >>
>>> >> [load-balancers]
>>> >> test1.lb.my.com  ansible_ssh_host=192.168.1.400
>>>  ansible_ssh_user=...
>>> >> test2.lb.my.com  ansible_ssh_host=192.168.1.401
>>>  ansible_ssh_user=...
>>> >>
>>> >> [test1]
>>> >> test1.db.my.com
>>> >> test1.web.my.com
>>> >> test1.lb.my.com
>>> >>
>>> >> [test2]
>>> >> test2.db.my.com
>>> >> test2.web.my.com
>>> >> test2.lb.my.com
>>> >
>>> >
>>> > So sometimes I need to run some update on all 'webservers', but
>>> sometimes I
>>> > want to stop and reconfigure all servers in 'test2'.
>>> >
>>> > At last I need to address a specific environment and do things on
>>> different
>>> > nodes iin sequence, e.g.
>>> > - ping the 'database' inside
>>> > - 'df -h' all the webservers
>>> > - then 'free -m' all the load-balancers
>>> >
>>> > How could I tell that the following playbook is only for 'test1'
>>> environment
>>> > and I need to run the 'databases' part of the playbook only for the
>>> > databases inside that environment?
>>> >
>>> > What are the starting points or steps? Topics I should read?
>>> >
>>> > Regards:
>>> >Bence
>>> >
>>> > --
>>> > 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/
>>> 4ad05415-ae9f-45c5-b41d-89a9340532e5%40googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>
>>> --
>>> Brian Coca
>>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/xxvsHlNEgws/unsubscribe.
> To unsubscribe from this group and all its topics, 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/682f0a2e-f7c0-4aed-8440-526fa1eaa6f8%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/682f0a2e-f7c0-4aed-8440-526fa1eaa6f8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAMQOM8RDFACdsbMR2rputdZWA3%3DvS-wNJ0cgZFqfrBrQyXvVUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] managing multi-node environments

2014-12-25 Thread Bence Takács
I found that:
http://stackoverflow.com/questions/18195142/safely-limiting-ansible-playbooks-to-a-single-machine

2014. december 25., csütörtök 16:41:17 UTC+1 időpontban Bence Takács a 
következőt írta:
>
> Thanks, Brian
>
> ...and what if i just don't want to declare it in the playbook?
> Can I make the environment a parameter for the playbook?
>
> hosts: "databases:&{{env}}" 
>
>
> or when calling the playbook:
>
> ansible-playbook example.yml --limit test1
>
>
>
> Regards:
>   Bence
>
> 2014. december 23., kedd 13:35:07 UTC+1 időpontban Brian Coca a következőt 
> írta:
>>
>> hosts: databases:&test1 
>>
>> ^ will make the playbook target only hosts that exist in both groups 
>> http://docs.ansible.com/intro_patterns.html#patterns 
>>
>> On Mon, Dec 22, 2014 at 10:22 PM, Bence Takács  
>> wrote: 
>> > 
>> > I have environments that contain different nodes of different 
>> roles/types 
>> > like: databases, webservers, load-balancers. 
>> > Sometimes I need to call every server of the same role/type, but 
>> sometimes I 
>> > need to address an environment. 
>> > 
>> > e.g.: 
>> >> 
>> >> [databases] 
>> >> test1.db.my.com  ansible_ssh_host=192.168.1.200  ansible_ssh_user=... 
>> >> test2.db.my.com   ansible_ssh_host=192.168.1.201 
>>  ansible_ssh_user=... 
>> >> 
>> >> [webservers] 
>> >> test1.web.my.com   ansible_ssh_host=192.168.1.300 
>>  ansible_ssh_user=... 
>> >> test2.web.my.com  ansible_ssh_host=192.168.1.301 
>>  ansible_ssh_user=... 
>> >> 
>> >> [load-balancers] 
>> >> test1.lb.my.com  ansible_ssh_host=192.168.1.400  ansible_ssh_user=... 
>> >> test2.lb.my.com  ansible_ssh_host=192.168.1.401  ansible_ssh_user=... 
>> >> 
>> >> [test1] 
>> >> test1.db.my.com 
>> >> test1.web.my.com 
>> >> test1.lb.my.com 
>> >> 
>> >> [test2] 
>> >> test2.db.my.com 
>> >> test2.web.my.com 
>> >> test2.lb.my.com 
>> > 
>> > 
>> > So sometimes I need to run some update on all 'webservers', but 
>> sometimes I 
>> > want to stop and reconfigure all servers in 'test2'. 
>> > 
>> > At last I need to address a specific environment and do things on 
>> different 
>> > nodes iin sequence, e.g. 
>> > - ping the 'database' inside 
>> > - 'df -h' all the webservers 
>> > - then 'free -m' all the load-balancers 
>> > 
>> > How could I tell that the following playbook is only for 'test1' 
>> environment 
>> > and I need to run the 'databases' part of the playbook only for the 
>> > databases inside that environment? 
>> > 
>> > What are the starting points or steps? Topics I should read? 
>> > 
>> > Regards: 
>> >Bence 
>> > 
>> > -- 
>> > 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/4ad05415-ae9f-45c5-b41d-89a9340532e5%40googlegroups.com.
>>  
>>
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>
>>
>> -- 
>> 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-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/682f0a2e-f7c0-4aed-8440-526fa1eaa6f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] managing multi-node environments

2014-12-25 Thread Bence Takács
Thanks, Brian

...and what if i just don't want to declare it in the playbook?
Can I make the environment a parameter for the playbook?

hosts: "databases:&{{env}}" 


or when calling the playbook:

ansible-playbook example.yml --limit test1



Regards:
  Bence

2014. december 23., kedd 13:35:07 UTC+1 időpontban Brian Coca a következőt 
írta:
>
> hosts: databases:&test1 
>
> ^ will make the playbook target only hosts that exist in both groups 
> http://docs.ansible.com/intro_patterns.html#patterns 
>
> On Mon, Dec 22, 2014 at 10:22 PM, Bence Takács  > wrote: 
> > 
> > I have environments that contain different nodes of different 
> roles/types 
> > like: databases, webservers, load-balancers. 
> > Sometimes I need to call every server of the same role/type, but 
> sometimes I 
> > need to address an environment. 
> > 
> > e.g.: 
> >> 
> >> [databases] 
> >> test1.db.my.com  ansible_ssh_host=192.168.1.200  ansible_ssh_user=... 
> >> test2.db.my.com   ansible_ssh_host=192.168.1.201  ansible_ssh_user=... 
> >> 
> >> [webservers] 
> >> test1.web.my.com   ansible_ssh_host=192.168.1.300 
>  ansible_ssh_user=... 
> >> test2.web.my.com  ansible_ssh_host=192.168.1.301  ansible_ssh_user=... 
> >> 
> >> [load-balancers] 
> >> test1.lb.my.com  ansible_ssh_host=192.168.1.400  ansible_ssh_user=... 
> >> test2.lb.my.com  ansible_ssh_host=192.168.1.401  ansible_ssh_user=... 
> >> 
> >> [test1] 
> >> test1.db.my.com 
> >> test1.web.my.com 
> >> test1.lb.my.com 
> >> 
> >> [test2] 
> >> test2.db.my.com 
> >> test2.web.my.com 
> >> test2.lb.my.com 
> > 
> > 
> > So sometimes I need to run some update on all 'webservers', but 
> sometimes I 
> > want to stop and reconfigure all servers in 'test2'. 
> > 
> > At last I need to address a specific environment and do things on 
> different 
> > nodes iin sequence, e.g. 
> > - ping the 'database' inside 
> > - 'df -h' all the webservers 
> > - then 'free -m' all the load-balancers 
> > 
> > How could I tell that the following playbook is only for 'test1' 
> environment 
> > and I need to run the 'databases' part of the playbook only for the 
> > databases inside that environment? 
> > 
> > What are the starting points or steps? Topics I should read? 
> > 
> > Regards: 
> >Bence 
> > 
> > -- 
> > 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/4ad05415-ae9f-45c5-b41d-89a9340532e5%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> 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-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/46e0b42c-43aa-4811-99b0-d327d8fd9359%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] managing multi-node environments

2014-12-22 Thread Bence Takács

I have environments that contain different nodes of different roles/types 
like: databases, webservers, load-balancers.
Sometimes I need to call every server of the same role/type, but sometimes 
I need to address an environment.

e.g.:

> [databases]
> test1.db.my.com  ansible_ssh_host=192.168.1.200  ansible_ssh_user=...
> test2.db.my.com   ansible_ssh_host=192.168.1.201  ansible_ssh_user=...
>
> [webservers]
> test1.web.my.com   ansible_ssh_host=192.168.1.300  ansible_ssh_user=...
> test2.web.my.com  ansible_ssh_host=192.168.1.301  ansible_ssh_user=...
>
> [load-balancers]
> test1.lb.my.com  ansible_ssh_host=192.168.1.400  ansible_ssh_user=...
> test2.lb.my.com  ansible_ssh_host=192.168.1.401  ansible_ssh_user=...
>
> [test1]
> test1.db.my.com
> test1.web.my.com
> test1.lb.my.com
>
> [test2]
> test2.db.my.com
> test2.web.my.com
> test2.lb.my.com
>
 
So sometimes I need to run some update on all 'webservers', but sometimes I 
want to stop and reconfigure all servers in 'test2'.

At last I need to address a specific environment and do things on different 
nodes iin sequence, e.g.
- ping the 'database' inside
- 'df -h' all the webservers 
- then 'free -m' all the load-balancers

How could I tell that the following playbook is only for 'test1' 
environment and I need to run the 'databases' part of the playbook only for 
the databases inside that environment?

What are the starting points or steps? Topics I should read? 

Regards:
   Bence

-- 
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/4ad05415-ae9f-45c5-b41d-89a9340532e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Problems with Ubuntu install: no modules detected

2014-12-22 Thread Bence Takács
Thanks for your help!

Merry Christmas ;-)


2014. december 21., vasárnap 20:21:42 UTC+1 időpontban titlei...@gmail.com 
a következőt írta:
>
> Sounds like you had an old config file pointed at the source install.  
> Glad it's working now.
>
> Jay
>
> On Sunday, December 21, 2014 12:16:43 PM UTC-6, Bence Takács wrote:
>>
>> Ok, after deleting the form /etc/ansible/ansible.cfg
>> and reinstalling again, everything is working with the 'normal' user, 
>> without sudo
>>
>> Thanks
>>
>> 2014. december 20., szombat 11:31:33 UTC+1 időpontban Bence Takács a 
>> következőt írta:
>>>
>>> Following the official Ubuntu guide (
>>> http://docs.ansible.com/intro_installation.html#latest-releases-via-apt-ubuntu)
>>>  
>>> I experienced the following problem:
>>>
>>> $ ansible --version
>>>> ansible 1.9
>>>>   configured module search path = None
>>>> $ ansible all -m ping
>>>> nas | FAILED => module ping not found in configured module paths.  
>>>> Additionally, core modules are missing. If this is a checkout, run 'git 
>>>> submodule update --init --recursive' to correct this problem.
>>>>
>>>
>>> Where could I find the default modules like 'ping'? 
>>>
>>> The /usr/share/ansible directory is empty, 
>>> The /etc/ansible directory contains only the ansible.cfg and the hosts 
>>> file (I already modified the latter and added my 'nas').
>>> The ~/.ansible cotains only an empty directory called cp
>>>
>>> If I run the suggested command, it says:
>>>
>>> $ git submodule update --init --recursive
>>>> fatal: Not a git repository (or any of the parent directories): .git
>>>>
>>>
>>> So: where are the default modules or how can I get them? :-)
>>>
>>> I'm on Ubuntu 14.04
>>>
>>> Regards:
>>>Bence
>>>
>>>
>>>

-- 
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/ed313e89-fc55-4311-bdb7-273a4ec7b418%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Problems with Ubuntu install: no modules detected

2014-12-21 Thread Bence Takács
Ok, after deleting the form /etc/ansible/ansible.cfg
and reinstalling again, everything is working with the 'normal' user, 
without sudo

Thanks

2014. december 20., szombat 11:31:33 UTC+1 időpontban Bence Takács a 
következőt írta:
>
> Following the official Ubuntu guide (
> http://docs.ansible.com/intro_installation.html#latest-releases-via-apt-ubuntu)
>  
> I experienced the following problem:
>
> $ ansible --version
>> ansible 1.9
>>   configured module search path = None
>> $ ansible all -m ping
>> nas | FAILED => module ping not found in configured module paths.  
>> Additionally, core modules are missing. If this is a checkout, run 'git 
>> submodule update --init --recursive' to correct this problem.
>>
>
> Where could I find the default modules like 'ping'? 
>
> The /usr/share/ansible directory is empty, 
> The /etc/ansible directory contains only the ansible.cfg and the hosts 
> file (I already modified the latter and added my 'nas').
> The ~/.ansible cotains only an empty directory called cp
>
> If I run the suggested command, it says:
>
> $ git submodule update --init --recursive
>> fatal: Not a git repository (or any of the parent directories): .git
>>
>
> So: where are the default modules or how can I get them? :-)
>
> I'm on Ubuntu 14.04
>
> Regards:
>Bence
>
>
>

-- 
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/f6fa43e4-d729-4637-80d6-4a8d02ab3c50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Problems with Ubuntu install: no modules detected

2014-12-21 Thread Bence Takács
According to my understanding I exactly did everything you suggested in the 
previous step.

Then installed it again.

The result is:

> $ ansible all -m ping
> bash: /usr/local/bin/ansible: No such file or directory
>

But it seems that this works:

> sudo ansible all -m ping

... or at least it initiates the ssh session but does not find the keys... 
since it is looking for them in '/root/.ssh' instead of my user's directory.
Is that the desired behaviour, that ansible could be run only by root (on 
Ubuntu)?





2014. december 21., vasárnap 19:02:12 UTC+1 időpontban titlei...@gmail.com 
a következőt írta:
>
> Seems like you still need some more cleanup to do.  Apt-get remove it, 
> then remove everyone ansible on your system, including any .ansible.cfg or 
> .ansible directories, and anything left in /usr/local and /etc.  And then 
> do a fresh install from scratch and see if that helps.  Make sure you don't 
> have any ANSIBLE environment variables set the old paths too.
>
> Jay
>
> On Sunday, December 21, 2014 11:46:01 AM UTC-6, Bence Takács wrote:
>>
>> I deleted the remaining files from /usr/local/bin and reinstalled ansible 
>> with apt-get again, but something is wrong:
>>
>> $ ansible all -m ping
>>> bash: /usr/local/bin/ansible: No such file or directory
>>>
>>
>> Any tips?
>>
>>
>> 2014. december 21., vasárnap 18:29:24 UTC+1 időpontban Bence Takács a 
>> következőt írta:
>>>
>>> Now I see what is the main issue: first I tried to install ansible from 
>>> source (I found a howto about that first...)
>>>
>>> And it has no 'remove' or 'uninstall' build target. So I just deleted 
>>> the directories I found...
>>>
>>> Now I tried some stronger cleanup: 
>>>
>>>> sudo apt-get remove ansible
>>>
>>> sudo pip uninstall ansible
>>>
>>>  
>>> I also have some remainings:
>>>
>>>> $ whereis ansible
>>>> ansible: /etc/ansible /usr/local/bin/ansible
>>>>
>>>
>>> How should I remove those?
>>>
>>> Regards:
>>>Bence
>>>
>>> 2014. december 20., szombat 11:31:33 UTC+1 időpontban Bence Takács a 
>>> következőt írta:
>>>>
>>>> Following the official Ubuntu guide (
>>>> http://docs.ansible.com/intro_installation.html#latest-releases-via-apt-ubuntu)
>>>>  
>>>> I experienced the following problem:
>>>>
>>>> $ ansible --version
>>>>> ansible 1.9
>>>>>   configured module search path = None
>>>>> $ ansible all -m ping
>>>>> nas | FAILED => module ping not found in configured module paths.  
>>>>> Additionally, core modules are missing. If this is a checkout, run 'git 
>>>>> submodule update --init --recursive' to correct this problem.
>>>>>
>>>>
>>>> Where could I find the default modules like 'ping'? 
>>>>
>>>> The /usr/share/ansible directory is empty, 
>>>> The /etc/ansible directory contains only the ansible.cfg and the hosts 
>>>> file (I already modified the latter and added my 'nas').
>>>> The ~/.ansible cotains only an empty directory called cp
>>>>
>>>> If I run the suggested command, it says:
>>>>
>>>> $ git submodule update --init --recursive
>>>>> fatal: Not a git repository (or any of the parent directories): .git
>>>>>
>>>>
>>>> So: where are the default modules or how can I get them? :-)
>>>>
>>>> I'm on Ubuntu 14.04
>>>>
>>>> Regards:
>>>>Bence
>>>>
>>>>
>>>>

-- 
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/7f1c717e-657f-42aa-a599-5923fdd01d56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Problems with Ubuntu install: no modules detected

2014-12-21 Thread Bence Takács
I deleted the remaining files from /usr/local/bin and reinstalled ansible 
with apt-get again, but something is wrong:

$ ansible all -m ping
> bash: /usr/local/bin/ansible: No such file or directory
>

Any tips?


2014. december 21., vasárnap 18:29:24 UTC+1 időpontban Bence Takács a 
következőt írta:
>
> Now I see what is the main issue: first I tried to install ansible from 
> source (I found a howto about that first...)
>
> And it has no 'remove' or 'uninstall' build target. So I just deleted the 
> directories I found...
>
> Now I tried some stronger cleanup: 
>
>> sudo apt-get remove ansible
>
> sudo pip uninstall ansible
>
>  
> I also have some remainings:
>
>> $ whereis ansible
>> ansible: /etc/ansible /usr/local/bin/ansible
>>
>
> How should I remove those?
>
> Regards:
>Bence
>
> 2014. december 20., szombat 11:31:33 UTC+1 időpontban Bence Takács a 
> következőt írta:
>>
>> Following the official Ubuntu guide (
>> http://docs.ansible.com/intro_installation.html#latest-releases-via-apt-ubuntu)
>>  
>> I experienced the following problem:
>>
>> $ ansible --version
>>> ansible 1.9
>>>   configured module search path = None
>>> $ ansible all -m ping
>>> nas | FAILED => module ping not found in configured module paths.  
>>> Additionally, core modules are missing. If this is a checkout, run 'git 
>>> submodule update --init --recursive' to correct this problem.
>>>
>>
>> Where could I find the default modules like 'ping'? 
>>
>> The /usr/share/ansible directory is empty, 
>> The /etc/ansible directory contains only the ansible.cfg and the hosts 
>> file (I already modified the latter and added my 'nas').
>> The ~/.ansible cotains only an empty directory called cp
>>
>> If I run the suggested command, it says:
>>
>> $ git submodule update --init --recursive
>>> fatal: Not a git repository (or any of the parent directories): .git
>>>
>>
>> So: where are the default modules or how can I get them? :-)
>>
>> I'm on Ubuntu 14.04
>>
>> Regards:
>>Bence
>>
>>
>>

-- 
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/156f97bd-2206-4482-8583-ad4a48f2bcfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Problems with Ubuntu install: no modules detected

2014-12-21 Thread Bence Takács
Now I see what is the main issue: first I tried to install ansible from 
source (I found a howto about that first...)

And it has no 'remove' or 'uninstall' build target. So I just deleted the 
directories I found...

Now I tried some stronger cleanup: 

> sudo apt-get remove ansible

sudo pip uninstall ansible

 
I also have some remainings:

> $ whereis ansible
> ansible: /etc/ansible /usr/local/bin/ansible
>

How should I remove those?

Regards:
   Bence

2014. december 20., szombat 11:31:33 UTC+1 időpontban Bence Takács a 
következőt írta:
>
> Following the official Ubuntu guide (
> http://docs.ansible.com/intro_installation.html#latest-releases-via-apt-ubuntu)
>  
> I experienced the following problem:
>
> $ ansible --version
>> ansible 1.9
>>   configured module search path = None
>> $ ansible all -m ping
>> nas | FAILED => module ping not found in configured module paths.  
>> Additionally, core modules are missing. If this is a checkout, run 'git 
>> submodule update --init --recursive' to correct this problem.
>>
>
> Where could I find the default modules like 'ping'? 
>
> The /usr/share/ansible directory is empty, 
> The /etc/ansible directory contains only the ansible.cfg and the hosts 
> file (I already modified the latter and added my 'nas').
> The ~/.ansible cotains only an empty directory called cp
>
> If I run the suggested command, it says:
>
> $ git submodule update --init --recursive
>> fatal: Not a git repository (or any of the parent directories): .git
>>
>
> So: where are the default modules or how can I get them? :-)
>
> I'm on Ubuntu 14.04
>
> Regards:
>Bence
>
>
>

-- 
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/8618ec35-f3c7-4bcf-bc93-ac9808eec994%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Problems with Ubuntu install: no modules detected

2014-12-20 Thread Bence Takács
Following the official Ubuntu guide 
(http://docs.ansible.com/intro_installation.html#latest-releases-via-apt-ubuntu)
 
I experienced the following problem:

$ ansible --version
> ansible 1.9
>   configured module search path = None
> $ ansible all -m ping
> nas | FAILED => module ping not found in configured module paths.  
> Additionally, core modules are missing. If this is a checkout, run 'git 
> submodule update --init --recursive' to correct this problem.
>

Where could I find the default modules like 'ping'? 

The /usr/share/ansible directory is empty, 
The /etc/ansible directory contains only the ansible.cfg and the hosts file 
(I already modified the latter and added my 'nas').
The ~/.ansible cotains only an empty directory called cp

If I run the suggested command, it says:

$ git submodule update --init --recursive
> fatal: Not a git repository (or any of the parent directories): .git
>

So: where are the default modules or how can I get them? :-)

I'm on Ubuntu 14.04

Regards:
   Bence


-- 
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/71b08cbb-a554-4215-aeb9-200fbce50be8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.