# Ansible dictionary or local facts for blue-green deployment

**URL:** <https://forum.ansible.com/t/ansible-dictionary-or-local-facts-for-blue-green-deployment/30070>\
**Category:** Ansible Developer\
**Tags:** kubernetes\
**Created:** [April 5, 2019, 1:49pm UTC](https://forum.ansible.com/t/ansible-dictionary-or-local-facts-for-blue-green-deployment/30070 "2019-04-05T13:49:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Bianco](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@Daniel\_Bianco](https://forum.ansible.com/u/Daniel_Bianco)\
**Post date:** [April 5, 2019, 1:49pm UTC](https://forum.ansible.com/t/ansible-dictionary-or-local-facts-for-blue-green-deployment/30070/1 "2019-04-05T13:49:51Z")

</div>

I’m working on a kubernetes blue green deployment on Ansible.  
I know this would probably be easier with Terraform, but we are not using it :S.

The variables I’m getting from the requestor are:

- Application Name

- Application Version

- Number of replicas

The deployment steps are more or less like this:  
1- Find if there is an application deployed  
2a- If there is no application, deploy it as new.  
2b- If there is an application, set it as blue.  
2c- If the application is the same as the one deploy check the number of replicas and rescale if necessary.  
3- Deploy the new application and wait for the pods to boot.  
4- Once the pods are running, change the service to the new deployment.  
5- Remove the blue application

What would you recommended to use, a dictionary or local facts to handle the variables?  
Would be possible to use them inside the roles?

This is container-deployment.yml I’m using, this is just for a normal application deployment:

```auto

- hosts: master gather_facts: no become: true roles: - namespace <-- this step will create the namespace - app-build <-- this will create the image for the build - deployment <-- deploy the "deployment" - service <-- create the service

```

Any suggestion will be appreciated.

Thanks
