D
D
DarkKefir2018-06-04 22:40:19
PHP
DarkKefir, 2018-06-04 22:40:19

Using PHP to call ansible-playbook?

[Noob Detected]
Trying to call the ansible script using an existing CMS written in PHP.
Involved: Symfony 3 and https://github.com/maschmann/php-ansible/
Task:
Through a web form, passing data, call ansible-playbook
Example:

$ansible = new Ansible();
$ansible->playbook()->play('add.yml')->extraVars([$vars])->execute();

Everything that I need works through root in the shell.
But here it is impossible to transfer the above through the form on the site (www-data is used). I changed the user
argument in the specified request of this fork - the result is one. Perhaps the secret is simple - but I just can't figure it out - how Using PHP call Ansible Playbook - using PHP to call the Ansible playbooks I need. Using the same WP, I "see" that during the installation both directories are created and the database is installed ... But now. in my case, how can I apply the same conditions/knowledge in a particular case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2018-06-05
@OnYourLips

Everything that I need works through root in the shell.
Why root? Are you configuring your machine or performing local actions that require root?
You need to fix these things first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question