This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ansible EC2 external inventory script settings | |
# | |
[ec2] | |
# AWS regions to make calls to. Set this to 'all' to make request to all regions | |
# in AWS and merge the results together. Alternatively, set this to a comma | |
# separated list of regions. E.g. 'us-east-1,us-west-1,us-west-2' | |
regions = us-east-1 | |
regions_exclude = us-gov-west-1,cn-north-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
EC2 external inventory script | |
================================= | |
Generates inventory that Ansible can understand by making API request to | |
AWS EC2 using the Boto library. | |
NOTE: This script assumes Ansible is being executed where the environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@all: | |
|--@ec2: | |
| |--54.173.53.76 | |
| |--54.208.143.201 | |
|--@ungrouped: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@all: | |
|--@aws_ec2: | |
| |--54.173.53.76 | |
| |--54.208.143.201 | |
|--@ungrouped: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example using filters | |
plugin: aws_ec2 | |
# Populate inventory with instances in these regions | |
regions: | |
- us-east-1 | |
filters: | |
# All dev and QA hosts | |
tag:Environment: | |
- dev | |
- qa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nginx_port: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- debug: | |
msg: "Nginx port number is: {{ nginx_port }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
vars: | |
nginx_port: 81 | |
children: | |
server: | |
hosts: "127.0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: server | |
gather_facts: no | |
connection: local | |
vars: | |
nginx_port: 82 | |
roles: | |
- roles/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
all: | |
children: | |
dev-server: | |
hosts: <your remote server ip or hostname> | |
vars: | |
drupal_port: 80 | |
nginx_port: 80 | |
mysql_port: 3306 | |
mysql_root_pass: !vault | |
NewerOlder