Hi,

I'm trying to use a dynamic inventory to configure Softlayer hosts. My 
scripts are working with a static inventory file where I specify things like

[BACKUP_SERVER]
10.000.00.00
[JIRA]
10.111.11.11

Now i want to move to using a dynamic inventory using softlayer.py from 
ansible/contrib/inventory

This returns the following structure:





























*{  "_meta": {    "hostvars": {      "159.xxx.xx.xx": {        
"datacenter": {          "id": 999,           "longName": "Xxxx 2", 
          "name": "xxx02",           "statusId": 2        },         
"domain": "softlayer.com",         "fullyQualifiedDomainName": 
"xxxx.softlayer.com",         "globalIdentifier": 
"xxxx-xxx-xxxx-xxxx-xxxxxxxxxx",         "hostname": "yyyyy",         "id": 
11327741,         "maxCpu": 1,         "maxMemory": 8192,         
"powerState": {          "keyName": "RUNNING",           "name": 
"Running"        },         "primaryBackendIpAddress": "10.XXX.XX.XX", 
        "primaryIpAddress": "159.XXX.XXX.XX",         "status": {          
"keyName": "ACTIVE",           "name": "Active"        },         
"tagReferences": []      }*

...

So my questions are .. how do I filter hosts in a playbook with a dynamic 
inventory?

I would have previously done:
---
- hosts: JIRA

but now I would like to filter by *hostname* or (more usefully) *tagReferences 
- *how is this possible?

Secondly, I would like ansible to ssh via the internal 10.xxx IP addresses 
not the external 159.xxx ones. Is this possible?

Thanks,
Bedwyr


-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0c6de7cb-b769-4dce-a17c-6a7c203e3ddd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to