shterm.appmgr_lookup_plugin
appmgr_lookup_plugin
The appmgr_lookup_plugin is used to get the account and password from shterm-appmgr.
Requirements
- shterm-agent
- shterm-appmgr
Installation
To install the appmgr_lookup_plugin role, use this command:
$ ansible-galaxy install shterm.appmgr_lookup_plugin
How to Use the Plugin
- Example 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="The value of foo.txt is {{contents.name}}"
- Example for Host File
[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':''})}}"
- Example Command
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'
Plugin Arguments
appid
(str): The unique ID for the application that is asking for the password.query
(str): The criteria for finding the password.extra
(str): Additional information.
Plugin Return
dict
: A dictionary with 'password
' and 'name
' values.
License
MIT
Author Information
- Ding Allen (zjdyms.hz@shterm.com)