2
votes

There's an AWS CloudFormation stack which defines an SNS topic and an SNS subscription. In another Ansible task, I want to update another subscription, but this isn't possible as SNS subscriptions can't be updated.

Using Ansible to perform CloudFormation. What are the alternatives?

  1. Club AWS CLI with Ansible and then execute plays which contain AWS CLI content?
  2. Create a custom module in Ansible using boto? But this would be difficult as I should store SNS ARN's and give those to the custom module.
1

1 Answers

0
votes

Ansible v2.0 added support of an sns_topic module. You can provide a name or ARN of an existing SNS topic to converge. You also probably want to set purge_subscriptions to False so any existing subscriptions are not removed.

- name: Update SNS topic subscriptions
  sns_topic:
    name: "my-topic"
    purge_subscriptions: False
    subscriptions:
      - endpoint: "[email protected]"
        protocol: "email"

http://docs.ansible.com/ansible/sns_topic_module.html