[ansible-project] Re: Do dynamic inventories support command line arguments?

2015-10-27 Thread esco real
You could use some wrapper script(s) as inventory source for 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/23b6aefd-205d-483b-81ce-7a83f1a70766%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Wrong group_var getting read?

2015-10-27 Thread esco real

Am Dienstag, 27. Oktober 2015 04:07:10 UTC+1 schrieb Francisco Reyes:
>
>
> I would have never expected it. I expected that if a playbook did a group 
> from the host file that only the matching file from group_vars/GroupName 
> would be read.
>

Ok, at first the whole inventory topic in Ansible was weird for me, too. 
Especially when everything is YAML and only for the inventory there is an 
INI-file. And if you look at your example you can't really map this data 
model to the internal (JSON) model.

The data model for inventory:
http://docs.ansible.com/ansible/developing_inventory.html

So you have unique hosts with vars (which can be key/value, list, 
dictionaries etc.)  and unique groups with vars. On the other hand you can 
assign hosts and groups to other groups.


What I ended up doing to achieve what I want is to use ansible_ssh_host to 
> fake unique names for the same machine depending on what group it is. 
>

You could also use a DNS alias. Depends on your infrastructure. We separate 
our servers in physical, virtual and alias.
 

-- 
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/ebabed13-3ebe-4792-815a-05c81ab1a35b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Wrong group_var getting read?

2015-10-26 Thread esco real
This is an expected behavior. The "hosts" entry in the playbook is just for 
limitation. The vars were build before that. To test what vars a host get:

ansible -m debug -a "var=hostvars" MachineA


-- 
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/998320aa-c7bf-476f-bc83-0560364b5c43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Manage SSh-Keys

2015-10-22 Thread esco real
Why not just template the authorized_keys file?

-- 
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/0746c9e9-7ca0-4775-a293-8ab6e89372d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Inventory group variables

2015-10-22 Thread esco real
I get this for abc:
TASK: [test vars] 
*
ok: [10.10.0.101] => {
"msg": "abc has name abc and port 4100 and /home/wwwroot/abc"
}


But the group xyz has the same hosts. So this is a expected result..

Version: 1.9.4

-- 
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/2ff53533-a7c2-433e-a7df-dd7ff73e453c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: protect ansible code ?

2015-10-20 Thread esco real
Hello,

I don't know what's the real use case here.

If you want to hide how you configure/deploy a system or software for your 
customer then this doesn't make much sense. If you administer the system 
then this is no problem at all. And if your customer manages the system by 
himself he would need this documentation.


But on the other hand Ansible is that flexible that building a cloud web 
service and hiding a big part of the code/logic wouldn't be that much of a 
problem. For example with Jenkins and some permissions you could build a 
web site where a user can input a SSH access to his own server and run some 
jobs without direct access to the YAML code.

esco

-- 
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/534913cf-893d-4208-8fb9-9d6d136b76e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: lineinfile Best Practice?

2015-10-20 Thread esco real
Hello Josef,

could you explain what exactly the problem is here? Maybe posting some 
examples with actual/ and expected results?

I have different relay hosts in main.cf, too. I just use a var per group 
and lineinfile to set relay and didn't have a problem with that.

esco

-- 
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/cd7dee02-7ecb-4345-8393-a87d565cc67a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Inventory issue

2015-10-15 Thread esco real
Hello,

if you don't want to put lb3 in a group you would need this:

lb3
[lb]
lb[1:2]

A blank line doesn't separate anything. In your second example lb3 is in 
the payment group.
http://docs.ansible.com/ansible/intro_inventory.html
https://en.wikipedia.org/wiki/INI_file

esco

-- 
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/505649c6-5a89-4433-921f-7f788e0665d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Selecting hosts with softlayer.py dynamic inventory

2015-10-07 Thread esco real
Hello Kesten,

you should check out this links: 
https://github.com/ansible/ansible/pull/12451
https://groups.google.com/forum/#!topic/ansible-devel/ZGwvE7RgWTc

esco

-- 
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/5bf536e5-35e2-45c7-959e-a81196fe7c02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: tree/hierarchic structure for inventory?

2015-09-07 Thread esco real
If someone is interested in this topic:
Now, I use the name and the UUID of the groups (name_uuid) to build up the 
tree (children, group_vars..). So group names don't have to be unique and 
performance and scaling isn't a problem anymore..

If you use a CMDB your groups usually would have some IDs, too.

esco

-- 
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/97a8600a-524e-486c-8879-379b708f09c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Host filter / patterns

2015-09-04 Thread esco real
Maybe I overlooked something..
But wouldn't that be the same as "staging:production:&app"?

esco

-- 
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/f60a897b-a516-4137-a564-8d6a1bd2226a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to elegantly change root password with mysql_user

