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
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
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.
By default, Ansible will run each task in paralell. You can set the play-level directive "serial" to force it to run the play on one and one node. This is described in detail here: "Delegation, Rolling Updates, and Local Actions"
serial tag must solve your problem. Limit the value to 1 so that the restart task will get executed in rolling fashion.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.