# Tomcat / Apache playbook

**URL:** <https://forum.ansible.com/t/tomcat-apache-playbook/16643>\
**Category:** Ansible Project\
**Created:** [October 30, 2014, 10:36am UTC](https://forum.ansible.com/t/tomcat-apache-playbook/16643 "2014-10-30T10:36:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark3](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@Mark3](https://forum.ansible.com/u/Mark3)\
**Post date:** [October 30, 2014, 10:36am UTC](https://forum.ansible.com/t/tomcat-apache-playbook/16643/1 "2014-10-30T10:36:07Z")

</div>

Greetings all,

I’m struggling to find the sollution to this ‘problem’.

I’ve created a role that installs and configures tomcat. After this is complete I’d like the role to update the webservers’ /etc/httpd/conf.d/{{ vhost\_instance\_name }}.conf with the AJP connection strings.

For this I’d probably need a lineinfile and search for the regexp and place it before that regexp.

Now the regexp is something I can overcome myself, what I can’t seem to solve is how I invoke a task to update the webservers’s conf when the role’s target is the application server.

---

<div class="post-metadata">

**Author:** ![Fred\_Badel](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@Fred\_Badel](https://forum.ansible.com/u/Fred_Badel)\
**Post date:** [October 30, 2014, 2:31pm UTC](https://forum.ansible.com/t/tomcat-apache-playbook/16643/2 "2014-10-30T14:31:59Z")

</div>

Hi Mark,

Why wouldn’t you use a template?

something like:

{% for host in groups[’tomcat\_servers’] %}  
ProxyPassReverse {{ hostvars[host][‘ansible\_eth0’][‘ipv4’][‘address’] }}  
{% endfor %}

look at example from the doc  
[http://docs.ansible.com/playbooks\_variables.html#magic-variables-and-how-to-access-information-about-other-hosts](http://docs.ansible.com/playbooks_variables.html#magic-variables-and-how-to-access-information-about-other-hosts)

cheers

Fred

---

<div class="post-metadata">

**Author:** ![Mark3](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@Mark3](https://forum.ansible.com/u/Mark3)\
**Post date:** [October 30, 2014, 3:12pm UTC](https://forum.ansible.com/t/tomcat-apache-playbook/16643/3 "2014-10-30T15:12:29Z")

</div>

Hi Fred,

Well I’m not using a template since I’ve already used a template to configure the vhost when I Installed the apache webserver.

If I create a new vhost with only the proxy pass than it will get full of vhost files very fast, especcialy on a webserver which hosts more then 20 websites.

So that’s the reason 😉

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [October 30, 2014, 8:53pm UTC](https://forum.ansible.com/t/tomcat-apache-playbook/16643/4 "2014-10-30T20:53:54Z")

</div>

“Well I’m not using a template since I’ve already used a template to configure the vhost when I Installed the apache webserver.”

I’m not entirely following why this part is a problem. Can you elaborate?
