1. Go to this page and download the library: Download asm/php-ansible library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
asm / php-ansible example snippets
$ansible = new Ansible(
'/path/to/ansible/deployment'
);
$ansible = new Ansible(
'/path/to/ansible/deployment',
'/optional/path/to/command/ansible-playbook',
'/optional/path/to/command/ansible-galaxy'
);
$ansible = new Ansible(
'/path/to/ansible/deployment'
);
// $logger is a PSR-compliant logging implementation (e.g. monolog)
$ansible->setLogger($logger);
$ansible
->playbook()
->play('mydeployment.yml') // based on deployment root
->user('maschmann')
->extraVars(['project_release' => 20150514092022])
->limit('test')
->execute();