mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Compare commits
434 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
026a54a634 | ||
|
|
6b8698a402 | ||
|
|
225818b1d4 | ||
|
|
02cd2e9252 | ||
|
|
f6edbe1f98 | ||
|
|
973da9670f | ||
|
|
e5a5e5a3ff | ||
|
|
7279ea33dd | ||
|
|
7b302f1d06 | ||
|
|
46b60dfdca | ||
|
|
9df16f405b | ||
|
|
af5920a4f2 | ||
|
|
2295837edf | ||
|
|
099e17d408 | ||
|
|
9943c564d5 | ||
|
|
8dd0a14666 | ||
|
|
35442f9e28 | ||
|
|
9101fb5046 | ||
|
|
5f968f609b | ||
|
|
3ed0a9c141 | ||
|
|
7ef0d9371b | ||
|
|
d053b6a1dc | ||
|
|
44e6f3bd97 | ||
|
|
fcf9e08dfa | ||
|
|
9b973ce633 | ||
|
|
0bc29c344d | ||
|
|
cc52e194be | ||
|
|
9e112272be | ||
|
|
8361aecf15 | ||
|
|
ebe214074e | ||
|
|
8db1ffeb49 | ||
|
|
4ea6ad08fa | ||
|
|
5fb79182e9 | ||
|
|
01f50d249a | ||
|
|
5d3ea0977a | ||
|
|
0c213d76c5 | ||
|
|
98e0f0b6ff | ||
|
|
421b5253f8 | ||
|
|
5e1ff39c8d | ||
|
|
a87aa9e360 | ||
|
|
744c92ae0d | ||
|
|
5392e0f1cc | ||
|
|
d64e1e8e64 | ||
|
|
7d3f6be2a2 | ||
|
|
624c5f7b68 | ||
|
|
3db3608335 | ||
|
|
af4ac4813e | ||
|
|
5dc60cbc9e | ||
|
|
8f6ea3de8e | ||
|
|
e4765f2e2b | ||
|
|
a91255824e | ||
|
|
e60daa8509 | ||
|
|
fd2528dc3c | ||
|
|
72b282fe85 | ||
|
|
cb49b96b4d | ||
|
|
2aca1a910c | ||
|
|
c44f07a405 | ||
|
|
e113c8cf11 | ||
|
|
552e1e826c | ||
|
|
516107aaf6 | ||
|
|
fb7797702a | ||
|
|
21478e3be0 | ||
|
|
3e6974815f | ||
|
|
737789b1e3 | ||
|
|
3176c08b5b | ||
|
|
40e0379112 | ||
|
|
e3a12f1e54 | ||
|
|
3e740112a0 | ||
|
|
8ce81d24f2 | ||
|
|
ba7f680486 | ||
|
|
637eb8a275 | ||
|
|
7e608db3e5 | ||
|
|
afb16dc0a2 | ||
|
|
6d03887c55 | ||
|
|
f2d980f75a | ||
|
|
d0b27d68e2 | ||
|
|
70747b0db8 | ||
|
|
c9728c2869 | ||
|
|
adced191b0 | ||
|
|
adda78b162 | ||
|
|
5e010994d9 | ||
|
|
51bf8ed298 | ||
|
|
c3b1a3a873 | ||
|
|
5da6dc7d72 | ||
|
|
d96600d4de | ||
|
|
1f5703d0af | ||
|
|
170a099101 | ||
|
|
04df03f365 | ||
|
|
76f9bc5b69 | ||
|
|
f9fdf816eb | ||
|
|
7ff20a5e98 | ||
|
|
865a8e9961 | ||
|
|
f61a6bd991 | ||
|
|
f4bae2d717 | ||
|
|
66e3c19a57 | ||
|
|
24210b32cf | ||
|
|
6932a937c5 | ||
|
|
a467da2f39 | ||
|
|
7c76d92ed0 | ||
|
|
74c7cee446 | ||
|
|
7b532be10d | ||
|
|
38616e43f9 | ||
|
|
dfac632d25 | ||
|
|
270754dc10 | ||
|
|
fef77b3c9c | ||
|
|
b022b87362 | ||
|
|
2c92db98d5 | ||
|
|
b66df6932e | ||
|
|
5060f19a05 | ||
|
|
99652cb06d | ||
|
|
6aeeab18c2 | ||
|
|
2a2bfb6c5b | ||
|
|
773ab9ba25 | ||
|
|
4fde0617c8 | ||
|
|
8cc343110f | ||
|
|
37feac8f68 | ||
|
|
7392a8e52c | ||
|
|
bfebc93f15 | ||
|
|
b6e822aad2 | ||
|
|
2a6f91b4e4 | ||
|
|
8d94d16eec | ||
|
|
f2c08bebd6 | ||
|
|
e7f66d9bc1 | ||
|
|
21e402e2bb | ||
|
|
6d4c5b76a4 | ||
|
|
a1fd642008 | ||
|
|
8298b2c7c1 | ||
|
|
25ff8d4179 | ||
|
|
145ceb693b | ||
|
|
40d094e63a | ||
|
|
6988ea052d | ||
|
|
f26883f45f | ||
|
|
03b312c0ae | ||
|
|
a634cc2928 | ||
|
|
14f23fbebe | ||
|
|
77aabcd8f5 | ||
|
|
3a1f23323c | ||
|
|
6ccb9a9813 | ||
|
|
e6e4260926 | ||
|
|
7111edd631 | ||
|
|
a84a004308 | ||
|
|
ac5bbe666e | ||
|
|
0273420e70 | ||
|
|
ce8d9d56ca | ||
|
|
7f6623657f | ||
|
|
ccdec10c67 | ||
|
|
09abc09b52 | ||
|
|
c87ba3a626 | ||
|
|
cda6248cea | ||
|
|
2cbd8ba71e | ||
|
|
eb2b8f4409 | ||
|
|
a27b1a135d | ||
|
|
db6cb07028 | ||
|
|
6ccffc3de5 | ||
|
|
17cc574b04 | ||
|
|
1f2c352b83 | ||
|
|
b90f87f3d8 | ||
|
|
b23fdc3be3 | ||
|
|
bc83586c15 | ||
|
|
b765938b79 | ||
|
|
4ed5177d60 | ||
|
|
88ac419c0e | ||
|
|
cc63dd884c | ||
|
|
d817fc7215 | ||
|
|
64897d762c | ||
|
|
64cbf1900b | ||
|
|
7e23ef3801 | ||
|
|
27fc80895c | ||
|
|
0754449d60 | ||
|
|
460cd523fe | ||
|
|
ad2d899713 | ||
|
|
3182be1a2f | ||
|
|
b726110f1f | ||
|
|
24a4d6e685 | ||
|
|
1badcffe1c | ||
|
|
b87196348a | ||
|
|
21423ca6a0 | ||
|
|
4926f15d86 | ||
|
|
9466103a4a | ||
|
|
b26df2a008 | ||
|
|
cba4fa2fe8 | ||
|
|
833530ab47 | ||
|
|
1f0361a1c6 | ||
|
|
4df53dbacf | ||
|
|
f25519e308 | ||
|
|
1bb47ad73e | ||
|
|
fd3e84fcd6 | ||
|
|
f75471e7d2 | ||
|
|
aadf1d4f6a | ||
|
|
f5ff54979a | ||
|
|
957a74b525 | ||
|
|
29afed337a | ||
|
|
e748acdd51 | ||
|
|
eed45fe6aa | ||
|
|
cce52e1812 | ||
|
|
0bcce340ed | ||
|
|
da8a11b8d8 | ||
|
|
9ed0603072 | ||
|
|
e2fa11b381 | ||
|
|
36f7ff15e9 | ||
|
|
8eac491057 | ||
|
|
607f3d83a0 | ||
|
|
d6cd90838f | ||
|
|
22e0a6dac7 | ||
|
|
3751e188ca | ||
|
|
cd4f3ca445 | ||
|
|
1d05f81e53 | ||
|
|
4ef80ecd46 | ||
|
|
68e184eba8 | ||
|
|
5dcd2c7df5 | ||
|
|
134a0dc7e2 | ||
|
|
13e3e176fb | ||
|
|
eb98be580d | ||
|
|
49ef8b1900 | ||
|
|
19d22d605a | ||
|
|
f17b10bfa2 | ||
|
|
258eb68022 | ||
|
|
264c98189c | ||
|
|
7aec01190a | ||
|
|
00fd2847e4 | ||
|
|
94ea18f1cb | ||
|
|
0b42aca72f | ||
|
|
2658bf31cd | ||
|
|
869e1a1eab | ||
|
|
d25b6e7681 | ||
|
|
8beb5d70c5 | ||
|
|
f9fecf12e7 | ||
|
|
b165337bbe | ||
|
|
6572f46998 | ||
|
|
b4ae2ce44d | ||
|
|
baec510c40 | ||
|
|
96cda3a48a | ||
|
|
9dc2e2d032 | ||
|
|
86c0af6cbb | ||
|
|
f5a2d32caa | ||
|
|
c11b7b4c86 | ||
|
|
cdbcf8abc7 | ||
|
|
2e781bf8c4 | ||
|
|
8f588ac745 | ||
|
|
7cd9b839c5 | ||
|
|
e4651c1bf3 | ||
|
|
0342cf1730 | ||
|
|
269df75421 | ||
|
|
bc32914424 | ||
|
|
21ad7c8bfa | ||
|
|
ae3fe51929 | ||
|
|
5d6047a21a | ||
|
|
c0d11f631f | ||
|
|
173c8b1dfa | ||
|
|
005db8177e | ||
|
|
8595601708 | ||
|
|
7229ef4ac4 | ||
|
|
5170c26ffd | ||
|
|
64049a35de | ||
|
|
3427e02fce | ||
|
|
f2e1abfe5e | ||
|
|
fc0d813d5f | ||
|
|
b51e008358 | ||
|
|
b32b69742b | ||
|
|
73ee9702db | ||
|
|
1cddae2265 | ||
|
|
ea2df93116 | ||
|
|
e646d21935 | ||
|
|
f522802977 | ||
|
|
3710f28efb | ||
|
|
2f24bcef8f | ||
|
|
6223b755e1 | ||
|
|
813c6e232d | ||
|
|
3e4aae56bd | ||
|
|
b099a465c5 | ||
|
|
d2b0a0d2bf | ||
|
|
fe0a5fd85f | ||
|
|
f3a2750205 | ||
|
|
5657889b28 | ||
|
|
1b2fbd72de | ||
|
|
5a2e7f9b1b | ||
|
|
c5ff49db56 | ||
|
|
43dc6ba533 | ||
|
|
eb1f0c28a9 | ||
|
|
41993d44e2 | ||
|
|
9345db2001 | ||
|
|
527417dce9 | ||
|
|
7bca37a098 | ||
|
|
4f18ecacfe | ||
|
|
cf17033278 | ||
|
|
1c07537dd5 | ||
|
|
a886633758 | ||
|
|
2e11c2dfa4 | ||
|
|
43e599abb1 | ||
|
|
ef11714708 | ||
|
|
6cd2b4f93b | ||
|
|
a509c08b3a | ||
|
|
4f036cc7f8 | ||
|
|
bc2403042a | ||
|
|
f67708f91c | ||
|
|
2587a2588d | ||
|
|
5a93168d88 | ||
|
|
e962da8b9d | ||
|
|
0d598c3542 | ||
|
|
7b73a83b91 | ||
|
|
82cdc354fa | ||
|
|
a125458748 | ||
|
|
df59034d75 | ||
|
|
6a029bcba3 | ||
|
|
1790dbd5e1 | ||
|
|
7933fe7ea3 | ||
|
|
45990b464e | ||
|
|
22a400d626 | ||
|
|
203747027e | ||
|
|
ffd51d1e22 | ||
|
|
4e13c8b969 | ||
|
|
bccf77a461 | ||
|
|
6b3c797bf6 | ||
|
|
a81e94ddc7 | ||
|
|
e56dafde94 | ||
|
|
767a296b60 | ||
|
|
963bbaccb7 | ||
|
|
9358640ed9 | ||
|
|
2846242e95 | ||
|
|
ce934aa49b | ||
|
|
083bd49976 | ||
|
|
2cc72c2213 | ||
|
|
1f4a98c8cc | ||
|
|
53b2d69bd7 | ||
|
|
981c7849ce | ||
|
|
258471b267 | ||
|
|
3020b305bb | ||
|
|
66cbd926f2 | ||
|
|
37fb2137b3 | ||
|
|
f083a0f4e7 | ||
|
|
9dc82793c4 | ||
|
|
aab93949e1 | ||
|
|
c8d6181f64 | ||
|
|
c286758248 | ||
|
|
6e685e740e | ||
|
|
695599e7d5 | ||
|
|
29e7fae303 | ||
|
|
303000c1a1 | ||
|
|
371ffaeabe | ||
|
|
42854887eb | ||
|
|
5386f7d8cd | ||
|
|
e86fcf76fc | ||
|
|
4d2895676f | ||
|
|
97b3ad6843 | ||
|
|
d7ecd40118 | ||
|
|
fbf3b85d6b | ||
|
|
1bb1e882df | ||
|
|
a7dbefcaf1 | ||
|
|
9d5490e510 | ||
|
|
2245742255 | ||
|
|
6058a5e5b1 | ||
|
|
224567e604 | ||
|
|
1eb872ccea | ||
|
|
ba18d6232a | ||
|
|
6115f18837 | ||
|
|
3f4e3dd2b6 | ||
|
|
a573661458 | ||
|
|
0977152b39 | ||
|
|
91fe881226 | ||
|
|
b78c0cf64f | ||
|
|
c79ccbbf7e | ||
|
|
a80761a8a4 | ||
|
|
213419fb0c | ||
|
|
39a1f280e3 | ||
|
|
a13d407247 | ||
|
|
ba3903e6e0 | ||
|
|
4b6b00d249 | ||
|
|
0a0b0cb42d | ||
|
|
d0b39271b3 | ||
|
|
f07cb76b09 | ||
|
|
09031fc9e6 | ||
|
|
4481d0a4a9 | ||
|
|
5861388f11 | ||
|
|
c581daa48a | ||
|
|
75e2de3581 | ||
|
|
6c7bee1225 | ||
|
|
eafcdfbceb | ||
|
|
82a764446b | ||
|
|
a0032f3513 | ||
|
|
8444367cd0 | ||
|
|
de5fbe457f | ||
|
|
40b35acee2 | ||
|
|
9835deb17f | ||
|
|
6fe9cf11f1 | ||
|
|
d3ebdd2874 | ||
|
|
4275bfe87b | ||
|
|
2f87b8c63f | ||
|
|
100fffb4c1 | ||
|
|
1206900488 | ||
|
|
c28ae26636 | ||
|
|
e1e626cdcb | ||
|
|
f8d35eeb14 | ||
|
|
c44298c437 | ||
|
|
1b580476a8 | ||
|
|
44d2d62d38 | ||
|
|
82b2d294b7 | ||
|
|
812fbef786 | ||
|
|
9d795c334b | ||
|
|
512d412eb4 | ||
|
|
8f0ee6966f | ||
|
|
3af9e39043 | ||
|
|
7b78512c59 | ||
|
|
9f0913bf73 | ||
|
|
aea851018b | ||
|
|
69c79f618e | ||
|
|
6a51ba5169 | ||
|
|
52e8e7e928 | ||
|
|
d71b90be07 | ||
|
|
1293b0ac91 | ||
|
|
d4330a3e54 | ||
|
|
7c3bf118ca | ||
|
|
742b438b32 | ||
|
|
c59ebc82cd | ||
|
|
36a4fbfe60 | ||
|
|
ad3e7bc21d | ||
|
|
66a7fdfeba | ||
|
|
77e25a7503 | ||
|
|
05ac79cee6 | ||
|
|
22b4fc8d8b | ||
|
|
6252f3bded | ||
|
|
15c4e08295 | ||
|
|
a77bb090b3 | ||
|
|
99958cea49 | ||
|
|
b2802dc8eb | ||
|
|
8617568146 | ||
|
|
7569d6315c | ||
|
|
ab5143b15d | ||
|
|
a71ff614f0 | ||
|
|
bfd3e15074 | ||
|
|
90b815de50 | ||
|
|
056e16baa5 | ||
|
|
890cf636a0 | ||
|
|
8c2b2aeb83 | ||
|
|
3c597d8b04 |
@@ -1,9 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) Ansible Project
|
|
||||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
-->
|
|
||||||
|
|
||||||
## Azure Pipelines Configuration
|
|
||||||
|
|
||||||
Please see the [Documentation](https://github.com/ansible/community/wiki/Testing:-Azure-Pipelines) for more information.
|
|
||||||
@@ -1,416 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
batch: true
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- main
|
|
||||||
- stable-*
|
|
||||||
|
|
||||||
pr:
|
|
||||||
autoCancel: true
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- main
|
|
||||||
- stable-*
|
|
||||||
|
|
||||||
schedules:
|
|
||||||
- cron: 0 8 * * *
|
|
||||||
displayName: Nightly (main)
|
|
||||||
always: true
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- main
|
|
||||||
- cron: 0 10 * * *
|
|
||||||
displayName: Nightly (active stable branches)
|
|
||||||
always: true
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- stable-7
|
|
||||||
- stable-6
|
|
||||||
- cron: 0 11 * * 0
|
|
||||||
displayName: Weekly (old stable branches)
|
|
||||||
always: true
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- stable-5
|
|
||||||
|
|
||||||
variables:
|
|
||||||
- name: checkoutPath
|
|
||||||
value: ansible_collections/community/general
|
|
||||||
- name: coverageBranches
|
|
||||||
value: main
|
|
||||||
- name: pipelinesCoverage
|
|
||||||
value: coverage
|
|
||||||
- name: entryPoint
|
|
||||||
value: tests/utils/shippable/shippable.sh
|
|
||||||
- name: fetchDepth
|
|
||||||
value: 0
|
|
||||||
|
|
||||||
resources:
|
|
||||||
containers:
|
|
||||||
- container: default
|
|
||||||
image: quay.io/ansible/azure-pipelines-test-container:4.0.1
|
|
||||||
|
|
||||||
pool: Standard
|
|
||||||
|
|
||||||
stages:
|
|
||||||
### Sanity
|
|
||||||
- stage: Sanity_devel
|
|
||||||
displayName: Sanity devel
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Test {0}
|
|
||||||
testFormat: devel/sanity/{0}
|
|
||||||
targets:
|
|
||||||
- test: 1
|
|
||||||
- test: 2
|
|
||||||
- test: 3
|
|
||||||
- test: 4
|
|
||||||
- test: extra
|
|
||||||
- stage: Sanity_2_16
|
|
||||||
displayName: Sanity 2.16
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Test {0}
|
|
||||||
testFormat: 2.16/sanity/{0}
|
|
||||||
targets:
|
|
||||||
- test: 1
|
|
||||||
- test: 2
|
|
||||||
- test: 3
|
|
||||||
- test: 4
|
|
||||||
- stage: Sanity_2_15
|
|
||||||
displayName: Sanity 2.15
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Test {0}
|
|
||||||
testFormat: 2.15/sanity/{0}
|
|
||||||
targets:
|
|
||||||
- test: 1
|
|
||||||
- test: 2
|
|
||||||
- test: 3
|
|
||||||
- test: 4
|
|
||||||
- stage: Sanity_2_14
|
|
||||||
displayName: Sanity 2.14
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Test {0}
|
|
||||||
testFormat: 2.14/sanity/{0}
|
|
||||||
targets:
|
|
||||||
- test: 1
|
|
||||||
- test: 2
|
|
||||||
- test: 3
|
|
||||||
- test: 4
|
|
||||||
### Units
|
|
||||||
- stage: Units_devel
|
|
||||||
displayName: Units devel
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: devel/units/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: 3.7
|
|
||||||
- test: 3.8
|
|
||||||
- test: 3.9
|
|
||||||
- test: '3.10'
|
|
||||||
- test: '3.11'
|
|
||||||
- test: '3.12'
|
|
||||||
- stage: Units_2_16
|
|
||||||
displayName: Units 2.16
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: 2.16/units/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: 3.6
|
|
||||||
- test: "3.11"
|
|
||||||
- stage: Units_2_15
|
|
||||||
displayName: Units 2.15
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: 2.15/units/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: 3.5
|
|
||||||
- test: "3.10"
|
|
||||||
- stage: Units_2_14
|
|
||||||
displayName: Units 2.14
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: 2.14/units/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: 3.9
|
|
||||||
|
|
||||||
## Remote
|
|
||||||
- stage: Remote_devel_extra_vms
|
|
||||||
displayName: Remote devel extra VMs
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: devel/{0}
|
|
||||||
targets:
|
|
||||||
- name: Alpine 3.18
|
|
||||||
test: alpine/3.18
|
|
||||||
# - name: Fedora 38
|
|
||||||
# test: fedora/38
|
|
||||||
- name: Ubuntu 22.04
|
|
||||||
test: ubuntu/22.04
|
|
||||||
groups:
|
|
||||||
- vm
|
|
||||||
- stage: Remote_devel
|
|
||||||
displayName: Remote devel
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: devel/{0}
|
|
||||||
targets:
|
|
||||||
- name: macOS 13.2
|
|
||||||
test: macos/13.2
|
|
||||||
- name: RHEL 9.2
|
|
||||||
test: rhel/9.2
|
|
||||||
- name: FreeBSD 13.2
|
|
||||||
test: freebsd/13.2
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- stage: Remote_2_16
|
|
||||||
displayName: Remote 2.16
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.16/{0}
|
|
||||||
targets:
|
|
||||||
#- name: macOS 13.2
|
|
||||||
# test: macos/13.2
|
|
||||||
- name: RHEL 8.8
|
|
||||||
test: rhel/8.8
|
|
||||||
#- name: FreeBSD 13.2
|
|
||||||
# test: freebsd/13.2
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- stage: Remote_2_15
|
|
||||||
displayName: Remote 2.15
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.15/{0}
|
|
||||||
targets:
|
|
||||||
- name: RHEL 9.1
|
|
||||||
test: rhel/9.1
|
|
||||||
- name: RHEL 8.7
|
|
||||||
test: rhel/8.7
|
|
||||||
- name: RHEL 7.9
|
|
||||||
test: rhel/7.9
|
|
||||||
- name: FreeBSD 13.1
|
|
||||||
test: freebsd/13.1
|
|
||||||
- name: FreeBSD 12.4
|
|
||||||
test: freebsd/12.4
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- stage: Remote_2_14
|
|
||||||
displayName: Remote 2.14
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.14/{0}
|
|
||||||
targets:
|
|
||||||
- name: RHEL 9.0
|
|
||||||
test: rhel/9.0
|
|
||||||
- name: macOS 12.0
|
|
||||||
test: macos/12.0
|
|
||||||
#- name: FreeBSD 12.4
|
|
||||||
# test: freebsd/12.4
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
|
|
||||||
### Docker
|
|
||||||
- stage: Docker_devel
|
|
||||||
displayName: Docker devel
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: devel/linux/{0}
|
|
||||||
targets:
|
|
||||||
- name: Fedora 38
|
|
||||||
test: fedora38
|
|
||||||
- name: Ubuntu 20.04
|
|
||||||
test: ubuntu2004
|
|
||||||
- name: Ubuntu 22.04
|
|
||||||
test: ubuntu2204
|
|
||||||
- name: Alpine 3
|
|
||||||
test: alpine3
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- stage: Docker_2_16
|
|
||||||
displayName: Docker 2.16
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.16/linux/{0}
|
|
||||||
targets:
|
|
||||||
- name: openSUSE 15
|
|
||||||
test: opensuse15
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- stage: Docker_2_15
|
|
||||||
displayName: Docker 2.15
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.15/linux/{0}
|
|
||||||
targets:
|
|
||||||
- name: Fedora 37
|
|
||||||
test: fedora37
|
|
||||||
- name: CentOS 7
|
|
||||||
test: centos7
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- stage: Docker_2_14
|
|
||||||
displayName: Docker 2.14
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.14/linux/{0}
|
|
||||||
targets:
|
|
||||||
- name: Fedora 36
|
|
||||||
test: fedora36
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
|
|
||||||
### Community Docker
|
|
||||||
- stage: Docker_community_devel
|
|
||||||
displayName: Docker (community images) devel
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: devel/linux-community/{0}
|
|
||||||
targets:
|
|
||||||
- name: Debian Bullseye
|
|
||||||
test: debian-bullseye/3.9
|
|
||||||
- name: Debian Bookworm
|
|
||||||
test: debian-bookworm/3.11
|
|
||||||
- name: ArchLinux
|
|
||||||
test: archlinux/3.11
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
|
|
||||||
### Generic
|
|
||||||
- stage: Generic_devel
|
|
||||||
displayName: Generic devel
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: devel/generic/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: '3.7'
|
|
||||||
- test: '3.12'
|
|
||||||
- stage: Generic_2_16
|
|
||||||
displayName: Generic 2.16
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: 2.16/generic/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: '2.7'
|
|
||||||
- test: '3.6'
|
|
||||||
- test: '3.11'
|
|
||||||
- stage: Generic_2_15
|
|
||||||
displayName: Generic 2.15
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: 2.15/generic/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: '3.9'
|
|
||||||
- stage: Generic_2_14
|
|
||||||
displayName: Generic 2.14
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: Python {0}
|
|
||||||
testFormat: 2.14/generic/{0}/1
|
|
||||||
targets:
|
|
||||||
- test: '3.10'
|
|
||||||
|
|
||||||
- stage: Summary
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
dependsOn:
|
|
||||||
- Sanity_devel
|
|
||||||
- Sanity_2_16
|
|
||||||
- Sanity_2_15
|
|
||||||
- Sanity_2_14
|
|
||||||
- Units_devel
|
|
||||||
- Units_2_16
|
|
||||||
- Units_2_15
|
|
||||||
- Units_2_14
|
|
||||||
- Remote_devel_extra_vms
|
|
||||||
- Remote_devel
|
|
||||||
- Remote_2_16
|
|
||||||
- Remote_2_15
|
|
||||||
- Remote_2_14
|
|
||||||
- Docker_devel
|
|
||||||
- Docker_2_16
|
|
||||||
- Docker_2_15
|
|
||||||
- Docker_2_14
|
|
||||||
- Docker_community_devel
|
|
||||||
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
|
|
||||||
# - Generic_devel
|
|
||||||
# - Generic_2_16
|
|
||||||
# - Generic_2_15
|
|
||||||
# - Generic_2_14
|
|
||||||
jobs:
|
|
||||||
- template: templates/coverage.yml
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Aggregate code coverage results for later processing.
|
|
||||||
|
|
||||||
set -o pipefail -eu
|
|
||||||
|
|
||||||
agent_temp_directory="$1"
|
|
||||||
|
|
||||||
PATH="${PWD}/bin:${PATH}"
|
|
||||||
|
|
||||||
mkdir "${agent_temp_directory}/coverage/"
|
|
||||||
|
|
||||||
options=(--venv --venv-system-site-packages --color -v)
|
|
||||||
|
|
||||||
ansible-test coverage combine --group-by command --export "${agent_temp_directory}/coverage/" "${options[@]}"
|
|
||||||
|
|
||||||
if ansible-test coverage analyze targets generate --help >/dev/null 2>&1; then
|
|
||||||
# Only analyze coverage if the installed version of ansible-test supports it.
|
|
||||||
# Doing so allows this script to work unmodified for multiple Ansible versions.
|
|
||||||
ansible-test coverage analyze targets generate "${agent_temp_directory}/coverage/coverage-analyze-targets.json" "${options[@]}"
|
|
||||||
fi
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
"""
|
|
||||||
Combine coverage data from multiple jobs, keeping the data only from the most recent attempt from each job.
|
|
||||||
Coverage artifacts must be named using the format: "Coverage $(System.JobAttempt) {StableUniqueNameForEachJob}"
|
|
||||||
The recommended coverage artifact name format is: Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)
|
|
||||||
Keep in mind that Azure Pipelines does not enforce unique job display names (only names).
|
|
||||||
It is up to pipeline authors to avoid name collisions when deviating from the recommended format.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main program entry point."""
|
|
||||||
source_directory = sys.argv[1]
|
|
||||||
|
|
||||||
if '/ansible_collections/' in os.getcwd():
|
|
||||||
output_path = "tests/output"
|
|
||||||
else:
|
|
||||||
output_path = "test/results"
|
|
||||||
|
|
||||||
destination_directory = os.path.join(output_path, 'coverage')
|
|
||||||
|
|
||||||
if not os.path.exists(destination_directory):
|
|
||||||
os.makedirs(destination_directory)
|
|
||||||
|
|
||||||
jobs = {}
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
for name in os.listdir(source_directory):
|
|
||||||
match = re.search('^Coverage (?P<attempt>[0-9]+) (?P<label>.+)$', name)
|
|
||||||
label = match.group('label')
|
|
||||||
attempt = int(match.group('attempt'))
|
|
||||||
jobs[label] = max(attempt, jobs.get(label, 0))
|
|
||||||
|
|
||||||
for label, attempt in jobs.items():
|
|
||||||
name = 'Coverage {attempt} {label}'.format(label=label, attempt=attempt)
|
|
||||||
source = os.path.join(source_directory, name)
|
|
||||||
source_files = os.listdir(source)
|
|
||||||
|
|
||||||
for source_file in source_files:
|
|
||||||
source_path = os.path.join(source, source_file)
|
|
||||||
destination_path = os.path.join(destination_directory, source_file + '.' + label)
|
|
||||||
print('"%s" -> "%s"' % (source_path, destination_path))
|
|
||||||
shutil.copyfile(source_path, destination_path)
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
print('Coverage file count: %d' % count)
|
|
||||||
print('##vso[task.setVariable variable=coverageFileCount]%d' % count)
|
|
||||||
print('##vso[task.setVariable variable=outputPath]%s' % output_path)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Check the test results and set variables for use in later steps.
|
|
||||||
|
|
||||||
set -o pipefail -eu
|
|
||||||
|
|
||||||
if [[ "$PWD" =~ /ansible_collections/ ]]; then
|
|
||||||
output_path="tests/output"
|
|
||||||
else
|
|
||||||
output_path="test/results"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "##vso[task.setVariable variable=outputPath]${output_path}"
|
|
||||||
|
|
||||||
if compgen -G "${output_path}"'/junit/*.xml' > /dev/null; then
|
|
||||||
echo "##vso[task.setVariable variable=haveTestResults]true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if compgen -G "${output_path}"'/bot/ansible-test-*' > /dev/null; then
|
|
||||||
echo "##vso[task.setVariable variable=haveBotResults]true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if compgen -G "${output_path}"'/coverage/*' > /dev/null; then
|
|
||||||
echo "##vso[task.setVariable variable=haveCoverageData]true"
|
|
||||||
fi
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
"""
|
|
||||||
Upload code coverage reports to codecov.io.
|
|
||||||
Multiple coverage files from multiple languages are accepted and aggregated after upload.
|
|
||||||
Python coverage, as well as PowerShell and Python stubs can all be uploaded.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import dataclasses
|
|
||||||
import pathlib
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
import typing as t
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
|
||||||
class CoverageFile:
|
|
||||||
name: str
|
|
||||||
path: pathlib.Path
|
|
||||||
flags: t.List[str]
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
|
||||||
class Args:
|
|
||||||
dry_run: bool
|
|
||||||
path: pathlib.Path
|
|
||||||
|
|
||||||
|
|
||||||
def parse_args() -> Args:
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('-n', '--dry-run', action='store_true')
|
|
||||||
parser.add_argument('path', type=pathlib.Path)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
# Store arguments in a typed dataclass
|
|
||||||
fields = dataclasses.fields(Args)
|
|
||||||
kwargs = {field.name: getattr(args, field.name) for field in fields}
|
|
||||||
|
|
||||||
return Args(**kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def process_files(directory: pathlib.Path) -> t.Tuple[CoverageFile, ...]:
|
|
||||||
processed = []
|
|
||||||
for file in directory.joinpath('reports').glob('coverage*.xml'):
|
|
||||||
name = file.stem.replace('coverage=', '')
|
|
||||||
|
|
||||||
# Get flags from name
|
|
||||||
flags = name.replace('-powershell', '').split('=') # Drop '-powershell' suffix
|
|
||||||
flags = [flag if not flag.startswith('stub') else flag.split('-')[0] for flag in flags] # Remove "-01" from stub files
|
|
||||||
|
|
||||||
processed.append(CoverageFile(name, file, flags))
|
|
||||||
|
|
||||||
return tuple(processed)
|
|
||||||
|
|
||||||
|
|
||||||
def upload_files(codecov_bin: pathlib.Path, files: t.Tuple[CoverageFile, ...], dry_run: bool = False) -> None:
|
|
||||||
for file in files:
|
|
||||||
cmd = [
|
|
||||||
str(codecov_bin),
|
|
||||||
'--name', file.name,
|
|
||||||
'--file', str(file.path),
|
|
||||||
]
|
|
||||||
for flag in file.flags:
|
|
||||||
cmd.extend(['--flags', flag])
|
|
||||||
|
|
||||||
if dry_run:
|
|
||||||
print(f'DRY-RUN: Would run command: {cmd}')
|
|
||||||
continue
|
|
||||||
|
|
||||||
subprocess.run(cmd, check=True)
|
|
||||||
|
|
||||||
|
|
||||||
def download_file(url: str, dest: pathlib.Path, flags: int, dry_run: bool = False) -> None:
|
|
||||||
if dry_run:
|
|
||||||
print(f'DRY-RUN: Would download {url} to {dest} and set mode to {flags:o}')
|
|
||||||
return
|
|
||||||
|
|
||||||
with urllib.request.urlopen(url) as resp:
|
|
||||||
with dest.open('w+b') as f:
|
|
||||||
# Read data in chunks rather than all at once
|
|
||||||
shutil.copyfileobj(resp, f, 64 * 1024)
|
|
||||||
|
|
||||||
dest.chmod(flags)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
args = parse_args()
|
|
||||||
url = 'https://ansible-ci-files.s3.amazonaws.com/codecov/linux/codecov'
|
|
||||||
with tempfile.TemporaryDirectory(prefix='codecov-') as tmpdir:
|
|
||||||
codecov_bin = pathlib.Path(tmpdir) / 'codecov'
|
|
||||||
download_file(url, codecov_bin, 0o755, args.dry_run)
|
|
||||||
|
|
||||||
files = process_files(args.path)
|
|
||||||
upload_files(codecov_bin, files, args.dry_run)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Generate code coverage reports for uploading to Azure Pipelines and codecov.io.
|
|
||||||
|
|
||||||
set -o pipefail -eu
|
|
||||||
|
|
||||||
PATH="${PWD}/bin:${PATH}"
|
|
||||||
|
|
||||||
if ! ansible-test --help >/dev/null 2>&1; then
|
|
||||||
# Install the devel version of ansible-test for generating code coverage reports.
|
|
||||||
# This is only used by Ansible Collections, which are typically tested against multiple Ansible versions (in separate jobs).
|
|
||||||
# Since a version of ansible-test is required that can work the output from multiple older releases, the devel version is used.
|
|
||||||
pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
|
|
||||||
fi
|
|
||||||
|
|
||||||
ansible-test coverage xml --group-by command --stub --venv --venv-system-site-packages --color -v
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# Configure the test environment and run the tests.
|
|
||||||
|
|
||||||
set -o pipefail -eu
|
|
||||||
|
|
||||||
entry_point="$1"
|
|
||||||
test="$2"
|
|
||||||
read -r -a coverage_branches <<< "$3" # space separated list of branches to run code coverage on for scheduled builds
|
|
||||||
|
|
||||||
export COMMIT_MESSAGE
|
|
||||||
export COMPLETE
|
|
||||||
export COVERAGE
|
|
||||||
export IS_PULL_REQUEST
|
|
||||||
|
|
||||||
if [ "${SYSTEM_PULLREQUEST_TARGETBRANCH:-}" ]; then
|
|
||||||
IS_PULL_REQUEST=true
|
|
||||||
COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD^2)
|
|
||||||
else
|
|
||||||
IS_PULL_REQUEST=
|
|
||||||
COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD)
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMPLETE=
|
|
||||||
COVERAGE=
|
|
||||||
|
|
||||||
if [ "${BUILD_REASON}" = "Schedule" ]; then
|
|
||||||
COMPLETE=yes
|
|
||||||
|
|
||||||
if printf '%s\n' "${coverage_branches[@]}" | grep -q "^${BUILD_SOURCEBRANCHNAME}$"; then
|
|
||||||
COVERAGE=yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
"${entry_point}" "${test}" 2>&1 | "$(dirname "$0")/time-command.py"
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
"""Prepends a relative timestamp to each input line from stdin and writes it to stdout."""
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main program entry point."""
|
|
||||||
start = time.time()
|
|
||||||
|
|
||||||
sys.stdin.reconfigure(errors='surrogateescape')
|
|
||||||
sys.stdout.reconfigure(errors='surrogateescape')
|
|
||||||
|
|
||||||
for line in sys.stdin:
|
|
||||||
seconds = time.time() - start
|
|
||||||
sys.stdout.write('%02d:%02d %s' % (seconds // 60, seconds % 60, line))
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# This template adds a job for processing code coverage data.
|
|
||||||
# It will upload results to Azure Pipelines and codecov.io.
|
|
||||||
# Use it from a job stage that completes after all other jobs have completed.
|
|
||||||
# This can be done by placing it in a separate summary stage that runs after the test stage(s) have completed.
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- job: Coverage
|
|
||||||
displayName: Code Coverage
|
|
||||||
container: default
|
|
||||||
workspace:
|
|
||||||
clean: all
|
|
||||||
steps:
|
|
||||||
- checkout: self
|
|
||||||
fetchDepth: $(fetchDepth)
|
|
||||||
path: $(checkoutPath)
|
|
||||||
- task: DownloadPipelineArtifact@2
|
|
||||||
displayName: Download Coverage Data
|
|
||||||
inputs:
|
|
||||||
path: coverage/
|
|
||||||
patterns: "Coverage */*=coverage.combined"
|
|
||||||
- bash: .azure-pipelines/scripts/combine-coverage.py coverage/
|
|
||||||
displayName: Combine Coverage Data
|
|
||||||
- bash: .azure-pipelines/scripts/report-coverage.sh
|
|
||||||
displayName: Generate Coverage Report
|
|
||||||
condition: gt(variables.coverageFileCount, 0)
|
|
||||||
- task: PublishCodeCoverageResults@1
|
|
||||||
inputs:
|
|
||||||
codeCoverageTool: Cobertura
|
|
||||||
# Azure Pipelines only accepts a single coverage data file.
|
|
||||||
# That means only Python or PowerShell coverage can be uploaded, but not both.
|
|
||||||
# Set the "pipelinesCoverage" variable to determine which type is uploaded.
|
|
||||||
# Use "coverage" for Python and "coverage-powershell" for PowerShell.
|
|
||||||
summaryFileLocation: "$(outputPath)/reports/$(pipelinesCoverage).xml"
|
|
||||||
displayName: Publish to Azure Pipelines
|
|
||||||
condition: gt(variables.coverageFileCount, 0)
|
|
||||||
- bash: .azure-pipelines/scripts/publish-codecov.py "$(outputPath)"
|
|
||||||
displayName: Publish to codecov.io
|
|
||||||
condition: gt(variables.coverageFileCount, 0)
|
|
||||||
continueOnError: true
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# This template uses the provided targets and optional groups to generate a matrix which is then passed to the test template.
|
|
||||||
# If this matrix template does not provide the required functionality, consider using the test template directly instead.
|
|
||||||
|
|
||||||
parameters:
|
|
||||||
# A required list of dictionaries, one per test target.
|
|
||||||
# Each item in the list must contain a "test" or "name" key.
|
|
||||||
# Both may be provided. If one is omitted, the other will be used.
|
|
||||||
- name: targets
|
|
||||||
type: object
|
|
||||||
|
|
||||||
# An optional list of values which will be used to multiply the targets list into a matrix.
|
|
||||||
# Values can be strings or numbers.
|
|
||||||
- name: groups
|
|
||||||
type: object
|
|
||||||
default: []
|
|
||||||
|
|
||||||
# An optional format string used to generate the job name.
|
|
||||||
# - {0} is the name of an item in the targets list.
|
|
||||||
- name: nameFormat
|
|
||||||
type: string
|
|
||||||
default: "{0}"
|
|
||||||
|
|
||||||
# An optional format string used to generate the test name.
|
|
||||||
# - {0} is the name of an item in the targets list.
|
|
||||||
- name: testFormat
|
|
||||||
type: string
|
|
||||||
default: "{0}"
|
|
||||||
|
|
||||||
# An optional format string used to add the group to the job name.
|
|
||||||
# {0} is the formatted name of an item in the targets list.
|
|
||||||
# {{1}} is the group -- be sure to include the double "{{" and "}}".
|
|
||||||
- name: nameGroupFormat
|
|
||||||
type: string
|
|
||||||
default: "{0} - {{1}}"
|
|
||||||
|
|
||||||
# An optional format string used to add the group to the test name.
|
|
||||||
# {0} is the formatted test of an item in the targets list.
|
|
||||||
# {{1}} is the group -- be sure to include the double "{{" and "}}".
|
|
||||||
- name: testGroupFormat
|
|
||||||
type: string
|
|
||||||
default: "{0}/{{1}}"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- template: test.yml
|
|
||||||
parameters:
|
|
||||||
jobs:
|
|
||||||
- ${{ if eq(length(parameters.groups), 0) }}:
|
|
||||||
- ${{ each target in parameters.targets }}:
|
|
||||||
- name: ${{ format(parameters.nameFormat, coalesce(target.name, target.test)) }}
|
|
||||||
test: ${{ format(parameters.testFormat, coalesce(target.test, target.name)) }}
|
|
||||||
- ${{ if not(eq(length(parameters.groups), 0)) }}:
|
|
||||||
- ${{ each group in parameters.groups }}:
|
|
||||||
- ${{ each target in parameters.targets }}:
|
|
||||||
- name: ${{ format(format(parameters.nameGroupFormat, parameters.nameFormat), coalesce(target.name, target.test), group) }}
|
|
||||||
test: ${{ format(format(parameters.testGroupFormat, parameters.testFormat), coalesce(target.test, target.name), group) }}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# This template uses the provided list of jobs to create test one or more test jobs.
|
|
||||||
# It can be used directly if needed, or through the matrix template.
|
|
||||||
|
|
||||||
parameters:
|
|
||||||
# A required list of dictionaries, one per test job.
|
|
||||||
# Each item in the list must contain a "job" and "name" key.
|
|
||||||
- name: jobs
|
|
||||||
type: object
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
- ${{ each job in parameters.jobs }}:
|
|
||||||
- job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }}
|
|
||||||
displayName: ${{ job.name }}
|
|
||||||
container: default
|
|
||||||
workspace:
|
|
||||||
clean: all
|
|
||||||
steps:
|
|
||||||
- checkout: self
|
|
||||||
fetchDepth: $(fetchDepth)
|
|
||||||
path: $(checkoutPath)
|
|
||||||
- bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)"
|
|
||||||
displayName: Run Tests
|
|
||||||
- bash: .azure-pipelines/scripts/process-results.sh
|
|
||||||
condition: succeededOrFailed()
|
|
||||||
displayName: Process Results
|
|
||||||
- bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
|
|
||||||
condition: eq(variables.haveCoverageData, 'true')
|
|
||||||
displayName: Aggregate Coverage Data
|
|
||||||
- task: PublishTestResults@2
|
|
||||||
condition: eq(variables.haveTestResults, 'true')
|
|
||||||
inputs:
|
|
||||||
testResultsFiles: "$(outputPath)/junit/*.xml"
|
|
||||||
displayName: Publish Test Results
|
|
||||||
- task: PublishPipelineArtifact@1
|
|
||||||
condition: eq(variables.haveBotResults, 'true')
|
|
||||||
displayName: Publish Bot Results
|
|
||||||
inputs:
|
|
||||||
targetPath: "$(outputPath)/bot/"
|
|
||||||
artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
|
|
||||||
- task: PublishPipelineArtifact@1
|
|
||||||
condition: eq(variables.haveCoverageData, 'true')
|
|
||||||
displayName: Publish Coverage Data
|
|
||||||
inputs:
|
|
||||||
targetPath: "$(Agent.TempDirectory)/coverage/"
|
|
||||||
artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
|
|
||||||
2062
.github/BOTMETA.yml
vendored
2062
.github/BOTMETA.yml
vendored
File diff suppressed because it is too large
Load Diff
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -47,7 +47,7 @@ body:
|
|||||||
label: Component Name
|
label: Component Name
|
||||||
description: >-
|
description: >-
|
||||||
Write the short name of the module, plugin, task or feature below,
|
Write the short name of the module, plugin, task or feature below,
|
||||||
*use your best guess if unsure*. Do not include `community.general.`!
|
*use your best guess if unsure*.
|
||||||
placeholder: dnf, apt, yum, pip, user etc.
|
placeholder: dnf, apt, yum, pip, user etc.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Component Name
|
label: Component Name
|
||||||
description: >-
|
description: >-
|
||||||
Write the short name of the file, module, plugin, task or feature below,
|
Write the short name of the rst file, module, plugin, task or
|
||||||
*use your best guess if unsure*. Do not include `community.general.`!
|
feature below, *use your best guess if unsure*.
|
||||||
placeholder: mysql_user
|
placeholder: mysql_user
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
4
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
4
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -42,8 +42,8 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Component Name
|
label: Component Name
|
||||||
description: >-
|
description: >-
|
||||||
Write the short name of the module or plugin, or which other part(s) of the collection this feature affects.
|
Write the short name of the module, plugin, task or feature below,
|
||||||
*use your best guess if unsure*. Do not include `community.general.`!
|
*use your best guess if unsure*.
|
||||||
placeholder: dnf, apt, yum, pip, user etc.
|
placeholder: dnf, apt, yum, pip, user etc.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
32
.github/pull_request_template.md
vendored
32
.github/pull_request_template.md
vendored
@@ -1,32 +0,0 @@
|
|||||||
##### SUMMARY
|
|
||||||
<!--- Describe the change below, including rationale and design decisions -->
|
|
||||||
|
|
||||||
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
|
|
||||||
|
|
||||||
<!--- Please do not forget to include a changelog fragment:
|
|
||||||
https://docs.ansible.com/ansible/devel/community/collection_development_process.html#creating-changelog-fragments
|
|
||||||
No need to include one for docs-only or test-only PR, and for new plugin/module PRs.
|
|
||||||
Read about more details in CONTRIBUTING.md.
|
|
||||||
-->
|
|
||||||
|
|
||||||
##### ISSUE TYPE
|
|
||||||
<!--- Pick one or more below and delete the rest.
|
|
||||||
'Test Pull Request' is for PRs that add/extend tests without code changes. -->
|
|
||||||
- Bugfix Pull Request
|
|
||||||
- Docs Pull Request
|
|
||||||
- Feature Pull Request
|
|
||||||
- New Module/Plugin Pull Request
|
|
||||||
- Refactoring Pull Request
|
|
||||||
- Test Pull Request
|
|
||||||
|
|
||||||
##### COMPONENT NAME
|
|
||||||
<!--- Write the SHORT NAME of the module, plugin, task or feature below. -->
|
|
||||||
|
|
||||||
##### ADDITIONAL INFORMATION
|
|
||||||
<!--- Include additional information to help people understand the change here -->
|
|
||||||
<!--- A step-by-step reproduction of the problem is helpful if there is no related issue -->
|
|
||||||
|
|
||||||
<!--- Paste verbatim command output below, e.g. before and after your change -->
|
|
||||||
```paste below
|
|
||||||
|
|
||||||
```
|
|
||||||
3
.github/pull_request_template.md.license
vendored
3
.github/pull_request_template.md.license
vendored
@@ -1,3 +0,0 @@
|
|||||||
Copyright (c) Ansible Project
|
|
||||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
287
.github/workflows/ansible-test.yml
vendored
287
.github/workflows/ansible-test.yml
vendored
@@ -1,287 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# For the comprehensive list of the inputs supported by the ansible-community/ansible-test-gh-action GitHub Action, see
|
|
||||||
# https://github.com/marketplace/actions/ansible-test
|
|
||||||
|
|
||||||
name: EOL CI
|
|
||||||
on:
|
|
||||||
# Run EOL CI against all pushes (direct commits, also merged PRs), Pull Requests
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- stable-*
|
|
||||||
pull_request:
|
|
||||||
# Run EOL CI once per day (at 10:00 UTC)
|
|
||||||
schedule:
|
|
||||||
- cron: '0 10 * * *'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
# Make sure there is at most one active run per PR, but do not cancel any non-PR runs
|
|
||||||
group: ${{ github.workflow }}-${{ (github.head_ref && github.event.number) || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sanity:
|
|
||||||
name: EOL Sanity (Ⓐ${{ matrix.ansible }})
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
ansible:
|
|
||||||
- '2.11'
|
|
||||||
- '2.12'
|
|
||||||
- '2.13'
|
|
||||||
# Ansible-test on various stable branches does not yet work well with cgroups v2.
|
|
||||||
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
|
|
||||||
# image for these stable branches. The list of branches where this is necessary will
|
|
||||||
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
|
|
||||||
# for the latest list.
|
|
||||||
runs-on: >-
|
|
||||||
${{ contains(fromJson(
|
|
||||||
'["2.9", "2.10", "2.11"]'
|
|
||||||
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
|
|
||||||
steps:
|
|
||||||
- name: Perform sanity testing
|
|
||||||
uses: felixfontein/ansible-test-gh-action@main
|
|
||||||
with:
|
|
||||||
ansible-core-github-repository-slug: ${{ contains(fromJson('["2.10", "2.11"]'), matrix.ansible) && 'felixfontein/ansible' || 'ansible/ansible' }}
|
|
||||||
ansible-core-version: stable-${{ matrix.ansible }}
|
|
||||||
coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }}
|
|
||||||
pull-request-change-detection: 'true'
|
|
||||||
testing-type: sanity
|
|
||||||
|
|
||||||
units:
|
|
||||||
# Ansible-test on various stable branches does not yet work well with cgroups v2.
|
|
||||||
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
|
|
||||||
# image for these stable branches. The list of branches where this is necessary will
|
|
||||||
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
|
|
||||||
# for the latest list.
|
|
||||||
runs-on: >-
|
|
||||||
${{ contains(fromJson(
|
|
||||||
'["2.9", "2.10", "2.11"]'
|
|
||||||
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
|
|
||||||
name: EOL Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
|
|
||||||
strategy:
|
|
||||||
# As soon as the first unit test fails, cancel the others to free up the CI queue
|
|
||||||
fail-fast: true
|
|
||||||
matrix:
|
|
||||||
ansible:
|
|
||||||
- ''
|
|
||||||
python:
|
|
||||||
- ''
|
|
||||||
exclude:
|
|
||||||
- ansible: ''
|
|
||||||
include:
|
|
||||||
- ansible: '2.11'
|
|
||||||
python: '2.7'
|
|
||||||
- ansible: '2.11'
|
|
||||||
python: '3.5'
|
|
||||||
- ansible: '2.12'
|
|
||||||
python: '2.6'
|
|
||||||
- ansible: '2.12'
|
|
||||||
python: '3.8'
|
|
||||||
- ansible: '2.13'
|
|
||||||
python: '2.7'
|
|
||||||
- ansible: '2.13'
|
|
||||||
python: '3.8'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: >-
|
|
||||||
Perform unit testing against
|
|
||||||
Ansible version ${{ matrix.ansible }}
|
|
||||||
uses: felixfontein/ansible-test-gh-action@main
|
|
||||||
with:
|
|
||||||
ansible-core-github-repository-slug: ${{ contains(fromJson('["2.10", "2.11"]'), matrix.ansible) && 'felixfontein/ansible' || 'ansible/ansible' }}
|
|
||||||
ansible-core-version: stable-${{ matrix.ansible }}
|
|
||||||
coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }}
|
|
||||||
pre-test-cmd: >-
|
|
||||||
mkdir -p ../../ansible
|
|
||||||
;
|
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
|
|
||||||
pull-request-change-detection: 'true'
|
|
||||||
target-python-version: ${{ matrix.python }}
|
|
||||||
testing-type: units
|
|
||||||
|
|
||||||
integration:
|
|
||||||
# Ansible-test on various stable branches does not yet work well with cgroups v2.
|
|
||||||
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
|
|
||||||
# image for these stable branches. The list of branches where this is necessary will
|
|
||||||
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
|
|
||||||
# for the latest list.
|
|
||||||
runs-on: >-
|
|
||||||
${{ contains(fromJson(
|
|
||||||
'["2.9", "2.10", "2.11"]'
|
|
||||||
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
|
|
||||||
name: EOL I (Ⓐ${{ matrix.ansible }}+${{ matrix.docker }}+py${{ matrix.python }}:${{ matrix.target }})
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
ansible:
|
|
||||||
- ''
|
|
||||||
docker:
|
|
||||||
- ''
|
|
||||||
python:
|
|
||||||
- ''
|
|
||||||
target:
|
|
||||||
- ''
|
|
||||||
exclude:
|
|
||||||
- ansible: ''
|
|
||||||
include:
|
|
||||||
# 2.11
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: fedora32
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: fedora32
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: fedora32
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: fedora33
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: fedora33
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: fedora33
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: alpine3
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: alpine3
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.11'
|
|
||||||
docker: alpine3
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
|
|
||||||
# - ansible: '2.11'
|
|
||||||
# docker: default
|
|
||||||
# python: '2.7'
|
|
||||||
# target: azp/generic/1/
|
|
||||||
# - ansible: '2.11'
|
|
||||||
# docker: default
|
|
||||||
# python: '3.5'
|
|
||||||
# target: azp/generic/1/
|
|
||||||
# 2.12
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: centos6
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: centos6
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: centos6
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: fedora34
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: fedora34
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: fedora34
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: ubuntu1804
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: ubuntu1804
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.12'
|
|
||||||
docker: ubuntu1804
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
|
|
||||||
# - ansible: '2.12'
|
|
||||||
# docker: default
|
|
||||||
# python: '3.8'
|
|
||||||
# target: azp/generic/1/
|
|
||||||
# 2.13
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: fedora35
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: fedora35
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: fedora35
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: opensuse15py2
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: opensuse15py2
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: opensuse15py2
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: alpine3
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/1/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: alpine3
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/2/
|
|
||||||
- ansible: '2.13'
|
|
||||||
docker: alpine3
|
|
||||||
python: ''
|
|
||||||
target: azp/posix/3/
|
|
||||||
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
|
|
||||||
# - ansible: '2.13'
|
|
||||||
# docker: default
|
|
||||||
# python: '3.9'
|
|
||||||
# target: azp/generic/1/
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: >-
|
|
||||||
Perform integration testing against
|
|
||||||
Ansible version ${{ matrix.ansible }}
|
|
||||||
under Python ${{ matrix.python }}
|
|
||||||
uses: felixfontein/ansible-test-gh-action@main
|
|
||||||
with:
|
|
||||||
ansible-core-github-repository-slug: ${{ contains(fromJson('["2.10", "2.11"]'), matrix.ansible) && 'felixfontein/ansible' || 'ansible/ansible' }}
|
|
||||||
ansible-core-version: stable-${{ matrix.ansible }}
|
|
||||||
coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }}
|
|
||||||
docker-image: ${{ matrix.docker }}
|
|
||||||
integration-continue-on-error: 'false'
|
|
||||||
integration-diff: 'false'
|
|
||||||
integration-retry-on-error: 'true'
|
|
||||||
pre-test-cmd: >-
|
|
||||||
mkdir -p ../../ansible
|
|
||||||
;
|
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.posix.git ../../ansible/posix
|
|
||||||
;
|
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.crypto.git ../../community/crypto
|
|
||||||
;
|
|
||||||
git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ../../community/internal_test_tools
|
|
||||||
pull-request-change-detection: 'true'
|
|
||||||
target: ${{ matrix.target }}
|
|
||||||
target-python-version: ${{ matrix.python }}
|
|
||||||
testing-type: integration
|
|
||||||
36
.github/workflows/codeql-analysis.yml
vendored
36
.github/workflows/codeql-analysis.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
name: "Code scanning - action"
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '26 19 * * 1'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
CodeQL-Build:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
actions: read # for github/codeql-action/init to get workflow details
|
|
||||||
contents: read # for actions/checkout to fetch code
|
|
||||||
security-events: write # for github/codeql-action/autobuild to send a status report
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: python
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
35
.github/workflows/reuse.yml
vendored
35
.github/workflows/reuse.yml
vendored
@@ -1,35 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
name: Verify REUSE
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
branches: [main]
|
|
||||||
# Run CI once per day (at 07:30 UTC)
|
|
||||||
schedule:
|
|
||||||
- cron: '30 7 * * *'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.sha || '' }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
pip install reuse
|
|
||||||
|
|
||||||
- name: Check REUSE compliance
|
|
||||||
run: |
|
|
||||||
reuse lint
|
|
||||||
1507
CHANGELOG.rst
1507
CHANGELOG.rst
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@ Also, consider taking up a valuable, reviewed, but abandoned pull request which
|
|||||||
* Try committing your changes with an informative but short commit message.
|
* Try committing your changes with an informative but short commit message.
|
||||||
* Do not squash your commits and force-push to your branch if not needed. Reviews of your pull request are much easier with individual commits to comprehend the pull request history. All commits of your pull request branch will be squashed into one commit by GitHub upon merge.
|
* Do not squash your commits and force-push to your branch if not needed. Reviews of your pull request are much easier with individual commits to comprehend the pull request history. All commits of your pull request branch will be squashed into one commit by GitHub upon merge.
|
||||||
* Do not add merge commits to your PR. The bot will complain and you will have to rebase ([instructions for rebasing](https://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html)) to remove them before your PR can be merged. To avoid that git automatically does merges during pulls, you can configure it to do rebases instead by running `git config pull.rebase true` inside the repository checkout.
|
* Do not add merge commits to your PR. The bot will complain and you will have to rebase ([instructions for rebasing](https://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html)) to remove them before your PR can be merged. To avoid that git automatically does merges during pulls, you can configure it to do rebases instead by running `git config pull.rebase true` inside the repository checkout.
|
||||||
* Make sure your PR includes a [changelog fragment](https://docs.ansible.com/ansible/devel/community/development_process.html#creating-changelog-fragments). (You must not include a fragment for new modules or new plugins. Also you shouldn't include one for docs-only changes. If you're not sure, simply don't include one, we'll tell you whether one is needed or not :) )
|
* Make sure your PR includes a [changelog fragment](https://docs.ansible.com/ansible/devel/community/development_process.html#creating-changelog-fragments). (You must not include a fragment for new modules or new plugins, except for test and filter plugins. Also you shouldn't include one for docs-only changes. If you're not sure, simply don't include one, we'll tell you whether one is needed or not :) )
|
||||||
* Avoid reformatting unrelated parts of the codebase in your PR. These types of changes will likely be requested for reversion, create additional work for reviewers, and may cause approval to be delayed.
|
* Avoid reformatting unrelated parts of the codebase in your PR. These types of changes will likely be requested for reversion, create additional work for reviewers, and may cause approval to be delayed.
|
||||||
|
|
||||||
You can also read [our Quick-start development guide](https://github.com/ansible/community-docs/blob/main/create_pr_quick_start_guide.rst).
|
You can also read [our Quick-start development guide](https://github.com/ansible/community-docs/blob/main/create_pr_quick_start_guide.rst).
|
||||||
@@ -112,7 +112,17 @@ Creating new modules and plugins requires a bit more work than other Pull Reques
|
|||||||
- Make sure that new plugins and modules have tests (unit tests, integration tests, or both); it is preferable to have some tests
|
- Make sure that new plugins and modules have tests (unit tests, integration tests, or both); it is preferable to have some tests
|
||||||
which run in CI.
|
which run in CI.
|
||||||
|
|
||||||
4. Action plugins need to be accompanied by a module, even if the module file only contains documentation
|
4. For modules and action plugins, make sure to create your module/plugin in the correct subdirectory, and add a redirect entry
|
||||||
|
in `meta/runtime.yml`. For example, for the `aerospike_migrations` module located in
|
||||||
|
`plugins/modules/database/aerospike/aerospike_migrations.py`, you need to create the following entry:
|
||||||
|
```.yaml
|
||||||
|
aerospike_migrations:
|
||||||
|
redirect: community.general.database.aerospike.aerospike_migrations
|
||||||
|
```
|
||||||
|
Here, the relative path `database/aerospike/` is inserted into the module's FQCN (Fully Qualified Collection Name) after the
|
||||||
|
collection's name and before the module's name. This must not be done for other plugin types but modules and action plugins!
|
||||||
|
|
||||||
|
- Action plugins need to be accompanied by a module, even if the module file only contains documentation
|
||||||
(`DOCUMENTATION`, `EXAMPLES` and `RETURN`). The module must have the same name and directory path in `plugins/modules/`
|
(`DOCUMENTATION`, `EXAMPLES` and `RETURN`). The module must have the same name and directory path in `plugins/modules/`
|
||||||
than the action plugin has in `plugins/action/`.
|
than the action plugin has in `plugins/action/`.
|
||||||
|
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
|
|
||||||
# Community General Collection
|
# Community General Collection
|
||||||
|
|
||||||
[](https://dev.azure.com/ansible/community.general/_build?definitionId=31)
|
[](https://dev.azure.com/ansible/community.general/_build?definitionId=31)
|
||||||
[](https://github.com/ansible-collections/community.general/actions)
|
[](https://github.com/ansible-collections/community.general/actions)
|
||||||
[](https://codecov.io/gh/ansible-collections/community.general)
|
[](https://codecov.io/gh/ansible-collections/community.general)
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ If you encounter abusive behavior violating the [Ansible Code of Conduct](https:
|
|||||||
|
|
||||||
## Tested with Ansible
|
## Tested with Ansible
|
||||||
|
|
||||||
Tested with the current ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, ansible-core 2.14, ansible-core 2.15, ansible-core 2.16 releases and the current development version of ansible-core. Ansible-core versions before 2.11.0 are not supported. This includes all ansible-base 2.10 and Ansible 2.9 releases.
|
Tested with the current ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, ansible-core 2.14, and ansible-core 2.15 releases. Ansible-core versions before 2.11.0 are not supported. This includes all ansible-base 2.10 and Ansible 2.9 releases.
|
||||||
|
|
||||||
Parts of this collection will not work with ansible-core 2.11 on Python 3.12+.
|
Parts of this collection will not work with ansible-core 2.11 on Python 3.12+.
|
||||||
|
|
||||||
@@ -65,6 +65,10 @@ ansible-galaxy collection install community.general:==X.Y.Z
|
|||||||
|
|
||||||
See [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details.
|
See [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details.
|
||||||
|
|
||||||
|
### FQCNs for modules and actions
|
||||||
|
|
||||||
|
⚠️ The collection uses a similar directory structure for modules as the Ansible repository used for Ansible 2.9 and before. This directory structure was never exposed to the user. Due to changes in community.general 5.0.0 (using `meta/runtime.yml` redirects instead of symbolic links) some tooling started exposing the internal module names to end-users. These **internal names**, like `community.general.system.ufw` for the UFW firewall managing module, do work, but should be avoided since they are treated as an implementation detail that can change at any time, even in bugfix releases. Always use the three-component FQCN form, for example `community.general.ufw` for the UFW module. ⚠️
|
||||||
|
|
||||||
## Contributing to this collection
|
## Contributing to this collection
|
||||||
|
|
||||||
The content of this collection is made by good people just like you, a community of individuals collaborating on making the world better through developing automation software.
|
The content of this collection is made by good people just like you, a community of individuals collaborating on making the world better through developing automation software.
|
||||||
@@ -73,13 +77,13 @@ We are actively accepting new contributors.
|
|||||||
|
|
||||||
All types of contributions are very welcome.
|
All types of contributions are very welcome.
|
||||||
|
|
||||||
You don't know how to start? Refer to our [contribution guide](https://github.com/ansible-collections/community.general/blob/stable-7/CONTRIBUTING.md)!
|
You don't know how to start? Refer to our [contribution guide](https://github.com/ansible-collections/community.general/blob/main/CONTRIBUTING.md)!
|
||||||
|
|
||||||
The current maintainers are listed in the [commit-rights.md](https://github.com/ansible-collections/community.general/blob/stable-7/commit-rights.md#people) file. If you have questions or need help, feel free to mention them in the proposals.
|
The current maintainers are listed in the [commit-rights.md](https://github.com/ansible-collections/community.general/blob/main/commit-rights.md#people) file. If you have questions or need help, feel free to mention them in the proposals.
|
||||||
|
|
||||||
You can find more information in the [developer guide for collections](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#contributing-to-collections), and in the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html).
|
You can find more information in the [developer guide for collections](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#contributing-to-collections), and in the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html).
|
||||||
|
|
||||||
Also for some notes specific to this collection see [our CONTRIBUTING documentation](https://github.com/ansible-collections/community.general/blob/stable-7/CONTRIBUTING.md).
|
Also for some notes specific to this collection see [our CONTRIBUTING documentation](https://github.com/ansible-collections/community.general/blob/main/CONTRIBUTING.md).
|
||||||
|
|
||||||
### Running tests
|
### Running tests
|
||||||
|
|
||||||
@@ -89,7 +93,7 @@ See [here](https://docs.ansible.com/ansible/devel/dev_guide/developing_collectio
|
|||||||
|
|
||||||
To learn how to maintain / become a maintainer of this collection, refer to:
|
To learn how to maintain / become a maintainer of this collection, refer to:
|
||||||
|
|
||||||
* [Committer guidelines](https://github.com/ansible-collections/community.general/blob/stable-7/commit-rights.md).
|
* [Committer guidelines](https://github.com/ansible-collections/community.general/blob/main/commit-rights.md).
|
||||||
* [Maintainer guidelines](https://github.com/ansible/community-docs/blob/main/maintaining.rst).
|
* [Maintainer guidelines](https://github.com/ansible/community-docs/blob/main/maintaining.rst).
|
||||||
|
|
||||||
It is necessary for maintainers of this collection to be subscribed to:
|
It is necessary for maintainers of this collection to be subscribed to:
|
||||||
@@ -117,7 +121,7 @@ See the [Releasing guidelines](https://github.com/ansible/community-docs/blob/ma
|
|||||||
|
|
||||||
## Release notes
|
## Release notes
|
||||||
|
|
||||||
See the [changelog](https://github.com/ansible-collections/community.general/blob/stable-7/CHANGELOG.rst).
|
See the [changelog](https://github.com/ansible-collections/community.general/blob/stable-5/CHANGELOG.rst).
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
@@ -136,8 +140,8 @@ See [this issue](https://github.com/ansible-collections/community.general/issues
|
|||||||
|
|
||||||
This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.
|
This collection is primarily licensed and distributed as a whole under the GNU General Public License v3.0 or later.
|
||||||
|
|
||||||
See [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-collections/community.general/blob/stable-7/COPYING) for the full text.
|
See [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-collections/community.general/blob/main/COPYING) for the full text.
|
||||||
|
|
||||||
Parts of the collection are licensed under the [BSD 2-Clause license](https://github.com/ansible-collections/community.general/blob/stable-7/LICENSES/BSD-2-Clause.txt), the [MIT license](https://github.com/ansible-collections/community.general/blob/stable-7/LICENSES/MIT.txt), and the [PSF 2.0 license](https://github.com/ansible-collections/community.general/blob/stable-7/LICENSES/PSF-2.0.txt).
|
Parts of the collection are licensed under the [BSD 2-Clause license](https://github.com/ansible-collections/community.general/blob/main/LICENSES/BSD-2-Clause.txt), the [MIT license](https://github.com/ansible-collections/community.general/blob/main/LICENSES/MIT.txt), and the [PSF 2.0 license](https://github.com/ansible-collections/community.general/blob/main/LICENSES/PSF-2.0.txt).
|
||||||
|
|
||||||
All files have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s) or an equivalent entry in an accompanying `.license` file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in `.reuse/dep5`. This conforms to the [REUSE specification](https://reuse.software/spec/).
|
All files have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s) or an equivalent entry in an accompanying `.license` file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in `.reuse/dep5`. This conforms to the [REUSE specification](https://reuse.software/spec/).
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace: community
|
namespace: community
|
||||||
name: general
|
name: general
|
||||||
version: 7.5.0
|
version: 5.8.10
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Ansible (https://github.com/ansible)
|
- Ansible (https://github.com/ansible)
|
||||||
|
|||||||
5207
meta/runtime.yml
5207
meta/runtime.yml
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,6 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible.errors import AnsibleError, AnsibleConnectionFailure
|
from ansible.errors import AnsibleError, AnsibleConnectionFailure
|
||||||
@@ -45,7 +44,7 @@ class ActionModule(ActionBase):
|
|||||||
SHUTDOWN_COMMAND_ARGS = {
|
SHUTDOWN_COMMAND_ARGS = {
|
||||||
'alpine': '',
|
'alpine': '',
|
||||||
'void': '-h +{delay_min} "{message}"',
|
'void': '-h +{delay_min} "{message}"',
|
||||||
'freebsd': '-p +{delay_sec}s "{message}"',
|
'freebsd': '-h +{delay_sec}s "{message}"',
|
||||||
'linux': DEFAULT_SHUTDOWN_COMMAND_ARGS,
|
'linux': DEFAULT_SHUTDOWN_COMMAND_ARGS,
|
||||||
'macosx': '-h +{delay_min} "{message}"',
|
'macosx': '-h +{delay_min} "{message}"',
|
||||||
'openbsd': '-h +{delay_min} "{message}"',
|
'openbsd': '-h +{delay_min} "{message}"',
|
||||||
@@ -81,6 +80,13 @@ class ActionModule(ActionBase):
|
|||||||
getattr(self, default_value))))
|
getattr(self, default_value))))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def get_shutdown_command_args(self, distribution):
|
||||||
|
args = self._get_value_from_facts('SHUTDOWN_COMMAND_ARGS', distribution, 'DEFAULT_SHUTDOWN_COMMAND_ARGS')
|
||||||
|
# Convert seconds to minutes. If less that 60, set it to 0.
|
||||||
|
delay_sec = self.delay
|
||||||
|
shutdown_message = self._task.args.get('msg', self.DEFAULT_SHUTDOWN_MESSAGE)
|
||||||
|
return args.format(delay_sec=delay_sec, delay_min=delay_sec // 60, message=shutdown_message)
|
||||||
|
|
||||||
def get_distribution(self, task_vars):
|
def get_distribution(self, task_vars):
|
||||||
# FIXME: only execute the module if we don't already have the facts we need
|
# FIXME: only execute the module if we don't already have the facts we need
|
||||||
distribution = {}
|
distribution = {}
|
||||||
@@ -95,8 +101,7 @@ class ActionModule(ActionBase):
|
|||||||
to_native(module_output['module_stdout']).strip(),
|
to_native(module_output['module_stdout']).strip(),
|
||||||
to_native(module_output['module_stderr']).strip()))
|
to_native(module_output['module_stderr']).strip()))
|
||||||
distribution['name'] = module_output['ansible_facts']['ansible_distribution'].lower()
|
distribution['name'] = module_output['ansible_facts']['ansible_distribution'].lower()
|
||||||
distribution['version'] = to_text(
|
distribution['version'] = to_text(module_output['ansible_facts']['ansible_distribution_version'].split('.')[0])
|
||||||
module_output['ansible_facts']['ansible_distribution_version'].split('.')[0])
|
|
||||||
distribution['family'] = to_text(module_output['ansible_facts']['ansible_os_family'].lower())
|
distribution['family'] = to_text(module_output['ansible_facts']['ansible_os_family'].lower())
|
||||||
display.debug("{action}: distribution: {dist}".format(action=self._task.action, dist=distribution))
|
display.debug("{action}: distribution: {dist}".format(action=self._task.action, dist=distribution))
|
||||||
return distribution
|
return distribution
|
||||||
@@ -104,23 +109,6 @@ class ActionModule(ActionBase):
|
|||||||
raise AnsibleError('Failed to get distribution information. Missing "{0}" in output.'.format(ke.args[0]))
|
raise AnsibleError('Failed to get distribution information. Missing "{0}" in output.'.format(ke.args[0]))
|
||||||
|
|
||||||
def get_shutdown_command(self, task_vars, distribution):
|
def get_shutdown_command(self, task_vars, distribution):
|
||||||
def find_command(command, find_search_paths):
|
|
||||||
display.debug('{action}: running find module looking in {paths} to get path for "{command}"'.format(
|
|
||||||
action=self._task.action,
|
|
||||||
command=command,
|
|
||||||
paths=find_search_paths))
|
|
||||||
find_result = self._execute_module(
|
|
||||||
task_vars=task_vars,
|
|
||||||
# prevent collection search by calling with ansible.legacy (still allows library/ override of find)
|
|
||||||
module_name='ansible.legacy.find',
|
|
||||||
module_args={
|
|
||||||
'paths': find_search_paths,
|
|
||||||
'patterns': [command],
|
|
||||||
'file_type': 'any'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return [x['path'] for x in find_result['files']]
|
|
||||||
|
|
||||||
shutdown_bin = self._get_value_from_facts('SHUTDOWN_COMMANDS', distribution, 'DEFAULT_SHUTDOWN_COMMAND')
|
shutdown_bin = self._get_value_from_facts('SHUTDOWN_COMMANDS', distribution, 'DEFAULT_SHUTDOWN_COMMAND')
|
||||||
default_search_paths = ['/sbin', '/usr/sbin', '/usr/local/sbin']
|
default_search_paths = ['/sbin', '/usr/sbin', '/usr/local/sbin']
|
||||||
search_paths = self._task.args.get('search_paths', default_search_paths)
|
search_paths = self._task.args.get('search_paths', default_search_paths)
|
||||||
@@ -139,53 +127,45 @@ class ActionModule(ActionBase):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
raise AnsibleError(err_msg.format(search_paths))
|
raise AnsibleError(err_msg.format(search_paths))
|
||||||
|
|
||||||
full_path = find_command(shutdown_bin, search_paths) # find the path to the shutdown command
|
display.debug('{action}: running find module looking in {paths} to get path for "{command}"'.format(
|
||||||
if not full_path: # if we could not find the shutdown command
|
action=self._task.action,
|
||||||
display.vvv('Unable to find command "{0}" in search paths: {1}, will attempt a shutdown using systemd '
|
command=shutdown_bin,
|
||||||
'directly.'.format(shutdown_bin, search_paths)) # tell the user we will try with systemd
|
paths=search_paths))
|
||||||
systemctl_search_paths = ['/bin', '/usr/bin']
|
find_result = self._execute_module(
|
||||||
full_path = find_command('systemctl', systemctl_search_paths) # find the path to the systemctl command
|
task_vars=task_vars,
|
||||||
if not full_path: # if we couldn't find systemctl
|
# prevent collection search by calling with ansible.legacy (still allows library/ override of find)
|
||||||
raise AnsibleError(
|
module_name='ansible.legacy.find',
|
||||||
'Could not find command "{0}" in search paths: {1} or systemctl command in search paths: {2}, unable to shutdown.'.
|
module_args={
|
||||||
format(shutdown_bin, search_paths, systemctl_search_paths)) # we give up here
|
'paths': search_paths,
|
||||||
else:
|
'patterns': [shutdown_bin],
|
||||||
return "{0} poweroff".format(full_path[0]) # done, since we cannot use args with systemd shutdown
|
'file_type': 'any'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# systemd case taken care of, here we add args to the command
|
full_path = [x['path'] for x in find_result['files']]
|
||||||
args = self._get_value_from_facts('SHUTDOWN_COMMAND_ARGS', distribution, 'DEFAULT_SHUTDOWN_COMMAND_ARGS')
|
if not full_path:
|
||||||
# Convert seconds to minutes. If less that 60, set it to 0.
|
raise AnsibleError('Unable to find command "{0}" in search paths: {1}'.format(shutdown_bin, search_paths))
|
||||||
delay_sec = self.delay
|
self._shutdown_command = full_path[0]
|
||||||
shutdown_message = self._task.args.get('msg', self.DEFAULT_SHUTDOWN_MESSAGE)
|
return self._shutdown_command
|
||||||
return '{0} {1}'. \
|
|
||||||
format(
|
|
||||||
full_path[0],
|
|
||||||
args.format(
|
|
||||||
delay_sec=delay_sec,
|
|
||||||
delay_min=delay_sec // 60,
|
|
||||||
message=shutdown_message
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def perform_shutdown(self, task_vars, distribution):
|
def perform_shutdown(self, task_vars, distribution):
|
||||||
result = {}
|
result = {}
|
||||||
shutdown_result = {}
|
shutdown_result = {}
|
||||||
shutdown_command_exec = self.get_shutdown_command(task_vars, distribution)
|
shutdown_command = self.get_shutdown_command(task_vars, distribution)
|
||||||
|
shutdown_command_args = self.get_shutdown_command_args(distribution)
|
||||||
|
shutdown_command_exec = '{0} {1}'.format(shutdown_command, shutdown_command_args)
|
||||||
|
|
||||||
self.cleanup(force=True)
|
self.cleanup(force=True)
|
||||||
try:
|
try:
|
||||||
display.vvv("{action}: shutting down server...".format(action=self._task.action))
|
display.vvv("{action}: shutting down server...".format(action=self._task.action))
|
||||||
display.debug("{action}: shutting down server with command '{command}'".
|
display.debug("{action}: shutting down server with command '{command}'".format(action=self._task.action, command=shutdown_command_exec))
|
||||||
format(action=self._task.action, command=shutdown_command_exec))
|
|
||||||
if self._play_context.check_mode:
|
if self._play_context.check_mode:
|
||||||
shutdown_result['rc'] = 0
|
shutdown_result['rc'] = 0
|
||||||
else:
|
else:
|
||||||
shutdown_result = self._low_level_execute_command(shutdown_command_exec, sudoable=self.DEFAULT_SUDOABLE)
|
shutdown_result = self._low_level_execute_command(shutdown_command_exec, sudoable=self.DEFAULT_SUDOABLE)
|
||||||
except AnsibleConnectionFailure as e:
|
except AnsibleConnectionFailure as e:
|
||||||
# If the connection is closed too quickly due to the system being shutdown, carry on
|
# If the connection is closed too quickly due to the system being shutdown, carry on
|
||||||
display.debug(
|
display.debug('{action}: AnsibleConnectionFailure caught and handled: {error}'.format(action=self._task.action, error=to_text(e)))
|
||||||
'{action}: AnsibleConnectionFailure caught and handled: {error}'.format(action=self._task.action,
|
|
||||||
error=to_text(e)))
|
|
||||||
shutdown_result['rc'] = 0
|
shutdown_result['rc'] = 0
|
||||||
|
|
||||||
if shutdown_result['rc'] != 0:
|
if shutdown_result['rc'] != 0:
|
||||||
@@ -68,7 +68,7 @@ DOCUMENTATION = '''
|
|||||||
- section: machinectl_become_plugin
|
- section: machinectl_become_plugin
|
||||||
key: password
|
key: password
|
||||||
notes:
|
notes:
|
||||||
- When not using this plugin with user V(root), it only works correctly with a polkit rule which will alter
|
- When not using this plugin with user C(root), it only works correctly with a polkit rule which will alter
|
||||||
the behaviour of machinectl. This rule must alter the prompt behaviour to ask directly for the user credentials,
|
the behaviour of machinectl. This rule must alter the prompt behaviour to ask directly for the user credentials,
|
||||||
if the user is allowed to perform the action (take a look at the examples section).
|
if the user is allowed to perform the action (take a look at the examples section).
|
||||||
If such a rule is not present the plugin only work if it is used in context with the root user,
|
If such a rule is not present the plugin only work if it is used in context with the root user,
|
||||||
@@ -102,7 +102,6 @@ class BecomeModule(BecomeBase):
|
|||||||
prompt = 'Password: '
|
prompt = 'Password: '
|
||||||
fail = ('==== AUTHENTICATION FAILED ====',)
|
fail = ('==== AUTHENTICATION FAILED ====',)
|
||||||
success = ('==== AUTHENTICATION COMPLETE ====',)
|
success = ('==== AUTHENTICATION COMPLETE ====',)
|
||||||
require_tty = True # see https://github.com/ansible-collections/community.general/issues/6932
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_ansi_codes(line):
|
def remove_ansi_codes(line):
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ DOCUMENTATION = '''
|
|||||||
env:
|
env:
|
||||||
- name: ANSIBLE_PFEXEC_WRAP_EXECUTION
|
- name: ANSIBLE_PFEXEC_WRAP_EXECUTION
|
||||||
notes:
|
notes:
|
||||||
- This plugin ignores O(become_user) as pfexec uses it's own C(exec_attr) to figure this out.
|
- This plugin ignores I(become_user) as pfexec uses it's own C(exec_attr) to figure this out.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.plugins.become import BecomeBase
|
from ansible.plugins.become import BecomeBase
|
||||||
|
|||||||
6
plugins/cache/redis.py
vendored
6
plugins/cache/redis.py
vendored
@@ -18,9 +18,9 @@ DOCUMENTATION = '''
|
|||||||
_uri:
|
_uri:
|
||||||
description:
|
description:
|
||||||
- A colon separated string of connection information for Redis.
|
- A colon separated string of connection information for Redis.
|
||||||
- The format is V(host:port:db:password), for example V(localhost:6379:0:changeme).
|
- The format is C(host:port:db:password), for example C(localhost:6379:0:changeme).
|
||||||
- To use encryption in transit, prefix the connection with V(tls://), as in V(tls://localhost:6379:0:changeme).
|
- To use encryption in transit, prefix the connection with C(tls://), as in C(tls://localhost:6379:0:changeme).
|
||||||
- To use redis sentinel, use separator V(;), for example V(localhost:26379;localhost:26379;0:changeme). Requires redis>=2.9.0.
|
- To use redis sentinel, use separator C(;), for example C(localhost:26379;localhost:26379;0:changeme). Requires redis>=2.9.0.
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_CACHE_PLUGIN_CONNECTION
|
- name: ANSIBLE_CACHE_PLUGIN_CONNECTION
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ DOCUMENTATION = '''
|
|||||||
options:
|
options:
|
||||||
max_mem_file:
|
max_mem_file:
|
||||||
required: true
|
required: true
|
||||||
description: Path to cgroups C(memory.max_usage_in_bytes) file. Example V(/sys/fs/cgroup/memory/ansible_profile/memory.max_usage_in_bytes).
|
description: Path to cgroups C(memory.max_usage_in_bytes) file. Example C(/sys/fs/cgroup/memory/ansible_profile/memory.max_usage_in_bytes).
|
||||||
env:
|
env:
|
||||||
- name: CGROUP_MAX_MEM_FILE
|
- name: CGROUP_MAX_MEM_FILE
|
||||||
ini:
|
ini:
|
||||||
@@ -32,7 +32,7 @@ DOCUMENTATION = '''
|
|||||||
key: max_mem_file
|
key: max_mem_file
|
||||||
cur_mem_file:
|
cur_mem_file:
|
||||||
required: true
|
required: true
|
||||||
description: Path to C(memory.usage_in_bytes) file. Example V(/sys/fs/cgroup/memory/ansible_profile/memory.usage_in_bytes).
|
description: Path to C(memory.usage_in_bytes) file. Example C(/sys/fs/cgroup/memory/ansible_profile/memory.usage_in_bytes).
|
||||||
env:
|
env:
|
||||||
- name: CGROUP_CUR_MEM_FILE
|
- name: CGROUP_CUR_MEM_FILE
|
||||||
ini:
|
ini:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ DOCUMENTATION = r'''
|
|||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- default_callback
|
- default_callback
|
||||||
notes:
|
notes:
|
||||||
- Uses the P(ansible.builtin.default#callback) callback plugin output when a custom callback V(message(msg\)) is not provided.
|
- Uses the C(default) callback plugin output when a custom callback message(C(msg)) is not provided.
|
||||||
- Makes the callback event data available via the C(ansible_callback_diy) dictionary, which can be used in the templating context for the options.
|
- Makes the callback event data available via the C(ansible_callback_diy) dictionary, which can be used in the templating context for the options.
|
||||||
The dictionary is only available in the templating context for the options. It is not a variable that is available via the other
|
The dictionary is only available in the templating context for the options. It is not a variable that is available via the other
|
||||||
various execution contexts, such as playbook, play, task etc.
|
various execution contexts, such as playbook, play, task etc.
|
||||||
@@ -40,8 +40,8 @@ DOCUMENTATION = r'''
|
|||||||
if value C(is not None and not omit and length is greater than 0),
|
if value C(is not None and not omit and length is greater than 0),
|
||||||
then the option is being used with output.
|
then the option is being used with output.
|
||||||
**Effect**: render value as template and output"
|
**Effect**: render value as template and output"
|
||||||
- "Valid color values: V(black), V(bright gray), V(blue), V(white), V(green), V(bright blue), V(cyan), V(bright green), V(red), V(bright cyan),
|
- "Valid color values: C(black), C(bright gray), C(blue), C(white), C(green), C(bright blue), C(cyan), C(bright green), C(red), C(bright cyan),
|
||||||
V(purple), V(bright red), V(yellow), V(bright purple), V(dark gray), V(bright yellow), V(magenta), V(bright magenta), V(normal)"
|
C(purple), C(bright red), C(yellow), C(bright purple), C(dark gray), C(bright yellow), C(magenta), C(bright magenta), C(normal)"
|
||||||
seealso:
|
seealso:
|
||||||
- name: default – default Ansible screen output
|
- name: default – default Ansible screen output
|
||||||
description: The official documentation on the B(default) callback plugin.
|
description: The official documentation on the B(default) callback plugin.
|
||||||
@@ -62,7 +62,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
on_any_msg_color:
|
on_any_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(on_any_msg).
|
- Output color to be used for I(on_any_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -86,7 +86,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_on_failed_msg_color:
|
runner_on_failed_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_on_failed_msg).
|
- Output color to be used for I(runner_on_failed_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -110,7 +110,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_on_ok_msg_color:
|
runner_on_ok_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_on_ok_msg).
|
- Output color to be used for I(runner_on_ok_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -134,7 +134,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_on_skipped_msg_color:
|
runner_on_skipped_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_on_skipped_msg).
|
- Output color to be used for I(runner_on_skipped_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -158,7 +158,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_on_unreachable_msg_color:
|
runner_on_unreachable_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_on_unreachable_msg).
|
- Output color to be used for I(runner_on_unreachable_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -182,7 +182,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_start_msg_color:
|
playbook_on_start_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_start_msg).
|
- Output color to be used for I(playbook_on_start_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -206,7 +206,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_notify_msg_color:
|
playbook_on_notify_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_notify_msg).
|
- Output color to be used for I(playbook_on_notify_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -230,7 +230,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_no_hosts_matched_msg_color:
|
playbook_on_no_hosts_matched_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_no_hosts_matched_msg).
|
- Output color to be used for I(playbook_on_no_hosts_matched_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -254,7 +254,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_no_hosts_remaining_msg_color:
|
playbook_on_no_hosts_remaining_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_no_hosts_remaining_msg).
|
- Output color to be used for I(playbook_on_no_hosts_remaining_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -278,7 +278,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_task_start_msg_color:
|
playbook_on_task_start_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_task_start_msg).
|
- Output color to be used for I(playbook_on_task_start_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -302,7 +302,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_handler_task_start_msg_color:
|
playbook_on_handler_task_start_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_handler_task_start_msg).
|
- Output color to be used for I(playbook_on_handler_task_start_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -326,7 +326,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_vars_prompt_msg_color:
|
playbook_on_vars_prompt_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_vars_prompt_msg).
|
- Output color to be used for I(playbook_on_vars_prompt_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -350,7 +350,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_play_start_msg_color:
|
playbook_on_play_start_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_play_start_msg).
|
- Output color to be used for I(playbook_on_play_start_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -374,7 +374,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_stats_msg_color:
|
playbook_on_stats_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_stats_msg).
|
- Output color to be used for I(playbook_on_stats_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -398,7 +398,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
on_file_diff_msg_color:
|
on_file_diff_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(on_file_diff_msg).
|
- Output color to be used for I(on_file_diff_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -422,7 +422,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_include_msg_color:
|
playbook_on_include_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_include_msg).
|
- Output color to be used for I(playbook_on_include_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -446,7 +446,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_item_on_ok_msg_color:
|
runner_item_on_ok_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_item_on_ok_msg).
|
- Output color to be used for I(runner_item_on_ok_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -470,7 +470,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_item_on_failed_msg_color:
|
runner_item_on_failed_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_item_on_failed_msg).
|
- Output color to be used for I(runner_item_on_failed_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -494,7 +494,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_item_on_skipped_msg_color:
|
runner_item_on_skipped_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_item_on_skipped_msg).
|
- Output color to be used for I(runner_item_on_skipped_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -518,7 +518,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_retry_msg_color:
|
runner_retry_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_retry_msg).
|
- Output color to be used for I(runner_retry_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -542,7 +542,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_on_start_msg_color:
|
runner_on_start_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_on_start_msg).
|
- Output color to be used for I(runner_on_start_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -566,7 +566,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
runner_on_no_hosts_msg_color:
|
runner_on_no_hosts_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(runner_on_no_hosts_msg).
|
- Output color to be used for I(runner_on_no_hosts_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
@@ -590,7 +590,7 @@ DOCUMENTATION = r'''
|
|||||||
|
|
||||||
playbook_on_setup_msg_color:
|
playbook_on_setup_msg_color:
|
||||||
description:
|
description:
|
||||||
- Output color to be used for O(playbook_on_setup_msg).
|
- Output color to be used for I(playbook_on_setup_msg).
|
||||||
- Template should render a L(valid color value,#notes).
|
- Template should render a L(valid color value,#notes).
|
||||||
ini:
|
ini:
|
||||||
- section: callback_diy
|
- section: callback_diy
|
||||||
|
|||||||
@@ -49,9 +49,8 @@ options:
|
|||||||
sender:
|
sender:
|
||||||
description:
|
description:
|
||||||
- Mail sender.
|
- Mail sender.
|
||||||
- This is required since community.general 6.0.0.
|
- Note that this will be required from community.general 6.0.0 on.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: sender
|
key: sender
|
||||||
@@ -105,6 +104,10 @@ class CallbackModule(CallbackBase):
|
|||||||
super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct)
|
super(CallbackModule, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct)
|
||||||
|
|
||||||
self.sender = self.get_option('sender')
|
self.sender = self.get_option('sender')
|
||||||
|
if self.sender is None:
|
||||||
|
self._display.deprecated(
|
||||||
|
'The sender for the mail callback has not been specified. This will be an error in the future',
|
||||||
|
version='6.0.0', collection_name='community.general')
|
||||||
self.to = self.get_option('to')
|
self.to = self.get_option('to')
|
||||||
self.smtphost = self.get_option('mta')
|
self.smtphost = self.get_option('mta')
|
||||||
self.smtpport = self.get_option('mtaport')
|
self.smtpport = self.get_option('mtaport')
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ DOCUMENTATION = '''
|
|||||||
enable_from_environment:
|
enable_from_environment:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Whether to enable this callback only if the given environment variable exists and it is set to V(true).
|
- Whether to enable this callback only if the given environment variable exists and it is set to C(true).
|
||||||
- This is handy when you use Configuration as Code and want to send distributed traces
|
- This is handy when you use Configuration as Code and want to send distributed traces
|
||||||
if running in the CI rather when running Ansible locally.
|
if running in the CI rather when running Ansible locally.
|
||||||
- For such, it evaluates the given O(enable_from_environment) value as environment variable
|
- For such, it evaluates the given I(enable_from_environment) value as environment variable
|
||||||
and if set to true this plugin will be enabled.
|
and if set to true this plugin will be enabled.
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
|
- name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
|
||||||
@@ -73,17 +73,6 @@ DOCUMENTATION = '''
|
|||||||
- section: callback_opentelemetry
|
- section: callback_opentelemetry
|
||||||
key: disable_logs
|
key: disable_logs
|
||||||
version_added: 5.8.0
|
version_added: 5.8.0
|
||||||
disable_attributes_in_logs:
|
|
||||||
default: false
|
|
||||||
type: bool
|
|
||||||
description:
|
|
||||||
- Disable populating span attributes to the logs.
|
|
||||||
env:
|
|
||||||
- name: ANSIBLE_OPENTELEMETRY_DISABLE_ATTRIBUTES_IN_LOGS
|
|
||||||
ini:
|
|
||||||
- section: callback_opentelemetry
|
|
||||||
key: disable_attributes_in_logs
|
|
||||||
version_added: 7.1.0
|
|
||||||
requirements:
|
requirements:
|
||||||
- opentelemetry-api (Python library)
|
- opentelemetry-api (Python library)
|
||||||
- opentelemetry-exporter-otlp (Python library)
|
- opentelemetry-exporter-otlp (Python library)
|
||||||
@@ -255,7 +244,7 @@ class OpenTelemetrySource(object):
|
|||||||
task.dump = dump
|
task.dump = dump
|
||||||
task.add_host(HostData(host_uuid, host_name, status, result))
|
task.add_host(HostData(host_uuid, host_name, status, result))
|
||||||
|
|
||||||
def generate_distributed_traces(self, otel_service_name, ansible_playbook, tasks_data, status, traceparent, disable_logs, disable_attributes_in_logs):
|
def generate_distributed_traces(self, otel_service_name, ansible_playbook, tasks_data, status, traceparent, disable_logs):
|
||||||
""" generate distributed traces from the collected TaskData and HostData """
|
""" generate distributed traces from the collected TaskData and HostData """
|
||||||
|
|
||||||
tasks = []
|
tasks = []
|
||||||
@@ -291,9 +280,9 @@ class OpenTelemetrySource(object):
|
|||||||
for task in tasks:
|
for task in tasks:
|
||||||
for host_uuid, host_data in task.host_data.items():
|
for host_uuid, host_data in task.host_data.items():
|
||||||
with tracer.start_as_current_span(task.name, start_time=task.start, end_on_exit=False) as span:
|
with tracer.start_as_current_span(task.name, start_time=task.start, end_on_exit=False) as span:
|
||||||
self.update_span_data(task, host_data, span, disable_logs, disable_attributes_in_logs)
|
self.update_span_data(task, host_data, span, disable_logs)
|
||||||
|
|
||||||
def update_span_data(self, task_data, host_data, span, disable_logs, disable_attributes_in_logs):
|
def update_span_data(self, task_data, host_data, span, disable_logs):
|
||||||
""" update the span with the given TaskData and HostData """
|
""" update the span with the given TaskData and HostData """
|
||||||
|
|
||||||
name = '[%s] %s: %s' % (host_data.name, task_data.play, task_data.name)
|
name = '[%s] %s: %s' % (host_data.name, task_data.play, task_data.name)
|
||||||
@@ -326,47 +315,39 @@ class OpenTelemetrySource(object):
|
|||||||
status = Status(status_code=StatusCode.UNSET)
|
status = Status(status_code=StatusCode.UNSET)
|
||||||
|
|
||||||
span.set_status(status)
|
span.set_status(status)
|
||||||
|
|
||||||
# Create the span and log attributes
|
|
||||||
attributes = {
|
|
||||||
"ansible.task.module": task_data.action,
|
|
||||||
"ansible.task.message": message,
|
|
||||||
"ansible.task.name": name,
|
|
||||||
"ansible.task.result": rc,
|
|
||||||
"ansible.task.host.name": host_data.name,
|
|
||||||
"ansible.task.host.status": host_data.status
|
|
||||||
}
|
|
||||||
if isinstance(task_data.args, dict) and "gather_facts" not in task_data.action:
|
if isinstance(task_data.args, dict) and "gather_facts" not in task_data.action:
|
||||||
names = tuple(self.transform_ansible_unicode_to_str(k) for k in task_data.args.keys())
|
names = tuple(self.transform_ansible_unicode_to_str(k) for k in task_data.args.keys())
|
||||||
values = tuple(self.transform_ansible_unicode_to_str(k) for k in task_data.args.values())
|
values = tuple(self.transform_ansible_unicode_to_str(k) for k in task_data.args.values())
|
||||||
attributes[("ansible.task.args.name")] = names
|
self.set_span_attribute(span, ("ansible.task.args.name"), names)
|
||||||
attributes[("ansible.task.args.value")] = values
|
self.set_span_attribute(span, ("ansible.task.args.value"), values)
|
||||||
|
self.set_span_attribute(span, "ansible.task.module", task_data.action)
|
||||||
self.set_span_attributes(span, attributes)
|
self.set_span_attribute(span, "ansible.task.message", message)
|
||||||
|
self.set_span_attribute(span, "ansible.task.name", name)
|
||||||
|
self.set_span_attribute(span, "ansible.task.result", rc)
|
||||||
|
self.set_span_attribute(span, "ansible.task.host.name", host_data.name)
|
||||||
|
self.set_span_attribute(span, "ansible.task.host.status", host_data.status)
|
||||||
# This will allow to enrich the service map
|
# This will allow to enrich the service map
|
||||||
self.add_attributes_for_service_map_if_possible(span, task_data)
|
self.add_attributes_for_service_map_if_possible(span, task_data)
|
||||||
# Send logs
|
# Send logs
|
||||||
if not disable_logs:
|
if not disable_logs:
|
||||||
# This will avoid populating span attributes to the logs
|
span.add_event(task_data.dump)
|
||||||
span.add_event(task_data.dump, attributes={} if disable_attributes_in_logs else attributes)
|
|
||||||
span.end(end_time=host_data.finish)
|
span.end(end_time=host_data.finish)
|
||||||
|
|
||||||
def set_span_attributes(self, span, attributes):
|
def set_span_attribute(self, span, attributeName, attributeValue):
|
||||||
""" update the span attributes with the given attributes if not None """
|
""" update the span attribute with the given attribute and value if not None """
|
||||||
|
|
||||||
if span is None and self._display is not None:
|
if span is None and self._display is not None:
|
||||||
self._display.warning('span object is None. Please double check if that is expected.')
|
self._display.warning('span object is None. Please double check if that is expected.')
|
||||||
else:
|
else:
|
||||||
if attributes is not None:
|
if attributeValue is not None:
|
||||||
span.set_attributes(attributes)
|
span.set_attribute(attributeName, attributeValue)
|
||||||
|
|
||||||
def add_attributes_for_service_map_if_possible(self, span, task_data):
|
def add_attributes_for_service_map_if_possible(self, span, task_data):
|
||||||
"""Update the span attributes with the service that the task interacted with, if possible."""
|
"""Update the span attributes with the service that the task interacted with, if possible."""
|
||||||
|
|
||||||
redacted_url = self.parse_and_redact_url_if_possible(task_data.args)
|
redacted_url = self.parse_and_redact_url_if_possible(task_data.args)
|
||||||
if redacted_url:
|
if redacted_url:
|
||||||
span.set_attribute("http.url", redacted_url.geturl())
|
self.set_span_attribute(span, "http.url", redacted_url.geturl())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_and_redact_url_if_possible(args):
|
def parse_and_redact_url_if_possible(args):
|
||||||
@@ -453,7 +434,6 @@ class CallbackModule(CallbackBase):
|
|||||||
def __init__(self, display=None):
|
def __init__(self, display=None):
|
||||||
super(CallbackModule, self).__init__(display=display)
|
super(CallbackModule, self).__init__(display=display)
|
||||||
self.hide_task_arguments = None
|
self.hide_task_arguments = None
|
||||||
self.disable_attributes_in_logs = None
|
|
||||||
self.disable_logs = None
|
self.disable_logs = None
|
||||||
self.otel_service_name = None
|
self.otel_service_name = None
|
||||||
self.ansible_playbook = None
|
self.ansible_playbook = None
|
||||||
@@ -485,8 +465,6 @@ class CallbackModule(CallbackBase):
|
|||||||
|
|
||||||
self.hide_task_arguments = self.get_option('hide_task_arguments')
|
self.hide_task_arguments = self.get_option('hide_task_arguments')
|
||||||
|
|
||||||
self.disable_attributes_in_logs = self.get_option('disable_attributes_in_logs')
|
|
||||||
|
|
||||||
self.disable_logs = self.get_option('disable_logs')
|
self.disable_logs = self.get_option('disable_logs')
|
||||||
|
|
||||||
self.otel_service_name = self.get_option('otel_service_name')
|
self.otel_service_name = self.get_option('otel_service_name')
|
||||||
@@ -584,8 +562,7 @@ class CallbackModule(CallbackBase):
|
|||||||
self.tasks_data,
|
self.tasks_data,
|
||||||
status,
|
status,
|
||||||
self.traceparent,
|
self.traceparent,
|
||||||
self.disable_logs,
|
self.disable_logs
|
||||||
self.disable_attributes_in_logs
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def v2_runner_on_async_failed(self, result, **kwargs):
|
def v2_runner_on_async_failed(self, result, **kwargs):
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ DOCUMENTATION = '''
|
|||||||
key: authtoken
|
key: authtoken
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description: Whether to validate certificates for connections to HEC. It is not recommended to set to
|
description: Whether to validate certificates for connections to HEC. It is not recommended to set to
|
||||||
V(false) except when you are sure that nobody can intercept the connection
|
C(false) except when you are sure that nobody can intercept the connection
|
||||||
between this plugin and HEC, as setting it to V(false) allows man-in-the-middle attacks!
|
between this plugin and HEC, as setting it to C(false) allows man-in-the-middle attacks!
|
||||||
env:
|
env:
|
||||||
- name: SPLUNK_VALIDATE_CERTS
|
- name: SPLUNK_VALIDATE_CERTS
|
||||||
ini:
|
ini:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = '''
|
||||||
name: sumologic
|
name: sumologic
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Sends task result events to Sumologic
|
short_description: Sends task result events to Sumologic
|
||||||
@@ -15,8 +15,8 @@ description:
|
|||||||
- This callback plugin will send task results as JSON formatted events to a Sumologic HTTP collector source.
|
- This callback plugin will send task results as JSON formatted events to a Sumologic HTTP collector source.
|
||||||
requirements:
|
requirements:
|
||||||
- Whitelisting this callback plugin
|
- Whitelisting this callback plugin
|
||||||
- 'Create a HTTP collector source in Sumologic and specify a custom timestamp format of V(yyyy-MM-dd HH:mm:ss ZZZZ) and a custom timestamp locator
|
- 'Create a HTTP collector source in Sumologic and specify a custom timestamp format of C(yyyy-MM-dd HH:mm:ss ZZZZ) and a custom timestamp locator
|
||||||
of V("timestamp": "(.*\)")'
|
of C("timestamp": "(.*)")'
|
||||||
options:
|
options:
|
||||||
url:
|
url:
|
||||||
description: URL to the Sumologic HTTP collector source.
|
description: URL to the Sumologic HTTP collector source.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2023, Al Bowles <@akatch>
|
# Copyright (c) 2017, Allyson Bowles <@akatch>
|
||||||
# Copyright (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
|
# Copyright (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
@@ -11,7 +11,7 @@ __metaclass__ = type
|
|||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
name: unixy
|
name: unixy
|
||||||
type: stdout
|
type: stdout
|
||||||
author: Al Bowles (@akatch)
|
author: Allyson Bowles (@akatch)
|
||||||
short_description: condensed Ansible output
|
short_description: condensed Ansible output
|
||||||
description:
|
description:
|
||||||
- Consolidated Ansible output in the style of LINUX/UNIX startup logs.
|
- Consolidated Ansible output in the style of LINUX/UNIX startup logs.
|
||||||
@@ -40,6 +40,7 @@ class CallbackModule(CallbackModule_default):
|
|||||||
- Only display task names if the task runs on at least one host
|
- Only display task names if the task runs on at least one host
|
||||||
- Add option to display all hostnames on a single line in the appropriate result color (failures may have a separate line)
|
- Add option to display all hostnames on a single line in the appropriate result color (failures may have a separate line)
|
||||||
- Consolidate stats display
|
- Consolidate stats display
|
||||||
|
- Display whether run is in --check mode
|
||||||
- Don't show play name if no hosts found
|
- Don't show play name if no hosts found
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@@ -91,27 +92,15 @@ class CallbackModule(CallbackModule_default):
|
|||||||
def v2_playbook_on_task_start(self, task, is_conditional):
|
def v2_playbook_on_task_start(self, task, is_conditional):
|
||||||
self._get_task_display_name(task)
|
self._get_task_display_name(task)
|
||||||
if self.task_display_name is not None:
|
if self.task_display_name is not None:
|
||||||
if task.check_mode and self.get_option('check_mode_markers'):
|
|
||||||
self._display.display("%s (check mode)..." % self.task_display_name)
|
|
||||||
else:
|
|
||||||
self._display.display("%s..." % self.task_display_name)
|
self._display.display("%s..." % self.task_display_name)
|
||||||
|
|
||||||
def v2_playbook_on_handler_task_start(self, task):
|
def v2_playbook_on_handler_task_start(self, task):
|
||||||
self._get_task_display_name(task)
|
self._get_task_display_name(task)
|
||||||
if self.task_display_name is not None:
|
if self.task_display_name is not None:
|
||||||
if task.check_mode and self.get_option('check_mode_markers'):
|
|
||||||
self._display.display("%s (via handler in check mode)... " % self.task_display_name)
|
|
||||||
else:
|
|
||||||
self._display.display("%s (via handler)... " % self.task_display_name)
|
self._display.display("%s (via handler)... " % self.task_display_name)
|
||||||
|
|
||||||
def v2_playbook_on_play_start(self, play):
|
def v2_playbook_on_play_start(self, play):
|
||||||
name = play.get_name().strip()
|
name = play.get_name().strip()
|
||||||
if play.check_mode and self.get_option('check_mode_markers'):
|
|
||||||
if name and play.hosts:
|
|
||||||
msg = u"\n- %s (in check mode) on hosts: %s -" % (name, ",".join(play.hosts))
|
|
||||||
else:
|
|
||||||
msg = u"- check mode -"
|
|
||||||
else:
|
|
||||||
if name and play.hosts:
|
if name and play.hosts:
|
||||||
msg = u"\n- %s on hosts: %s -" % (name, ",".join(play.hosts))
|
msg = u"\n- %s on hosts: %s -" % (name, ",".join(play.hosts))
|
||||||
else:
|
else:
|
||||||
@@ -238,9 +227,7 @@ class CallbackModule(CallbackModule_default):
|
|||||||
self._display.display(" Ran out of hosts!", color=C.COLOR_ERROR)
|
self._display.display(" Ran out of hosts!", color=C.COLOR_ERROR)
|
||||||
|
|
||||||
def v2_playbook_on_start(self, playbook):
|
def v2_playbook_on_start(self, playbook):
|
||||||
if context.CLIARGS['check'] and self.get_option('check_mode_markers'):
|
# TODO display whether this run is happening in check mode
|
||||||
self._display.display("Executing playbook %s in check mode" % basename(playbook._file_name))
|
|
||||||
else:
|
|
||||||
self._display.display("Executing playbook %s" % basename(playbook._file_name))
|
self._display.display("Executing playbook %s" % basename(playbook._file_name))
|
||||||
|
|
||||||
# show CLI arguments
|
# show CLI arguments
|
||||||
|
|||||||
@@ -46,42 +46,8 @@ DOCUMENTATION = '''
|
|||||||
vars:
|
vars:
|
||||||
- name: ansible_chroot_exe
|
- name: ansible_chroot_exe
|
||||||
default: chroot
|
default: chroot
|
||||||
disable_root_check:
|
|
||||||
description:
|
|
||||||
- Do not check that the user is not root.
|
|
||||||
ini:
|
|
||||||
- section: chroot_connection
|
|
||||||
key: disable_root_check
|
|
||||||
env:
|
|
||||||
- name: ANSIBLE_CHROOT_DISABLE_ROOT_CHECK
|
|
||||||
vars:
|
|
||||||
- name: ansible_chroot_disable_root_check
|
|
||||||
default: false
|
|
||||||
type: bool
|
|
||||||
version_added: 7.3.0
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = r"""
|
|
||||||
# Plugin requires root privileges for chroot, -E preserves your env (and location of ~/.ansible):
|
|
||||||
# sudo -E ansible-playbook ...
|
|
||||||
#
|
|
||||||
# Static inventory file
|
|
||||||
# [chroots]
|
|
||||||
# /path/to/debootstrap
|
|
||||||
# /path/to/feboostrap
|
|
||||||
# /path/to/lxc-image
|
|
||||||
# /path/to/chroot
|
|
||||||
|
|
||||||
# playbook
|
|
||||||
---
|
|
||||||
- hosts: chroots
|
|
||||||
connection: community.general.chroot
|
|
||||||
tasks:
|
|
||||||
- debug:
|
|
||||||
msg: "This is coming from chroot environment"
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -115,7 +81,11 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
self.chroot = self._play_context.remote_addr
|
self.chroot = self._play_context.remote_addr
|
||||||
|
|
||||||
# do some trivial checks for ensuring 'host' is actually a chroot'able dir
|
if os.geteuid() != 0:
|
||||||
|
raise AnsibleError("chroot connection requires running as root")
|
||||||
|
|
||||||
|
# we're running as root on the local system so do some
|
||||||
|
# trivial checks for ensuring 'host' is actually a chroot'able dir
|
||||||
if not os.path.isdir(self.chroot):
|
if not os.path.isdir(self.chroot):
|
||||||
raise AnsibleError("%s is not a directory" % self.chroot)
|
raise AnsibleError("%s is not a directory" % self.chroot)
|
||||||
|
|
||||||
@@ -129,11 +99,6 @@ class Connection(ConnectionBase):
|
|||||||
|
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
""" connect to the chroot """
|
""" connect to the chroot """
|
||||||
if not self.get_option('disable_root_check') and os.geteuid() != 0:
|
|
||||||
raise AnsibleError(
|
|
||||||
"chroot connection requires running as root. "
|
|
||||||
"You can override this check with the `disable_root_check` option.")
|
|
||||||
|
|
||||||
if os.path.isabs(self.get_option('chroot_exe')):
|
if os.path.isabs(self.get_option('chroot_exe')):
|
||||||
self.chroot_cmd = self.get_option('chroot_exe')
|
self.chroot_cmd = self.get_option('chroot_exe')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ DOCUMENTATION = '''
|
|||||||
- Container identifier
|
- Container identifier
|
||||||
default: inventory_hostname
|
default: inventory_hostname
|
||||||
vars:
|
vars:
|
||||||
- name: inventory_hostname
|
|
||||||
- name: ansible_host
|
- name: ansible_host
|
||||||
- name: ansible_lxc_host
|
- name: ansible_lxc_host
|
||||||
executable:
|
executable:
|
||||||
@@ -60,7 +59,7 @@ class Connection(ConnectionBase):
|
|||||||
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
def __init__(self, play_context, new_stdin, *args, **kwargs):
|
||||||
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
|
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
|
||||||
|
|
||||||
self.container_name = None
|
self.container_name = self._play_context.remote_addr
|
||||||
self.container = None
|
self.container = None
|
||||||
|
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
@@ -68,14 +67,12 @@ class Connection(ConnectionBase):
|
|||||||
super(Connection, self)._connect()
|
super(Connection, self)._connect()
|
||||||
|
|
||||||
if not HAS_LIBLXC:
|
if not HAS_LIBLXC:
|
||||||
msg = "lxc python bindings are not installed"
|
msg = "lxc bindings for python2 are not installed"
|
||||||
raise errors.AnsibleError(msg)
|
raise errors.AnsibleError(msg)
|
||||||
|
|
||||||
if self.container:
|
if self.container:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.container_name = self.get_option('remote_addr')
|
|
||||||
|
|
||||||
self._display.vvv("THIS IS A LOCAL LXC DIR", host=self.container_name)
|
self._display.vvv("THIS IS A LOCAL LXC DIR", host=self.container_name)
|
||||||
self.container = _lxc.Container(self.container_name)
|
self.container = _lxc.Container(self.container_name)
|
||||||
if self.container.state == "STOPPED":
|
if self.container.state == "STOPPED":
|
||||||
@@ -120,7 +117,7 @@ class Connection(ConnectionBase):
|
|||||||
super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
|
||||||
|
|
||||||
# python2-lxc needs bytes. python3-lxc needs text.
|
# python2-lxc needs bytes. python3-lxc needs text.
|
||||||
executable = to_native(self.get_option('executable'), errors='surrogate_or_strict')
|
executable = to_native(self._play_context.executable, errors='surrogate_or_strict')
|
||||||
local_cmd = [executable, '-c', to_native(cmd, errors='surrogate_or_strict')]
|
local_cmd = [executable, '-c', to_native(cmd, errors='surrogate_or_strict')]
|
||||||
|
|
||||||
read_stdout, write_stdout = None, None
|
read_stdout, write_stdout = None, None
|
||||||
|
|||||||
@@ -15,40 +15,40 @@ class ModuleDocFragment(object):
|
|||||||
options:
|
options:
|
||||||
alicloud_access_key:
|
alicloud_access_key:
|
||||||
description:
|
description:
|
||||||
- Alibaba Cloud access key. If not set then the value of environment variable E(ALICLOUD_ACCESS_KEY),
|
- Alibaba Cloud access key. If not set then the value of environment variable C(ALICLOUD_ACCESS_KEY),
|
||||||
E(ALICLOUD_ACCESS_KEY_ID) will be used instead.
|
C(ALICLOUD_ACCESS_KEY_ID) will be used instead.
|
||||||
aliases: ['access_key_id', 'access_key']
|
aliases: ['access_key_id', 'access_key']
|
||||||
type: str
|
type: str
|
||||||
alicloud_secret_key:
|
alicloud_secret_key:
|
||||||
description:
|
description:
|
||||||
- Alibaba Cloud secret key. If not set then the value of environment variable E(ALICLOUD_SECRET_KEY),
|
- Alibaba Cloud secret key. If not set then the value of environment variable C(ALICLOUD_SECRET_KEY),
|
||||||
E(ALICLOUD_SECRET_ACCESS_KEY) will be used instead.
|
C(ALICLOUD_SECRET_ACCESS_KEY) will be used instead.
|
||||||
aliases: ['secret_access_key', 'secret_key']
|
aliases: ['secret_access_key', 'secret_key']
|
||||||
type: str
|
type: str
|
||||||
alicloud_region:
|
alicloud_region:
|
||||||
description:
|
description:
|
||||||
- The Alibaba Cloud region to use. If not specified then the value of environment variable
|
- The Alibaba Cloud region to use. If not specified then the value of environment variable
|
||||||
E(ALICLOUD_REGION), E(ALICLOUD_REGION_ID) will be used instead.
|
C(ALICLOUD_REGION), C(ALICLOUD_REGION_ID) will be used instead.
|
||||||
aliases: ['region', 'region_id']
|
aliases: ['region', 'region_id']
|
||||||
required: true
|
required: true
|
||||||
type: str
|
type: str
|
||||||
alicloud_security_token:
|
alicloud_security_token:
|
||||||
description:
|
description:
|
||||||
- The Alibaba Cloud security token. If not specified then the value of environment variable
|
- The Alibaba Cloud security token. If not specified then the value of environment variable
|
||||||
E(ALICLOUD_SECURITY_TOKEN) will be used instead.
|
C(ALICLOUD_SECURITY_TOKEN) will be used instead.
|
||||||
aliases: ['security_token']
|
aliases: ['security_token']
|
||||||
type: str
|
type: str
|
||||||
alicloud_assume_role:
|
alicloud_assume_role:
|
||||||
description:
|
description:
|
||||||
- If provided with a role ARN, Ansible will attempt to assume this role using the supplied credentials.
|
- If provided with a role ARN, Ansible will attempt to assume this role using the supplied credentials.
|
||||||
- The nested assume_role block supports C(alicloud_assume_role_arn), C(alicloud_assume_role_session_name),
|
- The nested assume_role block supports I(alicloud_assume_role_arn), I(alicloud_assume_role_session_name),
|
||||||
C(alicloud_assume_role_session_expiration) and C(alicloud_assume_role_policy).
|
I(alicloud_assume_role_session_expiration) and I(alicloud_assume_role_policy)
|
||||||
type: dict
|
type: dict
|
||||||
aliases: ['assume_role']
|
aliases: ['assume_role']
|
||||||
alicloud_assume_role_arn:
|
alicloud_assume_role_arn:
|
||||||
description:
|
description:
|
||||||
- The Alibaba Cloud role_arn. The ARN of the role to assume. If ARN is set to an empty string,
|
- The Alibaba Cloud role_arn. The ARN of the role to assume. If ARN is set to an empty string,
|
||||||
it does not perform role switching. It supports environment variable E(ALICLOUD_ASSUME_ROLE_ARN).
|
it does not perform role switching. It supports environment variable ALICLOUD_ASSUME_ROLE_ARN.
|
||||||
ansible will execute with provided credentials.
|
ansible will execute with provided credentials.
|
||||||
aliases: ['assume_role_arn']
|
aliases: ['assume_role_arn']
|
||||||
type: str
|
type: str
|
||||||
@@ -56,14 +56,14 @@ options:
|
|||||||
description:
|
description:
|
||||||
- The Alibaba Cloud session_name. The session name to use when assuming the role. If omitted,
|
- The Alibaba Cloud session_name. The session name to use when assuming the role. If omitted,
|
||||||
'ansible' is passed to the AssumeRole call as session name. It supports environment variable
|
'ansible' is passed to the AssumeRole call as session name. It supports environment variable
|
||||||
E(ALICLOUD_ASSUME_ROLE_SESSION_NAME).
|
ALICLOUD_ASSUME_ROLE_SESSION_NAME
|
||||||
aliases: ['assume_role_session_name']
|
aliases: ['assume_role_session_name']
|
||||||
type: str
|
type: str
|
||||||
alicloud_assume_role_session_expiration:
|
alicloud_assume_role_session_expiration:
|
||||||
description:
|
description:
|
||||||
- The Alibaba Cloud session_expiration. The time after which the established session for assuming
|
- The Alibaba Cloud session_expiration. The time after which the established session for assuming
|
||||||
role expires. Valid value range 900-3600 seconds. Default to 3600 (in this case Alicloud use own default
|
role expires. Valid value range 900-3600 seconds. Default to 3600 (in this case Alicloud use own default
|
||||||
value). It supports environment variable E(ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION).
|
value). It supports environment variable ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION
|
||||||
aliases: ['assume_role_session_expiration']
|
aliases: ['assume_role_session_expiration']
|
||||||
type: int
|
type: int
|
||||||
ecs_role_name:
|
ecs_role_name:
|
||||||
@@ -79,11 +79,11 @@ options:
|
|||||||
profile:
|
profile:
|
||||||
description:
|
description:
|
||||||
- This is the Alicloud profile name as set in the shared credentials file. It can also be sourced from the
|
- This is the Alicloud profile name as set in the shared credentials file. It can also be sourced from the
|
||||||
E(ALICLOUD_PROFILE) environment variable.
|
ALICLOUD_PROFILE environment variable.
|
||||||
type: str
|
type: str
|
||||||
shared_credentials_file:
|
shared_credentials_file:
|
||||||
description:
|
description:
|
||||||
- This is the path to the shared credentials file. It can also be sourced from the E(ALICLOUD_SHARED_CREDENTIALS_FILE)
|
- This is the path to the shared credentials file. It can also be sourced from the ALICLOUD_SHARED_CREDENTIALS_FILE
|
||||||
environment variable.
|
environment variable.
|
||||||
- If this is not set and a profile is specified, ~/.aliyun/config.json will be used.
|
- If this is not set and a profile is specified, ~/.aliyun/config.json will be used.
|
||||||
type: str
|
type: str
|
||||||
@@ -94,16 +94,16 @@ requirements:
|
|||||||
notes:
|
notes:
|
||||||
- If parameters are not set within the module, the following
|
- If parameters are not set within the module, the following
|
||||||
environment variables can be used in decreasing order of precedence
|
environment variables can be used in decreasing order of precedence
|
||||||
E(ALICLOUD_ACCESS_KEY) or E(ALICLOUD_ACCESS_KEY_ID),
|
C(ALICLOUD_ACCESS_KEY) or C(ALICLOUD_ACCESS_KEY_ID),
|
||||||
E(ALICLOUD_SECRET_KEY) or E(ALICLOUD_SECRET_ACCESS_KEY),
|
C(ALICLOUD_SECRET_KEY) or C(ALICLOUD_SECRET_ACCESS_KEY),
|
||||||
E(ALICLOUD_REGION) or E(ALICLOUD_REGION_ID),
|
C(ALICLOUD_REGION) or C(ALICLOUD_REGION_ID),
|
||||||
E(ALICLOUD_SECURITY_TOKEN),
|
C(ALICLOUD_SECURITY_TOKEN),
|
||||||
E(ALICLOUD_ECS_ROLE_NAME),
|
C(ALICLOUD_ECS_ROLE_NAME),
|
||||||
E(ALICLOUD_SHARED_CREDENTIALS_FILE),
|
C(ALICLOUD_SHARED_CREDENTIALS_FILE),
|
||||||
E(ALICLOUD_PROFILE),
|
C(ALICLOUD_PROFILE),
|
||||||
E(ALICLOUD_ASSUME_ROLE_ARN),
|
C(ALICLOUD_ASSUME_ROLE_ARN),
|
||||||
E(ALICLOUD_ASSUME_ROLE_SESSION_NAME),
|
C(ALICLOUD_ASSUME_ROLE_SESSION_NAME),
|
||||||
E(ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION),
|
C(ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION),
|
||||||
- E(ALICLOUD_REGION) or E(ALICLOUD_REGION_ID) can be typically be used to specify the
|
- C(ALICLOUD_REGION) or C(ALICLOUD_REGION_ID) can be typically be used to specify the
|
||||||
ALICLOUD region, when required, but this can also be configured in the footmark config file
|
ALICLOUD region, when required, but this can also be configured in the footmark config file
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Copyright (c) Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
|
||||||
|
|
||||||
# Standard documentation fragment
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
check_mode:
|
|
||||||
description: Can run in C(check_mode) and return changed status prediction without modifying target.
|
|
||||||
diff_mode:
|
|
||||||
description: Will return details on what has changed (or possibly needs changing in C(check_mode)), when in diff mode.
|
|
||||||
'''
|
|
||||||
|
|
||||||
PLATFORM = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
platform:
|
|
||||||
description: Target OS/families that can be operated against.
|
|
||||||
support: N/A
|
|
||||||
'''
|
|
||||||
|
|
||||||
# Should be used together with the standard fragment
|
|
||||||
INFO_MODULE = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
check_mode:
|
|
||||||
support: full
|
|
||||||
details:
|
|
||||||
- This action does not modify state.
|
|
||||||
diff_mode:
|
|
||||||
support: N/A
|
|
||||||
details:
|
|
||||||
- This action does not modify state.
|
|
||||||
'''
|
|
||||||
|
|
||||||
CONN = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
become:
|
|
||||||
description: Is usable alongside C(become) keywords.
|
|
||||||
connection:
|
|
||||||
description: Uses the target's configured connection information to execute code on it.
|
|
||||||
delegation:
|
|
||||||
description: Can be used in conjunction with C(delegate_to) and related keywords.
|
|
||||||
'''
|
|
||||||
|
|
||||||
FACTS = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
facts:
|
|
||||||
description: Action returns an C(ansible_facts) dictionary that will update existing host facts.
|
|
||||||
'''
|
|
||||||
|
|
||||||
# Should be used together with the standard fragment and the FACTS fragment
|
|
||||||
FACTS_MODULE = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
check_mode:
|
|
||||||
support: full
|
|
||||||
details:
|
|
||||||
- This action does not modify state.
|
|
||||||
diff_mode:
|
|
||||||
support: N/A
|
|
||||||
details:
|
|
||||||
- This action does not modify state.
|
|
||||||
facts:
|
|
||||||
support: full
|
|
||||||
'''
|
|
||||||
|
|
||||||
FILES = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
safe_file_operations:
|
|
||||||
description: Uses Ansible's strict file operation functions to ensure proper permissions and avoid data corruption.
|
|
||||||
'''
|
|
||||||
|
|
||||||
FLOW = r'''
|
|
||||||
options: {}
|
|
||||||
attributes:
|
|
||||||
action:
|
|
||||||
description: Indicates this has a corresponding action plugin so some parts of the options can be executed on the controller.
|
|
||||||
async:
|
|
||||||
description: Supports being used with the C(async) keyword.
|
|
||||||
'''
|
|
||||||
@@ -16,25 +16,23 @@ options:
|
|||||||
client_id:
|
client_id:
|
||||||
description:
|
description:
|
||||||
- The OAuth consumer key.
|
- The OAuth consumer key.
|
||||||
- If not set the environment variable E(BITBUCKET_CLIENT_ID) will be used.
|
- If not set the environment variable C(BITBUCKET_CLIENT_ID) will be used.
|
||||||
type: str
|
type: str
|
||||||
client_secret:
|
client_secret:
|
||||||
description:
|
description:
|
||||||
- The OAuth consumer secret.
|
- The OAuth consumer secret.
|
||||||
- If not set the environment variable E(BITBUCKET_CLIENT_SECRET) will be used.
|
- If not set the environment variable C(BITBUCKET_CLIENT_SECRET) will be used.
|
||||||
type: str
|
type: str
|
||||||
user:
|
user:
|
||||||
description:
|
description:
|
||||||
- The username.
|
- The username.
|
||||||
- If not set the environment variable E(BITBUCKET_USERNAME) will be used.
|
- If not set the environment variable C(BITBUCKET_USERNAME) will be used.
|
||||||
- O(ignore:username) is an alias of O(user) since community.general 6.0.0. It was an alias of O(workspace) before.
|
|
||||||
type: str
|
type: str
|
||||||
version_added: 4.0.0
|
version_added: 4.0.0
|
||||||
aliases: [ username ]
|
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- The App password.
|
- The App password.
|
||||||
- If not set the environment variable E(BITBUCKET_PASSWORD) will be used.
|
- If not set the environment variable C(BITBUCKET_PASSWORD) will be used.
|
||||||
type: str
|
type: str
|
||||||
version_added: 4.0.0
|
version_added: 4.0.0
|
||||||
notes:
|
notes:
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ options:
|
|||||||
mcp_user:
|
mcp_user:
|
||||||
description:
|
description:
|
||||||
- The username used to authenticate to the CloudControl API.
|
- The username used to authenticate to the CloudControl API.
|
||||||
- If not specified, will fall back to E(MCP_USER) from environment variable or C(~/.dimensiondata).
|
- If not specified, will fall back to C(MCP_USER) from environment variable or C(~/.dimensiondata).
|
||||||
type: str
|
type: str
|
||||||
mcp_password:
|
mcp_password:
|
||||||
description:
|
description:
|
||||||
- The password used to authenticate to the CloudControl API.
|
- The password used to authenticate to the CloudControl API.
|
||||||
- If not specified, will fall back to E(MCP_PASSWORD) from environment variable or C(~/.dimensiondata).
|
- If not specified, will fall back to C(MCP_PASSWORD) from environment variable or C(~/.dimensiondata).
|
||||||
- Required if O(mcp_user) is specified.
|
- Required if I(mcp_user) is specified.
|
||||||
type: str
|
type: str
|
||||||
location:
|
location:
|
||||||
description:
|
description:
|
||||||
@@ -44,7 +44,7 @@ options:
|
|||||||
required: true
|
required: true
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- If V(false), SSL certificates will not be validated.
|
- If C(false), SSL certificates will not be validated.
|
||||||
- This should only be used on private instances of the CloudControl API that use self-signed certificates.
|
- This should only be used on private instances of the CloudControl API that use self-signed certificates.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ options:
|
|||||||
wait_time:
|
wait_time:
|
||||||
description:
|
description:
|
||||||
- The maximum amount of time (in seconds) to wait for the task to complete.
|
- The maximum amount of time (in seconds) to wait for the task to complete.
|
||||||
- Only applicable if O(wait=true).
|
- Only applicable if I(wait=true).
|
||||||
type: int
|
type: int
|
||||||
default: 600
|
default: 600
|
||||||
wait_poll_interval:
|
wait_poll_interval:
|
||||||
description:
|
description:
|
||||||
- The amount of time (in seconds) to wait between checks for task completion.
|
- The amount of time (in seconds) to wait between checks for task completion.
|
||||||
- Only applicable if O(wait=true).
|
- Only applicable if I(wait=true).
|
||||||
type: int
|
type: int
|
||||||
default: 2
|
default: 2
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ options:
|
|||||||
required: true
|
required: true
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- hpe3par_sdk >= 1.0.2. Install using C(pip install hpe3par_sdk).
|
- hpe3par_sdk >= 1.0.2. Install using 'pip install hpe3par_sdk'
|
||||||
- WSAPI service should be enabled on the 3PAR storage array.
|
- WSAPI service should be enabled on the 3PAR storage array.
|
||||||
notes:
|
notes:
|
||||||
|
- check_mode not supported
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -51,16 +51,16 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
notes:
|
notes:
|
||||||
- For authentication, you can set identity_endpoint using the
|
- For authentication, you can set identity_endpoint using the
|
||||||
E(ANSIBLE_HWC_IDENTITY_ENDPOINT) env variable.
|
C(ANSIBLE_HWC_IDENTITY_ENDPOINT) env variable.
|
||||||
- For authentication, you can set user using the
|
- For authentication, you can set user using the
|
||||||
E(ANSIBLE_HWC_USER) env variable.
|
C(ANSIBLE_HWC_USER) env variable.
|
||||||
- For authentication, you can set password using the E(ANSIBLE_HWC_PASSWORD) env
|
- For authentication, you can set password using the C(ANSIBLE_HWC_PASSWORD) env
|
||||||
variable.
|
variable.
|
||||||
- For authentication, you can set domain using the E(ANSIBLE_HWC_DOMAIN) env
|
- For authentication, you can set domain using the C(ANSIBLE_HWC_DOMAIN) env
|
||||||
variable.
|
variable.
|
||||||
- For authentication, you can set project using the E(ANSIBLE_HWC_PROJECT) env
|
- For authentication, you can set project using the C(ANSIBLE_HWC_PROJECT) env
|
||||||
variable.
|
variable.
|
||||||
- For authentication, you can set region using the E(ANSIBLE_HWC_REGION) env variable.
|
- For authentication, you can set region using the C(ANSIBLE_HWC_REGION) env variable.
|
||||||
- Environment variables values will only be used if the playbook values are
|
- Environment variables values will only be used if the playbook values are
|
||||||
not set.
|
not set.
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ options:
|
|||||||
username:
|
username:
|
||||||
description:
|
description:
|
||||||
- Username that will be used to authenticate against InfluxDB server.
|
- Username that will be used to authenticate against InfluxDB server.
|
||||||
- Alias O(login_username) added in Ansible 2.5.
|
- Alias C(login_username) added in Ansible 2.5.
|
||||||
type: str
|
type: str
|
||||||
default: root
|
default: root
|
||||||
aliases: [ login_username ]
|
aliases: [ login_username ]
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- Password that will be used to authenticate against InfluxDB server.
|
- Password that will be used to authenticate against InfluxDB server.
|
||||||
- Alias O(login_password) added in Ansible 2.5.
|
- Alias C(login_password) added in Ansible 2.5.
|
||||||
type: str
|
type: str
|
||||||
default: root
|
default: root
|
||||||
aliases: [ login_password ]
|
aliases: [ login_password ]
|
||||||
@@ -47,8 +47,8 @@ options:
|
|||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- If set to V(false), the SSL certificates will not be validated.
|
- If set to C(false), the SSL certificates will not be validated.
|
||||||
- This should only set to V(false) used on personally controlled sites using self-signed certificates.
|
- This should only set to C(false) used on personally controlled sites using self-signed certificates.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
ssl:
|
ssl:
|
||||||
@@ -63,7 +63,7 @@ options:
|
|||||||
retries:
|
retries:
|
||||||
description:
|
description:
|
||||||
- Number of retries client will try before aborting.
|
- Number of retries client will try before aborting.
|
||||||
- V(0) indicates try until success.
|
- C(0) indicates try until success.
|
||||||
- Only available when using python-influxdb >= 4.1.0
|
- Only available when using python-influxdb >= 4.1.0
|
||||||
type: int
|
type: int
|
||||||
default: 3
|
default: 3
|
||||||
|
|||||||
@@ -16,61 +16,61 @@ options:
|
|||||||
ipa_port:
|
ipa_port:
|
||||||
description:
|
description:
|
||||||
- Port of FreeIPA / IPA server.
|
- Port of FreeIPA / IPA server.
|
||||||
- If the value is not specified in the task, the value of environment variable E(IPA_PORT) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(IPA_PORT) will be used instead.
|
||||||
- If both the environment variable E(IPA_PORT) and the value are not specified in the task, then default value is set.
|
- If both the environment variable C(IPA_PORT) and the value are not specified in the task, then default value is set.
|
||||||
- Environment variable fallback mechanism is added in Ansible 2.5.
|
- Environment variable fallback mechanism is added in Ansible 2.5.
|
||||||
type: int
|
type: int
|
||||||
default: 443
|
default: 443
|
||||||
ipa_host:
|
ipa_host:
|
||||||
description:
|
description:
|
||||||
- IP or hostname of IPA server.
|
- IP or hostname of IPA server.
|
||||||
- If the value is not specified in the task, the value of environment variable E(IPA_HOST) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(IPA_HOST) will be used instead.
|
||||||
- If both the environment variable E(IPA_HOST) and the value are not specified in the task, then DNS will be used to try to discover the FreeIPA server.
|
- If both the environment variable C(IPA_HOST) and the value are not specified in the task, then DNS will be used to try to discover the FreeIPA server.
|
||||||
- The relevant entry needed in FreeIPA is the 'ipa-ca' entry.
|
- The relevant entry needed in FreeIPA is the 'ipa-ca' entry.
|
||||||
- If neither the DNS entry, nor the environment E(IPA_HOST), nor the value are available in the task, then the default value will be used.
|
- If neither the DNS entry, nor the environment C(IPA_HOST), nor the value are available in the task, then the default value will be used.
|
||||||
- Environment variable fallback mechanism is added in Ansible 2.5.
|
- Environment variable fallback mechanism is added in Ansible 2.5.
|
||||||
type: str
|
type: str
|
||||||
default: ipa.example.com
|
default: ipa.example.com
|
||||||
ipa_user:
|
ipa_user:
|
||||||
description:
|
description:
|
||||||
- Administrative account used on IPA server.
|
- Administrative account used on IPA server.
|
||||||
- If the value is not specified in the task, the value of environment variable E(IPA_USER) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(IPA_USER) will be used instead.
|
||||||
- If both the environment variable E(IPA_USER) and the value are not specified in the task, then default value is set.
|
- If both the environment variable C(IPA_USER) and the value are not specified in the task, then default value is set.
|
||||||
- Environment variable fallback mechanism is added in Ansible 2.5.
|
- Environment variable fallback mechanism is added in Ansible 2.5.
|
||||||
type: str
|
type: str
|
||||||
default: admin
|
default: admin
|
||||||
ipa_pass:
|
ipa_pass:
|
||||||
description:
|
description:
|
||||||
- Password of administrative user.
|
- Password of administrative user.
|
||||||
- If the value is not specified in the task, the value of environment variable E(IPA_PASS) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(IPA_PASS) will be used instead.
|
||||||
- Note that if the C(urllib_gssapi) library is available, it is possible to use GSSAPI to authenticate to FreeIPA.
|
- Note that if the 'urllib_gssapi' library is available, it is possible to use GSSAPI to authenticate to FreeIPA.
|
||||||
- If the environment variable E(KRB5CCNAME) is available, the module will use this kerberos credentials cache to authenticate to the FreeIPA server.
|
- If the environment variable C(KRB5CCNAME) is available, the module will use this kerberos credentials cache to authenticate to the FreeIPA server.
|
||||||
- If the environment variable E(KRB5_CLIENT_KTNAME) is available, and E(KRB5CCNAME) is not; the module will use this kerberos keytab to authenticate.
|
- If the environment variable C(KRB5_CLIENT_KTNAME) is available, and C(KRB5CCNAME) is not; the module will use this kerberos keytab to authenticate.
|
||||||
- If GSSAPI is not available, the usage of O(ipa_pass) is required.
|
- If GSSAPI is not available, the usage of 'ipa_pass' is required.
|
||||||
- Environment variable fallback mechanism is added in Ansible 2.5.
|
- Environment variable fallback mechanism is added in Ansible 2.5.
|
||||||
type: str
|
type: str
|
||||||
ipa_prot:
|
ipa_prot:
|
||||||
description:
|
description:
|
||||||
- Protocol used by IPA server.
|
- Protocol used by IPA server.
|
||||||
- If the value is not specified in the task, the value of environment variable E(IPA_PROT) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(IPA_PROT) will be used instead.
|
||||||
- If both the environment variable E(IPA_PROT) and the value are not specified in the task, then default value is set.
|
- If both the environment variable C(IPA_PROT) and the value are not specified in the task, then default value is set.
|
||||||
- Environment variable fallback mechanism is added in Ansible 2.5.
|
- Environment variable fallback mechanism is added in Ansible 2.5.
|
||||||
type: str
|
type: str
|
||||||
choices: [ http, https ]
|
choices: [ http, https ]
|
||||||
default: https
|
default: https
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- This only applies if O(ipa_prot) is V(https).
|
- This only applies if C(ipa_prot) is I(https).
|
||||||
- If set to V(false), the SSL certificates will not be validated.
|
- If set to C(false), the SSL certificates will not be validated.
|
||||||
- This should only set to V(false) used on personally controlled sites using self-signed certificates.
|
- This should only set to C(false) used on personally controlled sites using self-signed certificates.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
ipa_timeout:
|
ipa_timeout:
|
||||||
description:
|
description:
|
||||||
- Specifies idle timeout (in seconds) for the connection.
|
- Specifies idle timeout (in seconds) for the connection.
|
||||||
- For bulk operations, you may want to increase this in order to avoid timeout from IPA server.
|
- For bulk operations, you may want to increase this in order to avoid timeout from IPA server.
|
||||||
- If the value is not specified in the task, the value of environment variable E(IPA_TIMEOUT) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(IPA_TIMEOUT) will be used instead.
|
||||||
- If both the environment variable E(IPA_TIMEOUT) and the value are not specified in the task, then default value is set.
|
- If both the environment variable C(IPA_TIMEOUT) and the value are not specified in the task, then default value is set.
|
||||||
type: int
|
type: int
|
||||||
default: 10
|
default: 10
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ options:
|
|||||||
|
|
||||||
auth_client_id:
|
auth_client_id:
|
||||||
description:
|
description:
|
||||||
- OpenID Connect C(client_id) to authenticate to the API with.
|
- OpenID Connect I(client_id) to authenticate to the API with.
|
||||||
type: str
|
type: str
|
||||||
default: admin-cli
|
default: admin-cli
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ options:
|
|||||||
|
|
||||||
auth_client_secret:
|
auth_client_secret:
|
||||||
description:
|
description:
|
||||||
- Client Secret to use in conjunction with O(auth_client_id) (if required).
|
- Client Secret to use in conjunction with I(auth_client_id) (if required).
|
||||||
type: str
|
type: str
|
||||||
|
|
||||||
auth_username:
|
auth_username:
|
||||||
|
|||||||
@@ -21,26 +21,9 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
bind_pw:
|
bind_pw:
|
||||||
description:
|
description:
|
||||||
- The password to use with O(bind_dn).
|
- The password to use with I(bind_dn).
|
||||||
type: str
|
type: str
|
||||||
default: ''
|
default: ''
|
||||||
ca_path:
|
|
||||||
description:
|
|
||||||
- Set the path to PEM file with CA certs.
|
|
||||||
type: path
|
|
||||||
version_added: "6.5.0"
|
|
||||||
client_cert:
|
|
||||||
type: path
|
|
||||||
description:
|
|
||||||
- PEM formatted certificate chain file to be used for SSL client authentication.
|
|
||||||
- Required if O(client_key) is defined.
|
|
||||||
version_added: "7.1.0"
|
|
||||||
client_key:
|
|
||||||
type: path
|
|
||||||
description:
|
|
||||||
- PEM formatted file that contains your private key to be used for SSL client authentication.
|
|
||||||
- Required if O(client_cert) is defined.
|
|
||||||
version_added: "7.1.0"
|
|
||||||
dn:
|
dn:
|
||||||
required: true
|
required: true
|
||||||
description:
|
description:
|
||||||
@@ -52,12 +35,12 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Set the referrals chasing behavior.
|
- Set the referrals chasing behavior.
|
||||||
- V(anonymous) follow referrals anonymously. This is the default behavior.
|
- C(anonymous) follow referrals anonymously. This is the default behavior.
|
||||||
- V(disabled) disable referrals chasing. This sets C(OPT_REFERRALS) to off.
|
- C(disabled) disable referrals chasing. This sets C(OPT_REFERRALS) to off.
|
||||||
version_added: 2.0.0
|
version_added: 2.0.0
|
||||||
server_uri:
|
server_uri:
|
||||||
description:
|
description:
|
||||||
- The O(server_uri) parameter may be a comma- or whitespace-separated list of URIs containing only the schema, the host, and the port fields.
|
- The I(server_uri) parameter may be a comma- or whitespace-separated list of URIs containing only the schema, the host, and the port fields.
|
||||||
- The default value lets the underlying LDAP client library look for a UNIX domain socket in its default location.
|
- The default value lets the underlying LDAP client library look for a UNIX domain socket in its default location.
|
||||||
- Note that when using multiple URIs you cannot determine to which URI your client gets connected.
|
- Note that when using multiple URIs you cannot determine to which URI your client gets connected.
|
||||||
- For URIs containing additional fields, particularly when using commas, behavior is undefined.
|
- For URIs containing additional fields, particularly when using commas, behavior is undefined.
|
||||||
@@ -70,25 +53,16 @@ options:
|
|||||||
default: false
|
default: false
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- If set to V(false), SSL certificates will not be validated.
|
- If set to C(false), SSL certificates will not be validated.
|
||||||
- This should only be used on sites using self-signed certificates.
|
- This should only be used on sites using self-signed certificates.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
sasl_class:
|
sasl_class:
|
||||||
description:
|
description:
|
||||||
- The class to use for SASL authentication.
|
- The class to use for SASL authentication.
|
||||||
|
- Possible choices are C(external), C(gssapi).
|
||||||
type: str
|
type: str
|
||||||
choices: ['external', 'gssapi']
|
choices: ['external', 'gssapi']
|
||||||
default: external
|
default: external
|
||||||
version_added: "2.0.0"
|
version_added: "2.0.0"
|
||||||
xorder_discovery:
|
|
||||||
description:
|
|
||||||
- Set the behavior on how to process Xordered DNs.
|
|
||||||
- V(enable) will perform a C(ONELEVEL) search below the superior RDN to find the matching DN.
|
|
||||||
- V(disable) will always use the DN unmodified (as passed by the O(dn) parameter).
|
|
||||||
- V(auto) will only perform a search if the first RDN does not contain an index number (C({x})).
|
|
||||||
type: str
|
|
||||||
choices: ['enable', 'auto', 'disable']
|
|
||||||
default: auto
|
|
||||||
version_added: "6.4.0"
|
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -21,30 +21,30 @@ options:
|
|||||||
suboptions:
|
suboptions:
|
||||||
url:
|
url:
|
||||||
description:
|
description:
|
||||||
- ManageIQ environment URL. E(MIQ_URL) environment variable if set. Otherwise, it is required to pass it.
|
- ManageIQ environment url. C(MIQ_URL) env var if set. otherwise, it is required to pass it.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
username:
|
username:
|
||||||
description:
|
description:
|
||||||
- ManageIQ username. E(MIQ_USERNAME) environment variable if set. Otherwise, required if no token is passed in.
|
- ManageIQ username. C(MIQ_USERNAME) env var if set. otherwise, required if no token is passed in.
|
||||||
type: str
|
type: str
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- ManageIQ password. E(MIQ_PASSWORD) environment variable if set. Otherwise, required if no token is passed in.
|
- ManageIQ password. C(MIQ_PASSWORD) env var if set. otherwise, required if no token is passed in.
|
||||||
type: str
|
type: str
|
||||||
token:
|
token:
|
||||||
description:
|
description:
|
||||||
- ManageIQ token. E(MIQ_TOKEN) environment variable if set. Otherwise, required if no username or password is passed in.
|
- ManageIQ token. C(MIQ_TOKEN) env var if set. otherwise, required if no username or password is passed in.
|
||||||
type: str
|
type: str
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- Whether SSL certificates should be verified for HTTPS requests.
|
- Whether SSL certificates should be verified for HTTPS requests. defaults to True.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
aliases: [ verify_ssl ]
|
aliases: [ verify_ssl ]
|
||||||
ca_cert:
|
ca_cert:
|
||||||
description:
|
description:
|
||||||
- The path to a CA bundle file or directory with certificates.
|
- The path to a CA bundle file or directory with certificates. defaults to None.
|
||||||
type: str
|
type: str
|
||||||
aliases: [ ca_bundle_path ]
|
aliases: [ ca_bundle_path ]
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ options:
|
|||||||
default: true
|
default: true
|
||||||
notes:
|
notes:
|
||||||
- Also see the API documentation on U(https://console.online.net/en/api/)
|
- Also see the API documentation on U(https://console.online.net/en/api/)
|
||||||
- If O(api_token) is not set within the module, the following
|
- If C(api_token) is not set within the module, the following
|
||||||
environment variables can be used in decreasing order of precedence
|
environment variables can be used in decreasing order of precedence
|
||||||
E(ONLINE_TOKEN), E(ONLINE_API_KEY), E(ONLINE_OAUTH_TOKEN), E(ONLINE_API_TOKEN).
|
C(ONLINE_TOKEN), C(ONLINE_API_KEY), C(ONLINE_OAUTH_TOKEN), C(ONLINE_API_TOKEN)
|
||||||
- If one wants to use a different O(api_url) one can also set the E(ONLINE_API_URL)
|
- If one wants to use a different C(api_url) one can also set the C(ONLINE_API_URL)
|
||||||
environment variable.
|
environment variable.
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -15,26 +15,26 @@ options:
|
|||||||
api_url:
|
api_url:
|
||||||
description:
|
description:
|
||||||
- The ENDPOINT URL of the XMLRPC server.
|
- The ENDPOINT URL of the XMLRPC server.
|
||||||
- If not specified then the value of the E(ONE_URL) environment variable, if any, is used.
|
- If not specified then the value of the ONE_URL environment variable, if any, is used.
|
||||||
type: str
|
type: str
|
||||||
aliases:
|
aliases:
|
||||||
- api_endpoint
|
- api_endpoint
|
||||||
api_username:
|
api_username:
|
||||||
description:
|
description:
|
||||||
- The name of the user for XMLRPC authentication.
|
- The name of the user for XMLRPC authentication.
|
||||||
- If not specified then the value of the E(ONE_USERNAME) environment variable, if any, is used.
|
- If not specified then the value of the ONE_USERNAME environment variable, if any, is used.
|
||||||
type: str
|
type: str
|
||||||
api_password:
|
api_password:
|
||||||
description:
|
description:
|
||||||
- The password or token for XMLRPC authentication.
|
- The password or token for XMLRPC authentication.
|
||||||
- If not specified then the value of the E(ONE_PASSWORD) environment variable, if any, is used.
|
- If not specified then the value of the ONE_PASSWORD environment variable, if any, is used.
|
||||||
type: str
|
type: str
|
||||||
aliases:
|
aliases:
|
||||||
- api_token
|
- api_token
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- Whether to validate the TLS/SSL certificates or not.
|
- Whether to validate the SSL certificates or not.
|
||||||
- This parameter is ignored if E(PYTHONHTTPSVERIFY) environment variable is used.
|
- This parameter is ignored if PYTHONHTTPSVERIFY environment variable is used.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
wait_timeout:
|
wait_timeout:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ options:
|
|||||||
port:
|
port:
|
||||||
description:
|
description:
|
||||||
- Specifies the port to use when building the connection to the remote
|
- Specifies the port to use when building the connection to the remote
|
||||||
device. This value applies to either O(transport=cli) or O(transport=rest). The port
|
device. This value applies to either I(cli) or I(rest). The port
|
||||||
value will default to the appropriate transport common port if
|
value will default to the appropriate transport common port if
|
||||||
none is provided in the task. (cli=22, http=80, https=443). Note
|
none is provided in the task. (cli=22, http=80, https=443). Note
|
||||||
this argument does not affect the SSH transport.
|
this argument does not affect the SSH transport.
|
||||||
@@ -36,15 +36,15 @@ options:
|
|||||||
either the CLI login or the eAPI authentication depending on which
|
either the CLI login or the eAPI authentication depending on which
|
||||||
transport is used. Note this argument does not affect the SSH
|
transport is used. Note this argument does not affect the SSH
|
||||||
transport. If the value is not specified in the task, the value of
|
transport. If the value is not specified in the task, the value of
|
||||||
environment variable E(ANSIBLE_NET_USERNAME) will be used instead.
|
environment variable C(ANSIBLE_NET_USERNAME) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- Specifies the password to use to authenticate the connection to
|
- Specifies the password to use to authenticate the connection to
|
||||||
the remote device. This is a common argument used for either O(transport=cli)
|
the remote device. This is a common argument used for either I(cli)
|
||||||
or O(transport=rest). Note this argument does not affect the SSH
|
or I(rest) transports. Note this argument does not affect the SSH
|
||||||
transport. If the value is not specified in the task, the value of
|
transport. If the value is not specified in the task, the value of
|
||||||
environment variable E(ANSIBLE_NET_PASSWORD) will be used instead.
|
environment variable C(ANSIBLE_NET_PASSWORD) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
timeout:
|
timeout:
|
||||||
description:
|
description:
|
||||||
@@ -56,9 +56,9 @@ options:
|
|||||||
ssh_keyfile:
|
ssh_keyfile:
|
||||||
description:
|
description:
|
||||||
- Specifies the SSH key to use to authenticate the connection to
|
- Specifies the SSH key to use to authenticate the connection to
|
||||||
the remote device. This argument is only used for O(transport=cli).
|
the remote device. This argument is only used for the I(cli)
|
||||||
If the value is not specified in the task, the value of
|
transports. If the value is not specified in the task, the value of
|
||||||
environment variable E(ANSIBLE_NET_SSH_KEYFILE) will be used instead.
|
environment variable C(ANSIBLE_NET_SSH_KEYFILE) will be used instead.
|
||||||
type: path
|
type: path
|
||||||
transport:
|
transport:
|
||||||
description:
|
description:
|
||||||
@@ -71,14 +71,14 @@ options:
|
|||||||
default: ssh
|
default: ssh
|
||||||
use_ssl:
|
use_ssl:
|
||||||
description:
|
description:
|
||||||
- Configures the O(transport) to use SSL if set to V(true) only when the
|
- Configures the I(transport) to use SSL if set to C(true) only when the
|
||||||
O(transport) argument is configured as rest. If the transport
|
I(transport) argument is configured as rest. If the transport
|
||||||
argument is not V(rest), this value is ignored.
|
argument is not I(rest), this value is ignored.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
provider:
|
provider:
|
||||||
description:
|
description:
|
||||||
- Convenience method that allows all C(openswitch) arguments to be passed as
|
- Convenience method that allows all I(openswitch) arguments to be passed as
|
||||||
a dict object. All constraints (required, choices, etc) must be
|
a dict object. All constraints (required, choices, etc) must be
|
||||||
met either by individual arguments or values in this dict.
|
met either by individual arguments or values in this dict.
|
||||||
type: dict
|
type: dict
|
||||||
|
|||||||
@@ -18,28 +18,28 @@ class ModuleDocFragment(object):
|
|||||||
options:
|
options:
|
||||||
config_file_location:
|
config_file_location:
|
||||||
description:
|
description:
|
||||||
- Path to configuration file. If not set then the value of the E(OCI_CONFIG_FILE) environment variable,
|
- Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable,
|
||||||
if any, is used. Otherwise, defaults to ~/.oci/config.
|
if any, is used. Otherwise, defaults to ~/.oci/config.
|
||||||
type: str
|
type: str
|
||||||
config_profile_name:
|
config_profile_name:
|
||||||
description:
|
description:
|
||||||
- The profile to load from the config file referenced by O(config_file_location). If not set, then the
|
- The profile to load from the config file referenced by C(config_file_location). If not set, then the
|
||||||
value of the E(OCI_CONFIG_PROFILE) environment variable, if any, is used. Otherwise, defaults to the
|
value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the
|
||||||
"DEFAULT" profile in O(config_file_location).
|
"DEFAULT" profile in C(config_file_location).
|
||||||
default: "DEFAULT"
|
default: "DEFAULT"
|
||||||
type: str
|
type: str
|
||||||
api_user:
|
api_user:
|
||||||
description:
|
description:
|
||||||
- The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the
|
- The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the
|
||||||
value of the E(OCI_USER_OCID) environment variable, if any, is used. This option is required if the user
|
value of the OCI_USER_OCID environment variable, if any, is used. This option is required if the user
|
||||||
is not specified through a configuration file (See O(config_file_location)). To get the user's OCID,
|
is not specified through a configuration file (See C(config_file_location)). To get the user's OCID,
|
||||||
please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
|
please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
|
||||||
type: str
|
type: str
|
||||||
api_user_fingerprint:
|
api_user_fingerprint:
|
||||||
description:
|
description:
|
||||||
- Fingerprint for the key pair being used. If not set, then the value of the E(OCI_USER_FINGERPRINT)
|
- Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT
|
||||||
environment variable, if any, is used. This option is required if the key fingerprint is not
|
environment variable, if any, is used. This option is required if the key fingerprint is not
|
||||||
specified through a configuration file (See O(config_file_location)). To get the key pair's
|
specified through a configuration file (See C(config_file_location)). To get the key pair's
|
||||||
fingerprint value please refer
|
fingerprint value please refer
|
||||||
U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
|
U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm).
|
||||||
type: str
|
type: str
|
||||||
@@ -47,21 +47,21 @@ class ModuleDocFragment(object):
|
|||||||
description:
|
description:
|
||||||
- Full path and filename of the private key (in PEM format). If not set, then the value of the
|
- Full path and filename of the private key (in PEM format). If not set, then the value of the
|
||||||
OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is
|
OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is
|
||||||
not specified through a configuration file (See O(config_file_location)). If the key is encrypted
|
not specified through a configuration file (See C(config_file_location)). If the key is encrypted
|
||||||
with a pass-phrase, the O(api_user_key_pass_phrase) option must also be provided.
|
with a pass-phrase, the C(api_user_key_pass_phrase) option must also be provided.
|
||||||
type: path
|
type: path
|
||||||
api_user_key_pass_phrase:
|
api_user_key_pass_phrase:
|
||||||
description:
|
description:
|
||||||
- Passphrase used by the key referenced in O(api_user_key_file), if it is encrypted. If not set, then
|
- Passphrase used by the key referenced in C(api_user_key_file), if it is encrypted. If not set, then
|
||||||
the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the
|
the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the
|
||||||
key passphrase is not specified through a configuration file (See O(config_file_location)).
|
key passphrase is not specified through a configuration file (See C(config_file_location)).
|
||||||
type: str
|
type: str
|
||||||
auth_type:
|
auth_type:
|
||||||
description:
|
description:
|
||||||
- The type of authentication to use for making API requests. By default O(auth_type=api_key) based
|
- The type of authentication to use for making API requests. By default C(auth_type="api_key") based
|
||||||
authentication is performed and the API key (see O(api_user_key_file)) in your config file will be
|
authentication is performed and the API key (see I(api_user_key_file)) in your config file will be
|
||||||
used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE,
|
used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE,
|
||||||
if any, is used. Use O(auth_type=instance_principal) to use instance principal based authentication
|
if any, is used. Use C(auth_type="instance_principal") to use instance principal based authentication
|
||||||
when running ansible playbooks within an OCI compute instance.
|
when running ansible playbooks within an OCI compute instance.
|
||||||
choices: ['api_key', 'instance_principal']
|
choices: ['api_key', 'instance_principal']
|
||||||
default: 'api_key'
|
default: 'api_key'
|
||||||
@@ -70,14 +70,14 @@ class ModuleDocFragment(object):
|
|||||||
description:
|
description:
|
||||||
- OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is
|
- OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is
|
||||||
used. This option is required if the tenancy OCID is not specified through a configuration file
|
used. This option is required if the tenancy OCID is not specified through a configuration file
|
||||||
(See O(config_file_location)). To get the tenancy OCID, please refer
|
(See C(config_file_location)). To get the tenancy OCID, please refer
|
||||||
U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm)
|
U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm)
|
||||||
type: str
|
type: str
|
||||||
region:
|
region:
|
||||||
description:
|
description:
|
||||||
- The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the
|
- The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the
|
||||||
value of the OCI_REGION variable, if any, is used. This option is required if the region is
|
value of the OCI_REGION variable, if any, is used. This option is required if the region is
|
||||||
not specified through a configuration file (See O(config_file_location)). Please refer to
|
not specified through a configuration file (See C(config_file_location)). Please refer to
|
||||||
U(https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm) for more information
|
U(https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm) for more information
|
||||||
on OCI regions.
|
on OCI regions.
|
||||||
type: str
|
type: str
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ class ModuleDocFragment(object):
|
|||||||
description: Whether to attempt non-idempotent creation of a resource. By default, create resource is an
|
description: Whether to attempt non-idempotent creation of a resource. By default, create resource is an
|
||||||
idempotent operation, and doesn't create the resource if it already exists. Setting this option
|
idempotent operation, and doesn't create the resource if it already exists. Setting this option
|
||||||
to true, forcefully creates a copy of the resource, even if it already exists.This option is
|
to true, forcefully creates a copy of the resource, even if it already exists.This option is
|
||||||
mutually exclusive with O(key_by).
|
mutually exclusive with I(key_by).
|
||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
key_by:
|
key_by:
|
||||||
description: The list of comma-separated attributes of this resource which should be used to uniquely
|
description: The list of comma-separated attributes of this resource which should be used to uniquely
|
||||||
identify an instance of the resource. By default, all the attributes of a resource except
|
identify an instance of the resource. By default, all the attributes of a resource except
|
||||||
O(freeform_tags) are used to uniquely identify a resource.
|
I(freeform_tags) are used to uniquely identify a resource.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ModuleDocFragment(object):
|
|||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
options:
|
options:
|
||||||
display_name:
|
display_name:
|
||||||
description: Use O(display_name) along with the other options to return only resources that match the given
|
description: Use I(display_name) along with the other options to return only resources that match the given
|
||||||
display name exactly.
|
display name exactly.
|
||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ModuleDocFragment(object):
|
|||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description: Use O(name) along with the other options to return only resources that match the given name
|
description: Use I(name) along with the other options to return only resources that match the given name
|
||||||
exactly.
|
exactly.
|
||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ class ModuleDocFragment(object):
|
|||||||
default: true
|
default: true
|
||||||
type: bool
|
type: bool
|
||||||
wait_timeout:
|
wait_timeout:
|
||||||
description: Time, in seconds, to wait when O(wait=true).
|
description: Time, in seconds, to wait when I(wait=true).
|
||||||
default: 1200
|
default: 1200
|
||||||
type: int
|
type: int
|
||||||
wait_until:
|
wait_until:
|
||||||
description: The lifecycle state to wait for the resource to transition into when O(wait=true). By default,
|
description: The lifecycle state to wait for the resource to transition into when I(wait=true). By default,
|
||||||
when O(wait=true), we wait for the resource to get into ACTIVE/ATTACHED/AVAILABLE/PROVISIONED/
|
when I(wait=true), we wait for the resource to get into ACTIVE/ATTACHED/AVAILABLE/PROVISIONED/
|
||||||
RUNNING applicable lifecycle state during create operation & to get into DELETED/DETACHED/
|
RUNNING applicable lifecycle state during create operation & to get into DELETED/DETACHED/
|
||||||
TERMINATED lifecycle state during delete operation.
|
TERMINATED lifecycle state during delete operation.
|
||||||
type: str
|
type: str
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ options:
|
|||||||
default: true
|
default: true
|
||||||
description:
|
description:
|
||||||
- If certificates should be validated or not.
|
- If certificates should be validated or not.
|
||||||
- This should never be set to V(false), except if you are very sure that
|
- This should never be set to C(false), except if you are very sure that
|
||||||
your connection to the server can not be subject to a Man In The Middle
|
your connection to the server can not be subject to a Man In The Middle
|
||||||
attack.
|
attack.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -24,23 +24,21 @@ options:
|
|||||||
api_password:
|
api_password:
|
||||||
description:
|
description:
|
||||||
- Specify the password to authenticate with.
|
- Specify the password to authenticate with.
|
||||||
- You can use E(PROXMOX_PASSWORD) environment variable.
|
- You can use C(PROXMOX_PASSWORD) environment variable.
|
||||||
type: str
|
type: str
|
||||||
api_token_id:
|
api_token_id:
|
||||||
description:
|
description:
|
||||||
- Specify the token ID.
|
- Specify the token ID.
|
||||||
- Requires C(proxmoxer>=1.1.0) to work.
|
|
||||||
type: str
|
type: str
|
||||||
version_added: 1.3.0
|
version_added: 1.3.0
|
||||||
api_token_secret:
|
api_token_secret:
|
||||||
description:
|
description:
|
||||||
- Specify the token secret.
|
- Specify the token secret.
|
||||||
- Requires C(proxmoxer>=1.1.0) to work.
|
|
||||||
type: str
|
type: str
|
||||||
version_added: 1.3.0
|
version_added: 1.3.0
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- If V(false), SSL certificates will not be validated.
|
- If C(false), SSL certificates will not be validated.
|
||||||
- This should only be used on personally controlled sites using self-signed certificates.
|
- This should only be used on personally controlled sites using self-signed certificates.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
@@ -57,7 +55,7 @@ options:
|
|||||||
node:
|
node:
|
||||||
description:
|
description:
|
||||||
- Proxmox VE node on which to operate.
|
- Proxmox VE node on which to operate.
|
||||||
- Only required for O(state=present).
|
- Only required for I(state=present).
|
||||||
- For every other states it will be autodiscovered.
|
- For every other states it will be autodiscovered.
|
||||||
type: str
|
type: str
|
||||||
pool:
|
pool:
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
notes:
|
notes:
|
||||||
- This module requires the C(purity_fb) Python library
|
- This module requires the C(purity_fb) Python library
|
||||||
- You must set E(PUREFB_URL) and E(PUREFB_API) environment variables
|
- You must set C(PUREFB_URL) and C(PUREFB_API) environment variables
|
||||||
if O(fb_url) and O(api_token) arguments are not passed to the module directly
|
if I(fb_url) and I(api_token) arguments are not passed to the module directly
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.7
|
- python >= 2.7
|
||||||
- purity_fb >= 1.1
|
- purity_fb >= 1.1
|
||||||
@@ -55,8 +55,8 @@ options:
|
|||||||
required: true
|
required: true
|
||||||
notes:
|
notes:
|
||||||
- This module requires the C(purestorage) Python library
|
- This module requires the C(purestorage) Python library
|
||||||
- You must set E(PUREFA_URL) and E(PUREFA_API) environment variables
|
- You must set C(PUREFA_URL) and C(PUREFA_API) environment variables
|
||||||
if O(fa_url) and O(api_token) arguments are not passed to the module directly
|
if I(fa_url) and I(api_token) arguments are not passed to the module directly
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.7
|
- python >= 2.7
|
||||||
- purestorage
|
- purestorage
|
||||||
|
|||||||
@@ -15,18 +15,18 @@ class ModuleDocFragment(object):
|
|||||||
options:
|
options:
|
||||||
api_key:
|
api_key:
|
||||||
description:
|
description:
|
||||||
- Rackspace API key, overrides O(credentials).
|
- Rackspace API key, overrides I(credentials).
|
||||||
type: str
|
type: str
|
||||||
aliases: [ password ]
|
aliases: [ password ]
|
||||||
credentials:
|
credentials:
|
||||||
description:
|
description:
|
||||||
- File to find the Rackspace credentials in. Ignored if O(api_key) and
|
- File to find the Rackspace credentials in. Ignored if I(api_key) and
|
||||||
O(username) are provided.
|
I(username) are provided.
|
||||||
type: path
|
type: path
|
||||||
aliases: [ creds_file ]
|
aliases: [ creds_file ]
|
||||||
env:
|
env:
|
||||||
description:
|
description:
|
||||||
- Environment as configured in C(~/.pyrax.cfg),
|
- Environment as configured in I(~/.pyrax.cfg),
|
||||||
see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration).
|
see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration).
|
||||||
type: str
|
type: str
|
||||||
region:
|
region:
|
||||||
@@ -35,7 +35,7 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
username:
|
username:
|
||||||
description:
|
description:
|
||||||
- Rackspace username, overrides O(credentials).
|
- Rackspace username, overrides I(credentials).
|
||||||
type: str
|
type: str
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
@@ -46,12 +46,12 @@ requirements:
|
|||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- pyrax
|
- pyrax
|
||||||
notes:
|
notes:
|
||||||
- The following environment variables can be used, E(RAX_USERNAME),
|
- The following environment variables can be used, C(RAX_USERNAME),
|
||||||
E(RAX_API_KEY), E(RAX_CREDS_FILE), E(RAX_CREDENTIALS), E(RAX_REGION).
|
C(RAX_API_KEY), C(RAX_CREDS_FILE), C(RAX_CREDENTIALS), C(RAX_REGION).
|
||||||
- E(RAX_CREDENTIALS) and E(RAX_CREDS_FILE) point to a credentials file
|
- C(RAX_CREDENTIALS) and C(RAX_CREDS_FILE) points to a credentials file
|
||||||
appropriate for pyrax. See U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating)
|
appropriate for pyrax. See U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating)
|
||||||
- E(RAX_USERNAME) and E(RAX_API_KEY) obviate the use of a credentials file
|
- C(RAX_USERNAME) and C(RAX_API_KEY) obviate the use of a credentials file
|
||||||
- E(RAX_REGION) defines a Rackspace Public Cloud region (DFW, ORD, LON, ...)
|
- C(RAX_REGION) defines a Rackspace Public Cloud region (DFW, ORD, LON, ...)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Documentation fragment including attributes to enable communication
|
# Documentation fragment including attributes to enable communication
|
||||||
@@ -61,7 +61,7 @@ options:
|
|||||||
api_key:
|
api_key:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Rackspace API key, overrides O(credentials).
|
- Rackspace API key, overrides I(credentials).
|
||||||
aliases: [ password ]
|
aliases: [ password ]
|
||||||
auth_endpoint:
|
auth_endpoint:
|
||||||
type: str
|
type: str
|
||||||
@@ -71,13 +71,13 @@ options:
|
|||||||
credentials:
|
credentials:
|
||||||
type: path
|
type: path
|
||||||
description:
|
description:
|
||||||
- File to find the Rackspace credentials in. Ignored if O(api_key) and
|
- File to find the Rackspace credentials in. Ignored if I(api_key) and
|
||||||
O(username) are provided.
|
I(username) are provided.
|
||||||
aliases: [ creds_file ]
|
aliases: [ creds_file ]
|
||||||
env:
|
env:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Environment as configured in C(~/.pyrax.cfg),
|
- Environment as configured in I(~/.pyrax.cfg),
|
||||||
see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration).
|
see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration).
|
||||||
identity_type:
|
identity_type:
|
||||||
type: str
|
type: str
|
||||||
@@ -99,24 +99,20 @@ options:
|
|||||||
username:
|
username:
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
- Rackspace username, overrides O(credentials).
|
- Rackspace username, overrides I(credentials).
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- Whether or not to require SSL validation of API endpoints.
|
- Whether or not to require SSL validation of API endpoints.
|
||||||
type: bool
|
type: bool
|
||||||
aliases: [ verify_ssl ]
|
aliases: [ verify_ssl ]
|
||||||
deprecated:
|
|
||||||
removed_in: 9.0.0
|
|
||||||
why: This module relies on the deprecated package pyrax.
|
|
||||||
alternative: Use the Openstack modules instead.
|
|
||||||
requirements:
|
requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
- pyrax
|
- pyrax
|
||||||
notes:
|
notes:
|
||||||
- The following environment variables can be used, E(RAX_USERNAME),
|
- The following environment variables can be used, C(RAX_USERNAME),
|
||||||
E(RAX_API_KEY), E(RAX_CREDS_FILE), E(RAX_CREDENTIALS), E(RAX_REGION).
|
C(RAX_API_KEY), C(RAX_CREDS_FILE), C(RAX_CREDENTIALS), C(RAX_REGION).
|
||||||
- E(RAX_CREDENTIALS) and E(RAX_CREDS_FILE) points to a credentials file
|
- C(RAX_CREDENTIALS) and C(RAX_CREDS_FILE) points to a credentials file
|
||||||
appropriate for pyrax. See U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating)
|
appropriate for pyrax. See U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating)
|
||||||
- E(RAX_USERNAME) and E(RAX_API_KEY) obviate the use of a credentials file
|
- C(RAX_USERNAME) and C(RAX_API_KEY) obviate the use of a credentials file
|
||||||
- E(RAX_REGION) defines a Rackspace Public Cloud region (DFW, ORD, LON, ...)
|
- C(RAX_REGION) defines a Rackspace Public Cloud region (DFW, ORD, LON, ...)
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ options:
|
|||||||
default: true
|
default: true
|
||||||
ca_certs:
|
ca_certs:
|
||||||
description:
|
description:
|
||||||
- Path to root certificates file. If not set and O(tls) is
|
- Path to root certificates file. If not set and I(tls) is
|
||||||
set to V(true), certifi ca-certificates will be used.
|
set to C(true), certifi ca-certificates will be used.
|
||||||
type: str
|
type: str
|
||||||
requirements: [ "redis", "certifi" ]
|
requirements: [ "redis", "certifi" ]
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ options:
|
|||||||
default: true
|
default: true
|
||||||
notes:
|
notes:
|
||||||
- Also see the API documentation on U(https://developer.scaleway.com/)
|
- Also see the API documentation on U(https://developer.scaleway.com/)
|
||||||
- If O(api_token) is not set within the module, the following
|
- If C(api_token) is not set within the module, the following
|
||||||
environment variables can be used in decreasing order of precedence
|
environment variables can be used in decreasing order of precedence
|
||||||
E(SCW_TOKEN), E(SCW_API_KEY), E(SCW_OAUTH_TOKEN) or E(SCW_API_TOKEN).
|
C(SCW_TOKEN), C(SCW_API_KEY), C(SCW_OAUTH_TOKEN) or C(SCW_API_TOKEN).
|
||||||
- If one wants to use a different O(api_url) one can also set the E(SCW_API_URL)
|
- If one wants to use a different C(api_url) one can also set the C(SCW_API_URL)
|
||||||
environment variable.
|
environment variable.
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ options:
|
|||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- The desired state of the object.
|
- The desired state of the object.
|
||||||
- V(present) will create or update an object
|
- C(present) will create or update an object
|
||||||
- V(absent) will delete an object if it was present
|
- C(absent) will delete an object if it was present
|
||||||
type: str
|
type: str
|
||||||
choices: [ absent, present ]
|
choices: [ absent, present ]
|
||||||
default: present
|
default: present
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted.
|
- Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted.
|
||||||
- If set to V(true), please make sure Python >= 2.7.9 is installed on the given machine.
|
- If set to C(true), please make sure Python >= 2.7.9 is installed on the given machine.
|
||||||
required: false
|
required: false
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
|
|||||||
@@ -15,27 +15,27 @@ options:
|
|||||||
hostname:
|
hostname:
|
||||||
description:
|
description:
|
||||||
- The hostname or IP address of the XenServer host or XenServer pool master.
|
- The hostname or IP address of the XenServer host or XenServer pool master.
|
||||||
- If the value is not specified in the task, the value of environment variable E(XENSERVER_HOST) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(XENSERVER_HOST) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
default: localhost
|
default: localhost
|
||||||
aliases: [ host, pool ]
|
aliases: [ host, pool ]
|
||||||
username:
|
username:
|
||||||
description:
|
description:
|
||||||
- The username to use for connecting to XenServer.
|
- The username to use for connecting to XenServer.
|
||||||
- If the value is not specified in the task, the value of environment variable E(XENSERVER_USER) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(XENSERVER_USER) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
default: root
|
default: root
|
||||||
aliases: [ admin, user ]
|
aliases: [ admin, user ]
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- The password to use for connecting to XenServer.
|
- The password to use for connecting to XenServer.
|
||||||
- If the value is not specified in the task, the value of environment variable E(XENSERVER_PASSWORD) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(XENSERVER_PASSWORD) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
aliases: [ pass, pwd ]
|
aliases: [ pass, pwd ]
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description:
|
description:
|
||||||
- Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted.
|
- Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted.
|
||||||
- If the value is not specified in the task, the value of environment variable E(XENSERVER_VALIDATE_CERTS) will be used instead.
|
- If the value is not specified in the task, the value of environment variable C(XENSERVER_VALIDATE_CERTS) will be used instead.
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ DOCUMENTATION = '''
|
|||||||
dialect:
|
dialect:
|
||||||
description:
|
description:
|
||||||
- The CSV dialect to use when parsing the CSV file.
|
- The CSV dialect to use when parsing the CSV file.
|
||||||
- Possible values include V(excel), V(excel-tab) or V(unix).
|
- Possible values include C(excel), C(excel-tab) or C(unix).
|
||||||
type: str
|
type: str
|
||||||
default: excel
|
default: excel
|
||||||
fieldnames:
|
fieldnames:
|
||||||
@@ -35,19 +35,19 @@ DOCUMENTATION = '''
|
|||||||
delimiter:
|
delimiter:
|
||||||
description:
|
description:
|
||||||
- A one-character string used to separate fields.
|
- A one-character string used to separate fields.
|
||||||
- When using this parameter, you change the default value used by O(dialect).
|
- When using this parameter, you change the default value used by I(dialect).
|
||||||
- The default value depends on the dialect used.
|
- The default value depends on the dialect used.
|
||||||
type: str
|
type: str
|
||||||
skipinitialspace:
|
skipinitialspace:
|
||||||
description:
|
description:
|
||||||
- Whether to ignore any whitespaces immediately following the delimiter.
|
- Whether to ignore any whitespaces immediately following the delimiter.
|
||||||
- When using this parameter, you change the default value used by O(dialect).
|
- When using this parameter, you change the default value used by I(dialect).
|
||||||
- The default value depends on the dialect used.
|
- The default value depends on the dialect used.
|
||||||
type: bool
|
type: bool
|
||||||
strict:
|
strict:
|
||||||
description:
|
description:
|
||||||
- Whether to raise an exception on bad CSV input.
|
- Whether to raise an exception on bad CSV input.
|
||||||
- When using this parameter, you change the default value used by O(dialect).
|
- When using this parameter, you change the default value used by I(dialect).
|
||||||
- The default value depends on the dialect used.
|
- The default value depends on the dialect used.
|
||||||
type: bool
|
type: bool
|
||||||
'''
|
'''
|
||||||
@@ -56,7 +56,7 @@ EXAMPLES = '''
|
|||||||
- name: Parse a CSV file's contents
|
- name: Parse a CSV file's contents
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ csv_data | community.general.from_csv(dialect='unix') }}
|
{{ csv_data | community.genera.from_csv(dialect='unix') }}
|
||||||
vars:
|
vars:
|
||||||
csv_data: |
|
csv_data: |
|
||||||
Column 1,Value
|
Column 1,Value
|
||||||
|
|||||||
@@ -25,17 +25,17 @@ DOCUMENTATION = '''
|
|||||||
parser:
|
parser:
|
||||||
description:
|
description:
|
||||||
- The correct parser for the input data.
|
- The correct parser for the input data.
|
||||||
- For example V(ifconfig).
|
- For example C(ifconfig).
|
||||||
- "Note: use underscores instead of dashes (if any) in the parser module name."
|
- "Note: use underscores instead of dashes (if any) in the parser module name."
|
||||||
- See U(https://github.com/kellyjonbrazil/jc#parsers) for the latest list of parsers.
|
- See U(https://github.com/kellyjonbrazil/jc#parsers) for the latest list of parsers.
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
quiet:
|
quiet:
|
||||||
description: Set to V(false) to not suppress warnings.
|
description: Set to C(false) to not suppress warnings.
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
raw:
|
raw:
|
||||||
description: Set to V(true) to return pre-processed JSON.
|
description: Set to C(true) to return pre-processed JSON.
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
requirements:
|
requirements:
|
||||||
@@ -138,12 +138,6 @@ def jc_filter(data, parser, quiet=True, raw=False):
|
|||||||
raise AnsibleError('You need to install "jc" as a Python library on the Ansible controller prior to running jc filter')
|
raise AnsibleError('You need to install "jc" as a Python library on the Ansible controller prior to running jc filter')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# new API (jc v1.18.0 and higher) allows use of plugin parsers
|
|
||||||
if hasattr(jc, 'parse'):
|
|
||||||
return jc.parse(parser, data, quiet=quiet, raw=raw)
|
|
||||||
|
|
||||||
# old API (jc v1.17.7 and lower)
|
|
||||||
else:
|
|
||||||
jc_parser = importlib.import_module('jc.parsers.' + parser)
|
jc_parser = importlib.import_module('jc.parsers.' + parser)
|
||||||
return jc_parser.parse(data, quiet=quiet, raw=raw)
|
return jc_parser.parse(data, quiet=quiet, raw=raw)
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ DOCUMENTATION = '''
|
|||||||
version_added: 2.0.0
|
version_added: 2.0.0
|
||||||
author: Vladimir Botka (@vbotka)
|
author: Vladimir Botka (@vbotka)
|
||||||
description:
|
description:
|
||||||
- Merge two or more lists by attribute O(index). Optional parameters O(recursive) and O(list_merge)
|
- Merge two or more lists by attribute I(index). Optional parameters 'recursive' and 'list_merge'
|
||||||
control the merging of the lists in values. The function merge_hash from ansible.utils.vars
|
control the merging of the lists in values. The function merge_hash from ansible.utils.vars
|
||||||
is used. To learn details on how to use the parameters O(recursive) and O(list_merge) see
|
is used. To learn details on how to use the parameters 'recursive' and 'list_merge' see
|
||||||
Ansible User's Guide chapter "Using filters to manipulate data" section "Combining
|
Ansible User's Guide chapter "Using filters to manipulate data" section "Combining
|
||||||
hashes/dictionaries".
|
hashes/dictionaries".
|
||||||
positional: another_list, index
|
positional: another_list, index
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
unit:
|
unit:
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ DOCUMENTATION:
|
|||||||
_input:
|
_input:
|
||||||
description:
|
description:
|
||||||
- The time string to convert.
|
- The time string to convert.
|
||||||
- Can use the units V(y) and V(year) for a year, V(mo) and V(month) for a month, V(w) and V(week) for a week,
|
- Can use the units C(y) and C(year) for a year, C(mo) and C(month) for a month, C(w) and C(week) for a week,
|
||||||
V(d) and V(day) for a day, V(h) and V(hour) for a hour, V(m), V(min) and V(minute) for minutes, V(s), V(sec)
|
C(d) and C(day) for a day, C(h) and C(hour) for a hour, C(m), C(min) and C(minute) for minutes, C(s), C(sec)
|
||||||
and V(second) for seconds, V(ms), V(msec), V(msecond) and V(millisecond) for milliseconds. The suffix V(s)
|
and C(second) for seconds, C(ms), C(msec), C(msecond) and C(millisecond) for milliseconds. The suffix C(s)
|
||||||
can be added to a unit as well, so V(seconds) is the same as V(second).
|
can be added to a unit as well, so C(seconds) is the same as C(second).
|
||||||
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
- Valid strings are space separated combinations of an integer with an optional minus sign and a unit.
|
||||||
- Examples are V(1h), V(-5m), and V(3h -5m 6s).
|
- Examples are C(1h), C(-5m), and C(3h -5m 6s).
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
year:
|
year:
|
||||||
|
|||||||
@@ -13,14 +13,12 @@ DOCUMENTATION = '''
|
|||||||
version_added: 1.0.0
|
version_added: 1.0.0
|
||||||
description:
|
description:
|
||||||
- Get inventory hosts from the cobbler service.
|
- Get inventory hosts from the cobbler service.
|
||||||
- "Uses a configuration file as an inventory source, it must end in C(.cobbler.yml) or C(.cobbler.yaml) and have a C(plugin: cobbler) entry."
|
- "Uses a configuration file as an inventory source, it must end in C(.cobbler.yml) or C(.cobbler.yaml) and has a C(plugin: cobbler) entry."
|
||||||
- Adds the primary IP addresses to C(cobbler_ipv4_address) and C(cobbler_ipv6_address) host variables if defined in Cobbler. The primary IP address is
|
|
||||||
defined as the management interface if defined, or the interface who's DNS name matches the hostname of the system, or else the first interface found.
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- inventory_cache
|
- inventory_cache
|
||||||
options:
|
options:
|
||||||
plugin:
|
plugin:
|
||||||
description: The name of this plugin, it should always be set to V(community.general.cobbler) for this plugin to recognize it as it's own.
|
description: The name of this plugin, it should always be set to C(community.general.cobbler) for this plugin to recognize it as it's own.
|
||||||
required: true
|
required: true
|
||||||
choices: [ 'cobbler', 'community.general.cobbler' ]
|
choices: [ 'cobbler', 'community.general.cobbler' ]
|
||||||
url:
|
url:
|
||||||
@@ -34,73 +32,45 @@ DOCUMENTATION = '''
|
|||||||
env:
|
env:
|
||||||
- name: COBBLER_USER
|
- name: COBBLER_USER
|
||||||
password:
|
password:
|
||||||
description: Cobbler authentication password.
|
description: Cobbler authentication password
|
||||||
required: false
|
required: false
|
||||||
env:
|
env:
|
||||||
- name: COBBLER_PASSWORD
|
- name: COBBLER_PASSWORD
|
||||||
cache_fallback:
|
cache_fallback:
|
||||||
description: Fallback to cached results if connection to cobbler fails.
|
description: Fallback to cached results if connection to cobbler fails
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
exclude_mgmt_classes:
|
|
||||||
description: Management classes to exclude from inventory.
|
|
||||||
type: list
|
|
||||||
default: []
|
|
||||||
elements: str
|
|
||||||
version_added: 7.4.0
|
|
||||||
exclude_profiles:
|
exclude_profiles:
|
||||||
description:
|
description:
|
||||||
- Profiles to exclude from inventory.
|
- Profiles to exclude from inventory.
|
||||||
- Ignored if O(include_profiles) is specified.
|
- Ignored if I(include_profiles) is specified.
|
||||||
type: list
|
type: list
|
||||||
default: []
|
default: []
|
||||||
elements: str
|
elements: str
|
||||||
include_mgmt_classes:
|
|
||||||
description: Management classes to include from inventory.
|
|
||||||
type: list
|
|
||||||
default: []
|
|
||||||
elements: str
|
|
||||||
version_added: 7.4.0
|
|
||||||
include_profiles:
|
include_profiles:
|
||||||
description:
|
description:
|
||||||
- Profiles to include from inventory.
|
- Profiles to include from inventory.
|
||||||
- If specified, all other profiles will be excluded.
|
- If specified, all other profiles will be excluded.
|
||||||
- O(exclude_profiles) is ignored if O(include_profiles) is specified.
|
- I(exclude_profiles) is ignored if I(include_profiles) is specified.
|
||||||
type: list
|
type: list
|
||||||
default: []
|
default: []
|
||||||
elements: str
|
elements: str
|
||||||
version_added: 4.4.0
|
version_added: 4.4.0
|
||||||
inventory_hostname:
|
|
||||||
description:
|
|
||||||
- What to use for the ansible inventory hostname.
|
|
||||||
- By default the networking hostname is used if defined, otherwise the DNS name of the management or first non-static interface.
|
|
||||||
- If set to V(system), the cobbler system name is used.
|
|
||||||
type: str
|
|
||||||
choices: [ 'hostname', 'system' ]
|
|
||||||
default: hostname
|
|
||||||
version_added: 7.1.0
|
|
||||||
group_by:
|
group_by:
|
||||||
description: Keys to group hosts by.
|
description: Keys to group hosts by
|
||||||
type: list
|
type: list
|
||||||
elements: string
|
elements: string
|
||||||
default: [ 'mgmt_classes', 'owners', 'status' ]
|
default: [ 'mgmt_classes', 'owners', 'status' ]
|
||||||
group:
|
group:
|
||||||
description: Group to place all hosts into.
|
description: Group to place all hosts into
|
||||||
default: cobbler
|
default: cobbler
|
||||||
group_prefix:
|
group_prefix:
|
||||||
description: Prefix to apply to cobbler groups.
|
description: Prefix to apply to cobbler groups
|
||||||
default: cobbler_
|
default: cobbler_
|
||||||
want_facts:
|
want_facts:
|
||||||
description: Toggle, if V(true) the plugin will retrieve host facts from the server.
|
description: Toggle, if C(true) the plugin will retrieve host facts from the server
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
want_ip_addresses:
|
|
||||||
description:
|
|
||||||
- Toggle, if V(true) the plugin will add a C(cobbler_ipv4_addresses) and C(cobbleer_ipv6_addresses) dictionary to the defined O(group) mapping
|
|
||||||
interface DNS names to IP addresses.
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
version_added: 7.1.0
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@@ -115,8 +85,8 @@ import socket
|
|||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils.common.text.converters import to_text
|
from ansible.module_utils.common.text.converters import to_text
|
||||||
|
from ansible.module_utils.six import iteritems
|
||||||
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable, to_safe_group_name
|
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable, to_safe_group_name
|
||||||
from ansible.module_utils.six import text_type
|
|
||||||
|
|
||||||
# xmlrpc
|
# xmlrpc
|
||||||
try:
|
try:
|
||||||
@@ -158,7 +128,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
|
|||||||
self.connection = xmlrpc_client.Server(self.cobbler_url, allow_none=True)
|
self.connection = xmlrpc_client.Server(self.cobbler_url, allow_none=True)
|
||||||
self.token = None
|
self.token = None
|
||||||
if self.get_option('user') is not None:
|
if self.get_option('user') is not None:
|
||||||
self.token = self.connection.login(text_type(self.get_option('user')), text_type(self.get_option('password')))
|
self.token = self.connection.login(self.get_option('user'), self.get_option('password'))
|
||||||
return self.connection
|
return self.connection
|
||||||
|
|
||||||
def _init_cache(self):
|
def _init_cache(self):
|
||||||
@@ -228,12 +198,9 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
|
|||||||
self.cache_key = self.get_cache_key(path)
|
self.cache_key = self.get_cache_key(path)
|
||||||
self.use_cache = cache and self.get_option('cache')
|
self.use_cache = cache and self.get_option('cache')
|
||||||
|
|
||||||
self.exclude_mgmt_classes = self.get_option('exclude_mgmt_classes')
|
|
||||||
self.include_mgmt_classes = self.get_option('include_mgmt_classes')
|
|
||||||
self.exclude_profiles = self.get_option('exclude_profiles')
|
self.exclude_profiles = self.get_option('exclude_profiles')
|
||||||
self.include_profiles = self.get_option('include_profiles')
|
self.include_profiles = self.get_option('include_profiles')
|
||||||
self.group_by = self.get_option('group_by')
|
self.group_by = self.get_option('group_by')
|
||||||
self.inventory_hostname = self.get_option('inventory_hostname')
|
|
||||||
|
|
||||||
for profile in self._get_profiles():
|
for profile in self._get_profiles():
|
||||||
if profile['parent']:
|
if profile['parent']:
|
||||||
@@ -269,30 +236,18 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
|
|||||||
self.inventory.add_group(self.group)
|
self.inventory.add_group(self.group)
|
||||||
self.display.vvvv('Added site group %s\n' % self.group)
|
self.display.vvvv('Added site group %s\n' % self.group)
|
||||||
|
|
||||||
ip_addresses = {}
|
|
||||||
ipv6_addresses = {}
|
|
||||||
for host in self._get_systems():
|
for host in self._get_systems():
|
||||||
# Get the FQDN for the host and add it to the right groups
|
# Get the FQDN for the host and add it to the right groups
|
||||||
if self.inventory_hostname == 'system':
|
|
||||||
hostname = host['name'] # None
|
|
||||||
else:
|
|
||||||
hostname = host['hostname'] # None
|
hostname = host['hostname'] # None
|
||||||
interfaces = host['interfaces']
|
interfaces = host['interfaces']
|
||||||
|
|
||||||
if set(host['mgmt_classes']) & set(self.include_mgmt_classes):
|
|
||||||
self.display.vvvv('Including host %s in mgmt_classes %s\n' % (host['name'], host['mgmt_classes']))
|
|
||||||
else:
|
|
||||||
if self._exclude_profile(host['profile']):
|
if self._exclude_profile(host['profile']):
|
||||||
self.display.vvvv('Excluding host %s in profile %s\n' % (host['name'], host['profile']))
|
self.display.vvvv('Excluding host %s in profile %s\n' % (host['name'], host['profile']))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if set(host['mgmt_classes']) & set(self.exclude_mgmt_classes):
|
|
||||||
self.display.vvvv('Excluding host %s in mgmt_classes %s\n' % (host['name'], host['mgmt_classes']))
|
|
||||||
continue
|
|
||||||
|
|
||||||
# hostname is often empty for non-static IP hosts
|
# hostname is often empty for non-static IP hosts
|
||||||
if hostname == '':
|
if hostname == '':
|
||||||
for iname, ivalue in interfaces.items():
|
for (iname, ivalue) in iteritems(interfaces):
|
||||||
if ivalue['management'] or not ivalue['static']:
|
if ivalue['management'] or not ivalue['static']:
|
||||||
this_dns_name = ivalue.get('dns_name', None)
|
this_dns_name = ivalue.get('dns_name', None)
|
||||||
if this_dns_name is not None and this_dns_name != "":
|
if this_dns_name is not None and this_dns_name != "":
|
||||||
@@ -307,11 +262,8 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
|
|||||||
self.display.vvvv('Added host %s hostname %s\n' % (host['name'], hostname))
|
self.display.vvvv('Added host %s hostname %s\n' % (host['name'], hostname))
|
||||||
|
|
||||||
# Add host to profile group
|
# Add host to profile group
|
||||||
if host['profile'] != '':
|
|
||||||
group_name = self._add_safe_group_name(host['profile'], child=hostname)
|
group_name = self._add_safe_group_name(host['profile'], child=hostname)
|
||||||
self.display.vvvv('Added host %s to profile group %s\n' % (hostname, group_name))
|
self.display.vvvv('Added host %s to profile group %s\n' % (hostname, group_name))
|
||||||
else:
|
|
||||||
self.display.warning('Host %s has an empty profile\n' % (hostname))
|
|
||||||
|
|
||||||
# Add host to groups specified by group_by fields
|
# Add host to groups specified by group_by fields
|
||||||
for group_by in self.group_by:
|
for group_by in self.group_by:
|
||||||
@@ -328,51 +280,8 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
|
|||||||
self.inventory.add_child(self.group, hostname)
|
self.inventory.add_child(self.group, hostname)
|
||||||
|
|
||||||
# Add host variables
|
# Add host variables
|
||||||
ip_address = None
|
|
||||||
ip_address_first = None
|
|
||||||
ipv6_address = None
|
|
||||||
ipv6_address_first = None
|
|
||||||
for iname, ivalue in interfaces.items():
|
|
||||||
# Set to first interface or management interface if defined or hostname matches dns_name
|
|
||||||
if ivalue['ip_address'] != "":
|
|
||||||
if ip_address_first is None:
|
|
||||||
ip_address_first = ivalue['ip_address']
|
|
||||||
if ivalue['management']:
|
|
||||||
ip_address = ivalue['ip_address']
|
|
||||||
elif ivalue['dns_name'] == hostname and ip_address is None:
|
|
||||||
ip_address = ivalue['ip_address']
|
|
||||||
if ivalue['ipv6_address'] != "":
|
|
||||||
if ipv6_address_first is None:
|
|
||||||
ipv6_address_first = ivalue['ipv6_address']
|
|
||||||
if ivalue['management']:
|
|
||||||
ipv6_address = ivalue['ipv6_address']
|
|
||||||
elif ivalue['dns_name'] == hostname and ipv6_address is None:
|
|
||||||
ipv6_address = ivalue['ipv6_address']
|
|
||||||
|
|
||||||
# Collect all interface name mappings for adding to group vars
|
|
||||||
if self.get_option('want_ip_addresses'):
|
|
||||||
if ivalue['dns_name'] != "":
|
|
||||||
if ivalue['ip_address'] != "":
|
|
||||||
ip_addresses[ivalue['dns_name']] = ivalue['ip_address']
|
|
||||||
if ivalue['ipv6_address'] != "":
|
|
||||||
ip_addresses[ivalue['dns_name']] = ivalue['ipv6_address']
|
|
||||||
|
|
||||||
# Add ip_address to host if defined, use first if no management or matched dns_name
|
|
||||||
if ip_address is None and ip_address_first is not None:
|
|
||||||
ip_address = ip_address_first
|
|
||||||
if ip_address is not None:
|
|
||||||
self.inventory.set_variable(hostname, 'cobbler_ipv4_address', ip_address)
|
|
||||||
if ipv6_address is None and ipv6_address_first is not None:
|
|
||||||
ipv6_address = ipv6_address_first
|
|
||||||
if ipv6_address is not None:
|
|
||||||
self.inventory.set_variable(hostname, 'cobbler_ipv6_address', ipv6_address)
|
|
||||||
|
|
||||||
if self.get_option('want_facts'):
|
if self.get_option('want_facts'):
|
||||||
try:
|
try:
|
||||||
self.inventory.set_variable(hostname, 'cobbler', host)
|
self.inventory.set_variable(hostname, 'cobbler', host)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.display.warning("Could not set host info for %s: %s" % (hostname, to_text(e)))
|
self.display.warning("Could not set host info for %s: %s" % (hostname, to_text(e)))
|
||||||
|
|
||||||
if self.get_option('want_ip_addresses'):
|
|
||||||
self.inventory.set_variable(self.group, 'cobbler_ipv4_addresses', ip_addresses)
|
|
||||||
self.inventory.set_variable(self.group, 'cobbler_ipv6_addresses', ipv6_addresses)
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ DOCUMENTATION = '''
|
|||||||
description:
|
description:
|
||||||
- Allows the override of the inventory name based on different attributes.
|
- Allows the override of the inventory name based on different attributes.
|
||||||
- This allows for changing the way limits are used.
|
- This allows for changing the way limits are used.
|
||||||
- The current default, V(address), is sometimes not unique or present. We recommend to use V(name) instead.
|
- The current default, C(address), is sometimes not unique or present. We recommend to use C(name) instead.
|
||||||
type: string
|
type: string
|
||||||
default: address
|
default: address
|
||||||
choices: ['name', 'display_name', 'address']
|
choices: ['name', 'display_name', 'address']
|
||||||
|
|||||||
@@ -121,8 +121,11 @@ compose:
|
|||||||
ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first"
|
ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
|
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
|
||||||
|
from ansible.template import Templar
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -141,14 +144,22 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
def _build_client(self, loader):
|
def _build_client(self, loader):
|
||||||
"""Build the Linode client."""
|
"""Build the Linode client."""
|
||||||
|
|
||||||
|
t = Templar(loader=loader)
|
||||||
|
|
||||||
access_token = self.get_option('access_token')
|
access_token = self.get_option('access_token')
|
||||||
if self.templar.is_template(access_token):
|
if t.is_template(access_token):
|
||||||
access_token = self.templar.template(variable=access_token, disable_lookups=False)
|
access_token = t.template(variable=access_token, disable_lookups=False)
|
||||||
|
|
||||||
|
if access_token is None:
|
||||||
|
try:
|
||||||
|
access_token = os.environ['LINODE_ACCESS_TOKEN']
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
if access_token is None:
|
if access_token is None:
|
||||||
raise AnsibleError((
|
raise AnsibleError((
|
||||||
'Could not retrieve Linode access token '
|
'Could not retrieve Linode access token '
|
||||||
'from plugin configuration sources'
|
'from plugin configuration or environment'
|
||||||
))
|
))
|
||||||
|
|
||||||
self.client = LinodeClient(access_token)
|
self.client = LinodeClient(access_token)
|
||||||
|
|||||||
@@ -47,22 +47,17 @@ DOCUMENTATION = r'''
|
|||||||
- You need to set this password on the lxd server before
|
- You need to set this password on the lxd server before
|
||||||
running this module using the following command
|
running this module using the following command
|
||||||
C(lxc config set core.trust_password <some random password>)
|
C(lxc config set core.trust_password <some random password>)
|
||||||
See U(https://documentation.ubuntu.com/lxd/en/latest/authentication/#adding-client-certificates-using-a-trust-password).
|
See U(https://www.stgraber.org/2016/04/18/lxd-api-direct-interaction/).
|
||||||
- If O(trust_password) is set, this module send a request for authentication before sending any requests.
|
- If I(trust_password) is set, this module send a request for authentication before sending any requests.
|
||||||
type: str
|
type: str
|
||||||
state:
|
state:
|
||||||
description: Filter the instance according to the current status.
|
description: Filter the instance according to the current status.
|
||||||
type: str
|
type: str
|
||||||
default: none
|
default: none
|
||||||
choices: [ 'STOPPED', 'STARTING', 'RUNNING', 'none' ]
|
choices: [ 'STOPPED', 'STARTING', 'RUNNING', 'none' ]
|
||||||
project:
|
|
||||||
description: Filter the instance according to the given project.
|
|
||||||
type: str
|
|
||||||
default: default
|
|
||||||
version_added: 6.2.0
|
|
||||||
type_filter:
|
type_filter:
|
||||||
description:
|
description:
|
||||||
- Filter the instances by type V(virtual-machine), V(container) or V(both).
|
- Filter the instances by type C(virtual-machine), C(container) or C(both).
|
||||||
- The first version of the inventory only supported containers.
|
- The first version of the inventory only supported containers.
|
||||||
type: str
|
type: str
|
||||||
default: container
|
default: container
|
||||||
@@ -72,8 +67,8 @@ DOCUMENTATION = r'''
|
|||||||
description:
|
description:
|
||||||
- If an instance has multiple network interfaces, select which one is the prefered as pattern.
|
- If an instance has multiple network interfaces, select which one is the prefered as pattern.
|
||||||
- Combined with the first number that can be found e.g. 'eth' + 0.
|
- Combined with the first number that can be found e.g. 'eth' + 0.
|
||||||
- The option has been renamed from O(prefered_container_network_interface) to O(prefered_instance_network_interface)
|
- The option has been renamed from I(prefered_container_network_interface) to I(prefered_instance_network_interface) in community.general 3.8.0.
|
||||||
in community.general 3.8.0. The old name still works as an alias.
|
The old name still works as an alias.
|
||||||
type: str
|
type: str
|
||||||
default: eth
|
default: eth
|
||||||
aliases:
|
aliases:
|
||||||
@@ -81,7 +76,7 @@ DOCUMENTATION = r'''
|
|||||||
prefered_instance_network_family:
|
prefered_instance_network_family:
|
||||||
description:
|
description:
|
||||||
- If an instance has multiple network interfaces, which one is the prefered by family.
|
- If an instance has multiple network interfaces, which one is the prefered by family.
|
||||||
- Specify V(inet) for IPv4 and V(inet6) for IPv6.
|
- Specify C(inet) for IPv4 and C(inet6) for IPv6.
|
||||||
type: str
|
type: str
|
||||||
default: inet
|
default: inet
|
||||||
choices: [ 'inet', 'inet6' ]
|
choices: [ 'inet', 'inet6' ]
|
||||||
@@ -145,9 +140,6 @@ groupby:
|
|||||||
vlan666:
|
vlan666:
|
||||||
type: vlanid
|
type: vlanid
|
||||||
attribute: 666
|
attribute: 666
|
||||||
projectInternals:
|
|
||||||
type: project
|
|
||||||
attribute: internals
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@@ -159,7 +151,6 @@ from ansible.module_utils.common.text.converters import to_native, to_text
|
|||||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||||
from ansible.module_utils.six import raise_from
|
from ansible.module_utils.six import raise_from
|
||||||
from ansible.errors import AnsibleError, AnsibleParserError
|
from ansible.errors import AnsibleError, AnsibleParserError
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.lxd import LXDClient, LXDClientException
|
from ansible_collections.community.general.plugins.module_utils.lxd import LXDClient, LXDClientException
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -337,15 +328,7 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
# "status_code": 200,
|
# "status_code": 200,
|
||||||
# "type": "sync"
|
# "type": "sync"
|
||||||
# }
|
# }
|
||||||
url = '/1.0/instances'
|
instances = self.socket.do('GET', '/1.0/instances')
|
||||||
if self.project:
|
|
||||||
url = url + '?{0}'.format(urlencode(dict(project=self.project)))
|
|
||||||
|
|
||||||
instances = self.socket.do('GET', url)
|
|
||||||
|
|
||||||
if self.project:
|
|
||||||
return [m.split('/')[3].split('?')[0] for m in instances['metadata']]
|
|
||||||
|
|
||||||
return [m.split('/')[3] for m in instances['metadata']]
|
return [m.split('/')[3] for m in instances['metadata']]
|
||||||
|
|
||||||
def _get_config(self, branch, name):
|
def _get_config(self, branch, name):
|
||||||
@@ -359,18 +342,16 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
Kwargs:
|
Kwargs:
|
||||||
None
|
None
|
||||||
Source:
|
Source:
|
||||||
https://documentation.ubuntu.com/lxd/en/latest/rest-api/
|
https://github.com/lxc/lxd/blob/master/doc/rest-api.md
|
||||||
Raises:
|
Raises:
|
||||||
None
|
None
|
||||||
Returns:
|
Returns:
|
||||||
dict(config): Config of the instance"""
|
dict(config): Config of the instance"""
|
||||||
config = {}
|
config = {}
|
||||||
if isinstance(branch, (tuple, list)):
|
if isinstance(branch, (tuple, list)):
|
||||||
config[name] = {branch[1]: self.socket.do(
|
config[name] = {branch[1]: self.socket.do('GET', '/1.0/{0}/{1}/{2}'.format(to_native(branch[0]), to_native(name), to_native(branch[1])))}
|
||||||
'GET', '/1.0/{0}/{1}/{2}?{3}'.format(to_native(branch[0]), to_native(name), to_native(branch[1]), urlencode(dict(project=self.project))))}
|
|
||||||
else:
|
else:
|
||||||
config[name] = {branch: self.socket.do(
|
config[name] = {branch: self.socket.do('GET', '/1.0/{0}/{1}'.format(to_native(branch), to_native(name)))}
|
||||||
'GET', '/1.0/{0}/{1}?{2}'.format(to_native(branch), to_native(name), urlencode(dict(project=self.project))))}
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def get_instance_data(self, names):
|
def get_instance_data(self, names):
|
||||||
@@ -600,8 +581,6 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
self._set_data_entry(instance_name, 'network_interfaces', self.extract_network_information_from_instance_config(instance_name))
|
self._set_data_entry(instance_name, 'network_interfaces', self.extract_network_information_from_instance_config(instance_name))
|
||||||
self._set_data_entry(instance_name, 'preferred_interface', self.get_prefered_instance_network_interface(instance_name))
|
self._set_data_entry(instance_name, 'preferred_interface', self.get_prefered_instance_network_interface(instance_name))
|
||||||
self._set_data_entry(instance_name, 'vlan_ids', self.get_instance_vlans(instance_name))
|
self._set_data_entry(instance_name, 'vlan_ids', self.get_instance_vlans(instance_name))
|
||||||
self._set_data_entry(instance_name, 'project', self._get_data_entry(
|
|
||||||
'instances/{0}/instances/metadata/project'.format(instance_name)))
|
|
||||||
|
|
||||||
def build_inventory_network(self, instance_name):
|
def build_inventory_network(self, instance_name):
|
||||||
"""Add the network interfaces of the instance to the inventory
|
"""Add the network interfaces of the instance to the inventory
|
||||||
@@ -705,8 +684,6 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
# add VLAN_ID information
|
# add VLAN_ID information
|
||||||
if self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name)):
|
if self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name)):
|
||||||
self.inventory.set_variable(instance_name, 'ansible_lxd_vlan_ids', self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name)))
|
self.inventory.set_variable(instance_name, 'ansible_lxd_vlan_ids', self._get_data_entry('inventory/{0}/vlan_ids'.format(instance_name)))
|
||||||
# add project
|
|
||||||
self.inventory.set_variable(instance_name, 'ansible_lxd_project', self._get_data_entry('inventory/{0}/project'.format(instance_name)))
|
|
||||||
|
|
||||||
def build_inventory_groups_location(self, group_name):
|
def build_inventory_groups_location(self, group_name):
|
||||||
"""create group by attribute: location
|
"""create group by attribute: location
|
||||||
@@ -782,28 +759,6 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
# Ignore invalid IP addresses returned by lxd
|
# Ignore invalid IP addresses returned by lxd
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def build_inventory_groups_project(self, group_name):
|
|
||||||
"""create group by attribute: project
|
|
||||||
|
|
||||||
Args:
|
|
||||||
str(group_name): Group name
|
|
||||||
Kwargs:
|
|
||||||
None
|
|
||||||
Raises:
|
|
||||||
None
|
|
||||||
Returns:
|
|
||||||
None"""
|
|
||||||
# maybe we just want to expand one group
|
|
||||||
if group_name not in self.inventory.groups:
|
|
||||||
self.inventory.add_group(group_name)
|
|
||||||
|
|
||||||
gen_instances = [
|
|
||||||
instance_name for instance_name in self.inventory.hosts
|
|
||||||
if 'ansible_lxd_project' in self.inventory.get_host(instance_name).get_vars()]
|
|
||||||
for instance_name in gen_instances:
|
|
||||||
if self.groupby[group_name].get('attribute').lower() == self.inventory.get_host(instance_name).get_vars().get('ansible_lxd_project'):
|
|
||||||
self.inventory.add_child(group_name, instance_name)
|
|
||||||
|
|
||||||
def build_inventory_groups_os(self, group_name):
|
def build_inventory_groups_os(self, group_name):
|
||||||
"""create group by attribute: os
|
"""create group by attribute: os
|
||||||
|
|
||||||
@@ -942,7 +897,6 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
* 'profile'
|
* 'profile'
|
||||||
* 'vlanid'
|
* 'vlanid'
|
||||||
* 'type'
|
* 'type'
|
||||||
* 'project'
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
str(group_name): Group name
|
str(group_name): Group name
|
||||||
@@ -970,8 +924,6 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
self.build_inventory_groups_vlanid(group_name)
|
self.build_inventory_groups_vlanid(group_name)
|
||||||
elif self.groupby[group_name].get('type') == 'type':
|
elif self.groupby[group_name].get('type') == 'type':
|
||||||
self.build_inventory_groups_type(group_name)
|
self.build_inventory_groups_type(group_name)
|
||||||
elif self.groupby[group_name].get('type') == 'project':
|
|
||||||
self.build_inventory_groups_project(group_name)
|
|
||||||
else:
|
else:
|
||||||
raise AnsibleParserError('Unknown group type: {0}'.format(to_native(group_name)))
|
raise AnsibleParserError('Unknown group type: {0}'.format(to_native(group_name)))
|
||||||
|
|
||||||
@@ -1078,7 +1030,6 @@ class InventoryModule(BaseInventoryPlugin):
|
|||||||
try:
|
try:
|
||||||
self.client_key = self.get_option('client_key')
|
self.client_key = self.get_option('client_key')
|
||||||
self.client_cert = self.get_option('client_cert')
|
self.client_cert = self.get_option('client_cert')
|
||||||
self.project = self.get_option('project')
|
|
||||||
self.debug = self.DEBUG
|
self.debug = self.DEBUG
|
||||||
self.data = {} # store for inventory-data
|
self.data = {} # store for inventory-data
|
||||||
self.groupby = self.get_option('groupby')
|
self.groupby = self.get_option('groupby')
|
||||||
|
|||||||
@@ -23,34 +23,19 @@ DOCUMENTATION = '''
|
|||||||
required: true
|
required: true
|
||||||
choices: ['nmap', 'community.general.nmap']
|
choices: ['nmap', 'community.general.nmap']
|
||||||
sudo:
|
sudo:
|
||||||
description: Set to V(true) to execute a C(sudo nmap) plugin scan.
|
description: Set to C(true) to execute a C(sudo nmap) plugin scan.
|
||||||
version_added: 4.8.0
|
version_added: 4.8.0
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
address:
|
address:
|
||||||
description: Network IP or range of IPs to scan, you can use a simple range (10.2.2.15-25) or CIDR notation.
|
description: Network IP or range of IPs to scan, you can use a simple range (10.2.2.15-25) or CIDR notation.
|
||||||
required: true
|
required: true
|
||||||
env:
|
|
||||||
- name: ANSIBLE_NMAP_ADDRESS
|
|
||||||
version_added: 6.6.0
|
|
||||||
exclude:
|
exclude:
|
||||||
description:
|
description: list of addresses to exclude
|
||||||
- List of addresses to exclude.
|
|
||||||
- For example V(10.2.2.15-25) or V(10.2.2.15,10.2.2.16).
|
|
||||||
type: list
|
type: list
|
||||||
elements: string
|
elements: string
|
||||||
env:
|
|
||||||
- name: ANSIBLE_NMAP_EXCLUDE
|
|
||||||
version_added: 6.6.0
|
|
||||||
port:
|
|
||||||
description:
|
|
||||||
- Only scan specific port or port range (C(-p)).
|
|
||||||
- For example, you could pass V(22) for a single port, V(1-65535) for a range of ports,
|
|
||||||
or V(U:53,137,T:21-25,139,8080,S:9) to check port 53 with UDP, ports 21-25 with TCP, port 9 with SCTP, and ports 137, 139, and 8080 with all.
|
|
||||||
type: string
|
|
||||||
version_added: 6.5.0
|
|
||||||
ports:
|
ports:
|
||||||
description: Enable/disable scanning ports.
|
description: Enable/disable scanning for open ports
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
ipv4:
|
ipv4:
|
||||||
@@ -61,35 +46,6 @@ DOCUMENTATION = '''
|
|||||||
description: use IPv6 type addresses
|
description: use IPv6 type addresses
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
udp_scan:
|
|
||||||
description:
|
|
||||||
- Scan via UDP.
|
|
||||||
- Depending on your system you might need O(sudo=true) for this to work.
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
version_added: 6.1.0
|
|
||||||
icmp_timestamp:
|
|
||||||
description:
|
|
||||||
- Scan via ICMP Timestamp (C(-PP)).
|
|
||||||
- Depending on your system you might need O(sudo=true) for this to work.
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
version_added: 6.1.0
|
|
||||||
open:
|
|
||||||
description: Only scan for open (or possibly open) ports.
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
version_added: 6.5.0
|
|
||||||
dns_resolve:
|
|
||||||
description: Whether to always (V(true)) or never (V(false)) do DNS resolution.
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
version_added: 6.1.0
|
|
||||||
use_arp_ping:
|
|
||||||
description: Whether to always (V(true)) use the quick ARP ping or (V(false)) a slower but more reliable method.
|
|
||||||
type: boolean
|
|
||||||
default: true
|
|
||||||
version_added: 7.4.0
|
|
||||||
notes:
|
notes:
|
||||||
- At least one of ipv4 or ipv6 is required to be True, both can be True, but they cannot both be False.
|
- At least one of ipv4 or ipv6 is required to be True, both can be True, but they cannot both be False.
|
||||||
- 'TODO: add OS fingerprinting'
|
- 'TODO: add OS fingerprinting'
|
||||||
@@ -106,14 +62,6 @@ plugin: community.general.nmap
|
|||||||
sudo: true
|
sudo: true
|
||||||
strict: false
|
strict: false
|
||||||
address: 192.168.0.0/24
|
address: 192.168.0.0/24
|
||||||
|
|
||||||
# an nmap scan specifying ports and classifying results to an inventory group
|
|
||||||
plugin: community.general.nmap
|
|
||||||
address: 192.168.0.0/24
|
|
||||||
exclude: 192.168.0.1, web.example.com
|
|
||||||
port: 22, 443
|
|
||||||
groups:
|
|
||||||
web_servers: "ports | selectattr('port', 'equalto', '443')"
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -201,43 +149,24 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
# setup command
|
# setup command
|
||||||
cmd = [self._nmap]
|
cmd = [self._nmap]
|
||||||
|
|
||||||
if self.get_option('sudo'):
|
if self._options['sudo']:
|
||||||
cmd.insert(0, 'sudo')
|
cmd.insert(0, 'sudo')
|
||||||
|
|
||||||
if self.get_option('port'):
|
if not self._options['ports']:
|
||||||
cmd.append('-p')
|
|
||||||
cmd.append(self.get_option('port'))
|
|
||||||
|
|
||||||
if not self.get_option('ports'):
|
|
||||||
cmd.append('-sP')
|
cmd.append('-sP')
|
||||||
|
|
||||||
if self.get_option('ipv4') and not self.get_option('ipv6'):
|
if self._options['ipv4'] and not self._options['ipv6']:
|
||||||
cmd.append('-4')
|
cmd.append('-4')
|
||||||
elif self.get_option('ipv6') and not self.get_option('ipv4'):
|
elif self._options['ipv6'] and not self._options['ipv4']:
|
||||||
cmd.append('-6')
|
cmd.append('-6')
|
||||||
elif not self.get_option('ipv6') and not self.get_option('ipv4'):
|
elif not self._options['ipv6'] and not self._options['ipv4']:
|
||||||
raise AnsibleParserError('One of ipv4 or ipv6 must be enabled for this plugin')
|
raise AnsibleParserError('One of ipv4 or ipv6 must be enabled for this plugin')
|
||||||
|
|
||||||
if self.get_option('exclude'):
|
if self._options['exclude']:
|
||||||
cmd.append('--exclude')
|
cmd.append('--exclude')
|
||||||
cmd.append(','.join(self.get_option('exclude')))
|
cmd.append(','.join(self._options['exclude']))
|
||||||
|
|
||||||
if self.get_option('dns_resolve'):
|
cmd.append(self._options['address'])
|
||||||
cmd.append('-n')
|
|
||||||
|
|
||||||
if self.get_option('udp_scan'):
|
|
||||||
cmd.append('-sU')
|
|
||||||
|
|
||||||
if self.get_option('icmp_timestamp'):
|
|
||||||
cmd.append('-PP')
|
|
||||||
|
|
||||||
if self.get_option('open'):
|
|
||||||
cmd.append('--open')
|
|
||||||
|
|
||||||
if not self.get_option('use_arp_ping'):
|
|
||||||
cmd.append('--disable-arp-ping')
|
|
||||||
|
|
||||||
cmd.append(self.get_option('address'))
|
|
||||||
try:
|
try:
|
||||||
# execute
|
# execute
|
||||||
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ DOCUMENTATION = r'''
|
|||||||
- constructed
|
- constructed
|
||||||
description:
|
description:
|
||||||
- Get inventory hosts from OpenNebula cloud.
|
- Get inventory hosts from OpenNebula cloud.
|
||||||
- Uses an YAML configuration file ending with either C(opennebula.yml) or C(opennebula.yaml)
|
- Uses an YAML configuration file ending with either I(opennebula.yml) or I(opennebula.yaml)
|
||||||
to set parameter values.
|
to set parameter values.
|
||||||
- Uses O(api_authfile), C(~/.one/one_auth), or E(ONE_AUTH) pointing to a OpenNebula credentials file.
|
- Uses I(api_authfile), C(~/.one/one_auth), or C(ONE_AUTH) pointing to a OpenNebula credentials file.
|
||||||
options:
|
options:
|
||||||
plugin:
|
plugin:
|
||||||
description: Token that ensures this is a source file for the 'opennebula' plugin.
|
description: Token that ensures this is a source file for the 'opennebula' plugin.
|
||||||
@@ -31,7 +31,7 @@ DOCUMENTATION = r'''
|
|||||||
- URL of the OpenNebula RPC server.
|
- URL of the OpenNebula RPC server.
|
||||||
- It is recommended to use HTTPS so that the username/password are not
|
- It is recommended to use HTTPS so that the username/password are not
|
||||||
transferred over the network unencrypted.
|
transferred over the network unencrypted.
|
||||||
- If not set then the value of the E(ONE_URL) environment variable is used.
|
- If not set then the value of the C(ONE_URL) environment variable is used.
|
||||||
env:
|
env:
|
||||||
- name: ONE_URL
|
- name: ONE_URL
|
||||||
required: true
|
required: true
|
||||||
@@ -39,29 +39,29 @@ DOCUMENTATION = r'''
|
|||||||
api_username:
|
api_username:
|
||||||
description:
|
description:
|
||||||
- Name of the user to login into the OpenNebula RPC server. If not set
|
- Name of the user to login into the OpenNebula RPC server. If not set
|
||||||
then the value of the E(ONE_USERNAME) environment variable is used.
|
then the value of the C(ONE_USERNAME) environment variable is used.
|
||||||
env:
|
env:
|
||||||
- name: ONE_USERNAME
|
- name: ONE_USERNAME
|
||||||
type: string
|
type: string
|
||||||
api_password:
|
api_password:
|
||||||
description:
|
description:
|
||||||
- Password or a token of the user to login into OpenNebula RPC server.
|
- Password or a token of the user to login into OpenNebula RPC server.
|
||||||
- If not set, the value of the E(ONE_PASSWORD) environment variable is used.
|
- If not set, the value of the C(ONE_PASSWORD) environment variable is used.
|
||||||
env:
|
env:
|
||||||
- name: ONE_PASSWORD
|
- name: ONE_PASSWORD
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
api_authfile:
|
api_authfile:
|
||||||
description:
|
description:
|
||||||
- If both O(api_username) or O(api_password) are not set, then it will try
|
- If both I(api_username) or I(api_password) are not set, then it will try
|
||||||
authenticate with ONE auth file. Default path is C(~/.one/one_auth).
|
authenticate with ONE auth file. Default path is C(~/.one/one_auth).
|
||||||
- Set environment variable E(ONE_AUTH) to override this path.
|
- Set environment variable C(ONE_AUTH) to override this path.
|
||||||
env:
|
env:
|
||||||
- name: ONE_AUTH
|
- name: ONE_AUTH
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
hostname:
|
hostname:
|
||||||
description: Field to match the hostname. Note V(v4_first_ip) corresponds to the first IPv4 found on VM.
|
description: Field to match the hostname. Note C(v4_first_ip) corresponds to the first IPv4 found on VM.
|
||||||
type: string
|
type: string
|
||||||
default: v4_first_ip
|
default: v4_first_ip
|
||||||
choices:
|
choices:
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ DOCUMENTATION = '''
|
|||||||
- inventory_cache
|
- inventory_cache
|
||||||
options:
|
options:
|
||||||
plugin:
|
plugin:
|
||||||
description: The name of this plugin, it should always be set to V(community.general.proxmox) for this plugin to recognize it as it's own.
|
description: The name of this plugin, it should always be set to C(community.general.proxmox) for this plugin to recognize it as it's own.
|
||||||
required: true
|
required: true
|
||||||
choices: ['community.general.proxmox']
|
choices: ['community.general.proxmox']
|
||||||
type: str
|
type: str
|
||||||
url:
|
url:
|
||||||
description:
|
description:
|
||||||
- URL to Proxmox cluster.
|
- URL to Proxmox cluster.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_URL) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_URL) will be used instead.
|
||||||
- Since community.general 4.7.0 you can also use templating to specify the value of the O(url).
|
- Since community.general 4.7.0 you can also use templating to specify the value of the I(url).
|
||||||
default: 'http://localhost:8006'
|
default: 'http://localhost:8006'
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
@@ -42,8 +42,8 @@ DOCUMENTATION = '''
|
|||||||
user:
|
user:
|
||||||
description:
|
description:
|
||||||
- Proxmox authentication user.
|
- Proxmox authentication user.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_USER) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_USER) will be used instead.
|
||||||
- Since community.general 4.7.0 you can also use templating to specify the value of the O(user).
|
- Since community.general 4.7.0 you can also use templating to specify the value of the I(user).
|
||||||
required: true
|
required: true
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
@@ -52,9 +52,9 @@ DOCUMENTATION = '''
|
|||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- Proxmox authentication password.
|
- Proxmox authentication password.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_PASSWORD) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_PASSWORD) will be used instead.
|
||||||
- Since community.general 4.7.0 you can also use templating to specify the value of the O(password).
|
- Since community.general 4.7.0 you can also use templating to specify the value of the I(password).
|
||||||
- If you do not specify a password, you must set O(token_id) and O(token_secret) instead.
|
- If you do not specify a password, you must set I(token_id) and I(token_secret) instead.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: PROXMOX_PASSWORD
|
- name: PROXMOX_PASSWORD
|
||||||
@@ -62,8 +62,8 @@ DOCUMENTATION = '''
|
|||||||
token_id:
|
token_id:
|
||||||
description:
|
description:
|
||||||
- Proxmox authentication token ID.
|
- Proxmox authentication token ID.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_TOKEN_ID) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_TOKEN_ID) will be used instead.
|
||||||
- To use token authentication, you must also specify O(token_secret). If you do not specify O(token_id) and O(token_secret),
|
- To use token authentication, you must also specify I(token_secret). If you do not specify I(token_id) and I(token_secret),
|
||||||
you must set a password instead.
|
you must set a password instead.
|
||||||
- Make sure to grant explicit pve permissions to the token or disable 'privilege separation' to use the users' privileges instead.
|
- Make sure to grant explicit pve permissions to the token or disable 'privilege separation' to use the users' privileges instead.
|
||||||
version_added: 4.8.0
|
version_added: 4.8.0
|
||||||
@@ -73,8 +73,8 @@ DOCUMENTATION = '''
|
|||||||
token_secret:
|
token_secret:
|
||||||
description:
|
description:
|
||||||
- Proxmox authentication token secret.
|
- Proxmox authentication token secret.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(PROXMOX_TOKEN_SECRET) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(PROXMOX_TOKEN_SECRET) will be used instead.
|
||||||
- To use token authentication, you must also specify O(token_id). If you do not specify O(token_id) and O(token_secret),
|
- To use token authentication, you must also specify I(token_id). If you do not specify I(token_id) and I(token_secret),
|
||||||
you must set a password instead.
|
you must set a password instead.
|
||||||
version_added: 4.8.0
|
version_added: 4.8.0
|
||||||
type: str
|
type: str
|
||||||
@@ -95,27 +95,28 @@ DOCUMENTATION = '''
|
|||||||
want_facts:
|
want_facts:
|
||||||
description:
|
description:
|
||||||
- Gather LXC/QEMU configuration facts.
|
- Gather LXC/QEMU configuration facts.
|
||||||
- When O(want_facts) is set to V(true) more details about QEMU VM status are possible, besides the running and stopped states.
|
- When I(want_facts) is set to C(true) more details about QEMU VM status are possible, besides the running and stopped states.
|
||||||
Currently if the VM is running and it is suspended, the status will be running and the machine will be in C(running) group,
|
Currently if the VM is running and it is suspended, the status will be running and the machine will be in C(running) group,
|
||||||
but its actual state will be paused. See O(qemu_extended_statuses) for how to retrieve the real status.
|
but its actual state will be paused. See I(qemu_extended_statuses) for how to retrieve the real status.
|
||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
qemu_extended_statuses:
|
qemu_extended_statuses:
|
||||||
description:
|
description:
|
||||||
- Requires O(want_facts) to be set to V(true) to function. This will allow you to differentiate betweend C(paused) and C(prelaunch)
|
- Requires I(want_facts) to be set to C(true) to function. This will allow you to differentiate betweend C(paused) and C(prelaunch)
|
||||||
statuses of the QEMU VMs.
|
statuses of the QEMU VMs.
|
||||||
- This introduces multiple groups [prefixed with O(group_prefix)] C(prelaunch) and C(paused).
|
- This introduces multiple groups [prefixed with I(group_prefix)] C(prelaunch) and C(paused).
|
||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
version_added: 5.1.0
|
version_added: 5.1.0
|
||||||
want_proxmox_nodes_ansible_host:
|
want_proxmox_nodes_ansible_host:
|
||||||
version_added: 3.0.0
|
version_added: 3.0.0
|
||||||
description:
|
description:
|
||||||
- Whether to set C(ansible_host) for proxmox nodes.
|
- Whether to set C(ansbile_host) for proxmox nodes.
|
||||||
- When set to V(true) (default), will use the first available interface. This can be different from what you expect.
|
- When set to C(true) (default), will use the first available interface. This can be different from what you expect.
|
||||||
- The default of this option changed from V(true) to V(false) in community.general 6.0.0.
|
- This currently defaults to C(true), but the default is deprecated since community.general 4.8.0.
|
||||||
|
The default will change to C(false) in community.general 6.0.0. To avoid a deprecation warning, please
|
||||||
|
set this parameter explicitly.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
|
||||||
filters:
|
filters:
|
||||||
version_added: 4.6.0
|
version_added: 4.6.0
|
||||||
description: A list of Jinja templates that allow filtering hosts.
|
description: A list of Jinja templates that allow filtering hosts.
|
||||||
@@ -222,6 +223,7 @@ from ansible.module_utils.common.text.converters import to_native
|
|||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
from ansible.template import Templar
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
|
||||||
|
|
||||||
@@ -277,11 +279,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
credentials = urlencode({'username': self.proxmox_user, 'password': self.proxmox_password, })
|
credentials = urlencode({'username': self.proxmox_user, 'password': self.proxmox_password, })
|
||||||
|
|
||||||
a = self._get_session()
|
a = self._get_session()
|
||||||
|
|
||||||
if a.verify is False:
|
|
||||||
from requests.packages.urllib3 import disable_warnings
|
|
||||||
disable_warnings()
|
|
||||||
|
|
||||||
ret = a.post('%s/api2/json/access/ticket' % self.proxmox_url, data=credentials)
|
ret = a.post('%s/api2/json/access/ticket' % self.proxmox_url, data=credentials)
|
||||||
|
|
||||||
json = ret.json()
|
json = ret.json()
|
||||||
@@ -570,6 +567,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
self.inventory.add_group(nodes_group)
|
self.inventory.add_group(nodes_group)
|
||||||
|
|
||||||
want_proxmox_nodes_ansible_host = self.get_option("want_proxmox_nodes_ansible_host")
|
want_proxmox_nodes_ansible_host = self.get_option("want_proxmox_nodes_ansible_host")
|
||||||
|
if want_proxmox_nodes_ansible_host is None:
|
||||||
|
display.deprecated(
|
||||||
|
'The want_proxmox_nodes_ansible_host option of the community.general.proxmox inventory plugin'
|
||||||
|
' currently defaults to `true`, but this default has been deprecated and will change to `false`'
|
||||||
|
' in community.general 6.0.0. To keep the current behavior and remove this deprecation warning,'
|
||||||
|
' explicitly set `want_proxmox_nodes_ansible_host` to `true` in your inventory configuration',
|
||||||
|
version='6.0.0', collection_name='community.general')
|
||||||
|
want_proxmox_nodes_ansible_host = True
|
||||||
|
|
||||||
# gather vm's on nodes
|
# gather vm's on nodes
|
||||||
self._get_auth()
|
self._get_auth()
|
||||||
@@ -590,10 +595,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
ip = self._get_node_ip(node['node'])
|
ip = self._get_node_ip(node['node'])
|
||||||
self.inventory.set_variable(node['node'], 'ansible_host', ip)
|
self.inventory.set_variable(node['node'], 'ansible_host', ip)
|
||||||
|
|
||||||
# Setting composite variables
|
|
||||||
variables = self.inventory.get_host(node['node']).get_vars()
|
|
||||||
self._set_composite_vars(self.get_option('compose'), variables, node['node'], strict=self.strict)
|
|
||||||
|
|
||||||
# add LXC/Qemu groups for the node
|
# add LXC/Qemu groups for the node
|
||||||
for ittype in ('lxc', 'qemu'):
|
for ittype in ('lxc', 'qemu'):
|
||||||
node_type_group = self._group('%s_%s' % (node['node'], ittype))
|
node_type_group = self._group('%s_%s' % (node['node'], ittype))
|
||||||
@@ -620,23 +621,40 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
# read config from file, this sets 'options'
|
# read config from file, this sets 'options'
|
||||||
self._read_config_data(path)
|
self._read_config_data(path)
|
||||||
|
|
||||||
# read and template auth options
|
t = Templar(loader=loader)
|
||||||
for o in ('url', 'user', 'password', 'token_id', 'token_secret'):
|
|
||||||
v = self.get_option(o)
|
|
||||||
if self.templar.is_template(v):
|
|
||||||
v = self.templar.template(v, disable_lookups=False)
|
|
||||||
setattr(self, 'proxmox_%s' % o, v)
|
|
||||||
|
|
||||||
# some more cleanup and validation
|
# read options
|
||||||
self.proxmox_url = self.proxmox_url.rstrip('/')
|
proxmox_url = self.get_option('url')
|
||||||
|
if t.is_template(proxmox_url):
|
||||||
|
proxmox_url = t.template(variable=proxmox_url, disable_lookups=False)
|
||||||
|
self.proxmox_url = proxmox_url.rstrip('/')
|
||||||
|
|
||||||
if self.proxmox_password is None and (self.proxmox_token_id is None or self.proxmox_token_secret is None):
|
proxmox_user = self.get_option('user')
|
||||||
|
if t.is_template(proxmox_user):
|
||||||
|
proxmox_user = t.template(variable=proxmox_user, disable_lookups=False)
|
||||||
|
self.proxmox_user = proxmox_user
|
||||||
|
|
||||||
|
proxmox_password = self.get_option('password')
|
||||||
|
if t.is_template(proxmox_password):
|
||||||
|
proxmox_password = t.template(variable=proxmox_password, disable_lookups=False)
|
||||||
|
self.proxmox_password = proxmox_password
|
||||||
|
|
||||||
|
proxmox_token_id = self.get_option('token_id')
|
||||||
|
if t.is_template(proxmox_token_id):
|
||||||
|
proxmox_token_id = t.template(variable=proxmox_token_id, disable_lookups=False)
|
||||||
|
self.proxmox_token_id = proxmox_token_id
|
||||||
|
|
||||||
|
proxmox_token_secret = self.get_option('token_secret')
|
||||||
|
if t.is_template(proxmox_token_secret):
|
||||||
|
proxmox_token_secret = t.template(variable=proxmox_token_secret, disable_lookups=False)
|
||||||
|
self.proxmox_token_secret = proxmox_token_secret
|
||||||
|
|
||||||
|
if proxmox_password is None and (proxmox_token_id is None or proxmox_token_secret is None):
|
||||||
raise AnsibleError('You must specify either a password or both token_id and token_secret.')
|
raise AnsibleError('You must specify either a password or both token_id and token_secret.')
|
||||||
|
|
||||||
if self.get_option('qemu_extended_statuses') and not self.get_option('want_facts'):
|
if self.get_option('qemu_extended_statuses') and not self.get_option('want_facts'):
|
||||||
raise AnsibleError('You must set want_facts to True if you want to use qemu_extended_statuses.')
|
raise AnsibleError('You must set want_facts to True if you want to use qemu_extended_statuses.')
|
||||||
|
|
||||||
# read rest of options
|
|
||||||
self.cache_key = self.get_cache_key(path)
|
self.cache_key = self.get_cache_key(path)
|
||||||
self.use_cache = cache and self.get_option('cache')
|
self.use_cache = cache and self.get_option('cache')
|
||||||
self.host_filters = self.get_option('filters')
|
self.host_filters = self.get_option('filters')
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ DOCUMENTATION = r'''
|
|||||||
scw_profile:
|
scw_profile:
|
||||||
description:
|
description:
|
||||||
- The config profile to use in config file.
|
- The config profile to use in config file.
|
||||||
- By default uses the one specified as C(active_profile) in the config file, or falls back to V(default) if that is not defined.
|
- By default uses the one specified as C(active_profile) in the config file, or falls back to C(default) if that is not defined.
|
||||||
type: string
|
type: string
|
||||||
version_added: 4.4.0
|
version_added: 4.4.0
|
||||||
oauth_token:
|
oauth_token:
|
||||||
|
|||||||
@@ -23,21 +23,21 @@ DOCUMENTATION = '''
|
|||||||
- inventory_cache
|
- inventory_cache
|
||||||
options:
|
options:
|
||||||
plugin:
|
plugin:
|
||||||
description: The name of this plugin, it should always be set to V(community.general.xen_orchestra) for this plugin to recognize it as its own.
|
description: The name of this plugin, it should always be set to C(community.general.xen_orchestra) for this plugin to recognize it as its own.
|
||||||
required: true
|
required: true
|
||||||
choices: ['community.general.xen_orchestra']
|
choices: ['community.general.xen_orchestra']
|
||||||
type: str
|
type: str
|
||||||
api_host:
|
api_host:
|
||||||
description:
|
description:
|
||||||
- API host to XOA API.
|
- API host to XOA API.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_HOST) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(ANSIBLE_XO_HOST) will be used instead.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_XO_HOST
|
- name: ANSIBLE_XO_HOST
|
||||||
user:
|
user:
|
||||||
description:
|
description:
|
||||||
- Xen Orchestra user.
|
- Xen Orchestra user.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_USER) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(ANSIBLE_XO_USER) will be used instead.
|
||||||
required: true
|
required: true
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
@@ -45,7 +45,7 @@ DOCUMENTATION = '''
|
|||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- Xen Orchestra password.
|
- Xen Orchestra password.
|
||||||
- If the value is not specified in the inventory configuration, the value of environment variable E(ANSIBLE_XO_PASSWORD) will be used instead.
|
- If the value is not specified in the inventory configuration, the value of environment variable C(ANSIBLE_XO_PASSWORD) will be used instead.
|
||||||
required: true
|
required: true
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ DOCUMENTATION = """
|
|||||||
requirements:
|
requirements:
|
||||||
- bw (command line utility)
|
- bw (command line utility)
|
||||||
- be logged into bitwarden
|
- be logged into bitwarden
|
||||||
- bitwarden vault unlocked
|
|
||||||
- E(BW_SESSION) environment variable set
|
|
||||||
short_description: Retrieve secrets from Bitwarden
|
short_description: Retrieve secrets from Bitwarden
|
||||||
version_added: 5.4.0
|
version_added: 5.4.0
|
||||||
description:
|
description:
|
||||||
@@ -25,17 +23,13 @@ DOCUMENTATION = """
|
|||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
search:
|
search:
|
||||||
description: Field to retrieve, for example V(name) or V(id).
|
description: Field to retrieve, for example C(name) or C(id).
|
||||||
type: str
|
type: str
|
||||||
default: name
|
default: name
|
||||||
version_added: 5.7.0
|
version_added: 5.7.0
|
||||||
field:
|
field:
|
||||||
description: Field to fetch. Leave unset to fetch whole response.
|
description: Field to fetch; leave unset to fetch whole response.
|
||||||
type: str
|
type: str
|
||||||
collection_id:
|
|
||||||
description: Collection ID to filter results by collection. Leave unset to skip filtering.
|
|
||||||
type: str
|
|
||||||
version_added: 6.3.0
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
@@ -49,20 +43,10 @@ EXAMPLES = """
|
|||||||
msg: >-
|
msg: >-
|
||||||
{{ lookup('community.general.bitwarden', 'bafba515-af11-47e6-abe3-af1200cd18b2', search='id', field='password') }}
|
{{ lookup('community.general.bitwarden', 'bafba515-af11-47e6-abe3-af1200cd18b2', search='id', field='password') }}
|
||||||
|
|
||||||
- name: "Get 'password' from Bitwarden record named 'a_test' from collection"
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: >-
|
|
||||||
{{ lookup('community.general.bitwarden', 'a_test', field='password', collection_id='bafba515-af11-47e6-abe3-af1200cd18b2') }}
|
|
||||||
|
|
||||||
- name: "Get full Bitwarden record named 'a_test'"
|
- name: "Get full Bitwarden record named 'a_test'"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ lookup('community.general.bitwarden', 'a_test') }}
|
{{ lookup('community.general.bitwarden', 'a_test') }}
|
||||||
|
|
||||||
- name: "Get custom field 'api_key' from Bitwarden record named 'a_test'"
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: >-
|
|
||||||
{{ lookup('community.general.bitwarden', 'a_test', field='api_key') }}
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
@@ -107,17 +91,10 @@ class Bitwarden(object):
|
|||||||
raise BitwardenException(err)
|
raise BitwardenException(err)
|
||||||
return to_text(out, errors='surrogate_or_strict'), to_text(err, errors='surrogate_or_strict')
|
return to_text(out, errors='surrogate_or_strict'), to_text(err, errors='surrogate_or_strict')
|
||||||
|
|
||||||
def _get_matches(self, search_value, search_field, collection_id):
|
def _get_matches(self, search_value, search_field):
|
||||||
"""Return matching records whose search_field is equal to key.
|
"""Return matching records whose search_field is equal to key.
|
||||||
"""
|
"""
|
||||||
|
out, err = self._run(['list', 'items', '--search', search_value])
|
||||||
# Prepare set of params for Bitwarden CLI
|
|
||||||
params = ['list', 'items', '--search', search_value]
|
|
||||||
|
|
||||||
if collection_id:
|
|
||||||
params.extend(['--collectionid', collection_id])
|
|
||||||
|
|
||||||
out, err = self._run(params)
|
|
||||||
|
|
||||||
# This includes things that matched in different fields.
|
# This includes things that matched in different fields.
|
||||||
initial_matches = AnsibleJSONDecoder().raw_decode(out)[0]
|
initial_matches = AnsibleJSONDecoder().raw_decode(out)[0]
|
||||||
@@ -125,36 +102,17 @@ class Bitwarden(object):
|
|||||||
# Filter to only include results from the right field.
|
# Filter to only include results from the right field.
|
||||||
return [item for item in initial_matches if item[search_field] == search_value]
|
return [item for item in initial_matches if item[search_field] == search_value]
|
||||||
|
|
||||||
def get_field(self, field, search_value, search_field="name", collection_id=None):
|
def get_field(self, field, search_value, search_field="name"):
|
||||||
"""Return a list of the specified field for records whose search_field match search_value
|
"""Return a list of the specified field for records whose search_field match search_value.
|
||||||
and filtered by collection if collection has been provided.
|
|
||||||
|
|
||||||
If field is None, return the whole record for each match.
|
If field is None, return the whole record for each match.
|
||||||
"""
|
"""
|
||||||
matches = self._get_matches(search_value, search_field, collection_id)
|
matches = self._get_matches(search_value, search_field)
|
||||||
if not field:
|
|
||||||
|
if field:
|
||||||
|
return [match['login'][field] for match in matches]
|
||||||
|
|
||||||
return matches
|
return matches
|
||||||
field_matches = []
|
|
||||||
for match in matches:
|
|
||||||
# if there are no custom fields, then `match` has no key 'fields'
|
|
||||||
if 'fields' in match:
|
|
||||||
custom_field_found = False
|
|
||||||
for custom_field in match['fields']:
|
|
||||||
if field == custom_field['name']:
|
|
||||||
field_matches.append(custom_field['value'])
|
|
||||||
custom_field_found = True
|
|
||||||
break
|
|
||||||
if custom_field_found:
|
|
||||||
continue
|
|
||||||
if 'login' in match and field in match['login']:
|
|
||||||
field_matches.append(match['login'][field])
|
|
||||||
continue
|
|
||||||
if field in match:
|
|
||||||
field_matches.append(match[field])
|
|
||||||
continue
|
|
||||||
if matches and not field_matches:
|
|
||||||
raise AnsibleError("field {field} does not exist in {search_value}".format(field=field, search_value=search_value))
|
|
||||||
return field_matches
|
|
||||||
|
|
||||||
|
|
||||||
class LookupModule(LookupBase):
|
class LookupModule(LookupBase):
|
||||||
@@ -163,11 +121,10 @@ class LookupModule(LookupBase):
|
|||||||
self.set_options(var_options=variables, direct=kwargs)
|
self.set_options(var_options=variables, direct=kwargs)
|
||||||
field = self.get_option('field')
|
field = self.get_option('field')
|
||||||
search_field = self.get_option('search')
|
search_field = self.get_option('search')
|
||||||
collection_id = self.get_option('collection_id')
|
|
||||||
if not _bitwarden.unlocked:
|
if not _bitwarden.unlocked:
|
||||||
raise AnsibleError("Bitwarden Vault locked. Run 'bw unlock'.")
|
raise AnsibleError("Bitwarden Vault locked. Run 'bw unlock'.")
|
||||||
|
|
||||||
return [_bitwarden.get_field(field, term, search_field, collection_id) for term in terms]
|
return [_bitwarden.get_field(field, term, search_field) for term in terms]
|
||||||
|
|
||||||
|
|
||||||
_bitwarden = Bitwarden()
|
_bitwarden = Bitwarden()
|
||||||
|
|||||||
@@ -1,125 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (c) 2023, jantari (https://github.com/jantari)
|
|
||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = """
|
|
||||||
name: bitwarden_secrets_manager
|
|
||||||
author:
|
|
||||||
- jantari (@jantari)
|
|
||||||
requirements:
|
|
||||||
- bws (command line utility)
|
|
||||||
short_description: Retrieve secrets from Bitwarden Secrets Manager
|
|
||||||
version_added: 7.2.0
|
|
||||||
description:
|
|
||||||
- Retrieve secrets from Bitwarden Secrets Manager.
|
|
||||||
options:
|
|
||||||
_terms:
|
|
||||||
description: Secret ID(s) to fetch values for.
|
|
||||||
required: true
|
|
||||||
type: list
|
|
||||||
elements: str
|
|
||||||
bws_access_token:
|
|
||||||
description: The BWS access token to use for this lookup.
|
|
||||||
env:
|
|
||||||
- name: BWS_ACCESS_TOKEN
|
|
||||||
required: true
|
|
||||||
type: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
EXAMPLES = """
|
|
||||||
- name: Get a secret relying on the BWS_ACCESS_TOKEN environment variable for authentication
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: >-
|
|
||||||
{{ lookup("community.general.bitwarden_secrets_manager", "2bc23e48-4932-40de-a047-5524b7ddc972") }}
|
|
||||||
|
|
||||||
- name: Get a secret passing an explicit access token for authentication
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: >-
|
|
||||||
{{
|
|
||||||
lookup(
|
|
||||||
"community.general.bitwarden_secrets_manager",
|
|
||||||
"2bc23e48-4932-40de-a047-5524b7ddc972",
|
|
||||||
bws_access_token="9.4f570d14-4b54-42f5-bc07-60f4450b1db5.YmluYXJ5LXNvbWV0aGluZy0xMjMK:d2h5IGhlbGxvIHRoZXJlCg=="
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
|
|
||||||
- name: Get two different secrets each using a different access token for authentication
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg:
|
|
||||||
- '{{ lookup("community.general.bitwarden_secrets_manager", "2bc23e48-4932-40de-a047-5524b7ddc972", bws_access_token=token1) }}'
|
|
||||||
- '{{ lookup("community.general.bitwarden_secrets_manager", "9d89af4c-eb5d-41f5-bb0f-4ae81215c768", bws_access_token=token2) }}'
|
|
||||||
vars:
|
|
||||||
token1: "9.4f570d14-4b54-42f5-bc07-60f4450b1db5.YmluYXJ5LXNvbWV0aGluZy0xMjMK:d2h5IGhlbGxvIHRoZXJlCg=="
|
|
||||||
token2: "1.69b72797-6ea9-4687-a11e-848e41a30ae6.YW5zaWJsZSBpcyBncmVhdD8K:YW5zaWJsZSBpcyBncmVhdAo="
|
|
||||||
|
|
||||||
- name: Get just the value of a secret
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: >-
|
|
||||||
{{ lookup("community.general.bitwarden_secrets_manager", "2bc23e48-4932-40de-a047-5524b7ddc972").value }}
|
|
||||||
"""
|
|
||||||
|
|
||||||
RETURN = """
|
|
||||||
_raw:
|
|
||||||
description: List containing one or more secrets.
|
|
||||||
type: list
|
|
||||||
elements: dict
|
|
||||||
"""
|
|
||||||
|
|
||||||
from subprocess import Popen, PIPE
|
|
||||||
|
|
||||||
from ansible.errors import AnsibleLookupError
|
|
||||||
from ansible.module_utils.common.text.converters import to_text
|
|
||||||
from ansible.parsing.ajson import AnsibleJSONDecoder
|
|
||||||
from ansible.plugins.lookup import LookupBase
|
|
||||||
|
|
||||||
|
|
||||||
class BitwardenSecretsManagerException(AnsibleLookupError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class BitwardenSecretsManager(object):
|
|
||||||
def __init__(self, path='bws'):
|
|
||||||
self._cli_path = path
|
|
||||||
|
|
||||||
@property
|
|
||||||
def cli_path(self):
|
|
||||||
return self._cli_path
|
|
||||||
|
|
||||||
def _run(self, args, stdin=None):
|
|
||||||
p = Popen([self.cli_path] + args, stdout=PIPE, stderr=PIPE, stdin=PIPE)
|
|
||||||
out, err = p.communicate(stdin)
|
|
||||||
rc = p.wait()
|
|
||||||
return to_text(out, errors='surrogate_or_strict'), to_text(err, errors='surrogate_or_strict'), rc
|
|
||||||
|
|
||||||
def get_secret(self, secret_id, bws_access_token):
|
|
||||||
"""Get and return the secret with the given secret_id.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Prepare set of params for Bitwarden Secrets Manager CLI
|
|
||||||
# Color output was not always disabled correctly with the default 'auto' setting so explicitly disable it.
|
|
||||||
params = [
|
|
||||||
'--color', 'no',
|
|
||||||
'--access-token', bws_access_token,
|
|
||||||
'get', 'secret', secret_id
|
|
||||||
]
|
|
||||||
|
|
||||||
out, err, rc = self._run(params)
|
|
||||||
if rc != 0:
|
|
||||||
raise BitwardenSecretsManagerException(to_text(err))
|
|
||||||
|
|
||||||
return AnsibleJSONDecoder().raw_decode(out)[0]
|
|
||||||
|
|
||||||
|
|
||||||
class LookupModule(LookupBase):
|
|
||||||
def run(self, terms, variables=None, **kwargs):
|
|
||||||
self.set_options(var_options=variables, direct=kwargs)
|
|
||||||
bws_access_token = self.get_option('bws_access_token')
|
|
||||||
|
|
||||||
return [_bitwarden_secrets_manager.get_secret(term, bws_access_token) for term in terms]
|
|
||||||
|
|
||||||
|
|
||||||
_bitwarden_secrets_manager = BitwardenSecretsManager()
|
|
||||||
@@ -15,11 +15,9 @@ DOCUMENTATION = '''
|
|||||||
- It is clearer with an example, it turns [1, 2, 3], [a, b] into [1, a], [1, b], [2, a], [2, b], [3, a], [3, b].
|
- It is clearer with an example, it turns [1, 2, 3], [a, b] into [1, a], [1, b], [2, a], [2, b], [3, a], [3, b].
|
||||||
You can see the exact syntax in the examples section.
|
You can see the exact syntax in the examples section.
|
||||||
options:
|
options:
|
||||||
_terms:
|
_raw:
|
||||||
description:
|
description:
|
||||||
- a set of lists
|
- a set of lists
|
||||||
type: list
|
|
||||||
elements: list
|
|
||||||
required: true
|
required: true
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@@ -76,7 +74,6 @@ class LookupModule(LookupBase):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
def run(self, terms, variables=None, **kwargs):
|
def run(self, terms, variables=None, **kwargs):
|
||||||
self.set_options(var_options=variables, direct=kwargs)
|
|
||||||
|
|
||||||
terms = self._lookup_variables(terms)
|
terms = self._lookup_variables(terms)
|
||||||
|
|
||||||
|
|||||||
@@ -13,22 +13,22 @@ short_description: Retrieves the version of an installed collection
|
|||||||
description:
|
description:
|
||||||
- This lookup allows to query the version of an installed collection, and to determine whether a
|
- This lookup allows to query the version of an installed collection, and to determine whether a
|
||||||
collection is installed at all.
|
collection is installed at all.
|
||||||
- By default it returns V(none) for non-existing collections and V(*) for collections without a
|
- By default it returns C(none) for non-existing collections and C(*) for collections without a
|
||||||
version number. The latter should only happen in development environments, or when installing
|
version number. The latter should only happen in development environments, or when installing
|
||||||
a collection from git which has no version in its C(galaxy.yml). This behavior can be adjusted
|
a collection from git which has no version in its C(galaxy.yml). This behavior can be adjusted
|
||||||
by providing other values with O(result_not_found) and O(result_no_version).
|
by providing other values with I(result_not_found) and I(result_no_version).
|
||||||
options:
|
options:
|
||||||
_terms:
|
_terms:
|
||||||
description:
|
description:
|
||||||
- The collections to look for.
|
- The collections to look for.
|
||||||
- For example V(community.general).
|
- For example C(community.general).
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
required: true
|
required: true
|
||||||
result_not_found:
|
result_not_found:
|
||||||
description:
|
description:
|
||||||
- The value to return when the collection could not be found.
|
- The value to return when the collection could not be found.
|
||||||
- By default, V(none) is returned.
|
- By default, C(none) is returned.
|
||||||
type: string
|
type: string
|
||||||
default: ~
|
default: ~
|
||||||
result_no_version:
|
result_no_version:
|
||||||
@@ -36,7 +36,7 @@ options:
|
|||||||
- The value to return when the collection has no version number.
|
- The value to return when the collection has no version number.
|
||||||
- This can happen for collections installed from git which do not have a version number
|
- This can happen for collections installed from git which do not have a version number
|
||||||
in C(galaxy.yml).
|
in C(galaxy.yml).
|
||||||
- By default, V(*) is returned.
|
- By default, C(*) is returned.
|
||||||
type: string
|
type: string
|
||||||
default: '*'
|
default: '*'
|
||||||
"""
|
"""
|
||||||
@@ -51,11 +51,11 @@ RETURN = """
|
|||||||
_raw:
|
_raw:
|
||||||
description:
|
description:
|
||||||
- The version number of the collections listed as input.
|
- The version number of the collections listed as input.
|
||||||
- If a collection can not be found, it will return the value provided in O(result_not_found).
|
- If a collection can not be found, it will return the value provided in I(result_not_found).
|
||||||
By default, this is V(none).
|
By default, this is C(none).
|
||||||
- If a collection can be found, but the version not identified, it will return the value provided in
|
- If a collection can be found, but the version not identified, it will return the value provided in
|
||||||
O(result_no_version). By default, this is V(*). This can happen for collections installed
|
I(result_no_version). By default, this is C(*). This can happen for collections installed
|
||||||
from git which do not have a version number in V(galaxy.yml).
|
from git which do not have a version number in C(galaxy.yml).
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -38,20 +38,23 @@ DOCUMENTATION = '''
|
|||||||
default: localhost
|
default: localhost
|
||||||
description:
|
description:
|
||||||
- The target to connect to, must be a resolvable address.
|
- The target to connect to, must be a resolvable address.
|
||||||
- Will be determined from E(ANSIBLE_CONSUL_URL) if that is set.
|
Will be determined from C(ANSIBLE_CONSUL_URL) if that is set.
|
||||||
|
- "C(ANSIBLE_CONSUL_URL) should look like this: C(https://my.consul.server:8500)"
|
||||||
|
env:
|
||||||
|
- name: ANSIBLE_CONSUL_URL
|
||||||
ini:
|
ini:
|
||||||
- section: lookup_consul
|
- section: lookup_consul
|
||||||
key: host
|
key: host
|
||||||
port:
|
port:
|
||||||
description:
|
description:
|
||||||
- The port of the target host to connect to.
|
- The port of the target host to connect to.
|
||||||
- If you use E(ANSIBLE_CONSUL_URL) this value will be used from there.
|
- If you use C(ANSIBLE_CONSUL_URL) this value will be used from there.
|
||||||
default: 8500
|
default: 8500
|
||||||
scheme:
|
scheme:
|
||||||
default: http
|
default: http
|
||||||
description:
|
description:
|
||||||
- Whether to use http or https.
|
- Whether to use http or https.
|
||||||
- If you use E(ANSIBLE_CONSUL_URL) this value will be used from there.
|
- If you use C(ANSIBLE_CONSUL_URL) this value will be used from there.
|
||||||
validate_certs:
|
validate_certs:
|
||||||
default: true
|
default: true
|
||||||
description: Whether to verify the ssl connection or not.
|
description: Whether to verify the ssl connection or not.
|
||||||
@@ -68,9 +71,7 @@ DOCUMENTATION = '''
|
|||||||
- section: lookup_consul
|
- section: lookup_consul
|
||||||
key: client_cert
|
key: client_cert
|
||||||
url:
|
url:
|
||||||
description:
|
description: "The target to connect to, should look like this: C(https://my.consul.server:8500)."
|
||||||
- The target to connect to.
|
|
||||||
- "Should look like this: V(https://my.consul.server:8500)."
|
|
||||||
type: str
|
type: str
|
||||||
version_added: 1.0.0
|
version_added: 1.0.0
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -22,33 +22,25 @@ DOCUMENTATION = '''
|
|||||||
required: true
|
required: true
|
||||||
table:
|
table:
|
||||||
description: name of the credstash table to query
|
description: name of the credstash table to query
|
||||||
type: str
|
|
||||||
default: 'credential-store'
|
default: 'credential-store'
|
||||||
version:
|
version:
|
||||||
description: Credstash version
|
description: Credstash version
|
||||||
type: str
|
|
||||||
default: ''
|
|
||||||
region:
|
region:
|
||||||
description: AWS region
|
description: AWS region
|
||||||
type: str
|
|
||||||
profile_name:
|
profile_name:
|
||||||
description: AWS profile to use for authentication
|
description: AWS profile to use for authentication
|
||||||
type: str
|
|
||||||
env:
|
env:
|
||||||
- name: AWS_PROFILE
|
- name: AWS_PROFILE
|
||||||
aws_access_key_id:
|
aws_access_key_id:
|
||||||
description: AWS access key ID
|
description: AWS access key ID
|
||||||
type: str
|
|
||||||
env:
|
env:
|
||||||
- name: AWS_ACCESS_KEY_ID
|
- name: AWS_ACCESS_KEY_ID
|
||||||
aws_secret_access_key:
|
aws_secret_access_key:
|
||||||
description: AWS access key
|
description: AWS access key
|
||||||
type: str
|
|
||||||
env:
|
env:
|
||||||
- name: AWS_SECRET_ACCESS_KEY
|
- name: AWS_SECRET_ACCESS_KEY
|
||||||
aws_session_token:
|
aws_session_token:
|
||||||
description: AWS session token
|
description: AWS session token
|
||||||
type: str
|
|
||||||
env:
|
env:
|
||||||
- name: AWS_SESSION_TOKEN
|
- name: AWS_SESSION_TOKEN
|
||||||
'''
|
'''
|
||||||
@@ -93,6 +85,8 @@ RETURN = """
|
|||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
|
|
||||||
@@ -106,39 +100,28 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
class LookupModule(LookupBase):
|
class LookupModule(LookupBase):
|
||||||
def run(self, terms, variables=None, **kwargs):
|
def run(self, terms, variables, **kwargs):
|
||||||
|
|
||||||
if not CREDSTASH_INSTALLED:
|
if not CREDSTASH_INSTALLED:
|
||||||
raise AnsibleError('The credstash lookup plugin requires credstash to be installed.')
|
raise AnsibleError('The credstash lookup plugin requires credstash to be installed.')
|
||||||
|
|
||||||
self.set_options(var_options=variables, direct=kwargs)
|
|
||||||
|
|
||||||
version = self.get_option('version')
|
|
||||||
region = self.get_option('region')
|
|
||||||
table = self.get_option('table')
|
|
||||||
profile_name = self.get_option('profile_name')
|
|
||||||
aws_access_key_id = self.get_option('aws_access_key_id')
|
|
||||||
aws_secret_access_key = self.get_option('aws_secret_access_key')
|
|
||||||
aws_session_token = self.get_option('aws_session_token')
|
|
||||||
|
|
||||||
context = dict(
|
|
||||||
(k, v) for k, v in kwargs.items()
|
|
||||||
if k not in ('version', 'region', 'table', 'profile_name', 'aws_access_key_id', 'aws_secret_access_key', 'aws_session_token')
|
|
||||||
)
|
|
||||||
|
|
||||||
kwargs_pass = {
|
|
||||||
'profile_name': profile_name,
|
|
||||||
'aws_access_key_id': aws_access_key_id,
|
|
||||||
'aws_secret_access_key': aws_secret_access_key,
|
|
||||||
'aws_session_token': aws_session_token,
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
for term in terms:
|
for term in terms:
|
||||||
try:
|
try:
|
||||||
ret.append(credstash.getSecret(term, version, region, table, context=context, **kwargs_pass))
|
version = kwargs.pop('version', '')
|
||||||
|
region = kwargs.pop('region', None)
|
||||||
|
table = kwargs.pop('table', 'credential-store')
|
||||||
|
profile_name = kwargs.pop('profile_name', os.getenv('AWS_PROFILE', None))
|
||||||
|
aws_access_key_id = kwargs.pop('aws_access_key_id', os.getenv('AWS_ACCESS_KEY_ID', None))
|
||||||
|
aws_secret_access_key = kwargs.pop('aws_secret_access_key', os.getenv('AWS_SECRET_ACCESS_KEY', None))
|
||||||
|
aws_session_token = kwargs.pop('aws_session_token', os.getenv('AWS_SESSION_TOKEN', None))
|
||||||
|
kwargs_pass = {'profile_name': profile_name, 'aws_access_key_id': aws_access_key_id,
|
||||||
|
'aws_secret_access_key': aws_secret_access_key, 'aws_session_token': aws_session_token}
|
||||||
|
val = credstash.getSecret(term, version, region, table, context=kwargs, **kwargs_pass)
|
||||||
except credstash.ItemNotFound:
|
except credstash.ItemNotFound:
|
||||||
raise AnsibleError('Key {0} not found'.format(term))
|
raise AnsibleError('Key {0} not found'.format(term))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise AnsibleError('Encountered exception while fetching {0}: {1}'.format(term, e))
|
raise AnsibleError('Encountered exception while fetching {0}: {1}'.format(term, e))
|
||||||
|
ret.append(val)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ class LookupModule(LookupBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def run(self, terms, variables=None, **kwargs):
|
def run(self, terms, variables=None, **kwargs):
|
||||||
|
|
||||||
display.vvvv("%s" % terms)
|
display.vvvv("%s" % terms)
|
||||||
if isinstance(terms, list):
|
if isinstance(terms, list):
|
||||||
return_values = []
|
return_values = []
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ description:
|
|||||||
or template expressions which evaluate to lists or dicts, composed of the elements of
|
or template expressions which evaluate to lists or dicts, composed of the elements of
|
||||||
the input evaluated lists and dictionaries."
|
the input evaluated lists and dictionaries."
|
||||||
options:
|
options:
|
||||||
_terms:
|
_raw:
|
||||||
description:
|
description:
|
||||||
- A list where the elements are one-element dictionaries, mapping a name to a string, list, or dictionary.
|
- A list where the elements are one-element dictionaries, mapping a name to a string, list, or dictionary.
|
||||||
The name is the index that is used in the result object. The value is iterated over as described below.
|
The name is the index that is used in the result object. The value is iterated over as described below.
|
||||||
- If the value is a list, it is simply iterated over.
|
- If the value is a list, it is simply iterated over.
|
||||||
- If the value is a dictionary, it is iterated over and returned as if they would be processed by the
|
- If the value is a dictionary, it is iterated over and returned as if they would be processed by the
|
||||||
P(ansible.builtin.dict2items#filter) filter.
|
R(ansible.builtin.dict2items filter,ansible_collections.ansible.builtin.dict2items_filter).
|
||||||
- If the value is a string, it is evaluated as Jinja2 expressions which can access the previously chosen
|
- If the value is a string, it is evaluated as Jinja2 expressions which can access the previously chosen
|
||||||
elements with C(item.<index_name>). The result must be a list or a dictionary.
|
elements with C(item.<index_name>). The result must be a list or a dictionary.
|
||||||
type: list
|
type: list
|
||||||
@@ -191,8 +191,6 @@ class LookupModule(LookupBase):
|
|||||||
|
|
||||||
def run(self, terms, variables=None, **kwargs):
|
def run(self, terms, variables=None, **kwargs):
|
||||||
"""Generate list."""
|
"""Generate list."""
|
||||||
self.set_options(var_options=variables, direct=kwargs)
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
if len(terms) > 0:
|
if len(terms) > 0:
|
||||||
templar = Templar(loader=self._templar._loader)
|
templar = Templar(loader=self._templar._loader)
|
||||||
|
|||||||
@@ -21,27 +21,22 @@ DOCUMENTATION = '''
|
|||||||
- In addition to (default) A record, it is also possible to specify a different record type that should be queried.
|
- In addition to (default) A record, it is also possible to specify a different record type that should be queried.
|
||||||
This can be done by either passing-in additional parameter of format qtype=TYPE to the dig lookup, or by appending /TYPE to the FQDN being queried.
|
This can be done by either passing-in additional parameter of format qtype=TYPE to the dig lookup, or by appending /TYPE to the FQDN being queried.
|
||||||
- If multiple values are associated with the requested record, the results will be returned as a comma-separated list.
|
- If multiple values are associated with the requested record, the results will be returned as a comma-separated list.
|
||||||
In such cases you may want to pass option C(wantlist=true) to the lookup call, or alternatively use C(query) instead of C(lookup),
|
In such cases you may want to pass option wantlist=True to the plugin, which will result in the record values being returned as a list
|
||||||
which will result in the record values being returned as a list over which you can iterate later on.
|
over which you can iterate later on.
|
||||||
- By default, the lookup will rely on system-wide configured DNS servers for performing the query.
|
- By default, the lookup will rely on system-wide configured DNS servers for performing the query.
|
||||||
It is also possible to explicitly specify DNS servers to query using the @DNS_SERVER_1,DNS_SERVER_2,...,DNS_SERVER_N notation.
|
It is also possible to explicitly specify DNS servers to query using the @DNS_SERVER_1,DNS_SERVER_2,...,DNS_SERVER_N notation.
|
||||||
This needs to be passed-in as an additional parameter to the lookup
|
This needs to be passed-in as an additional parameter to the lookup
|
||||||
options:
|
options:
|
||||||
_terms:
|
_terms:
|
||||||
description: Domain(s) to query.
|
description: Domain(s) to query.
|
||||||
type: list
|
|
||||||
elements: str
|
|
||||||
qtype:
|
qtype:
|
||||||
description:
|
description:
|
||||||
- Record type to query.
|
- Record type to query.
|
||||||
- V(DLV) has been removed in community.general 6.0.0.
|
- C(DLV) is deprecated and will be removed in community.general 6.0.0.
|
||||||
- V(CAA) has been added in community.general 6.3.0.
|
|
||||||
type: str
|
|
||||||
default: 'A'
|
default: 'A'
|
||||||
choices: [A, ALL, AAAA, CAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, RRSIG, SOA, SPF, SRV, SSHFP, TLSA, TXT]
|
choices: [A, ALL, AAAA, CNAME, DNAME, DLV, DNSKEY, DS, HINFO, LOC, MX, NAPTR, NS, NSEC3PARAM, PTR, RP, RRSIG, SOA, SPF, SRV, SSHFP, TLSA, TXT]
|
||||||
flat:
|
flat:
|
||||||
description: If 0 each record is returned as a dictionary, otherwise a string.
|
description: If 0 each record is returned as a dictionary, otherwise a string.
|
||||||
type: int
|
|
||||||
default: 1
|
default: 1
|
||||||
retry_servfail:
|
retry_servfail:
|
||||||
description: Retry a nameserver if it returns SERVFAIL.
|
description: Retry a nameserver if it returns SERVFAIL.
|
||||||
@@ -51,30 +46,12 @@ DOCUMENTATION = '''
|
|||||||
fail_on_error:
|
fail_on_error:
|
||||||
description:
|
description:
|
||||||
- Abort execution on lookup errors.
|
- Abort execution on lookup errors.
|
||||||
- The default for this option will likely change to V(true) in the future.
|
- The default for this option will likely change to C(true) in the future.
|
||||||
The current default, V(false), is used for backwards compatibility, and will result in empty strings
|
The current default, C(false), is used for backwards compatibility, and will result in empty strings
|
||||||
or the string V(NXDOMAIN) in the result in case of errors.
|
or the string C(NXDOMAIN) in the result in case of errors.
|
||||||
default: false
|
default: false
|
||||||
type: bool
|
type: bool
|
||||||
version_added: 5.4.0
|
version_added: 5.4.0
|
||||||
real_empty:
|
|
||||||
description:
|
|
||||||
- Return empty result without empty strings, and return empty list instead of V(NXDOMAIN).
|
|
||||||
- The default for this option will likely change to V(true) in the future.
|
|
||||||
- This option will be forced to V(true) if multiple domains to be queried are specified.
|
|
||||||
default: false
|
|
||||||
type: bool
|
|
||||||
version_added: 6.0.0
|
|
||||||
class:
|
|
||||||
description:
|
|
||||||
- "Class."
|
|
||||||
type: str
|
|
||||||
default: 'IN'
|
|
||||||
tcp:
|
|
||||||
description: Use TCP to lookup DNS records.
|
|
||||||
default: false
|
|
||||||
type: bool
|
|
||||||
version_added: 7.5.0
|
|
||||||
notes:
|
notes:
|
||||||
- ALL is not a record per-se, merely the listed fields are available for any record results you retrieve in the form of a dictionary.
|
- ALL is not a record per-se, merely the listed fields are available for any record results you retrieve in the form of a dictionary.
|
||||||
- While the 'dig' lookup plugin supports anything which dnspython supports out of the box, only a subset can be converted into a dictionary.
|
- While the 'dig' lookup plugin supports anything which dnspython supports out of the box, only a subset can be converted into a dictionary.
|
||||||
@@ -90,7 +67,7 @@ EXAMPLES = """
|
|||||||
|
|
||||||
- name: "The TXT record for example.org."
|
- name: "The TXT record for example.org."
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ lookup('community.general.dig', 'example.org.', qtype='TXT') }}"
|
msg: "{{ lookup('community.general.dig', 'example.org.', 'qtype=TXT') }}"
|
||||||
|
|
||||||
- name: "The TXT record for example.org, alternative syntax."
|
- name: "The TXT record for example.org, alternative syntax."
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
@@ -99,39 +76,24 @@ EXAMPLES = """
|
|||||||
- name: use in a loop
|
- name: use in a loop
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "MX record for gmail.com {{ item }}"
|
msg: "MX record for gmail.com {{ item }}"
|
||||||
with_items: "{{ lookup('community.general.dig', 'gmail.com./MX', wantlist=true) }}"
|
with_items: "{{ lookup('community.general.dig', 'gmail.com./MX', wantlist=True) }}"
|
||||||
|
|
||||||
- name: Lookup multiple names at once
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "A record found {{ item }}"
|
|
||||||
loop: "{{ query('community.general.dig', 'example.org.', 'example.com.', 'gmail.com.') }}"
|
|
||||||
|
|
||||||
- name: Lookup multiple names at once (from list variable)
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "A record found {{ item }}"
|
|
||||||
loop: "{{ query('community.general.dig', *hosts) }}"
|
|
||||||
vars:
|
|
||||||
hosts:
|
|
||||||
- example.org.
|
|
||||||
- example.com.
|
|
||||||
- gmail.com.
|
|
||||||
|
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "Reverse DNS for 192.0.2.5 is {{ lookup('community.general.dig', '192.0.2.5/PTR') }}"
|
msg: "Reverse DNS for 192.0.2.5 is {{ lookup('community.general.dig', '192.0.2.5/PTR') }}"
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "Reverse DNS for 192.0.2.5 is {{ lookup('community.general.dig', '5.2.0.192.in-addr.arpa./PTR') }}"
|
msg: "Reverse DNS for 192.0.2.5 is {{ lookup('community.general.dig', '5.2.0.192.in-addr.arpa./PTR') }}"
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "Reverse DNS for 192.0.2.5 is {{ lookup('community.general.dig', '5.2.0.192.in-addr.arpa.', qtype='PTR') }}"
|
msg: "Reverse DNS for 192.0.2.5 is {{ lookup('community.general.dig', '5.2.0.192.in-addr.arpa.', 'qtype=PTR') }}"
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "Querying 198.51.100.23 for IPv4 address for example.com. produces {{ lookup('dig', 'example.com', '@198.51.100.23') }}"
|
msg: "Querying 198.51.100.23 for IPv4 address for example.com. produces {{ lookup('dig', 'example.com', '@198.51.100.23') }}"
|
||||||
|
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "XMPP service for gmail.com. is available at {{ item.target }} on port {{ item.port }}"
|
msg: "XMPP service for gmail.com. is available at {{ item.target }} on port {{ item.port }}"
|
||||||
with_items: "{{ lookup('community.general.dig', '_xmpp-server._tcp.gmail.com./SRV', flat=0, wantlist=true) }}"
|
with_items: "{{ lookup('community.general.dig', '_xmpp-server._tcp.gmail.com./SRV', 'flat=0', wantlist=True) }}"
|
||||||
|
|
||||||
- name: Retry nameservers that return SERVFAIL
|
- name: Retry nameservers that return SERVFAIL
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ lookup('community.general.dig', 'example.org./A', retry_servfail=true) }}"
|
msg: "{{ lookup('community.general.dig', 'example.org./A', 'retry_servfail=True') }}"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
@@ -151,18 +113,15 @@ RETURN = """
|
|||||||
AAAA:
|
AAAA:
|
||||||
description:
|
description:
|
||||||
- address
|
- address
|
||||||
CAA:
|
|
||||||
description:
|
|
||||||
- flags
|
|
||||||
- tag
|
|
||||||
- value
|
|
||||||
version_added: 6.3.0
|
|
||||||
CNAME:
|
CNAME:
|
||||||
description:
|
description:
|
||||||
- target
|
- target
|
||||||
DNAME:
|
DNAME:
|
||||||
description:
|
description:
|
||||||
- target
|
- target
|
||||||
|
DLV:
|
||||||
|
description:
|
||||||
|
- algorithm, digest_type, key_tag, digest
|
||||||
DNSKEY:
|
DNSKEY:
|
||||||
description:
|
description:
|
||||||
- flags, algorithm, protocol, key
|
- flags, algorithm, protocol, key
|
||||||
@@ -226,7 +185,7 @@ try:
|
|||||||
import dns.resolver
|
import dns.resolver
|
||||||
import dns.reversename
|
import dns.reversename
|
||||||
import dns.rdataclass
|
import dns.rdataclass
|
||||||
from dns.rdatatype import (A, AAAA, CAA, CNAME, DNAME, DNSKEY, DS, HINFO, LOC,
|
from dns.rdatatype import (A, AAAA, CNAME, DLV, DNAME, DNSKEY, DS, HINFO, LOC,
|
||||||
MX, NAPTR, NS, NSEC3PARAM, PTR, RP, SOA, SPF, SRV, SSHFP, TLSA, TXT)
|
MX, NAPTR, NS, NSEC3PARAM, PTR, RP, SOA, SPF, SRV, SSHFP, TLSA, TXT)
|
||||||
HAVE_DNS = True
|
HAVE_DNS = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -246,9 +205,9 @@ def make_rdata_dict(rdata):
|
|||||||
supported_types = {
|
supported_types = {
|
||||||
A: ['address'],
|
A: ['address'],
|
||||||
AAAA: ['address'],
|
AAAA: ['address'],
|
||||||
CAA: ['flags', 'tag', 'value'],
|
|
||||||
CNAME: ['target'],
|
CNAME: ['target'],
|
||||||
DNAME: ['target'],
|
DNAME: ['target'],
|
||||||
|
DLV: ['algorithm', 'digest_type', 'key_tag', 'digest'],
|
||||||
DNSKEY: ['flags', 'algorithm', 'protocol', 'key'],
|
DNSKEY: ['flags', 'algorithm', 'protocol', 'key'],
|
||||||
DS: ['algorithm', 'digest_type', 'key_tag', 'digest'],
|
DS: ['algorithm', 'digest_type', 'key_tag', 'digest'],
|
||||||
HINFO: ['cpu', 'os'],
|
HINFO: ['cpu', 'os'],
|
||||||
@@ -278,6 +237,8 @@ def make_rdata_dict(rdata):
|
|||||||
if isinstance(val, dns.name.Name):
|
if isinstance(val, dns.name.Name):
|
||||||
val = dns.name.Name.to_text(val)
|
val = dns.name.Name.to_text(val)
|
||||||
|
|
||||||
|
if rdata.rdtype == DLV and f == 'digest':
|
||||||
|
val = dns.rdata._hexify(rdata.digest).replace(' ', '')
|
||||||
if rdata.rdtype == DS and f == 'digest':
|
if rdata.rdtype == DS and f == 'digest':
|
||||||
val = dns.rdata._hexify(rdata.digest).replace(' ', '')
|
val = dns.rdata._hexify(rdata.digest).replace(' ', '')
|
||||||
if rdata.rdtype == DNSKEY and f == 'algorithm':
|
if rdata.rdtype == DNSKEY and f == 'algorithm':
|
||||||
@@ -319,27 +280,20 @@ class LookupModule(LookupBase):
|
|||||||
|
|
||||||
... flat=0 # returns a dict; default is 1 == string
|
... flat=0 # returns a dict; default is 1 == string
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if HAVE_DNS is False:
|
if HAVE_DNS is False:
|
||||||
raise AnsibleError("The dig lookup requires the python 'dnspython' library and it is not installed")
|
raise AnsibleError("The dig lookup requires the python 'dnspython' library and it is not installed")
|
||||||
|
|
||||||
self.set_options(var_options=variables, direct=kwargs)
|
|
||||||
|
|
||||||
# Create Resolver object so that we can set NS if necessary
|
# Create Resolver object so that we can set NS if necessary
|
||||||
myres = dns.resolver.Resolver(configure=True)
|
myres = dns.resolver.Resolver(configure=True)
|
||||||
edns_size = 4096
|
edns_size = 4096
|
||||||
myres.use_edns(0, ednsflags=dns.flags.DO, payload=edns_size)
|
myres.use_edns(0, ednsflags=dns.flags.DO, payload=edns_size)
|
||||||
|
|
||||||
domains = []
|
domain = None
|
||||||
qtype = self.get_option('qtype')
|
qtype = 'A'
|
||||||
flat = self.get_option('flat')
|
flat = True
|
||||||
fail_on_error = self.get_option('fail_on_error')
|
fail_on_error = False
|
||||||
real_empty = self.get_option('real_empty')
|
rdclass = dns.rdataclass.from_text('IN')
|
||||||
tcp = self.get_option('tcp')
|
|
||||||
try:
|
|
||||||
rdclass = dns.rdataclass.from_text(self.get_option('class'))
|
|
||||||
except Exception as e:
|
|
||||||
raise AnsibleError("dns lookup illegal CLASS: %s" % to_native(e))
|
|
||||||
myres.retry_servfail = self.get_option('retry_servfail')
|
|
||||||
|
|
||||||
for t in terms:
|
for t in terms:
|
||||||
if t.startswith('@'): # e.g. "@10.0.1.2,192.0.2.1" is ok.
|
if t.startswith('@'): # e.g. "@10.0.1.2,192.0.2.1" is ok.
|
||||||
@@ -362,7 +316,7 @@ class LookupModule(LookupBase):
|
|||||||
continue
|
continue
|
||||||
if '=' in t:
|
if '=' in t:
|
||||||
try:
|
try:
|
||||||
opt, arg = t.split('=', 1)
|
opt, arg = t.split('=')
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -379,44 +333,37 @@ class LookupModule(LookupBase):
|
|||||||
myres.retry_servfail = boolean(arg)
|
myres.retry_servfail = boolean(arg)
|
||||||
elif opt == 'fail_on_error':
|
elif opt == 'fail_on_error':
|
||||||
fail_on_error = boolean(arg)
|
fail_on_error = boolean(arg)
|
||||||
elif opt == 'real_empty':
|
|
||||||
real_empty = boolean(arg)
|
|
||||||
elif opt == 'tcp':
|
|
||||||
tcp = boolean(arg)
|
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if '/' in t:
|
if '/' in t:
|
||||||
try:
|
try:
|
||||||
domain, qtype = t.split('/')
|
domain, qtype = t.split('/')
|
||||||
domains.append(domain)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
domains.append(t)
|
domain = t
|
||||||
else:
|
else:
|
||||||
domains.append(t)
|
domain = t
|
||||||
|
|
||||||
# print "--- domain = {0} qtype={1} rdclass={2}".format(domain, qtype, rdclass)
|
# print "--- domain = {0} qtype={1} rdclass={2}".format(domain, qtype, rdclass)
|
||||||
|
|
||||||
|
ret = []
|
||||||
|
|
||||||
|
if qtype.upper() == 'DLV':
|
||||||
|
display.deprecated('The DLV record type has been decommissioned in 2017 and support for'
|
||||||
|
' it will be removed from community.general 6.0.0',
|
||||||
|
version='6.0.0', collection_name='community.general')
|
||||||
|
|
||||||
if qtype.upper() == 'PTR':
|
if qtype.upper() == 'PTR':
|
||||||
reversed_domains = []
|
|
||||||
for domain in domains:
|
|
||||||
try:
|
try:
|
||||||
n = dns.reversename.from_address(domain)
|
n = dns.reversename.from_address(domain)
|
||||||
reversed_domains.append(n.to_text())
|
domain = n.to_text()
|
||||||
except dns.exception.SyntaxError:
|
except dns.exception.SyntaxError:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise AnsibleError("dns.reversename unhandled exception %s" % to_native(e))
|
raise AnsibleError("dns.reversename unhandled exception %s" % to_native(e))
|
||||||
domains = reversed_domains
|
|
||||||
|
|
||||||
if len(domains) > 1:
|
|
||||||
real_empty = True
|
|
||||||
|
|
||||||
ret = []
|
|
||||||
|
|
||||||
for domain in domains:
|
|
||||||
try:
|
try:
|
||||||
answers = myres.query(domain, qtype, rdclass=rdclass, tcp=tcp)
|
answers = myres.query(domain, qtype, rdclass=rdclass)
|
||||||
for rdata in answers:
|
for rdata in answers:
|
||||||
s = rdata.to_text()
|
s = rdata.to_text()
|
||||||
if qtype.upper() == 'TXT':
|
if qtype.upper() == 'TXT':
|
||||||
@@ -441,18 +388,15 @@ class LookupModule(LookupBase):
|
|||||||
except dns.resolver.NXDOMAIN as err:
|
except dns.resolver.NXDOMAIN as err:
|
||||||
if fail_on_error:
|
if fail_on_error:
|
||||||
raise AnsibleError("Lookup failed: %s" % str(err))
|
raise AnsibleError("Lookup failed: %s" % str(err))
|
||||||
if not real_empty:
|
|
||||||
ret.append('NXDOMAIN')
|
ret.append('NXDOMAIN')
|
||||||
except dns.resolver.NoAnswer as err:
|
except dns.resolver.NoAnswer as err:
|
||||||
if fail_on_error:
|
if fail_on_error:
|
||||||
raise AnsibleError("Lookup failed: %s" % str(err))
|
raise AnsibleError("Lookup failed: %s" % str(err))
|
||||||
if not real_empty:
|
|
||||||
ret.append("")
|
ret.append("")
|
||||||
except dns.resolver.Timeout as err:
|
except dns.resolver.Timeout as err:
|
||||||
if fail_on_error:
|
if fail_on_error:
|
||||||
raise AnsibleError("Lookup failed: %s" % str(err))
|
raise AnsibleError("Lookup failed: %s" % str(err))
|
||||||
if not real_empty:
|
ret.append('')
|
||||||
ret.append("")
|
|
||||||
except dns.exception.DNSException as err:
|
except dns.exception.DNSException as err:
|
||||||
raise AnsibleError("dns.resolver unhandled exception %s" % to_native(err))
|
raise AnsibleError("dns.resolver unhandled exception %s" % to_native(err))
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user