# Running Ansible playbooks as www-data

**URL:** <https://forum.ansible.com/t/running-ansible-playbooks-as-www-data/20948>\
**Category:** Ansible Developer\
**Created:** [March 21, 2016, 7:56pm UTC](https://forum.ansible.com/t/running-ansible-playbooks-as-www-data/20948 "2016-03-21T19:56:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Gray](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@Ryan\_Gray](https://forum.ansible.com/u/Ryan_Gray)\
**Post date:** [March 21, 2016, 7:56pm UTC](https://forum.ansible.com/t/running-ansible-playbooks-as-www-data/20948/1 "2016-03-21T19:56:23Z")

</div>

Greetings,

I’m writing some web based system management utilities. Having the application fire ansible playbooks seems perfect and a natural direction to go. PHP-Ansible ([https://github.com/maschmann/php-ansible](https://github.com/maschmann/php-ansible)) works really well provided I set things up so that my www-data user (the nginx owner) is set up with a valid shell and can run the playbooks.

Yes, I am very aware that allowing a shell on the www-data user is a very bad practice.

What are some alternatives to the “let the web server user run playbooks” aproach? I’ve got to be missing something fundamental here.

Many thanks for any thoughts anyone might have.

-goat

---

<div class="post-metadata">

**Author:** ![mcv21](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@mcv21](https://forum.ansible.com/u/mcv21)\
**Post date:** [March 22, 2016, 11:26am UTC](https://forum.ansible.com/t/running-ansible-playbooks-as-www-data/20948/2 "2016-03-22T11:26:45Z")

</div>

userv. [http://www.gnu.org/software/userv/](http://www.gnu.org/software/userv/)

Have a different user that runs ansible, and get www-data to speak to  
that user via userv.

We make extensive use of this pattern to enable our django app (a  
control panel) to control VMs and the like with ansible.

Regards,

Matthew

---

<div class="post-metadata">

**Author:** ![Ryan\_Gray](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@Ryan\_Gray](https://forum.ansible.com/u/Ryan_Gray)\
**Post date:** [March 22, 2016, 11:33am UTC](https://forum.ansible.com/t/running-ansible-playbooks-as-www-data/20948/3 "2016-03-22T11:33:51Z")

</div>

Brilliant! This is exactly what I’ve been looking for! Thank you very much for your response!

-goat
