bosh部署的ansible动态库存

bosh_inventor的Python项目详细描述


#bosh ansible inventory


通过调用程序
"bosh-inventory.py",而不是"bosh-inventory"。



由bosh控制器老化。


中,'~/.bosh/config'或'~/.bosh_config'),以便从中获取凭据。您可以通过bosh ansible_inventory_params环境变量定义其他inventory
参数,例如:
bosh ansible_inventory_params="ansible_user=vcap ansible_ssh_pass=blablabla"。请注意,
默认位置
中可能不存在python2(ansible所需),但可以使用此变量指定"ansible_python_interpreter=/path/to/python"。
如果使用bosh cli v2,则还需要定义变量
bosh_environment,以便针对c正确的控制器。

您可以使用的值列表如下:https://bosh.io/docs/director-api-v1.html列出详细的实例,
例如bosh-ansible_inventory_vars="state bootstrap"将在每个清单条目中添加
"state=started bootstrap=false"。

_实例,定义库存中将包含的vm名称。如果它是"dns",它将使用bosh director提供的dns名称构建inventory条目(如果在bosh中启用了dns,则它将返回到自动生成的名称,并包括每个
实例的ip地址),如果"vm_cid"(默认值),它将使用vm的名称,就像在IaaS。您可以看到
https://bosh.io/docs/director-api-v1.html list instances detailed中支持的所有参数。
若要始终强制将IP包含在资源清册中,只需将
变量bosh ansible_inventory_IP定义为一个正整数,指示T的索引
(从1开始)将采用的IP(对于具有多个IP的虚拟机),
0禁用该功能。bosh ansible_inventory_ip的默认值为1。

bosh ansible_inventory_call定义inventoy的填充方式。它可以是'instances'(默认)或'vms'。实例速度更快,因为它不查询
bosh代理,所以它获得所需的状态。vms'将查询bosh agents
以获取当前状态,因此根据具体情况,可能需要很长时间才能获得结果。


您还可以通过设置环境变量bosh ansible\u deployment的值
将库存限制为一个特定部署它的名称。

0.3.0,2017年jose riguera<;jose.riguera@springer.com>;
```

它将从那里读取所有参数。



默认情况下,它将返回INI格式的清单:
````
$export bosh_config=~/.bosh_config
$bosh inventory>;ansible inventory
````

$export bosh ansible_inventory_params="ansible_user=vcap"
$export bosh ansible_inventory_vars="ansible_user=vcap"
$export bosh ansible_inventory_call="vms"
$export bosh ansible_inventory_instances="dns"
$导出bosh ansible_inventory_ip="1"
$ansible"runner_z*"-i$(哪个bosh inventory)-a"sudo/sbin/reboot"
````


您还可以使用"bosh ansible_deployment"指向一个部署,
并且只有这些实例会出现:
```
$export bosh ansible_deployment=concourse
$bosh inventory
[all:children]
concourse


[concourse:children]
[concourse:children]
>web
>worker
db

[web]
web-0 ansible虚拟主机=10.10.10.10.64 ansible用户=vcap

[worker]
[worker-0 ansible虚拟主机=10.10.10.10.10.10.66 ansible用户=vcapp


worker-1 ansible虚拟主机=10.10.10.10.10.10.10.10.10.10.67责任_user=vcap

[db]
db-0 ansible_host=10.10.10.65 ansible_user=vcap

````


请注意,默认位置中不存在python,但可以使用"bosh ansible_inventory"params="ansible_python解释器=/path/to/python"`


给所有的cf跑步者写一本行动手册,首先,确保你的bosh客户的目标是正确的bosh总监!!!!!

````
bosh status


https://x.x.x.x:25555
config
/home/jriguera/.bosh_config

name devbosh2
url https://x.x.x.x:25555
version 1.3232.6.0(00000000)
user admin
uuid c4f5c583-1bc3-427f-8DED-B3F5E107F970
CPI vSphere
启用DNS(域名:microbosh)
禁用编译包缓存
禁用快照


部署
未设置
`````

键入"bosh vms--详细信息"以确认!

"bosh inventory"需要一些变量才能工作:

```

export bosh_config=~/.bosh_config
定义部署的名称(以避免获得其他vm)
export bosh_ansible_deployment=dev
集中使用ips(如果bosh已启用dns,则不使用dns名称)
export bosh_ansible_inventory_ip="1"
定义ssh用户和其他可能的参数
导出bosh ansible_inventory_params="ansible_user=nsaadmin host_key_checking=false"
````

>检查它是否工作:

````
`````
ansible runner_z1-i/usr/local/bin/bosh inventory-m ping
````

-剧本-i/usr/local/bin/bosh inventory cf warden.yml
````

上传到pypi


1。创建一个".pypirc"配置文件。此文件保存用于使用PYPI进行身份验证的信息。

```
[distutils]
index servers=PYPI

[PYPI]
repository=https://pypi.python.org/pypi
username=your戥username
password=your戥password
```
2。登录并将其上载到pypi

```
python setup.py register-r pypi
python setup.py sdist upload-r pypi
````


todo

*使用uaa auth添加对bosh director的支持


author

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
junit有没有办法在Java中重新初始化静态类?   在浏览器中点击应用程序时java Play框架挂起   文件Java错误中的NullPointerException   使用Java中的SNMP查找网络中计算机的登录名   java包装服务器引导程序已弃用,有什么替代方案?   当客户在等待理发时,java信号量值是否存在问题?   java如何使用JavaMail仅下载特定类型的附件   如何在java中将十进制转换为十六进制   java Slick2D粒子系统不会生成粒子   java检测更改事件来自何处   将Java集合类型参数类设置为数组   java如何从eclipse导出为可运行JAR文件?   java EntityManager对象未注入Glassfish和Spring   swing从actionPerformed和actionListener Java返回字符串   java在给定另一个等价键对象的情况下获取映射项的当前键   无论输入如何,java网络都会产生相同的输出