community.general.heroku_collaborator 模块 – 在 Heroku 上添加或删除应用协作者

注意

此模块是 community.general 集合 (版本 10.1.0) 的一部分。

如果您使用的是 ansible 软件包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装它,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.general。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求

要在 playbook 中使用它,请指定: community.general.heroku_collaborator

概要

  • 管理 Heroku 应用的协作者。

  • 如果设置为 present 并且 Heroku 用户已经是协作者,则不执行任何操作。

  • 如果设置为 present 并且 Heroku 用户不是协作者,则将用户添加到应用。

  • 如果设置为 absent 并且 Heroku 用户是协作者,则从应用中删除用户。

要求

执行此模块的主机需要以下要求。

  • heroku3

参数

参数

注释

api_key

字符串

Heroku API 密钥

apps

列表 / 元素=字符串 / 必需

Heroku 应用名称列表

state

字符串

创建或删除 Heroku 协作者

选项

  • "present" ← (默认)

  • "absent"

suppress_invitation

布尔值

创建协作者时禁止发送电子邮件邀请

选项

  • false ← (默认)

  • true

user

字符串 / 必需

用户 ID 或电子邮件

属性

属性

支持

描述

check_mode

支持:完全支持

可以在 check_mode 下运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持:不支持

在差异模式下,将返回有关已更改内容(或可能需要在 check_mode 下更改的内容)的详细信息。

备注

注意

  • HEROKU_API_KEYTF_VAR_HEROKU_API_KEY 环境变量可以用来代替设置 api_key

  • 如果您使用 check_mode,还可以传递 -v 标志以在 msg 中查看受影响的应用,例如 [“heroku-example-app”]。

示例

- name: Create a heroku collaborator
  community.general.heroku_collaborator:
    api_key: YOUR_API_KEY
    user: [email protected]
    apps: heroku-example-app
    state: present

- name: An example of using the module in loop
  community.general.heroku_collaborator:
    api_key: YOUR_API_KEY
    user: '{{ item.user }}'
    apps: '{{ item.apps | default(apps) }}'
    suppress_invitation: '{{ item.suppress_invitation | default(suppress_invitation) }}'
    state: '{{ item.state | default("present") }}'
  with_items:
    - { user: '[email protected]' }
    - { state: 'absent', user: '[email protected]', suppress_invitation: false }
    - { user: '[email protected]', apps: ["heroku-example-app"] }

作者

  • Marcel Arns (@marns93)