diff --git a/README.md b/README.md index 24a2f4a..23e488e 100644 --- a/README.md +++ b/README.md @@ -32,41 +32,40 @@ optional arguments: -h, --help show this help message and exit --list Enable JSON output for dynamic ansible inventory -In order to use it, you have to define BOSH_CONFIG environment variable -pointing to the configuration file used by Bosh. It will read the credentials -from the file. You can define additional inventory parameters with -BOSH_ANSIBLE_INVENTORY_PARAMS environment variable, for example: -BOSH_ANSIBLE_INVENTORY_PARAMS="ansible_user=vcap ansible_ssh_pass=blabla" -Be aware that Python is not present in the default location, but you can -use this variable to specify "ansible_python_interpreter=/path/to/python". +In order to use bosh-inventory, you have to define BOSH_CONFIG environment +variable pointing to the configuration file used by Bosh. It will read the +credentials from the file. You can define additional inventory parameters +via BOSH_ANSIBLE_INVENTORY_PARAMS environment variable, for example: +BOSH_ANSIBLE_INVENTORY_PARAMS="ansible_user=vcap ansible_ssh_pass=blabla". +Be aware that maybe Python2 (required by ansible) is not present in the +default location, but you can use this variable to specify +"ansible_python_interpreter=/path/to/python". The environment variable BOSH_ANSIBLE_INVENTORY_VARS defines a list of -entries which can appear in the inventory as variables for each VM. The -list of values is here: -https://bosh.io/docs/director-api-v1.html#list-instances-detailed, +entries which can appear as inventory variables for each VM. The list of values +you can use is here: https://bosh.io/docs/director-api-v1.html#list-instances-detailed, for example BOSH_ANSIBLE_INVENTORY_VARS="state bootstrap" will add "state=started bootstrap=false" to each inventory entry. -The environment variable BOSH_ANSIBLE_INVENTORY_INSTANCES, defines the name will -appear in the inventory. If it 'dns' it will build the inventory with the -dns names given by Bosh Director, if 'vm_cid' (default) it will be using the -name of the VM as it is in the IaaS. You can see all parameters supported in -https://bosh.io/docs/director-api-v1.html#list-instances-detailed - -In case of 'dns' the IP of each vm will be include if DNS is not defined in -Bosh Director. To force always the inclusion of the IP in the inventory, -just define the variable BOSH_ANSIBLE_INVENTORY_IP as a positive integer -indicating the index (starting from 1) of the IP which will be taken -(for VMs with multiple IPs), 0 will disable the feature. - -BOSH_ANSIBLE_INVENTORY_CALL can be 'instances'(default) or 'vms'. -Instances is faster because it does not query the Bosh Agents, it gets the -desired state. 'vms' will query the Bosh Agents in order to result the current -state, so depending on the situation, it can take a lot of time to get the -result. 'instances' includes references to errand jobs, but 'vms' will only show -vms runnign on the IaaS. - -You can also limit the inventory to one deployment by setting the value +The environment variable BOSH_ANSIBLE_INVENTORY_INSTANCES, defines the VM name +will have in the inventory. If it 'dns' it will build the inventory entry with +the dns names given by Bosh Director (if dns is enabled in Bosh, otherwise it +will fallback to autogenerated names and include the ip address for each +instance), if 'vm_cid' (default) it will be using the name of the VM as it is +in the IaaS. You can see all parameters supported in +https://bosh.io/docs/director-api-v1.html#list-instances-detailed. +To force always the inclusion of the IP in the inventory, just define the +variable BOSH_ANSIBLE_INVENTORY_IP as a positive integer indicating the index +(starting from 1) of the IP which will be taken (for VMs with multiple IPs), +0 disabled the feature. + +BOSH_ANSIBLE_INVENTORY_CALL defines the way the inventoy is populated. It can +be 'instances'(default) or 'vms'. Instances is faster because it does not query +the Bosh Agents, so it gets the desired state. 'vms' will query the Bosh Agents +in order to get the current state, so depending on the situation, it can take a +lot of time to get the result. + +You can also limit the inventory to one specific deployment by setting the value of the environment variable BOSH_ANSIBLE_DEPLOYMENT to the name of it. 0.3.0, 2017 Jose Riguera @@ -175,6 +174,11 @@ If so, just run the playbook. ansible-playbook -i /usr/local/bin/bosh-inventory cf-warden.yml ``` +# TODO + +* Add support for reading new bosh-cli v2 config files +* Add support for Bosh director with UAA auth + # Author