shterm.appmgr_lookup_plugin

appmgr_lookup_plugin

appmgr_lookup_plugin 用于从 shterm-appmgr 获取真实的账户和密码

需求

  1. shterm-agent
  2. shterm-appmgr

安装

使用以下语法安装 appmgr_lookup_plugin 角色:

$ ansible-galaxy install shterm.appmgr_lookup_plugin

插件使用

  • playbook 示例
- hosts: server1
  roles:
    - role: shterm.appmgr_lookup_plugin         
  vars:
     contents: "{{lookup('appmgr_lookup_plugin',{'appid':'centos', 'query':'username=root;resourceName=host;reason=test;', 'extra':''})}}"
     ansible_ssh_pass: "{{contents.password}}"
     ansible_ssh_user: "{{contents.name}}"
  tasks:
    - debug: msg="foo.txt 的值是 {{contents.name}}"
  • 主机文件示例
[demo]
server1 ansible_ssh_host=10.10.20.29 ansible_ssh_pass="{{content.password}}" 
[demo:vars]
content="{{lookup('appmgr_lookup_plugin',{'appid':'centos', 'query':'username=root;resourceName=host;reason=test;', 'extra':''})}}"
  • 命令示例
ansible 10.10.20.29 -i 10.10.20.29, --playbook-dir ~/.ansible/roles/shterm.appmgr_lookup_plugin/ -u root -e ansible_password="{{lookup('appmgr_lookup_plugin',{'appid':'centos', 'query':'username=root;resourceName=host;reason=test;', 'extra':''}).password}}"  -a 'echo dial'

插件参数

  • appid (str): 定义请求密码的应用的唯一 ID。
  • query (str): 描述获取密码的过滤条件。
  • extra (str): 扩展字段

插件返回

  • dict: 一个包含 'password' 和 'name' 的字典

许可信息

MIT

作者信息

关于项目

Provides access to appmgr variables through a lookup plugin

安装
ansible-galaxy install shterm.appmgr_lookup_plugin
许可证
other
下载
151
拥有者