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