amazon-web-services - 如何使用 Ansible 在 AWS 机密管理器中设置键/值机密?
问题描述
以下代码未设置密钥的键/值对。它只创建一个字符串。但我想创建键/值,文档甚至没有提到它......
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Add string to AWS Secrets Manager
aws_secret:
name: 'testvar'
state: present
secret_type: 'string'
secret: "i love devops"
register: secret_facts
- debug:
var: secret_facts
解决方案
如果这与Secrets Manager CLI之类的任何内容匹配,那么要设置键值对,您应该期望创建如下所示的键值对:
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Add string to AWS Secrets Manager
aws_secret:
name: 'testvar'
state: present
secret_type: 'string'
secret: "{\"username\":\"bob\",\"password\":\"abc123xyz456\"}"
register: secret_facts
- debug:
var: secret_facts
推荐阅读
- javascript - 我正在生成行、列并动态设置 ID。我需要定位 JS 中第二行的第三列。我该如何定位它?
- java - 是否可以将依赖项插入到 intellij 模块依赖项的列表顶部?
- python-3.x - 破折号将文件存储在本地文件夹(用户的)中
- python - 由于“UnpicklingError: invalid load key”,无法加载从其他 repo 克隆的 pickle 文件。
- python - Groupby 列是对象列表但导致错误:不可散列类型:'numpy.ndarray'
- android - 如何仅使用微型 USB 电缆(无 OTG 适配器)在已植根的 Galaxy S7 上配置静态 IP 和以太网?
- makefile - 在链接 Fortran 可执行文件之前,如何通过不同的目录进行 make 扫描以查找和编译模块
- java - 我如何才能解析 json 响应,以便我只能使用 Java 获取密钥?
- symfony - 允许 Symfony 4 和 Doctrine 重复多对多关系
- excel - Excel 尝试向数据库查询连接显示最近的刷新时间和日期