1 | <?php |
||
26 | final class Ansible |
||
27 | { |
||
28 | |||
29 | const DEFAULT_TIMEOUT = 300; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $playbookCommand; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $galaxyCommand; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | private $ansibleBaseDir; |
||
45 | |||
46 | /** |
||
47 | * @var integer |
||
48 | */ |
||
49 | private $timeout; |
||
50 | |||
51 | /** |
||
52 | * @param string $ansibleBaseDir base directory of ansible project structure |
||
53 | * @param string $playbookCommand path to playbook executable, default ansible-playbook |
||
54 | * @param string $galaxyCommand path to galaxy executable, default ansible-galaxy |
||
55 | * @throws CommandException |
||
56 | */ |
||
57 | 7 | public function __construct( |
|
68 | |||
69 | /** |
||
70 | * AnsiblePlaybook instance creator |
||
71 | * |
||
72 | * @return AnsiblePlaybookInterface |
||
73 | */ |
||
74 | 1 | public function playbook() |
|
80 | |||
81 | /** |
||
82 | * AnsibleGalaxy instance creator |
||
83 | * |
||
84 | * @return AnsibleGalaxyInterface |
||
85 | */ |
||
86 | 1 | public function galaxy() |
|
92 | |||
93 | /** |
||
94 | * Set process timeout in seconds. |
||
95 | * |
||
96 | * @param integer $timeout |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function setTimeout($timeout) |
||
105 | |||
106 | /** |
||
107 | * @param string $prefix command to execute |
||
108 | * @return ProcessBuilder |
||
109 | */ |
||
110 | 2 | private function createProcess($prefix) |
|
119 | |||
120 | /** |
||
121 | * @param string $command |
||
122 | * @param string $default |
||
123 | * @return string |
||
124 | * @throws CommandException |
||
125 | */ |
||
126 | 5 | private function checkCommand($command, $default) |
|
146 | |||
147 | /** |
||
148 | * @param string $dir directory to check |
||
149 | * @return string |
||
150 | * @throws CommandException |
||
151 | */ |
||
152 | 7 | private function checkDir($dir) |
|
160 | } |
||
161 |