跳至正文
Wener Notes

Ansible Plugins

约 1 分钟阅读
标签:DevOpsAnsiblePlugins

Modules (also referred to as “task plugins” or “library plugins”) are discrete units of code that can be used from the command line or in a playbook task. Ansible executes each module, usually on the remote target node, and collects return values.

Lookup

  • lookup plugin
  • 常用 - 所有 ansible-doc -t lookup -l
    • env
    • file
    • password - 生成密码到文件
    • consul_kv
    • hashi_vault - vault 中的数据 - 需要 hvac
    • dig
    • dnstxt
    • fileglob
    • first_found
    • config - 配置项 ansible-config list
    • k8s
    • vars
    • varnames
    • dict
bash
ansible -m debug -a "msg={{lookup('env','HOME')}}" localhost
ansible -m debug -a "msg={{lookup('file',lookup('env','HOME')+'/.ssh/id_rsa.pub')}}" localhost
yaml
- name: access env
  debug: msg={{lookup('env','HOME')}}
- name: access file
  debug: msg={{lookup('file',lookup('env','HOME')+'/.ssh/id_rsa.pub')}}

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

其他外链6 条
最近更新commit 906e816编辑