Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Can we group resources into ansible groups? #13

Closed
christian-posta opened this issue Sep 2, 2015 · 2 comments
Closed

Can we group resources into ansible groups? #13

christian-posta opened this issue Sep 2, 2015 · 2 comments

Comments

@christian-posta
Copy link
Contributor

I have a terraform script that creates multiple "types" of ec2 instances... so think "web server" "database" type groups.

If i hack the ansible inventory script it would look like this:

[webserver]
node1.example.com
node2.example.com

[database]
node3.example.com

and then my ansible play books would classify tasks based on groups, i.e., install httpd on the "web server" assets only.

Is there a way to generate the hosts using terraform.py such that these groups get created based on some metadata in the terraform resource scripts? ie.. i think maybe role tags do this? https://github.com/CiscoCloud/terraform.py/blob/master/terraform.py#L330

@stevendborrelli
Copy link

This is how we do it in the mantl project (which uses terraform.py):

https://github.com/CiscoCloud/microservices-infrastructure/blob/master/terraform/aws/aws.tf

Basically set a role tag when creating an instance.

@christian-posta
Copy link
Contributor Author

awesome, thanks @stevendborrelli and @BrianHicks on twitter :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants