Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deluan/auto-environments
Elastic Environments in Source-Control with Ansible
https://github.com/deluan/auto-environments
Last synced: about 2 months ago
JSON representation
Elastic Environments in Source-Control with Ansible
- Host: GitHub
- URL: https://github.com/deluan/auto-environments
- Owner: deluan
- License: mit
- Created: 2013-10-25T14:59:28.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-05T19:31:15.000Z (about 11 years ago)
- Last Synced: 2024-10-14T10:22:32.060Z (3 months ago)
- Language: Ruby
- Homepage: http://paulhammant.com/2013/11/19/elastic-environments-in-source-control-with-ansible/
- Size: 246 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ansible Setup
====
Clone [this repository](http://github.com/deluan/petshop-rails-ansible), which contains the sample [ansible](https://github.com/ansible/ansible) project that we will be using.The ansible project will be launching instances in EC2. In order for this to work, you must set the following environment variables (the ansible ec2 and ec2_group modules have inconsistent variable naming conventions):
export AWS_ACCESS_KEY=[your AWS access key] && export EC2_ACCESS_KEY=$AWS_ACCESS_KEY
export AWS_SECRET_KEY=[your AWS secret key] && export EC2_SECRET_KEY=$AWS_SECRET_KEY
You will also need the private key to a key pair called "petshop" that has been created in EC2ssh-agent
ssh-add /path/to/petshop.pemYou will also have to create a hosted zone in [Route 53](http://aws.amazon.com/route53) for the domain that these instances will be accessible from and configure the name servers for your domain accordingly. Ansible will handle adding an A record for each instance.
Note: this project requires features present only in Ansible version 1.4 and later
Installation
====
Add the auto-environment gem to your Gemfile:
gem 'auto-environment', git: '[email protected]:deluan/auto-environments.git'Execution
====
Run the gem, passing it the path to the environment YAML file and the ansible project:auto-environment environments/staging.yml ../petshop-rails-ansible
By default, the output from ansible will be displayed. To run in quiet mode, which only outputs a short status message after execution is complete, include the -q flag. In either case, all output is logged to ./log/auto-environment.log.
Example Environment File
====
staging.yml:machines:
db:
- common
- mysql
www:
- common
- ruby19
- passenger
- nginx
network:
domain: petshop.example.comRunning auto-environment against this file will launch two EC2 instances (if they are not running already), update the DNS configuration so they are accessible at db.staging.petshop.example.com and www.staging.petshop.example.com, and configure them with the ansible roles that are listed for each.