Blue-Green Deployment in AWS with Ansible

amazon-ec2, amazon-s3, amazon-web-services, ansible

Solution

By default, Ansible will try to manage all of the machines referenced in a play in parallel. For a rolling updates use case, you can define how many hosts Ansible should manage at a single time by using the `serial` keyword: (maybe you look for something like this and not blue green deployment)

- name: test play
  hosts: webservers
  serial: 1

ansible-serial-link

Also your playbook is not a blue green deployment, I suggest you to read about it.

little bit. A blue/green deployment is a software deployment strategy that relies on two identical production configurations that alternate between active and inactive. One environment is referred to as blue, and the duplicate environment is dubbed green. The two environments, blue and green, can each handle the entire production workload and are used in an alternating manner rather than as a primary and secondary space. One environment is live and the other is idle at any given time. When a new software release is ready, the team deploys this release to the idle environment, where it is thoroughly tested. Once the new release has been vetted, the team will make the idle environment active, typically by adjusting a router configuration to redirect application traffic. This leaves the alternate environment idle.

Problem

I am thinking to use Ansible to manage my AWS infrastructure; I have (2 servers with auto scaling). I will deploy using `ansible-playbook -i hosts deploy-plats.yml --limit spring-boot` Here my `deploy-plats.yml` ``` --- - hosts: bastion:apache:spring-boot vars: remote_user: ec2-user tasks: - name: Copies the .jar to the Spring Boot boxes copy: dest=~/ src=~/dev/plats/target/plats.jar mode=0777 - name: Restarts the plats service service: name=plats state=restarted enabled=yes become: yes become_user: root ``` and I am wondering if using this technology will be a Blue-green deployment or the servers will be restarted at the same time, producing a downtime

Original source