Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible cloudformation update stack

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 }}"

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?

Thanks in advance.

like image 467
user2755442 Avatar asked Oct 16 '22 23:10

user2755442


1 Answers

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.

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.

like image 84
tedder42 Avatar answered Oct 21 '22 04:10

tedder42