curl - curl命令从ansible Tower获取库存ID
问题描述
我需要使用 curl 命令从 ansible tower 检索给定项目的 inventory_id(project_dev 是项目名称)
curl -X GET -s -k -u "user:password" -vvv -H 'Content-Type:application/json' -d '{"organization": 1,"name": "project-dev"}' https://ansibletower.com/api/v2/inventories/"
解决方案
问:I need to retrieve the inventory_id from ansible tower.
A:使用tower-cli
用法: tower-cli 库存获取 [OPTIONS] [ID]
问:How to add special character password to tower-cli config?
答:使用tower_cli.cfg
$ cat $HOME/.tower_cli.cfg
[general]
host = http://srv.example.com
username = admin
password = password
verify_ssl = no
推荐阅读
- python - 如果我有一个带有烧瓶 API 的应用程序,我是否需要将整个应用程序放入像 gunicorn 这样的网络服务器中?
- php - 如何将“数组格式的字符串”转换为php中的数组?
- amazon-web-services - 集群的 ec2 worker 有多少容量?
- oracle - 对表空间 'SYSTEM' ORA-00942 没有权限
- firebase-authentication - 使用 Firebase 进行无密码登录,从 PC 打开链接
- javascript - jQuery 从我提交的表单中获取表单名称
- reactjs - 将类添加到选定的选项
- ios - 无法创建 iPhone ...未知的运行时
- ios - 完全崩溃和日志没有帮助
- parse-cloud-code - Back4App 部署带有 .js 文件问题的文件夹