Skip to content

Instantly share code, notes, and snippets.

@sandys
Last active December 28, 2015 20:39
Show Gist options
  • Save sandys/7559115 to your computer and use it in GitHub Desktop.
Save sandys/7559115 to your computer and use it in GitHub Desktop.
ansible teardown problem
#This is the output of running ec2.py
{
"ec2": [
"54.201.98.213"
],
"i-8bcae5bf": [
"54.201.98.213"
],
"key_ansible-1": [
"54.201.98.213"
],
"security_group_default": [
"54.201.98.213"
],
"type_t1_micro": [
"54.201.98.213"
],
"us-west-2": [
"54.201.98.213"
],
"us-west-2c": [
"54.201.98.213"
]
}
# this is my teardown file
---
- name: Teardown up Amazon Instance
#also tried using "security_group_default" with the "ansible-playbook -i ec2.py" option
hosts: localhost
user: ubuntu
gather_facts: False
vars:
# ec2: { instance_ids: "{{ instance_ids }}" }
group_names: security_group_default
roles:
- aws
tasks:
- name: teardown ec2 instances
local_action:
module: ec2
keypair: "{{ key_name }}"
key_name: "{{ key_name }}"
ec2_access_key: "{{ aws_access_key }}"
ec2_secret_key: "{{ aws_secret_key }}"
state: absent
region: us-west-2
#group: "default"
#instance_tags: '{"name":"sss"}'
instance_ids: "{{group_names}}"
tags:
- teardown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment