# Ansible roles to configure different  multiple wordpress server

**URL:** <https://forum.ansible.com/t/ansible-roles-to-configure-different-multiple-wordpress-server/34107>\
**Category:** Ansible Project\
**Created:** [October 26, 2020, 4:01pm UTC](https://forum.ansible.com/t/ansible-roles-to-configure-different-multiple-wordpress-server/34107 "2020-10-26T16:01:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unai\_abrisketa\_sanch](https://avatars.discourse-cdn.com/v4/letter/u/278dde/32.png) [@unai\_abrisketa\_sanch](https://forum.ansible.com/u/unai_abrisketa_sanch)\
**Post date:** [October 26, 2020, 4:01pm UTC](https://forum.ansible.com/t/ansible-roles-to-configure-different-multiple-wordpress-server/34107/1 "2020-10-26T16:01:06Z")

</div>

Hi Team!

I am having a big doubt while using Ansible to deploy my wordpress servers.

I am using the wp-cli utility to install wordpress, so I want to use ansible roles in order to execute each role to each server with the modifications needed.

For example I have three different server names: dev.akme.eus, test.akme.eus and www.akme.eus, Ok, that´s quite easy to do using vars folder in ansible roles structure. But at the time to define the hosts to execute, I don’t understand how can I define each host to use different vars, Could I define variables in hosts field in a role? As I have seen, role playbooks don’t use hosts field.

I am a little bit lost with this topic.

Thanks for support!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 3, 2020, 4:07pm UTC](https://forum.ansible.com/t/ansible-roles-to-configure-different-multiple-wordpress-server/34107/2 "2020-11-03T16:07:15Z")

</div>

If you need host specific vars I recommend you do this in  
host\_vars/\<hostname\>.yml adjacent to inventory or play and not in  
role, just have the roles use sane defaults or require these variables  
be present (assert/fail tasks).
