Debian Codegraph @

ansible_collections/pcg/alpaca_operator/README.md

raw
1 # ALPACA Operator Collection for Ansible
2
3 [![CI](https://github.com/pcg-sap/alpaca-operator-ansible/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/pcg-sap/alpaca-operator-ansible/actions/workflows/ci-cd.yml)
4
5 This Ansible Collection provides modules to manage **[ALPACA Operator](https://alpaca.pcg.io/)** via its REST API. It is designed to allow automation of common lifecycle operations related to groups, agents, systems, and commands within ALPACA-managed infrastructures.
6
7 ## License
8
9 This project is licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for details.
10
11
12 ## Code of Conduct
13
14 We follow the [Ansible Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html) in all our interactions within this project.
15
16 If you encounter abusive behavior, please refer to the [policy violations](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html#policy-violations) section of the Code for information on how to raise a complaint.
17
18 ## Included content
19
20 This collection includes the following modules:
21
22 | Module Name | Description |
23 | ------------------------------------- | -------------------------------------------------------- |
24 | `pcg.alpaca_operator.alpaca_agent` | Manage ALPACA Operator agents |
25 | `pcg.alpaca_operator.alpaca_command_set` | Manage all ALPACA Operator commands of a specific system |
26 | `pcg.alpaca_operator.alpaca_command` | Manage a single ALPACA Operator command |
27 | `pcg.alpaca_operator.alpaca_group` | Manage ALPACA Operator groups |
28 | `pcg.alpaca_operator.alpaca_system` | Manage ALPACA Operator systems |
29
30
31 All modules require API connection parameters and support both `present` and `absent` states where applicable.
32
33 Additionally, a shared utility (`_alpaca_api.py`) is available under `module_utils` for internal use, handling REST API logic and token management.
34
35 ## Requirements
36
37 - Python >= 3.9
38 - ansible-core >= 2.12
39 - ALPACA Operator >= 5.6.0
40
41 ### Support Matrix
42
43 <!-- support-matrix:start -->
44
45 | | Ansible 2.12.* | Ansible 2.13.* | Ansible 2.14.* | Ansible 2.15.* | Ansible 2.16.* | Ansible 2.17.* | Ansible 2.18.* | Ansible 2.19.* | Ansible 2.20.* |
46 | ----------- | -------------- | -------------- | -------------- | -------------- | -------------- | -------------- | -------------- | -------------- | -------------- |
47 | Python 3.8 | ✅ | ✅ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ |
48 | Python 3.9 | ✅ | ✅ | ✅ | ✅ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ |
49 | Python 3.10 | ⬜ | ✅ | ✅ | ✅ | ✅ | ✅ | ⬜ | ⬜ | ⬜ |
50 | Python 3.11 | ⬜ | ⬜ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⬜ |
51 | Python 3.12 | ⬜ | ⬜ | ⬜ | ⬜ | ✅ | ✅ | ✅ | ✅ | ✅ |
52 | Python 3.13 | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ✅ | ✅ | ✅ |
53 | Python 3.14 | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ⬜ | ✅ |
54
55 <!-- support-matrix:end -->
56
57 ### Legend
58
59 | Symbol | Meaning |
60 | ------ | ----------------------------------------------------- |
61 | ✅ | Tested and **supported** |
62 | ❌ | Tested and **unsupported** (failed) |
63 | ⬜ | **Not tested** (e.g. unsupported version combination) |
64
65 ## Installation
66
67 You can install this collection from Ansible Galaxy:
68
69 ```bash
70 ansible-galaxy collection install pcg.alpaca_operator
71 ```
72
73 Or directly from the Git repository:
74
75 ```bash
76 ansible-galaxy collection install git+https://github.com/pcg-sap/alpaca-operator-ansible.git
77 ```
78
79 Alternatively, you can install manually from a release:
80
81 1. Download the latest release from [GitHub Releases](https://github.com/pcg-sap/alpaca-operator-ansible/releases)
82 2. Copy the release archive to your server
83 3. Extract the archive
84 4. Change to the extracted directory
85 5. Install the collection:
86
87 ```bash
88 cd alpaca-operator-ansible-*
89 ansible-galaxy collection install ./ --force
90 ```
91
92 ### Quick Start Guide
93
94 For a complete setup guide including Ansible installation, collection setup, and first playbook execution, see the [Quick Start Guide](docs/index.md).
95
96 ## Example Usage
97
98 ### Group Management
99
100 ```yaml
101 - name: Ensure group "ansible_testing_group_01" exists
102 pcg.alpaca_operator.alpaca_group:
103 name: ansible_testing_group_01
104 state: present
105 api_connection:
106 host: "{{ ALPACA_Operator_API_Host }}"
107 protocol: "{{ ALPACA_Operator_API_Protocol }}"
108 port: "{{ ALPACA_Operator_API_Port }}"
109 username: "{{ ALPACA_Operator_API_Username }}"
110 password: "{{ ALPACA_Operator_API_Password }}"
111 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
112
113 - name: Delete group ansible_testing_group_01
114 pcg.alpaca_operator.alpaca_group:
115 name: ansible_testing_group_01
116 state: absent
117 api_connection:
118 host: "{{ ALPACA_Operator_API_Host }}"
119 protocol: "{{ ALPACA_Operator_API_Protocol }}"
120 port: "{{ ALPACA_Operator_API_Port }}"
121 username: "{{ ALPACA_Operator_API_Username }}"
122 password: "{{ ALPACA_Operator_API_Password }}"
123 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
124 ```
125
126 ### Agent Management
127
128 ```yaml
129 - name: Ensure agent "ansible_testing_agent_01" exists
130 pcg.alpaca_operator.alpaca_agent:
131 name: ansible_testing_agent_01
132 description: My Test Agent 01
133 ip_address: 10.1.1.1
134 location: virtual
135 escalation:
136 failures_before_report: 1
137 mail_enabled: False
138 mail_address: [email protected]
139 sms_enabled: True
140 sms_address: 0123456789
141 script_group_id: -1
142 state: present
143 api_connection:
144 host: "{{ ALPACA_Operator_API_Host }}"
145 protocol: "{{ ALPACA_Operator_API_Protocol }}"
146 port: "{{ ALPACA_Operator_API_Port }}"
147 username: "{{ ALPACA_Operator_API_Username }}"
148 password: "{{ ALPACA_Operator_API_Password }}"
149 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
150
151 - name: Delete agent ansible_testing_agent_01
152 pcg.alpaca_operator.alpaca_agent:
153 name: ansible_testing_agent_01
154 state: absent
155 api_connection:
156 host: "{{ ALPACA_Operator_API_Host }}"
157 protocol: "{{ ALPACA_Operator_API_Protocol }}"
158 port: "{{ ALPACA_Operator_API_Port }}"
159 username: "{{ ALPACA_Operator_API_Username }}"
160 password: "{{ ALPACA_Operator_API_Password }}"
161 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
162 ```
163
164 ### System Management
165
166 ```yaml
167 - name: Ensure system "ansible01" exists
168 pcg.alpaca_operator.alpaca_system:
169 name: ansible01
170 description: Ansible Test System 01
171 magic_number: 59
172 checks_disabled: False
173 group_name: ansible_testing_group_01
174 rfc_connection:
175 type: instance
176 host: ansible01-host
177 instance_number: 42
178 sid: ABC
179 logon_group: ansible01-lgroup
180 username: rfc_myUser
181 password: rfc_myPasswd
182 client: 123
183 sap_router_string: rfc_SAPRouter
184 snc_enabled: False
185 agents:
186 - name: ansible_testing_agent_01
187 - name: ansible_testing_agent_02
188 - name: ansible_testing_agent_03
189 variables:
190 - name: <BKP_DATA_CLEANUP_INT>
191 value: "400"
192 - name: <BKP_DATA_DEST1>
193 value: this is a string
194 - name: <BKP_DATA_DEST2>
195 value: "11"
196 state: present
197 api_connection:
198 host: "{{ ALPACA_Operator_API_Host }}"
199 protocol: "{{ ALPACA_Operator_API_Protocol }}"
200 port: "{{ ALPACA_Operator_API_Port }}"
201 username: "{{ ALPACA_Operator_API_Username }}"
202 password: "{{ ALPACA_Operator_API_Password }}"
203 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
204
205 - name: Delete system ansible01
206 pcg.alpaca_operator.alpaca_system:
207 name: ansible01
208 state: absent
209 api_connection:
210 host: "{{ ALPACA_Operator_API_Host }}"
211 protocol: "{{ ALPACA_Operator_API_Protocol }}"
212 port: "{{ ALPACA_Operator_API_Port }}"
213 username: "{{ ALPACA_Operator_API_Username }}"
214 password: "{{ ALPACA_Operator_API_Password }}"
215 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
216 ```
217
218 ### System Command Management
219
220 > [!WARNING]
221 > When using the `pcg.alpaca_operator.alpaca_command_set` module, all existing commands on the target system that are not included in your playbook will be deleted. Use this module with care!
222
223 ```yaml
224 - name: Ensure that exactly these system commands exist — no more, no fewer
225 pcg.alpaca_operator.alpaca_command_set:
226 system:
227 system_name: ansible01
228 commands:
229 - name: "BKP: DB log sync 1"
230 state: present
231 agent_name: ansible_testing_agent_01
232 parameters: "-p GLTarch -s <BKP_LOG_SRC> -l 4 -d <BKP_LOG_DEST1> -r <BKP_LOG_DEST2> -b <BKP_LOG_CLEANUP_INT> -t <BKP_LOG_CLEANUP_INT2> -h DB_HOST"
233 process_central_id: 8990048
234 schedule:
235 period: manually
236 time: "11:11:11"
237 cron_expression: ""
238 days_of_week:
239 - monday
240 - sunday
241 parameters_needed: false
242 disabled: true
243 critical: true
244 history:
245 document_all_runs: false
246 retention: 100
247 auto_deploy: false
248 timeout:
249 type: custom
250 value: 10
251 escalation:
252 mail_enabled: true
253 sms_enabled: true
254 mail_address: "[email protected]"
255 sms_address: "0123456789-1"
256 min_failure_count: 1
257 triggers:
258 every_change: true
259 to_red: false
260 to_yellow: false
261 to_green: true
262 - name: "BKP: DB log sync 2"
263 state: present
264 agent_name: ansible_testing_agent_02
265 parameters: "-p GLTarch -s <BKP_LOG_SRC> -l 4 -d <BKP_LOG_DEST1> -r <BKP_LOG_DEST2> -b <BKP_LOG_CLEANUP_INT> -t <BKP_LOG_CLEANUP_INT2> -h DB_HOST"
266 process_id: 801
267 schedule:
268 period: manually
269 time: "12:12:12"
270 cron_expression: ""
271 days_of_week:
272 - monday
273 - wednesday
274 - friday
275 - sunday
276 parameters_needed: false
277 disabled: true
278 critical: true
279 history:
280 document_all_runs: false
281 retention: 200
282 auto_deploy: false
283 timeout:
284 type: custom
285 value: 20
286 escalation:
287 mail_enabled: true
288 sms_enabled: true
289 mail_address: "[email protected]"
290 sms_address: "0123456789-2"
291 min_failure_count: 2
292 triggers:
293 every_change: true
294 to_red: false
295 to_yellow: false
296 to_green: true
297
298 - name: Ensure a specific system command exist
299 pcg.alpaca_operator.alpaca_command:
300 system:
301 system_name: ansible01
302 command:
303 name: "BKP: DB log sync 3"
304 state: present
305 agent_name: ansible_testing_agent_03
306 parameters: "-p GLTarch -s <BKP_LOG_SRC> -l 4 -d <BKP_LOG_DEST1> -r <BKP_LOG_DEST2> -b <BKP_LOG_CLEANUP_INT> -t <BKP_LOG_CLEANUP_INT2> -h DB_HOST"
307 process_id: 801
308 process_central_id: 8990048
309 schedule:
310 period: manually
311 time: "13:13:13"
312 cron_expression: ""
313 days_of_week:
314 - monday
315 - sunday
316 - wednesday
317 parameters_needed: false
318 disabled: true
319 critical: true
320 history:
321 document_all_runs: false
322 retention: 300
323 auto_deploy: false
324 timeout:
325 type: custom
326 value: 30
327 escalation:
328 mail_enabled: true
329 sms_enabled: true
330 mail_address: "[email protected]"
331 sms_address: "0123456789-3"
332 min_failure_count: 3
333 triggers:
334 every_change: true
335 to_red: false
336 to_yellow: false
337 to_green: true
338 api_connection:
339 host: "{{ ALPACA_Operator_API_Host }}"
340 protocol: "{{ ALPACA_Operator_API_Protocol }}"
341 port: "{{ ALPACA_Operator_API_Port }}"
342 username: "{{ ALPACA_Operator_API_Username }}"
343 password: "{{ ALPACA_Operator_API_Password }}"
344 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
345
346 - name: Delete all commands in system ansible01
347 pcg.alpaca_operator.alpaca_command_set:
348 system:
349 system_name: ansible01
350 commands: []
351 api_connection:
352 host: "{{ ALPACA_Operator_API_Host }}"
353 protocol: "{{ ALPACA_Operator_API_Protocol }}"
354 port: "{{ ALPACA_Operator_API_Port }}"
355 username: "{{ ALPACA_Operator_API_Username }}"
356 password: "{{ ALPACA_Operator_API_Password }}"
357 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
358
359 - name: Delete a specific command
360 pcg.alpaca_operator.alpaca_command:
361 system:
362 system_name: ansible01
363 command:
364 name: "BKP: DB log sync 3"
365 agent_name: "ansible_testing_agent_03"
366 state: absent
367 api_connection:
368 host: "{{ ALPACA_Operator_API_Host }}"
369 protocol: "{{ ALPACA_Operator_API_Protocol }}"
370 port: "{{ ALPACA_Operator_API_Port }}"
371 username: "{{ ALPACA_Operator_API_Username }}"
372 password: "{{ ALPACA_Operator_API_Password }}"
373 tls_verify: "{{ ALPACA_Operator_API_Validate_Certs }}"
374 ```