小编Ric*_*d E的帖子

Ansible“错误!正在尝试解密,但未找到保管库秘密”,但我没有解密任何内容

奇怪且令人沮丧的错误

我正在尝试学习并为 Ansible 创建一个 python 模块。我正在关注此页面:Medium.com 这是本地模块,所以我只想使用./library/module.py.

代码:

剧本

---
- hosts: localhost    # I've used 127.0.0.1 here also
  connection: local

  vars:
    - Test: "This is a test"

  tasks:
  - name: set result
    set_fact:
      result: "set"

  - name: Test that my hello_world module works
    hello_world:
    register: result

  - debug: var=result
...
Run Code Online (Sandbox Code Playgroud)

该模块是一个简单的 python 脚本,用于打印“Hello World”。它是./library/hello_world.py

模块

#!/usr/bin/python

from ansible.module_utils.basic import *

def main():
    module = AnsibleModule(argument_spec={})
    theReturnValue = {"hello": "world"}
    module.exit_json(changed=False, meta=theReturnValue)

if __name__ == '__main__': …
Run Code Online (Sandbox Code Playgroud)

python ansible

9
推荐指数
1
解决办法
4万
查看次数

标签 统计

ansible ×1

python ×1