This creates an aws autoscaling group with one instance running, it creates the security group required withing the default vpc and creates aws keypair to connect to the instance.
Ansible 2.4
stack creation depends on below repository wp_stack
using fixed ec2_lc for ansible 2.4 bug 30268
ansible-playbook create_aws_resources.yml --skip-tags "destroy" --check
Creates aws server with wordpress running and prometheus, grafana for monitoring the stack
ansible-playbook create_aws_resources.yml --skip-tags "destroy"
Creates aws server in a aws region and vpc you specify
ansible-playbook create_aws_resources.yml --skip-tags "destroy" --extra-vars "aws_region=us-west-2 aws_vpc_id=vpc-xxxxx aws_ami_id=ami-6e1a0117"
Destroys resources created
ansible-playbook create_aws_resources.yml --tags "destroy"
add a new userdata file with only installing python
create aws resources
ansible-playbook create_aws_resources.yml --skip-tags "destroy"
run setup playbooks to configure stack
ansible-playbook setup_stack.yml --private-key=keypair-wpstack.pem
-
Ansible would throw errors on security group creation if the ansible version is less than 2.4. Please update your ansible version.
-
subnets in vpc_zone_identifier should be changed before running relevent to your vpc, also ami and vpc id should be updated
-
you would run into a bug in ansible version 2.4 when using ec2_lc more details
use below file to replace ec2_lc.py in your ansible installation file location : /usr/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/ec2_lc.py replace with this https://raw.githubusercontent.com/ansible/ansible/stable-2.4/lib/ansible/modules/cloud/amazon/ec2_lc.py