2015-09-02 Thread esco real
I do this (in this order):
- name: set password
  mysql_user: name={{ mysql_user }} password={{ hostvars[product + '_' + 
inventory_hostname + '_' + mysql_user].password }}
 
- name: create client config
  template: src=client.my.cnf dest=~/.my.cnf mode=0600



client.my.cnf:
[client]
user={{ mysql_user }}
password={{ hostvars[product + '_' + inventory_hostname + '_' + 
mysql_user].password 
}}


By using .my.cnf with [client]-config you would have the login information 
to the database on the server (for example in /root/.my.cnf with 600). The 
variable for the password is just an example from my inventory..



-- 
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/990a1aa1-c794-4bdb-90a3-19c2339adab2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: multi stage and variables

2015-09-01 Thread esco real
Maybe not the best way. But for some cases I "misuse" host entries to 
address this.

So the host entry "web_prod" in the group "web_conf" could have the 
variable ram with "4GB" and in the group_vars for web_conf ram would have 
"1GB". And to access this: {{ hostvars[tier + '_' + stage ].ram }}.

In my case I do this with a generated inventory to manage app and database 
users/passwords from KeePass. And to separate this the entries have 
underscores and are in the "user" group.

esco


-- 
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/d7fcad76-5fc9-42f3-9f10-2333b71f05cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Using ansible's inventory to ssh

2015-08-28 Thread esco real
not that fancy and no support for non default port, you could do something 
similar with bash: 

# function ansible-ssh { ssh $(ansible -m debug -a "msg={{ ansible_ssh_user 
}}@{{ ansible_ssh_host }}" $1 | grep msg |awk -F\" '{print $4}');}
# export -f ansible-ssh
# ansible-ssh 

esco

-- 
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/b1ed88aa-35e0-447b-ad26-a73c9f40cfc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_regedit?

2015-08-02 Thread esco real
Hello Jim,

maybe you don't use version 2 of Ansible?
http://docs.ansible.com/ansible/win_regedit_module.html
"New in version 2.0."

esco

-- 
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/0f8304e6-bc69-49db-944b-fabd6b9aade4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: tree/hierarchic structure for inventory?

2015-07-29 Thread esco real
Hello Martin,

you are right. Supporting a tree structure for this with plain 
files/directories (group_vars..) wouldn't be that nice. And it is very 
sensible at the moment.

But I made this work for me by resolving the group_vars in the tree 
directly to host_vars. So group names don't have to be unique in the 
inventory. And now I am very happy with the combination of Ansible and 
KeePass..

esco

-- 
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/c373352b-6be4-4027-ac7a-a252ee04da6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: tree/hierarchic structure for inventory?

2015-07-22 Thread esco real
Hello,

to build a tree with ini format I think something like that could be used:

[server.atlanta.web]
web1

[server.raleigh.web]
web2

esco



-- 
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/094e31e6-7fac-4b7d-bd3a-25b9ebac4153%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: tree/hierarchic structure for inventory?

2015-07-19 Thread esco real
Hello Paul,

yes, I did likely the same but used a KeePass 2 database instead of an ini 
file as inventory source. So here we have similar thoughts (if you are 
using KeePass 2 you should try my script ;) ). Adding each host to his 
parents is possible. But apart from the scaling problem you would have 
trouble with group_vars for non unique group names in different branches. 
And I guess there are a lot more users which manage their inventory as tree.

esco

-- 
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/00d7df2c-3bd6-467f-b9d4-9507cf752a27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] tree/hierarchic structure for inventory?

2015-07-15 Thread esco real
Hello,

I would like to discuss the idea for a hierarchic structure for the 
inventory. Would it possible to support something like that?

For example with this structure:

| server
| -- atlanta
|`-- web
|   `--hosts:web1
| -- raleigh
|`-- web
|`-- host:web2

You would need this config:
{
  "web" : { "hosts": [ "web1", "web2" ] },
  "server" : { "hosts": [ "web1", "web2" ] },
  "atlanta" : { "hosts": [ "web1" ] },
  "raleigh" : { "hosts": [ "web2" ] }
}


To work with "children" the group names would have to be unique in the 
whole tree. So "web" would break this up.

Wouldn't it be nice to use something like that?
{
  "server" 
  { "atlanta" { "web" {"hosts": [ "web1" ] } } },
  { "raleigh" { "web" {"hosts": [ "web2" ] } } }
}

I came up with this by using a KeePass database as inventory source:
https://github.com/escoreal/ansible_kdb_inventory
Here I have to build the tree for each host and add it to all parents. But 
this doesn't scale to well.

Thanks,
esco





-- 
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/b41a7c85-dff6-4b51-963d-8ebd57b239e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.