I'm trying to automate the deployment of my company's infrastructure using blue-green deployment and I think ansible is a good fit to this project.
One of the websites is a WordPress installation with about 100gb worth of images. Currently the database is separate from the nginx+php config in its own server.
My doubts appear on:
1- should I make ansible create that specific website or WordPress in general? (there is already a lot of custom code in place)
2- what is the best way to keep the media folder (uploads) in sync when it comes the time to switch between blue and green?
Acording to your comment - of course it makes sence - always.
Ansible has the option to not only "clone" an environment. It is also good to be used in a desaster recovery scenario. Also if you automate any changes to your environment you can see a little bit more easier any manual changes that are made.
About the concrete question
A very good option would be to think about the desaster recovery. In that case you have an "empty" OS running and your ansible builds your complete environment. If you can do that - your are the hero of the company. And every step into that is one step. I would do it (and I have). So installing, configuring the OS is one step (which must not be the first), installing, configuring Wordpress, the ReverseProxy if so, the DB etc. is another step. Make a plan: what do you do often enough that could be automated - automate that, and you have more time. And if you think, it cannot be automated, why do you think that.
That is a question what you need to answer yourself. Using rsync is an option. Using a network share is another option. There a
syncronize
modul in Ansible (which uses rsync). https://docs.ansible.com/ansible/latest/modules/synchronize_module.html