Ansible cloudformation 更新堆栈 [英] Ansible cloudformation update stack
问题描述
我正在尝试使用我需要通过 Ansible 更改的参数值来更新 cloudformation 堆栈.堆栈是之前创建的,并且有大约 20 个输入参数,但我只需要更新其中一个的值.我尝试了以下方法:
I'm trying to update a cloudformation stack with just a param value that I need to change via Ansible. The stack is previously created and has about 20 input params, but I just need to update the value for one. I tried the following:
- name: update
cloudformation:
stack_name: "{{ stack_name }}"
state: present
region: "{{ region }}"
disable_rollback: false
args:
template_parameters:
CreateAlarms: "{{ create_alarms }}"
当我运行它时,播放会抛出一个错误,指出它需要其他模板参数的值.从这里的 ansible 文档http://docs.ansible.com/ansible/latest/cloudformation_module.html,它说如果state
存在,堆栈确实存在,并且template
和template_url
都没有被指定,前面的模板将被重用."我如何告诉 cloudformation 模块也使用以前的值?我知道 aws cli 通过 usePreviousValue 标志支持它,但我如何使用 Ansible cloudformation 来支持它?
When I run it, the play throws an error stating that it expects values for the other template params. From the ansible documentation here http://docs.ansible.com/ansible/latest/cloudformation_module.html, it says "If state
is present, the stack does exist, and neither template
nor template_url
is specified, the previous template will be reused." How do I tell the cloudformation module to use previous values as well? I know that aws cli supports it via the usePreviousValue flag, but how I do it with Ansible cloudformation?
提前致谢.
推荐答案
作者/维护者当前 Ansible cloudformation
模块在这里.没有一种方法可以重用以前的值,您每次都必须指定参数.通常这很好,因为无论如何您都将参数存储在 Ansible playbook 中.
author/maintainer of the current Ansible cloudformation
module here. There isn't a method to reuse previous values, you must specify the parameters every time. Usually that's fine because you have your params stored in your Ansible playbook anyhow.
如果您不放心,cloudformation 控制台中会列出这些值,您也可以使用 更改集 以确保只有预期的更改.
If you're nervous, the values are listed in the cloudformation console, and you can also use changesets in Ansible to make sure only the expected are changing.
这篇关于Ansible cloudformation 更新堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!