PHP code example of chenjiesuper / ansible-php
1. Go to this page and download the library: Download chenjiesuper/ansible-php 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/ */
chenjiesuper / ansible-php example snippets
use Jay\Ansible\Command;
$name = 'dev'; //中心机配置的客户机别名或机器组名
$binPath = '/usr/bin/ansible'; //中心机ansible 命令绝对路径
$test = new Command($name);
//$test = new Command($name, $binPath); //$binPaht 默认值/usr/bin/ansible,可不传
$ls = $test->run('ls'); //执行具体shell命令
var_dump($ls);