In the previous articles we created our infrastructure on AWS and configured the services. All using Ansible and creating an infrastructure as code. When the number of servers or services grows, keeping track of their names clearly can be complicated. This article describes how to manage your servers automatically using AWS Route53….
Ansible
In the previous article we showed you how we created our infrastructure as code. This article describes how to configure services within our EC2 instances. Provision Backend Let’s start with a bash script to run the playbooks:
1 2 3 4 5 6 7 8 |
./provision_nuvola_backend.sh --limit "tag_nuvola_type_${ENV}_backend" ./provision_nuvola_dbserver.sh --limit "tag_nuvola_type_${ENV}_database" ./provision_nuvola_routine.sh --limit "tag_nuvola_type_${ENV}_routine" if [ "$ENV" != "prod" ]; then ./nuvola-init-not-prod-env.sh --env ${ENV} ./deploy_nuvola.sh --limit "tag_nuvola_type_${ENV}_backend" --env ${ENV} fi |
Here is the playbook used to configure backend services:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
- hosts: all vars_files: - vars/system.yml - vars/packages.yml - vars/php_prod.yml - vars/vars_newrelic.yml - vars/vars_backend.yml - vars/vars_backend_secure.yml - "inventories/group_vars/regions.yml" handlers: - include: roles/newrelic/handlers/main.yml tasks: - include: roles/init/tasks/init_upgrade_generic.yml tags: init - include: roles/init/tasks/init_nuvola_dns_updater.yml tags: dns - include: roles/init/tasks/init_nuvola_backend.yml tags: init - include: roles/php7/tasks/php7_prod.yml tags: php - include: roles/nginx/tasks/nginx_prod.yml tags: nginx - include: roles/newrelic/tasks/newrelic_php7.yml tags: newrelic - include: roles/rabbitmq/tasks/rabbitmq_php.yml tags: rabbitmq_php - include: roles/logstash/tasks/logstash_forwarder_all.yml tags: logstash - include: roles/cloudwatch-logs-agent/tasks/cloudwatch-logs-agent.yml tags: cloudwatch - include: roles/webserver/tasks/finalize.yml tags: webserver - include: roles/deploy-nuvola/tasks/auto-deploy.yml tags: auto-deploy |
Let’s focus on php…
In the previous article we described the reasons that made us change the provider. In this article we will describe how we built our infrastructure as code. As a first step let’s create a bash script to run the playbook:
1 2 3 4 5 6 7 8 9 10 11 |
:~$ ./infrastructure_nuvola_env_aws.sh --env prod #!/bin/bash . libs/extra_option_parser.sh … ansible-playbook --vault-password-file secrets/infrastructure_nuvola_env.secret \ ansible/infrastucture_nuvola_env.yml \ -e"$EXTRA_OPTIONS" |
With the flexibility of AWS & Ansible we can easily craft an isolated…
In this series of articles we will describe our migration experience to AWS. Why a migration? Our old provider had limits. We had to overcome. In particular: No automation No flexibility No autoscaling If we wanted to grow it was necessary to migrate to a provider with these features. Need…