chenjiesuper/ansible-php

使用PHP 执行ansible shell命令的小工具

Installs: 29

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

pkg:composer/chenjiesuper/ansible-php

v0.5 2017-01-15 10:33 UTC

This package is not auto-updated.

Last update: 2025-10-12 02:35:51 UTC


README

使用PHP 执行ansible shell命令的小工具

安装前

请确保已经安装ansible并配置了相关的中心机和客户机的ssh_auth,ssh_config(在中心机配置客户机的别名或机器组) 并将中心机PHP配置文件php.ini中disable_functions中值删除后重启PHP-FPM

安装

composer require chenjiesuper/ansible-php

使用说明

include __DIR__ . '/vendor/autoload.php';

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);