ansible:为什么它要寻找 vultr.ini 文件?

ansible:为什么它要寻找 vultr.ini 文件?

我创建了以下剧本来创建一台 vultr 机器。我使用的是 ansible 的 vultr 模块,并输入了所有必要的参数;

---

# Ansible Blocks
- hosts: 127.0.0.1
#  gather_facts: False
  connection: local
  tasks:

    - block:
      - name: List root
        local_action:
          module: vr_server
          name: "myserver"
          os: CentOS 7 x64
          plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
          region: Amsterdam
          api_key: "242HXXXXXXC3HGGXPSZTK7ILY4QUEC5KN555"
          api_account: "john"

      rescue:
        - name: Only run when a task inside the block throws an error.
          debug: msg="Something went wrong."

      always:
        - name: Always run.
          debug: msg="Regardless of what happened above, we're done with this block!"

...

但是当我运行它时,出现以下错误:

fatal: [127.0.0.1 -> localhost]: FAILED! => {"changed": false, "msg": "Config file not found. Tried : /home/john/.vultr.ini, /home/john/automation/utils/ansible-vultr/core_vultr/vultr.ini"}

看起来,它正在搜索 vultr.ini。为什么会这样?我应该在 vultr.ini 文件中输入什么?

Ansible 的版本是 2.5.0,它在 ubuntu 14.04 上运行。

答案1

看起来这个链接可能正是您要找的:https://www.renemoser.net/blog/2018/03/18/begin-vultr-with-ansible/

具体来说,你可能需要这一点:

[default]
key = <your api key>

相关内容