mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-03-27 05:43:28 +00:00
Compare commits
317 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04b8a5f918 | ||
|
|
f109c162b0 | ||
|
|
a2ab6881db | ||
|
|
ec72fdc3ab | ||
|
|
d6a997b37d | ||
|
|
d537e7ded8 | ||
|
|
bd9aa64a2b | ||
|
|
6b7dc6ee0a | ||
|
|
a831f22b83 | ||
|
|
cf8e77cf7d | ||
|
|
c4742cfa81 | ||
|
|
bf0ad4aad2 | ||
|
|
0fff8fde30 | ||
|
|
adcb28f806 | ||
|
|
d0e1504f8a | ||
|
|
090706b581 | ||
|
|
e52ae8a9bc | ||
|
|
7df358d74f | ||
|
|
dcd9598e48 | ||
|
|
fc5894171d | ||
|
|
a3b8fdbf25 | ||
|
|
69228e79d2 | ||
|
|
d1fbbb7905 | ||
|
|
50f87b0d15 | ||
|
|
4512e7b1e9 | ||
|
|
297a10fec7 | ||
|
|
139e103b0f | ||
|
|
83a933772c | ||
|
|
6c9616291e | ||
|
|
0224e4d415 | ||
|
|
cc20deaad2 | ||
|
|
5e0a6592ca | ||
|
|
acd5a2b17e | ||
|
|
e629ae2d7c | ||
|
|
abfe36c62f | ||
|
|
6c0b91a3ee | ||
|
|
f7fac90009 | ||
|
|
c4be75114b | ||
|
|
6da0cbb3d3 | ||
|
|
17fc3bcce6 | ||
|
|
d7c7d1d2c8 | ||
|
|
b8ed919011 | ||
|
|
04089e80fb | ||
|
|
55bd196e82 | ||
|
|
f451f2211b | ||
|
|
18c847a8a0 | ||
|
|
ee65205607 | ||
|
|
2c9c3a0f54 | ||
|
|
c1f830f3df | ||
|
|
2d3f55caa7 | ||
|
|
ab3bf45c6c | ||
|
|
00a22a525c | ||
|
|
eebfff4eb8 | ||
|
|
2ee9cc533a | ||
|
|
6d5145e285 | ||
|
|
45519c68be | ||
|
|
33f2ef8f11 | ||
|
|
dc4da60aff | ||
|
|
c520b68276 | ||
|
|
3ab812953f | ||
|
|
0e71c0e530 | ||
|
|
04fdbffca1 | ||
|
|
def5d2bae0 | ||
|
|
aecf81a23b | ||
|
|
373250a0ce | ||
|
|
62d060a173 | ||
|
|
b5247a27d4 | ||
|
|
792714f598 | ||
|
|
b886d7691f | ||
|
|
a383c6b27c | ||
|
|
ac611b801f | ||
|
|
68e7ddb7a7 | ||
|
|
cbd915c8ea | ||
|
|
3acced944b | ||
|
|
90cdaf873d | ||
|
|
44a23e363b | ||
|
|
a45448bb26 | ||
|
|
95785bbbbd | ||
|
|
43ead73934 | ||
|
|
16436f4f55 | ||
|
|
cd04f5a092 | ||
|
|
a8fcc028c0 | ||
|
|
667ebef95c | ||
|
|
f17fda3162 | ||
|
|
35a910a698 | ||
|
|
90385b97d8 | ||
|
|
a42d7f0420 | ||
|
|
12c00aa810 | ||
|
|
deac6a412e | ||
|
|
9525e23dc7 | ||
|
|
69a46eb0e8 | ||
|
|
36efb13c23 | ||
|
|
607b7cfcb4 | ||
|
|
af2af9cff3 | ||
|
|
40a9ff36bb | ||
|
|
2768c58f90 | ||
|
|
a15e376bb9 | ||
|
|
e366b90f39 | ||
|
|
d1be5519e6 | ||
|
|
3514f9d3dc | ||
|
|
9890937bcc | ||
|
|
8fda5f8678 | ||
|
|
399f5e2f09 | ||
|
|
1ca54d181d | ||
|
|
8f58cbb41c | ||
|
|
aaa96c2011 | ||
|
|
6ca7a7c0a4 | ||
|
|
4304552677 | ||
|
|
b09750ca7f | ||
|
|
5a2b3662cb | ||
|
|
595ee76b69 | ||
|
|
96c342fd67 | ||
|
|
53d47e1763 | ||
|
|
6e2230c1b3 | ||
|
|
f0f0b0a2e2 | ||
|
|
3d57a17ed6 | ||
|
|
610717ca76 | ||
|
|
dc8f7d68df | ||
|
|
1626c3d5e6 | ||
|
|
e396e5cb43 | ||
|
|
4a67de7b08 | ||
|
|
7f16f56c5b | ||
|
|
391d113a95 | ||
|
|
01bccb08a9 | ||
|
|
249e64a64d | ||
|
|
12941f6d9a | ||
|
|
617302ba94 | ||
|
|
ab9eaf24bc | ||
|
|
fad1d3a870 | ||
|
|
c21fb99f54 | ||
|
|
a65807edc3 | ||
|
|
dad5379461 | ||
|
|
bd594970a8 | ||
|
|
c244abd82f | ||
|
|
42d2b9c65a | ||
|
|
7a62e01af6 | ||
|
|
18614bb82d | ||
|
|
944f5416c9 | ||
|
|
ce3d0fdfa4 | ||
|
|
244c9b2066 | ||
|
|
f85f2904c9 | ||
|
|
db12a40a4c | ||
|
|
5282ece77e | ||
|
|
133ffe51fb | ||
|
|
b3e395a4a3 | ||
|
|
424004c4c0 | ||
|
|
dd2782d81c | ||
|
|
f7f5f89899 | ||
|
|
2b7a35c346 | ||
|
|
fee81b19a8 | ||
|
|
1ebacfb195 | ||
|
|
ab5c1d9911 | ||
|
|
4be66cfb34 | ||
|
|
c5d49b2a91 | ||
|
|
a03e652437 | ||
|
|
e815909859 | ||
|
|
f2601b01da | ||
|
|
27434455e5 | ||
|
|
25cfc56f6f | ||
|
|
f6fa00bfff | ||
|
|
68263bfc29 | ||
|
|
e23ea12cc5 | ||
|
|
69d17ed4b7 | ||
|
|
ed573a8223 | ||
|
|
dd7d29495d | ||
|
|
c596feab78 | ||
|
|
606e3cfe07 | ||
|
|
23fadc9f02 | ||
|
|
6d51660be4 | ||
|
|
957a7420ca | ||
|
|
b740bdaf3a | ||
|
|
049292669b | ||
|
|
310c68e6dd | ||
|
|
fcb2a466e0 | ||
|
|
757b544cf3 | ||
|
|
9f384c00a3 | ||
|
|
0118bf0cb9 | ||
|
|
a994a58b23 | ||
|
|
23afcce8b8 | ||
|
|
e2a316122a | ||
|
|
1671173e99 | ||
|
|
0b597f2e66 | ||
|
|
e068522325 | ||
|
|
51d117285f | ||
|
|
c29bbd265b | ||
|
|
7417d857f1 | ||
|
|
ceddb849b8 | ||
|
|
f5666924ab | ||
|
|
7bed8ce79e | ||
|
|
7d928e6e9d | ||
|
|
07fe3a91b6 | ||
|
|
5cebc90623 | ||
|
|
6ba8445fb1 | ||
|
|
9d4ae8b7e4 | ||
|
|
41e5b8428f | ||
|
|
1793cd70c4 | ||
|
|
b98c7926da | ||
|
|
5d0c5ae3a6 | ||
|
|
cfff8a3806 | ||
|
|
7e6adc977f | ||
|
|
54ea8777f8 | ||
|
|
5d0c8e40d8 | ||
|
|
eaf3d666cc | ||
|
|
c985096af5 | ||
|
|
92c6037900 | ||
|
|
0bef7bb164 | ||
|
|
6e60b0d454 | ||
|
|
0e6f8ab976 | ||
|
|
6b41ce1a9d | ||
|
|
052a2f6d94 | ||
|
|
13e77fd7da | ||
|
|
1f15216d0d | ||
|
|
9173166223 | ||
|
|
da82df4004 | ||
|
|
9313bf3e68 | ||
|
|
8ae6651cff | ||
|
|
86b32d8730 | ||
|
|
707523a763 | ||
|
|
8b1b4df54f | ||
|
|
fc9fce718d | ||
|
|
7511421440 | ||
|
|
553b0ea4f7 | ||
|
|
20e294e026 | ||
|
|
18469dbb3e | ||
|
|
d976add5da | ||
|
|
ecd5ad53e0 | ||
|
|
f6f436f227 | ||
|
|
355a99f779 | ||
|
|
c8b58875d9 | ||
|
|
bd8a3f35c2 | ||
|
|
edec4d767d | ||
|
|
0a56fb0e46 | ||
|
|
f3b6b5e690 | ||
|
|
d65a36e9ea | ||
|
|
252b531c20 | ||
|
|
bc88258687 | ||
|
|
1747370f30 | ||
|
|
72353d3f04 | ||
|
|
1822789d95 | ||
|
|
ccbb679fc3 | ||
|
|
98c86c54cd | ||
|
|
354239d6c9 | ||
|
|
4825036c7e | ||
|
|
360d0c3441 | ||
|
|
d8fb68514c | ||
|
|
d8c6add988 | ||
|
|
ea8fc70373 | ||
|
|
20f70caa1f | ||
|
|
04f976d7d3 | ||
|
|
b6a2dee8bb | ||
|
|
5b66052067 | ||
|
|
2655a6ffc1 | ||
|
|
bbba9beb70 | ||
|
|
a8594c5477 | ||
|
|
3043f737a0 | ||
|
|
080ae28e7d | ||
|
|
e1dad76ccb | ||
|
|
bc0fb3096b | ||
|
|
1e7d82af6d | ||
|
|
41d49e4e08 | ||
|
|
6241e09ccd | ||
|
|
679fe78f32 | ||
|
|
b8c5d6b1b7 | ||
|
|
665f84d996 | ||
|
|
c359200e80 | ||
|
|
793b039691 | ||
|
|
ef36fdc17d | ||
|
|
bcb08106d9 | ||
|
|
cbf54f214c | ||
|
|
931326fb70 | ||
|
|
6343dbdcff | ||
|
|
34a12eb3f9 | ||
|
|
402e0b1f76 | ||
|
|
1268d4aa0a | ||
|
|
5988748999 | ||
|
|
5935dce47f | ||
|
|
77df4ba3fd | ||
|
|
1e84bce91a | ||
|
|
d1fff45191 | ||
|
|
0eeaf61a1a | ||
|
|
c96be65ec9 | ||
|
|
4b0b50439d | ||
|
|
0177b87cbc | ||
|
|
079ba357d4 | ||
|
|
e5e36d3c7b | ||
|
|
f68cec59e7 | ||
|
|
402ec20076 | ||
|
|
2dfa6e28a1 | ||
|
|
c390183337 | ||
|
|
06efaeb108 | ||
|
|
12e0c72841 | ||
|
|
8d568fb6ea | ||
|
|
210ed7c147 | ||
|
|
dd249846ec | ||
|
|
53bb7312e4 | ||
|
|
32350028b6 | ||
|
|
85b43f9059 | ||
|
|
d944df3bde | ||
|
|
be61219931 | ||
|
|
4aba0d1e93 | ||
|
|
3df097259c | ||
|
|
51a1e6d59a | ||
|
|
ff154e5d3b | ||
|
|
04441336fc | ||
|
|
8c9bb90629 | ||
|
|
116b38a946 | ||
|
|
b32447d107 | ||
|
|
78623fd7de | ||
|
|
6f822d08d4 | ||
|
|
5dee4b0576 | ||
|
|
e82c3907bb | ||
|
|
ea952f0825 | ||
|
|
4f2c75a775 | ||
|
|
54f74612e6 | ||
|
|
0338fc5a8f | ||
|
|
f7fc4a2504 | ||
|
|
cd13b2edbc |
3
.azure-pipelines/README.md
Normal file
3
.azure-pipelines/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## Azure Pipelines Configuration
|
||||
|
||||
Please see the [Documentation](https://github.com/ansible/community/wiki/Testing:-Azure-Pipelines) for more information.
|
||||
341
.azure-pipelines/azure-pipelines.yml
Normal file
341
.azure-pipelines/azure-pipelines.yml
Normal file
@@ -0,0 +1,341 @@
|
||||
trigger:
|
||||
batch: true
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- stable-*
|
||||
|
||||
pr:
|
||||
autoCancel: true
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- stable-*
|
||||
|
||||
schedules:
|
||||
- cron: 0 9 * * *
|
||||
displayName: Nightly
|
||||
always: true
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- stable-*
|
||||
|
||||
variables:
|
||||
- name: checkoutPath
|
||||
value: ansible_collections/ansible/posix
|
||||
- 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:3.0.0
|
||||
|
||||
pool: Standard
|
||||
|
||||
stages:
|
||||
|
||||
## Docker
|
||||
- stage: Docker_devel
|
||||
displayName: Docker devel
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: devel/linux/{0}/1
|
||||
targets:
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 37
|
||||
test: fedora37
|
||||
- name: openSUSE 15 py3
|
||||
test: opensuse15
|
||||
- name: Ubuntu 20.04
|
||||
test: ubuntu2004
|
||||
- name: Ubuntu 22.04
|
||||
test: ubuntu2204
|
||||
- stage: Docker_2_14
|
||||
displayName: Docker 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.14/linux/{0}/1
|
||||
targets:
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 36
|
||||
test: fedora36
|
||||
- name: openSUSE 15 py3
|
||||
test: opensuse15
|
||||
- name: Ubuntu 20.04
|
||||
test: ubuntu2004
|
||||
- name: Ubuntu 22.04
|
||||
test: ubuntu2204
|
||||
- stage: Docker_2_13
|
||||
displayName: Docker 2.13
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.13/linux/{0}/1
|
||||
targets:
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 34
|
||||
test: fedora34
|
||||
- name: Fedora 35
|
||||
test: fedora35
|
||||
- name: openSUSE 15 py3
|
||||
test: opensuse15
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
- name: Ubuntu 20.04
|
||||
test: ubuntu2004
|
||||
- stage: Docker_2_12
|
||||
displayName: Docker 2.12
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.12/linux/{0}/1
|
||||
targets:
|
||||
- name: CentOS 6
|
||||
test: centos6
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 33
|
||||
test: fedora33
|
||||
- name: Fedora 34
|
||||
test: fedora34
|
||||
- name: openSUSE 15 py2
|
||||
test: opensuse15py2
|
||||
- name: openSUSE 15 py3
|
||||
test: opensuse15
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
- name: Ubuntu 20.04
|
||||
test: ubuntu2004
|
||||
- stage: Docker_2_11
|
||||
displayName: Docker 2.11
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.11/linux/{0}/1
|
||||
targets:
|
||||
- name: CentOS 6
|
||||
test: centos6
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 32
|
||||
test: fedora32
|
||||
- name: Fedora 33
|
||||
test: fedora33
|
||||
- name: openSUSE 15 py2
|
||||
test: opensuse15py2
|
||||
- name: openSUSE 15 py3
|
||||
test: opensuse15
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
- name: Ubuntu 20.04
|
||||
test: ubuntu2004
|
||||
- stage: Docker_2_10
|
||||
displayName: Docker 2.10
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.10/linux/{0}/1
|
||||
targets:
|
||||
- name: CentOS 6
|
||||
test: centos6
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 30
|
||||
test: fedora30
|
||||
- name: Fedora 31
|
||||
test: fedora31
|
||||
- name: openSUSE 15 py2
|
||||
test: opensuse15py2
|
||||
- name: openSUSE 15 py3
|
||||
test: opensuse15
|
||||
- name: Ubuntu 16.04
|
||||
test: ubuntu1604
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
- stage: Docker_2_9
|
||||
displayName: Docker 2.9
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.9/linux/{0}/1
|
||||
targets:
|
||||
- name: CentOS 6
|
||||
test: centos6
|
||||
- name: CentOS 7
|
||||
test: centos7
|
||||
- name: Fedora 30
|
||||
test: fedora30
|
||||
- name: Fedora 31
|
||||
test: fedora31
|
||||
- name: openSUSE 15 py2
|
||||
test: opensuse15py2
|
||||
- name: openSUSE 15 py3
|
||||
test: opensuse15
|
||||
- name: Ubuntu 16.04
|
||||
test: ubuntu1604
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
|
||||
## Remote
|
||||
- stage: Remote_devel
|
||||
displayName: Remote devel
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: devel/{0}/1
|
||||
targets:
|
||||
- name: MacOS 12.0
|
||||
test: macos/12.0
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.7
|
||||
test: rhel/8.7
|
||||
- name: RHEL 9.1
|
||||
test: rhel/9.1
|
||||
- name: FreeBSD 12.4
|
||||
test: freebsd/12.4
|
||||
- name: FreeBSD 13.1
|
||||
test: freebsd/13.1
|
||||
- stage: Remote_2_14
|
||||
displayName: Remote 2.14
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.14/{0}/1
|
||||
targets:
|
||||
- name: MacOS 12.0
|
||||
test: macos/12.0
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.6
|
||||
test: rhel/8.6
|
||||
- name: RHEL 9.0
|
||||
test: rhel/9.0
|
||||
- name: FreeBSD 12.3
|
||||
test: freebsd/12.3
|
||||
- name: FreeBSD 13.1
|
||||
test: freebsd/13.1
|
||||
- stage: Remote_2_13
|
||||
displayName: Remote 2.13
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.13/{0}/1
|
||||
targets:
|
||||
- name: MacOS 12.0
|
||||
test: macos/12.0
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.5
|
||||
test: rhel/8.5
|
||||
- name: FreeBSD 12.3
|
||||
test: freebsd/12.3
|
||||
- name: FreeBSD 13.0
|
||||
test: freebsd/13.0
|
||||
- stage: Remote_2_12
|
||||
displayName: Remote 2.12
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.12/{0}/1
|
||||
targets:
|
||||
- name: MacOS 11.1
|
||||
test: macos/11.1
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.4
|
||||
test: rhel/8.4
|
||||
- name: FreeBSD 12.2
|
||||
test: freebsd/12.2
|
||||
- name: FreeBSD 13.0
|
||||
test: freebsd/13.0
|
||||
- stage: Remote_2_11
|
||||
displayName: Remote 2.11
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.11/{0}/1
|
||||
targets:
|
||||
- name: MacOS 11.1
|
||||
test: macos/11.1
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.3
|
||||
test: rhel/8.3
|
||||
- name: FreeBSD 12.2
|
||||
test: freebsd/12.2
|
||||
- stage: Remote_2_10
|
||||
displayName: Remote 2.10
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.10/{0}/1
|
||||
targets:
|
||||
- name: OS X 10.11
|
||||
test: osx/10.11
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.2
|
||||
test: rhel/8.2
|
||||
- stage: Remote_2_9
|
||||
displayName: Remote 2.9
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.9/{0}/1
|
||||
targets:
|
||||
- name: OS X 10.11
|
||||
test: osx/10.11
|
||||
- name: RHEL 7.9
|
||||
test: rhel/7.9
|
||||
- name: RHEL 8.1
|
||||
test: rhel/8.1
|
||||
|
||||
## Finally
|
||||
|
||||
- stage: Summary
|
||||
condition: succeededOrFailed()
|
||||
dependsOn:
|
||||
- Remote_2_9
|
||||
- Docker_2_9
|
||||
- Remote_2_10
|
||||
- Docker_2_10
|
||||
- Remote_2_11
|
||||
- Docker_2_11
|
||||
- Remote_2_12
|
||||
- Docker_2_12
|
||||
- Remote_2_13
|
||||
- Docker_2_13
|
||||
- Remote_2_14
|
||||
- Docker_2_14
|
||||
- Remote_devel
|
||||
- Docker_devel
|
||||
jobs:
|
||||
- template: templates/coverage.yml
|
||||
20
.azure-pipelines/scripts/aggregate-coverage.sh
Executable file
20
.azure-pipelines/scripts/aggregate-coverage.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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 --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
|
||||
60
.azure-pipelines/scripts/combine-coverage.py
Executable file
60
.azure-pipelines/scripts/combine-coverage.py
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
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()
|
||||
24
.azure-pipelines/scripts/process-results.sh
Executable file
24
.azure-pipelines/scripts/process-results.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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
|
||||
27
.azure-pipelines/scripts/publish-codecov.sh
Executable file
27
.azure-pipelines/scripts/publish-codecov.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
set -o pipefail -eu
|
||||
|
||||
output_path="$1"
|
||||
|
||||
curl --silent --show-error https://ansible-ci-files.s3.us-east-1.amazonaws.com/codecov/codecov.sh > codecov.sh
|
||||
|
||||
for file in "${output_path}"/reports/coverage*.xml; do
|
||||
name="${file}"
|
||||
name="${name##*/}" # remove path
|
||||
name="${name##coverage=}" # remove 'coverage=' prefix if present
|
||||
name="${name%.xml}" # remove '.xml' suffix
|
||||
|
||||
bash codecov.sh \
|
||||
-f "${file}" \
|
||||
-n "${name}" \
|
||||
-X coveragepy \
|
||||
-X gcov \
|
||||
-X fix \
|
||||
-X search \
|
||||
-X xcode \
|
||||
|| echo "Failed to upload code coverage report to codecov.io: ${file}"
|
||||
done
|
||||
15
.azure-pipelines/scripts/report-coverage.sh
Executable file
15
.azure-pipelines/scripts/report-coverage.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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 --stub --venv --venv-system-site-packages --color -v
|
||||
34
.azure-pipelines/scripts/run-tests.sh
Executable file
34
.azure-pipelines/scripts/run-tests.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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"
|
||||
25
.azure-pipelines/scripts/time-command.py
Executable file
25
.azure-pipelines/scripts/time-command.py
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
"""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()
|
||||
39
.azure-pipelines/templates/coverage.yml
Normal file
39
.azure-pipelines/templates/coverage.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
# 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.sh "$(outputPath)"
|
||||
displayName: Publish to codecov.io
|
||||
condition: gt(variables.coverageFileCount, 0)
|
||||
continueOnError: true
|
||||
55
.azure-pipelines/templates/matrix.yml
Normal file
55
.azure-pipelines/templates/matrix.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# 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) }}
|
||||
45
.azure-pipelines/templates/test.yml
Normal file
45
.azure-pipelines/templates/test.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
# 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)"
|
||||
61
.github/settings.yml
vendored
61
.github/settings.yml
vendored
@@ -1,61 +0,0 @@
|
||||
###
|
||||
# https://probot.github.io/apps/settings/
|
||||
#
|
||||
|
||||
# DO NOT MODIFY
|
||||
# this is a copy of https://github.com/gundalow-collection/.github/blob/master/.github/settings.yml
|
||||
# Work around till https://github.com/probot/settings/pull/179 is merged
|
||||
|
||||
|
||||
|
||||
repository:
|
||||
# See https://developer.github.com/v3/repos/#edit for all available settings.
|
||||
has_issues: true
|
||||
has_wiki: false
|
||||
has_pages: false
|
||||
default_branch: devel
|
||||
allow_squash_merge: true
|
||||
allow_merge_commit: false
|
||||
allow_rebase_merge: true
|
||||
|
||||
# Labels: define labels for Issues and Pull Requests
|
||||
labels:
|
||||
- name: bug
|
||||
color: fbca04
|
||||
description: This issue/PR relates to a bug.
|
||||
- name: feature
|
||||
description: This issue/PR relates to a feature request.
|
||||
color: 006b75
|
||||
- name: migrated_from_ansible_ansible
|
||||
color: 5319e7
|
||||
description: This issue/PR was moved from gh/ansible/ansible
|
||||
|
||||
branches:
|
||||
- name: master
|
||||
# https://developer.github.com/v3/repos/branches/#update-branch-protection
|
||||
# Branch Protection settings. Set to null to disable
|
||||
protection:
|
||||
# Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
|
||||
required_pull_request_reviews:
|
||||
# The number of approvals required. (1-6)
|
||||
required_approving_review_count: 1
|
||||
# Dismiss approved reviews automatically when a new commit is pushed.
|
||||
dismiss_stale_reviews: true
|
||||
# Blocks merge until code owners have reviewed.
|
||||
require_code_owner_reviews: true
|
||||
# Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories.
|
||||
dismissal_restrictions:
|
||||
users: []
|
||||
teams: []
|
||||
# Required. Require status checks to pass before merging. Set to null to disable
|
||||
required_status_checks:
|
||||
# Required. Require branches to be up to date before merging.
|
||||
strict: true
|
||||
# Required. The list of status checks to require in order to merge into this branch
|
||||
contexts: []
|
||||
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
|
||||
enforce_admins: true
|
||||
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
|
||||
#restrictions:
|
||||
# users: []
|
||||
# teams: []
|
||||
175
CHANGELOG.rst
Normal file
175
CHANGELOG.rst
Normal file
@@ -0,0 +1,175 @@
|
||||
===========================
|
||||
ansible.posix Release Notes
|
||||
===========================
|
||||
|
||||
.. contents:: Topics
|
||||
|
||||
|
||||
v1.4.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This is the minor release of the ``ansible.posix`` collection.
|
||||
This changelog contains all changes to the modules in this collection that
|
||||
have been added after the release of ``ansible.posix`` 1.3.0.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- firewalld - Show warning message that variable type of ``masquerade`` and ``icmp_block_inversion`` will be changed from ``str`` to ``boolean`` in the future release (https://github.com/ansible-collections/ansible.posix/pull/254).
|
||||
- selinux - optionally update kernel boot params when disabling/re-enabling SELinux (https://github.com/ansible-collections/ansible.posix/pull/142).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Fix for whitespace in source full path causing error ```code 23) at main.c(1330) [sender=3.2.3]``` (https://github.com/ansible-collections/ansible.posix/pull/278)
|
||||
- Include ``PSF-license.txt`` file for ``plugins/module_utils/_version.py``.
|
||||
- Use vendored version of ``distutils.version`` instead of the deprecated Python standard library to address PEP 632 (https://github.com/ansible-collections/ansible.posix/issues/303).
|
||||
- firewalld - Correct usage of queryForwardPort (https://github.com/ansible-collections/ansible.posix/issues/247).
|
||||
- firewalld - Refine the handling of exclusive options (https://github.com/ansible-collections/ansible.posix/issues/255).
|
||||
- mount - add a newline at the end of line in ``fstab`` (https://github.com/ansible-collections/ansible.posix/issues/210).
|
||||
- profile_tasks - Correctly calculate task execution time with serial execution (https://github.com/ansible-collections/ansible.posix/issues/83).
|
||||
- seboolean - add ``python3-libsemanage`` package dependency for RHEL8+ systems.
|
||||
|
||||
v1.3.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This is the minor release of the ``ansible.posix`` collection.
|
||||
This changelog contains all changes to the modules in this collection that
|
||||
have been added after the release of ``ansible.posix`` 1.2.0.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- acl - add new alias ``recurse`` for ``recursive`` parameter (https://github.com/ansible-collections/ansible.posix/issues/124).
|
||||
- added 2.11 branch to test matrix, added ignore-2.12.txt.
|
||||
- authorized_key - add ``no_log=False`` in ``argument_spec`` to clear false-positives of ``no-log-needed`` (https://github.com/ansible-collections/ansible.posix/pull/156).
|
||||
- authorized_key - add a list of valid key types (https://github.com/ansible-collections/ansible.posix/issues/134).
|
||||
- mount - Change behavior of ``boot`` option to set ``noauto`` on BSD nodes (https://github.com/ansible-collections/ansible.posix/issues/28).
|
||||
- mount - Change behavior of ``boot`` option to set ``noauto`` on Linux nodes (https://github.com/ansible-collections/ansible.posix/issues/28).
|
||||
- mount - add ``no_log=False`` in ``argument_spec`` to clear false-positives of ``no-log-needed`` (https://github.com/ansible-collections/ansible.posix/pull/156).
|
||||
- mount - returns ``backup_file`` value when a backup fstab is created.
|
||||
- synchronize - add ``delay_updates`` option (https://github.com/ansible-collections/ansible.posix/issues/157).
|
||||
- synchronize - fix typo (https://github.com/ansible-collections/ansible.posix/pull/198).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Synchronize module not recognizing remote ssh key (https://github.com/ansible-collections/ansible.posix/issues/24).
|
||||
- Synchronize not using quotes around arguments like --out-format (https://github.com/ansible-collections/ansible.posix/issues/190).
|
||||
- at - append line-separator to the end of the ``command`` (https://github.com/ansible-collections/ansible.posix/issues/169).
|
||||
- csh - define ``ECHO`` and ``COMMAND_SEP`` (https://github.com/ansible-collections/ansible.posix/issues/204).
|
||||
- firewalld - enable integration after migration (https://github.com/ansible-collections/ansible.posix/pull/239).
|
||||
- firewalld - ensure idempotency with firewalld 0.9.3 (https://github.com/ansible-collections/ansible.posix/issues/179).
|
||||
- firewalld - fix setting zone target to ``%%REJECT%%`` (https://github.com/ansible-collections/ansible.posix/pull/215).
|
||||
- mount - Handle ``boot`` option on Solaris correctly (https://github.com/ansible-collections/ansible.posix/issues/184).
|
||||
- synchronize - add ``community.podman.podman`` to the list of supported connection plugins (https://github.com/ansible-community/molecule-podman/issues/45).
|
||||
- synchronize - complete podman support for synchronize module.
|
||||
- synchronize - properly quote rsync CLI parameters (https://github.com/ansible-collections/ansible.posix/pull/241).
|
||||
- synchronize - replace removed ``ansible_ssh_user`` by ``ansible_user`` everywhere; do the same for ``ansible_ssh_port`` and ``ansible_ssh_host`` (https://github.com/ansible-collections/ansible.posix/issues/60).
|
||||
- synchronize - use SSH args from SSH connection plugin (https://github.com/ansible-collections/ansible.posix/issues/222).
|
||||
- synchronize - use become_user when invoking rsync on remote with sudo (https://github.com/ansible-collections/ansible.posix/issues/186).
|
||||
- sysctl - modifying conditional check for docker to fix tests being skipped (https://github.com/ansible-collections/ansible.posix/pull/226).
|
||||
|
||||
v1.2.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
This is the minor release of the ``ansible.posix`` collection.
|
||||
This changelog contains all changes to the modules in this collection that
|
||||
have been added after the release of ``ansible.posix`` 1.1.0.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- firewalld - bring the ``target`` feature back (https://github.com/ansible-collections/ansible.posix/issues/112).
|
||||
- fix sanity test for various modules.
|
||||
- synchronize - add the ``ssh_connection_multiplexing`` option to allow SSH connection multiplexing (https://github.com/ansible/ansible/issues/24365).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- at - add AIX support (https://github.com/ansible-collections/ansible.posix/pull/99).
|
||||
- synchronize - add ``community.docker.docker`` to the list of supported transports (https://github.com/ansible-collections/ansible.posix/issues/132).
|
||||
- synchronize - do not prepend PWD when path is in form user@server:path or server:path (https://github.com/ansible-collections/ansible.posix/pull/118).
|
||||
- synchronize - fix for private_key overriding in synchronize module.
|
||||
- sysctl - do not persist sysctl when value is invalid (https://github.com/ansible-collections/ansible.posix/pull/101).
|
||||
|
||||
v1.1.1
|
||||
======
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- skippy - fixed the deprecation warning (by date) for skippy callback plugin
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Fix synchronize to work with renamed docker and buildah connection plugins.
|
||||
|
||||
v1.1.0
|
||||
======
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- firewalld - add firewalld module to ansible.posix collection
|
||||
|
||||
v1.0.0
|
||||
======
|
||||
|
||||
Major Changes
|
||||
-------------
|
||||
|
||||
- Bootstrap Collection (https://github.com/ansible-collections/ansible.posix/pull/1).
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- CI should use devel (https://github.com/ansible-collections/ansible.posix/pull/6).
|
||||
- Enable tests for at, patch and synchronize modules (https://github.com/ansible-collections/ansible.posix/pull/5).
|
||||
- Enabled tags in galaxy.yml (https://github.com/ansible-collections/ansible.posix/issues/18).
|
||||
- Migrate hacking/cgroup_perf_recap_graph.py to this collection, since the cgroup_perf_recap callback lives here.
|
||||
- Remove license key from galaxy.yml.
|
||||
- Remove sanity jobs from shippable (https://github.com/ansible-collections/ansible.posix/pull/43).
|
||||
- Removed ANSIBLE_METADATA from all the modules.
|
||||
- Revert "Enable at, patch and synchronize tests (https://github.com/ansible-collections/ansible.posix/pull/5)".
|
||||
- Update EXAMPLES section in modules to use FQCN.
|
||||
- Update README.md (https://github.com/ansible-collections/ansible.posix/pull/4/).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- Allow unsetting existing environment vars via environment by specifying a null value (https://github.com/ansible/ansible/pull/68236).
|
||||
- Mount - Handle remount with new options (https://github.com/ansible/ansible/issues/59460).
|
||||
- Profile_tasks - result was a odict_items which is not subscriptable, so the slicing was failing (https://github.com/ansible/ansible/issues/59059).
|
||||
- Revert "mount - Check if src exists before mounted (ansible/ansible#61752)".
|
||||
- Typecast results before use in profile_tasks callback (https://github.com/ansible/ansible/issues/69563).
|
||||
- authorized_keys - Added FIDO2 security keys (https://github.com/ansible-collections/ansible.posix/issues/17).
|
||||
- authorized_keys - fix inconsistent return value for check mode (https://github.com/ansible-collections/ansible.posix/issues/37)
|
||||
- json callback - Fix host result to task references in the resultant JSON output for non-lockstep strategy plugins such as free (https://github.com/ansible/ansible/issues/65931)
|
||||
- mount - fix issues with ismount module_util pathing for Ansible 2.9 (fixes https://github.com/ansible-collections/ansible.posix/issues/21)
|
||||
- patch - fix FQCN usage for action plugin (https://github.com/ansible-collections/ansible.posix/issues/11)
|
||||
- selinux - add missing configuration keys for /etc/selinux/config (https://github.com/ansible-collections/ansible.posix/issues/23)
|
||||
- synchronize - fix FQCN usage for action plugin (https://github.com/ansible-collections/ansible.posix/issues/11)
|
||||
|
||||
New Modules
|
||||
-----------
|
||||
|
||||
- acl - Set and retrieve file ACL information.
|
||||
- at - Schedule the execution of a command or script file via the at command
|
||||
- authorized_key - Adds or removes an SSH authorized key
|
||||
- mount - Control active and configured mount points
|
||||
- patch - Apply patch files using the GNU patch tool
|
||||
- seboolean - Toggles SELinux booleans
|
||||
- selinux - Change policy and state of SELinux
|
||||
- synchronize - A wrapper around rsync to make common tasks in your playbooks quick and easy
|
||||
- sysctl - Manage entries in sysctl.conf.
|
||||
48
PSF-license.txt
Normal file
48
PSF-license.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||
--------------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||
otherwise using this software ("Python") in source or binary form and
|
||||
its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
||||
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
||||
analyze, test, perform and/or display publicly, prepare derivative works,
|
||||
distribute, and otherwise use Python alone or in any derivative version,
|
||||
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
||||
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Python Software Foundation;
|
||||
All Rights Reserved" are retained in Python alone or in any derivative version
|
||||
prepared by Licensee.
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python.
|
||||
|
||||
4. PSF is making Python available to Licensee on an "AS IS"
|
||||
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between PSF and
|
||||
Licensee. This License Agreement does not grant permission to use PSF
|
||||
trademarks or trade name in a trademark sense to endorse or promote
|
||||
products or services of Licensee, or any third party.
|
||||
|
||||
8. By copying, installing or otherwise using Python, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
45
README.md
45
README.md
@@ -1,16 +1,20 @@
|
||||
# ansible.posix
|
||||
<!-- Add CI and code coverage badges here. Samples included below. -->
|
||||
[]() <!--[](https://codecov.io/gh/ansible-collections/ansible.posix)-->
|
||||
[](https://dev.azure.com/ansible/ansible.posix/_build?definitionId=26)
|
||||
[]() <!--[](https://codecov.io/gh/ansible-collections/ansible.posix)-->
|
||||
|
||||
<!-- Describe the collection and why a user would want to use it. What does the collection do? -->
|
||||
An Ansible Collection of modules and plugins that target POSIX UNIX/Linux and derivative Operating Systems.
|
||||
|
||||
|
||||
## Supported Versions of Ansible
|
||||
<!--start requires_ansible-->
|
||||
## Ansible version compatibility
|
||||
|
||||
This collection has been tested against following Ansible versions: **>=2.9,<2.11**.
|
||||
This collection has been tested against following Ansible versions: **>=2.9**.
|
||||
|
||||
For collections that support Ansible 2.9, please ensure you update your `network_os` to use the
|
||||
fully qualified collection name (for example, `cisco.ios.ios`).
|
||||
Plugins and modules within a collection may be tested with only specific Ansible versions.
|
||||
A collection may contain metadata that identifies these versions.
|
||||
PEP440 is the schema used to describe the versions of Ansible.
|
||||
@@ -22,15 +26,17 @@ PEP440 is the schema used to describe the versions of Ansible.
|
||||
### Modules
|
||||
Name | Description
|
||||
--- | ---
|
||||
[ansible.posix.acl](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.acl_module.rst)|Set and retrieve file ACL information.
|
||||
[ansible.posix.at](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.at_module.rst)|Schedule the execution of a command or script file via the at command
|
||||
[ansible.posix.authorized_key](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.authorized_key_module.rst)|Adds or removes an SSH authorized key
|
||||
[ansible.posix.mount](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.mount_module.rst)|Control active and configured mount points
|
||||
[ansible.posix.patch](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.patch_module.rst)|Apply patch files using the GNU patch tool
|
||||
[ansible.posix.seboolean](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.seboolean_module.rst)|Toggles SELinux booleans
|
||||
[ansible.posix.selinux](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.selinux_module.rst)|Change policy and state of SELinux
|
||||
[ansible.posix.synchronize](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.synchronize_module.rst)|A wrapper around rsync to make common tasks in your playbooks quick and easy
|
||||
[ansible.posix.sysctl](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.sysctl_module.rst)|Manage entries in sysctl.conf.
|
||||
[ansible.posix.acl](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.acl_module.rst)|Set and retrieve file ACL information.
|
||||
[ansible.posix.at](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.at_module.rst)|Schedule the execution of a command or script file via the at command
|
||||
[ansible.posix.authorized_key](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.authorized_key_module.rst)|Adds or removes an SSH authorized key
|
||||
[ansible.posix.firewalld](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.firewalld_module.rst)|Manage arbitrary ports/services with firewalld
|
||||
[ansible.posix.firewalld_info](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.firewalld_info_module.rst)|Gather information about firewalld
|
||||
[ansible.posix.mount](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.mount_module.rst)|Control active and configured mount points
|
||||
[ansible.posix.patch](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.patch_module.rst)|Apply patch files using the GNU patch tool
|
||||
[ansible.posix.seboolean](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.seboolean_module.rst)|Toggles SELinux booleans
|
||||
[ansible.posix.selinux](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.selinux_module.rst)|Change policy and state of SELinux
|
||||
[ansible.posix.synchronize](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.synchronize_module.rst)|A wrapper around rsync to make common tasks in your playbooks quick and easy
|
||||
[ansible.posix.sysctl](https://github.com/ansible-collections/ansible.posix/blob/main/docs/ansible.posix.sysctl_module.rst)|Manage entries in sysctl.conf.
|
||||
|
||||
<!--end collection content-->
|
||||
|
||||
@@ -72,9 +78,7 @@ This collection follows the Ansible project's
|
||||
Please read and familiarize yourself with this document.
|
||||
|
||||
## Release notes
|
||||
|
||||
* 0.1.1 Initial stable build
|
||||
* 0.1.0 Internal only build
|
||||
See [changelog](https://github.com/ansible-collections/ansible.posix/blob/main/CHANGELOG.rst) for more details.
|
||||
|
||||
## External requirements
|
||||
|
||||
@@ -84,9 +88,12 @@ None
|
||||
|
||||
<!-- List the versions of Ansible the collection has been tested with. Must match what is in galaxy.yml. -->
|
||||
|
||||
* ansible-base 2.11 (devel)
|
||||
* ansible-base 2.10 (Beta)
|
||||
* ansible-base 2.9 (stable)
|
||||
- ansible-core 2.14 (devel)
|
||||
- ansible-core 2.13 (stable)
|
||||
- ansible-core 2.12 (stable)
|
||||
- ansible-core 2.11 (stable)
|
||||
- ansible-base 2.10 (stable)
|
||||
- ansible 2.9 (stable)
|
||||
|
||||
## Roadmap
|
||||
|
||||
@@ -105,4 +112,4 @@ None
|
||||
|
||||
GNU General Public License v3.0 or later.
|
||||
|
||||
See [COPYING](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text.
|
||||
See [COPYING](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text.
|
||||
|
||||
4
bindep.txt
Normal file
4
bindep.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
# This is a cross-platform list tracking distribution packages needed by tests;
|
||||
# see https://docs.openstack.org/infra/bindep/ for additional information.
|
||||
|
||||
rsync [platform:rhel-8 platform:rhel-9]
|
||||
262
changelogs/changelog.yaml
Normal file
262
changelogs/changelog.yaml
Normal file
@@ -0,0 +1,262 @@
|
||||
ancestor: null
|
||||
releases:
|
||||
1.0.0:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Allow unsetting existing environment vars via environment by specifying a
|
||||
null value (https://github.com/ansible/ansible/pull/68236).
|
||||
- Mount - Handle remount with new options (https://github.com/ansible/ansible/issues/59460).
|
||||
- Profile_tasks - result was a odict_items which is not subscriptable, so the
|
||||
slicing was failing (https://github.com/ansible/ansible/issues/59059).
|
||||
- Revert "mount - Check if src exists before mounted (ansible/ansible#61752)".
|
||||
- Typecast results before use in profile_tasks callback (https://github.com/ansible/ansible/issues/69563).
|
||||
- authorized_keys - Added FIDO2 security keys (https://github.com/ansible-collections/ansible.posix/issues/17).
|
||||
- authorized_keys - fix inconsistent return value for check mode (https://github.com/ansible-collections/ansible.posix/issues/37)
|
||||
- json callback - Fix host result to task references in the resultant JSON output
|
||||
for non-lockstep strategy plugins such as free (https://github.com/ansible/ansible/issues/65931)
|
||||
- mount - fix issues with ismount module_util pathing for Ansible 2.9 (fixes
|
||||
https://github.com/ansible-collections/ansible.posix/issues/21)
|
||||
- patch - fix FQCN usage for action plugin (https://github.com/ansible-collections/ansible.posix/issues/11)
|
||||
- selinux - add missing configuration keys for /etc/selinux/config (https://github.com/ansible-collections/ansible.posix/issues/23)
|
||||
- synchronize - fix FQCN usage for action plugin (https://github.com/ansible-collections/ansible.posix/issues/11)
|
||||
major_changes:
|
||||
- Bootstrap Collection (https://github.com/ansible-collections/ansible.posix/pull/1).
|
||||
minor_changes:
|
||||
- CI should use devel (https://github.com/ansible-collections/ansible.posix/pull/6).
|
||||
- Enable tests for at, patch and synchronize modules (https://github.com/ansible-collections/ansible.posix/pull/5).
|
||||
- Enabled tags in galaxy.yml (https://github.com/ansible-collections/ansible.posix/issues/18).
|
||||
- Migrate hacking/cgroup_perf_recap_graph.py to this collection, since the cgroup_perf_recap
|
||||
callback lives here.
|
||||
- Remove license key from galaxy.yml.
|
||||
- Remove sanity jobs from shippable (https://github.com/ansible-collections/ansible.posix/pull/43).
|
||||
- Removed ANSIBLE_METADATA from all the modules.
|
||||
- Revert "Enable at, patch and synchronize tests (https://github.com/ansible-collections/ansible.posix/pull/5)".
|
||||
- Update EXAMPLES section in modules to use FQCN.
|
||||
- Update README.md (https://github.com/ansible-collections/ansible.posix/pull/4/).
|
||||
fragments:
|
||||
- 11-action-plugins-use-fqcn.yml
|
||||
- 12_migrate_cgroup_perf_recap_graph.yml
|
||||
- 14_mount_option.yml
|
||||
- 15_profile_tasks.yml
|
||||
- 17_authorized_keys.yml
|
||||
- 19_enable_tags.yml
|
||||
- 21-mount-module_util-routing-issue.yml
|
||||
- 23-selinux-doesnt-create-missing-config-keys.yml
|
||||
- 25_ansible_metadata.yml
|
||||
- 26_profile_tasks_doc.yml
|
||||
- 27_update_examples.yml
|
||||
- 33_mount.yml
|
||||
- 35_disable_tests.yml
|
||||
- 37-authorized_keys-inconsistent-check-mode-values.yml
|
||||
- 39_remove_license.yml
|
||||
- 43_remove_shippable.yml
|
||||
- 4_update_readme.yml
|
||||
- 5_enable_tests.yml
|
||||
- 65931-json-callback-non-lockstep-output.yml
|
||||
- 6_test_devel.yml
|
||||
- 7_env.yml
|
||||
- initial_commit.yaml
|
||||
modules:
|
||||
- description: Set and retrieve file ACL information.
|
||||
name: acl
|
||||
namespace: ''
|
||||
- description: Schedule the execution of a command or script file via the at command
|
||||
name: at
|
||||
namespace: ''
|
||||
- description: Adds or removes an SSH authorized key
|
||||
name: authorized_key
|
||||
namespace: ''
|
||||
- description: Control active and configured mount points
|
||||
name: mount
|
||||
namespace: ''
|
||||
- description: Apply patch files using the GNU patch tool
|
||||
name: patch
|
||||
namespace: ''
|
||||
- description: Toggles SELinux booleans
|
||||
name: seboolean
|
||||
namespace: ''
|
||||
- description: Change policy and state of SELinux
|
||||
name: selinux
|
||||
namespace: ''
|
||||
- description: A wrapper around rsync to make common tasks in your playbooks quick
|
||||
and easy
|
||||
name: synchronize
|
||||
namespace: ''
|
||||
- description: Manage entries in sysctl.conf.
|
||||
name: sysctl
|
||||
namespace: ''
|
||||
release_date: '2020-06-19'
|
||||
1.1.0:
|
||||
changes:
|
||||
minor_changes:
|
||||
- firewalld - add firewalld module to ansible.posix collection
|
||||
fragments:
|
||||
- firewalld_migration.yml
|
||||
release_date: '2020-07-15'
|
||||
1.1.1:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Fix synchronize to work with renamed docker and buildah connection plugins.
|
||||
minor_changes:
|
||||
- skippy - fixed the deprecation warning (by date) for skippy callback plugin
|
||||
fragments:
|
||||
- 74_synchronize_docker.yml
|
||||
- skippy_deprecation.yml
|
||||
release_date: '2020-09-02'
|
||||
1.2.0:
|
||||
changes:
|
||||
bugfixes:
|
||||
- at - add AIX support (https://github.com/ansible-collections/ansible.posix/pull/99).
|
||||
- synchronize - add ``community.docker.docker`` to the list of supported transports
|
||||
(https://github.com/ansible-collections/ansible.posix/issues/132).
|
||||
- synchronize - do not prepend PWD when path is in form user@server:path or
|
||||
server:path (https://github.com/ansible-collections/ansible.posix/pull/118).
|
||||
- synchronize - fix for private_key overriding in synchronize module.
|
||||
- sysctl - do not persist sysctl when value is invalid (https://github.com/ansible-collections/ansible.posix/pull/101).
|
||||
minor_changes:
|
||||
- firewalld - bring the ``target`` feature back (https://github.com/ansible-collections/ansible.posix/issues/112).
|
||||
- fix sanity test for various modules.
|
||||
- synchronize - add the ``ssh_connection_multiplexing`` option to allow SSH
|
||||
connection multiplexing (https://github.com/ansible/ansible/issues/24365).
|
||||
release_summary: 'This is the minor release of the ``ansible.posix`` collection.
|
||||
|
||||
This changelog contains all changes to the modules in this collection that
|
||||
|
||||
have been added after the release of ``ansible.posix`` 1.1.0.'
|
||||
fragments:
|
||||
- 1.2.0.yml
|
||||
- 101-sysctl-dont-persist-when-invalid.yml
|
||||
- 118-synchronize_bugfix.yml
|
||||
- 120-synchronize_add_option.yml
|
||||
- 144_add_community_docker_connection_plugin_alias.yml
|
||||
- 82-private-key-override-fix.yml
|
||||
- 99-at_add_aix_support.yml
|
||||
- firewalld_zone_target.yml
|
||||
- misc_fix.yml
|
||||
release_date: '2021-03-08'
|
||||
1.3.0:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Synchronize module not recognizing remote ssh key (https://github.com/ansible-collections/ansible.posix/issues/24).
|
||||
- Synchronize not using quotes around arguments like --out-format (https://github.com/ansible-collections/ansible.posix/issues/190).
|
||||
- at - append line-separator to the end of the ``command`` (https://github.com/ansible-collections/ansible.posix/issues/169).
|
||||
- csh - define ``ECHO`` and ``COMMAND_SEP`` (https://github.com/ansible-collections/ansible.posix/issues/204).
|
||||
- firewalld - enable integration after migration (https://github.com/ansible-collections/ansible.posix/pull/239).
|
||||
- firewalld - ensure idempotency with firewalld 0.9.3 (https://github.com/ansible-collections/ansible.posix/issues/179).
|
||||
- firewalld - fix setting zone target to ``%%REJECT%%`` (https://github.com/ansible-collections/ansible.posix/pull/215).
|
||||
- mount - Handle ``boot`` option on Solaris correctly (https://github.com/ansible-collections/ansible.posix/issues/184).
|
||||
- synchronize - add ``community.podman.podman`` to the list of supported connection
|
||||
plugins (https://github.com/ansible-community/molecule-podman/issues/45).
|
||||
- synchronize - complete podman support for synchronize module.
|
||||
- synchronize - properly quote rsync CLI parameters (https://github.com/ansible-collections/ansible.posix/pull/241).
|
||||
- synchronize - replace removed ``ansible_ssh_user`` by ``ansible_user`` everywhere;
|
||||
do the same for ``ansible_ssh_port`` and ``ansible_ssh_host`` (https://github.com/ansible-collections/ansible.posix/issues/60).
|
||||
- synchronize - use SSH args from SSH connection plugin (https://github.com/ansible-collections/ansible.posix/issues/222).
|
||||
- synchronize - use become_user when invoking rsync on remote with sudo (https://github.com/ansible-collections/ansible.posix/issues/186).
|
||||
- sysctl - modifying conditional check for docker to fix tests being skipped
|
||||
(https://github.com/ansible-collections/ansible.posix/pull/226).
|
||||
minor_changes:
|
||||
- acl - add new alias ``recurse`` for ``recursive`` parameter (https://github.com/ansible-collections/ansible.posix/issues/124).
|
||||
- added 2.11 branch to test matrix, added ignore-2.12.txt.
|
||||
- authorized_key - add ``no_log=False`` in ``argument_spec`` to clear false-positives
|
||||
of ``no-log-needed`` (https://github.com/ansible-collections/ansible.posix/pull/156).
|
||||
- authorized_key - add a list of valid key types (https://github.com/ansible-collections/ansible.posix/issues/134).
|
||||
- mount - Change behavior of ``boot`` option to set ``noauto`` on BSD nodes
|
||||
(https://github.com/ansible-collections/ansible.posix/issues/28).
|
||||
- mount - Change behavior of ``boot`` option to set ``noauto`` on Linux nodes
|
||||
(https://github.com/ansible-collections/ansible.posix/issues/28).
|
||||
- mount - add ``no_log=False`` in ``argument_spec`` to clear false-positives
|
||||
of ``no-log-needed`` (https://github.com/ansible-collections/ansible.posix/pull/156).
|
||||
- mount - returns ``backup_file`` value when a backup fstab is created.
|
||||
- synchronize - add ``delay_updates`` option (https://github.com/ansible-collections/ansible.posix/issues/157).
|
||||
- synchronize - fix typo (https://github.com/ansible-collections/ansible.posix/pull/198).
|
||||
release_summary: 'This is the minor release of the ``ansible.posix`` collection.
|
||||
|
||||
This changelog contains all changes to the modules in this collection that
|
||||
|
||||
have been added after the release of ``ansible.posix`` 1.2.0.'
|
||||
fragments:
|
||||
- 1.3.0.yml
|
||||
- 124_acl.yml
|
||||
- 126_mount_not_returning_backup_file.yml
|
||||
- 134_authorized_key.yml
|
||||
- 156-fix_no-log-needed_false_positives.yml
|
||||
- 159-fix-60-deprecated-ansible_ssh_user.yml
|
||||
- 167-synchronize-add_delay_option.yml
|
||||
- 169_add_lineseparator_to_command.yml
|
||||
- 175_synchronize.yml
|
||||
- 179_firewalld.yml
|
||||
- 181-update_codecov_sh_url.yml
|
||||
- 185_mount_at_boot.yml
|
||||
- 187-fix-synchronize-become-user.yml
|
||||
- 193_firewalld.yml
|
||||
- 196_boot_opt_for_linux.yml
|
||||
- 203_boot_opt_for_bsd.yml
|
||||
- 204_csh_shell.yml
|
||||
- 207-mount_tests.yml
|
||||
- 213_quote_cmd_args.yml
|
||||
- 214-add_firewalld_info_module.yml
|
||||
- 215_fix_REJECT_target_name.yml
|
||||
- 217-restructure_authrized_key_test.yml
|
||||
- 222_synchronize.yml
|
||||
- 226_sysctl_fix_integration_test.yml
|
||||
- 229_add_podman_connection_plugin_to_synchronize.yml
|
||||
- 230_complete_podman_support_for_synchronize.yml
|
||||
- 233-fix-wrong-firewalld-version-info.yml
|
||||
- 241-synchronize-shell-quoting.yml
|
||||
- firewalld_integ_test.yml
|
||||
- firewalld_test.yml
|
||||
- sanity_test_ignore_file.yml
|
||||
- synchronize.yml
|
||||
- test_matrix.yml
|
||||
release_date: '2021-08-11'
|
||||
1.4.0:
|
||||
changes:
|
||||
bugfixes:
|
||||
- Fix for whitespace in source full path causing error ```code 23) at main.c(1330)
|
||||
[sender=3.2.3]``` (https://github.com/ansible-collections/ansible.posix/pull/278)
|
||||
- Include ``PSF-license.txt`` file for ``plugins/module_utils/_version.py``.
|
||||
- Use vendored version of ``distutils.version`` instead of the deprecated Python
|
||||
standard library to address PEP 632 (https://github.com/ansible-collections/ansible.posix/issues/303).
|
||||
- firewalld - Correct usage of queryForwardPort (https://github.com/ansible-collections/ansible.posix/issues/247).
|
||||
- firewalld - Refine the handling of exclusive options (https://github.com/ansible-collections/ansible.posix/issues/255).
|
||||
- mount - add a newline at the end of line in ``fstab`` (https://github.com/ansible-collections/ansible.posix/issues/210).
|
||||
- profile_tasks - Correctly calculate task execution time with serial execution
|
||||
(https://github.com/ansible-collections/ansible.posix/issues/83).
|
||||
- seboolean - add ``python3-libsemanage`` package dependency for RHEL8+ systems.
|
||||
minor_changes:
|
||||
- firewalld - Show warning message that variable type of ``masquerade`` and
|
||||
``icmp_block_inversion`` will be changed from ``str`` to ``boolean`` in the
|
||||
future release (https://github.com/ansible-collections/ansible.posix/pull/254).
|
||||
- selinux - optionally update kernel boot params when disabling/re-enabling
|
||||
SELinux (https://github.com/ansible-collections/ansible.posix/pull/142).
|
||||
release_summary: 'This is the minor release of the ``ansible.posix`` collection.
|
||||
|
||||
This changelog contains all changes to the modules in this collection that
|
||||
|
||||
have been added after the release of ``ansible.posix`` 1.3.0.'
|
||||
fragments:
|
||||
- 1.4.0.yml
|
||||
- 211_fstab_append_newline.yml
|
||||
- 247_firewalld.yml
|
||||
- 254_variable_warnings.yml
|
||||
- 255_authorized_key_url.yml
|
||||
- 263_profile_tasks_with_serial.yml
|
||||
- 272-copy_ignore_txt.yml
|
||||
- 277_fix_integration_test_on_devel.yml
|
||||
- 282_fix_unit_test_for_synchronize.yml
|
||||
- 287_firewalld_requirements.yml
|
||||
- 288_mounts_options.yml
|
||||
- 297_firewalld_exclusive_options_handling.yml
|
||||
- 299_seboolean_python3.yml
|
||||
- 302_shippable_exit_code.yml
|
||||
- 304_pep632.yml
|
||||
- 346_copy_ignore_txt_for_devel.yml
|
||||
- 347_add_branch_213.yml
|
||||
- 349_follow_new_guidelines.yml
|
||||
- 353_ci_fix_unittest_for_synchronize.yml
|
||||
- disable_selinux_via_kernel_cmdline.yml
|
||||
- psf-license.yml
|
||||
- sanity_fixes.yml
|
||||
- shell_escape_full_path_for_rsync.yml
|
||||
release_date: '2022-05-23'
|
||||
@@ -2,7 +2,7 @@ changelog_filename_template: ../CHANGELOG.rst
|
||||
changelog_filename_version_depth: 0
|
||||
changes_file: changelog.yaml
|
||||
changes_format: combined
|
||||
keep_fragments: true
|
||||
keep_fragments: false
|
||||
mention_ancestor: true
|
||||
new_plugins_after_name: removed_features
|
||||
notesdir: fragments
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
bugfixes:
|
||||
- patch - fix FQCN usage for action plugin (https://github.com/ansible-collections/ansible.posix/issues/11)
|
||||
- synchronize - fix FQCN usage for action plugin (https://github.com/ansible-collections/ansible.posix/issues/11)
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Migrate hacking/cgroup_perf_recap_graph.py to this collection, since the cgroup_perf_recap callback lives here.
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- Mount - Handle remount with new options (https://github.com/ansible/ansible/issues/59460).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- Profile_tasks - result was a odict_items which is not subscriptable, so the slicing was failing (https://github.com/ansible/ansible/issues/59059).
|
||||
2
changelogs/fragments/166_mount_absent_fstab.yml
Normal file
2
changelogs/fragments/166_mount_absent_fstab.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- mount - Add ``absent_from_fstab`` state (https://github.com/ansible-collections/ansible.posix/pull/166).
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
bugfixes:
|
||||
- authorized_keys - Added FIDO2 security keys (https://github.com/ansible-collections/ansible.posix/issues/17).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Enabled tags in galaxy.yml (https://github.com/ansible-collections/ansible.posix/issues/18).
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
bugfixes:
|
||||
- mount - fix issues with ismount module_util pathing for Ansible 2.9 (fixes https://github.com/ansible-collections/ansible.posix/issues/21)
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
bugfixes:
|
||||
- selinux - add missing configuration keys for /etc/selinux/config (https://github.com/ansible-collections/ansible.posix/issues/23)
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Removed ANSIBLE_METADATA from all the modules.
|
||||
4
changelogs/fragments/267_mount_ephemeral.yml
Normal file
4
changelogs/fragments/267_mount_ephemeral.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
minor_changes:
|
||||
- mount - Add ``ephemeral`` value for the ``state`` parameter, that allows to mount a filesystem
|
||||
without altering the ``fstab`` file (https://github.com/ansible-collections/ansible.posix/pull/267).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- Typecast results before use in profile_tasks callback (https://github.com/ansible/ansible/issues/69563).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Update EXAMPLES section in modules to use FQCN.
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- Revert "mount - Check if src exists before mounted (ansible/ansible#61752)".
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Revert "Enable at, patch and synchronize tests (https://github.com/ansible-collections/ansible.posix/pull/5)".
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- Update version number in galaxy.yml to 1.5.0.
|
||||
@@ -1,3 +0,0 @@
|
||||
---
|
||||
bugfixes:
|
||||
- authorized_keys - fix inconsistent return value for check mode (https://github.com/ansible-collections/ansible.posix/issues/37)
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- CI - Refactor AZP to address new test infrastructure (https://github.com/ansible-collections/news-for-maintainers/issues/17).
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
bugfixes:
|
||||
- firewall - Fixed to output a more complete missing library message.
|
||||
3
changelogs/fragments/375_update_azp_container.yml
Normal file
3
changelogs/fragments/375_update_azp_container.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- CI - AZP test container to 3.0.0 (https://github.com/ansible-collections/news-for-maintainers/issues/18).
|
||||
3
changelogs/fragments/380_update_usage_profile_tasks.yml
Normal file
3
changelogs/fragments/380_update_usage_profile_tasks.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
bugfixes:
|
||||
- Removed contentious terminology to match reference documentation in profile_tasks.
|
||||
3
changelogs/fragments/386_follow_ci_testing_rules.yml
Normal file
3
changelogs/fragments/386_follow_ci_testing_rules.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- CI - following the new CI testing rule ansible-test-sanity-docker-devel.
|
||||
3
changelogs/fragments/389_ci_add_stable_214.yml
Normal file
3
changelogs/fragments/389_ci_add_stable_214.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- CI - Add stable-2.14 to AZP (https://github.com/ansible-collections/ansible.posix/issues/388).
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
bugfixes:
|
||||
- synchronize - Fixed hosts involved in rsync require the same password
|
||||
5
changelogs/fragments/393-rpm-ostree.yml
Normal file
5
changelogs/fragments/393-rpm-ostree.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
minor_changes:
|
||||
- rhel_facts - new facts module to handle RHEL specific facts
|
||||
- rhel_rpm_ostree - new module to handle RHEL rpm-ostree specific package management functionality
|
||||
- rpm_ostree_upgrade - new module to automate rpm-ostree upgrades
|
||||
4
changelogs/fragments/393_rhel_for_edge.yml
Normal file
4
changelogs/fragments/393_rhel_for_edge.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
minor_changes:
|
||||
- r4e_rpm_ostree - new module for validating package state on RHEL for Edge
|
||||
- rpm_ostree_upgrade - new module to manage upgrades for rpm-ostree based systems
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Remove license key from galaxy.yml.
|
||||
3
changelogs/fragments/400-fix-boolean-values-in-docs.yml
Normal file
3
changelogs/fragments/400-fix-boolean-values-in-docs.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- Change boolean values in documentation to ``true/false`` (https://github.com/ansible-collections/ansible.posix/pull/400).
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
trivial:
|
||||
- acl - document default value for the ``entry`` parameter
|
||||
- rhel_rpm_ostree - document default value for the ``name`` parameter
|
||||
3
changelogs/fragments/407_fix_firewalld_port_test.yml
Normal file
3
changelogs/fragments/407_fix_firewalld_port_test.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- Fix firewalld port test cases to avoid port duplicatation.
|
||||
3
changelogs/fragments/409_update_azp_matrix.yml
Normal file
3
changelogs/fragments/409_update_azp_matrix.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
trivial:
|
||||
- CI - Update AZP CI matrix (https://github.com/ansible-collections/ansible.posix/issues/408).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Remove sanity jobs from shippable (https://github.com/ansible-collections/ansible.posix/pull/43).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Update README.md (https://github.com/ansible-collections/ansible.posix/pull/4/).
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- Enable tests for at, patch and synchronize modules (https://github.com/ansible-collections/ansible.posix/pull/5).
|
||||
@@ -1,4 +0,0 @@
|
||||
bugfixes:
|
||||
- json callback - Fix host result to task references in the resultant JSON
|
||||
output for non-lockstep strategy plugins such as free
|
||||
(https://github.com/ansible/ansible/issues/65931)
|
||||
@@ -1,2 +0,0 @@
|
||||
minor_changes:
|
||||
- CI should use devel (https://github.com/ansible-collections/ansible.posix/pull/6).
|
||||
@@ -1,2 +0,0 @@
|
||||
bugfixes:
|
||||
- Allow unsetting existing environment vars via environment by specifying a null value (https://github.com/ansible/ansible/pull/68236).
|
||||
@@ -1,2 +0,0 @@
|
||||
major_changes:
|
||||
- Bootstrap Collection (https://github.com/ansible-collections/ansible.posix/pull/1).
|
||||
1
codecov.yml
Normal file
1
codecov.yml
Normal file
@@ -0,0 +1 @@
|
||||
comment: false
|
||||
@@ -31,217 +31,221 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>default</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If the target is a directory, setting this to <code>yes</code> will make it the default ACL for entities created inside the directory.</div>
|
||||
<div>Setting <code>default</code> to <code>yes</code> causes an error if the path is a file.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If the target is a directory, setting this to <code>yes</code> will make it the default ACL for entities created inside the directory.</div>
|
||||
<div>Setting <code>default</code> to <code>yes</code> causes an error if the path is a file.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>entity</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The actual user or group that the ACL applies to when matching entity types user or group are selected.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The actual user or group that the ACL applies to when matching entity types user or group are selected.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>entry</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>DEPRECATED.</div>
|
||||
<div>The ACL to set or remove.</div>
|
||||
<div>This must always be quoted in the form of <code><etype>:<qualifier>:<perms></code>.</div>
|
||||
<div>The qualifier may be empty for some types, but the type and perms are always required.</div>
|
||||
<div><code>-</code> can be used as placeholder when you do not care about permissions.</div>
|
||||
<div>This is now superseded by entity, type and permissions fields.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>DEPRECATED.</div>
|
||||
<div>The ACL to set or remove.</div>
|
||||
<div>This must always be quoted in the form of <code><etype>:<qualifier>:<perms></code>.</div>
|
||||
<div>The qualifier may be empty for some types, but the type and perms are always required.</div>
|
||||
<div><code>-</code> can be used as placeholder when you do not care about permissions.</div>
|
||||
<div>This is now superseded by entity, type and permissions fields.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>etype</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>group</li>
|
||||
<li>mask</li>
|
||||
<li>other</li>
|
||||
<li>user</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The entity type of the ACL to apply, see <code>setfacl</code> documentation for more info.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>group</li>
|
||||
<li>mask</li>
|
||||
<li>other</li>
|
||||
<li>user</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The entity type of the ACL to apply, see <code>setfacl</code> documentation for more info.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>follow</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether to follow symlinks on the path if a symlink is encountered.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether to follow symlinks on the path if a symlink is encountered.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>path</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The full path of the file or object.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: name</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The full path of the file or object.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: name</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>permissions</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The permissions to apply/remove can be any combination of <code>r</code>, <code>w</code> and <code>x</code> (read, write and execute respectively)</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The permissions to apply/remove can be any combination of <code>r</code>, <code>w</code>, <code>x</code></div>
|
||||
<div>(read, write and execute respectively), and <code>X</code> (execute permission if the file is a directory or already has execute permission for some user)</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>recalculate_mask</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>default</b> ←</div></li>
|
||||
<li>mask</li>
|
||||
<li>no_mask</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Select if and when to recalculate the effective right masks of the files.</div>
|
||||
<div>See <code>setfacl</code> documentation for more info.</div>
|
||||
<div>Incompatible with <code>state=query</code>.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>default</b> ←</div></li>
|
||||
<li>mask</li>
|
||||
<li>no_mask</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Select if and when to recalculate the effective right masks of the files.</div>
|
||||
<div>See <code>setfacl</code> documentation for more info.</div>
|
||||
<div>Incompatible with <code>state=query</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>recursive</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Recursively sets the specified ACL.</div>
|
||||
<div>Incompatible with <code>state=query</code>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Recursively sets the specified ACL.</div>
|
||||
<div>Incompatible with <code>state=query</code>.</div>
|
||||
<div>Alias <code>recurse</code> added in version 1.3.0.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: recurse</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li>present</li>
|
||||
<li><div style="color: blue"><b>query</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Define whether the ACL should be present or not.</div>
|
||||
<div>The <code>query</code> state gets the current ACL without changing it, for use in <code>register</code> operations.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li>present</li>
|
||||
<li><div style="color: blue"><b>query</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Define whether the ACL should be present or not.</div>
|
||||
<div>The <code>query</code> state gets the current ACL without changing it, for use in <code>register</code> operations.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>use_nfsv4_acls</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Use NFSv4 ACLs instead of POSIX ACLs.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Use NFSv4 ACLs instead of POSIX ACLs.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -258,9 +262,8 @@ Notes
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
- name: Grant user Joe read access to a file
|
||||
ansible.posix.acl:
|
||||
path: /etc/foo.conf
|
||||
@@ -298,7 +301,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Return Values
|
||||
-------------
|
||||
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||
@@ -311,24 +313,24 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
||||
<th>Returned</th>
|
||||
<th width="100%">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>acl</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Current ACL on provided path (after changes, if any)</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['user::rwx', 'group::rwx', 'other::rwx']</div>
|
||||
</td>
|
||||
<div>Current ACL on provided path (after changes, if any)</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['user::rwx', 'group::rwx', 'other::rwx']</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/><br/>
|
||||
|
||||
|
||||
@@ -341,5 +343,3 @@ Authors
|
||||
|
||||
- Brian Coca (@bcoca)
|
||||
- Jérémie Astori (@astorije)
|
||||
|
||||
|
||||
|
||||
@@ -38,113 +38,113 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>command</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>A command to be executed in the future.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>A command to be executed in the future.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>count</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">integer</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The count of units in the future to execute the command or script file.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The count of units in the future to execute the command or script file.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>script_file</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>An existing script file to be executed in the future.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>An existing script file to be executed in the future.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The state dictates if the command or script file should be evaluated as present(added) or absent(deleted).</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The state dictates if the command or script file should be evaluated as present(added) or absent(deleted).</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>unique</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If a matching job is present a new job will not be added.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If a matching job is present a new job will not be added.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>units</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>minutes</li>
|
||||
<li>hours</li>
|
||||
<li>days</li>
|
||||
<li>weeks</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The type of units in the future to execute the command or script file.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>minutes</li>
|
||||
<li>hours</li>
|
||||
<li>days</li>
|
||||
<li>weeks</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The type of units in the future to execute the command or script file.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -153,9 +153,8 @@ Parameters
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
- name: Schedule a command to execute in 20 minutes as root
|
||||
ansible.posix.at:
|
||||
command: ls -d / >/dev/null
|
||||
@@ -177,7 +176,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
@@ -186,5 +184,3 @@ Authors
|
||||
~~~~~~~
|
||||
|
||||
- Richard Isaacson (@risaacson)
|
||||
|
||||
|
||||
|
||||
@@ -31,191 +31,193 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>comment</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Change the comment on the public key.</div>
|
||||
<div>Rewriting the comment is useful in cases such as fetching it from GitHub or GitLab.</div>
|
||||
<div>If no comment is specified, the existing comment will be kept.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Change the comment on the public key.</div>
|
||||
<div>Rewriting the comment is useful in cases such as fetching it from GitHub or GitLab.</div>
|
||||
<div>If no comment is specified, the existing comment will be kept.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>exclusive</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether to remove all other non-specified keys from the authorized_keys file.</div>
|
||||
<div>Multiple keys can be specified in a single <code>key</code> string value by separating them by newlines.</div>
|
||||
<div>This option is not loop aware, so if you use <code>with_</code> , it will be exclusive per iteration of the loop.</div>
|
||||
<div>If you want multiple keys in the file you need to pass them all to <code>key</code> in a single batch as mentioned above.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether to remove all other non-specified keys from the authorized_keys file.</div>
|
||||
<div>Multiple keys can be specified in a single <code>key</code> string value by separating them by newlines.</div>
|
||||
<div>This option is not loop aware, so if you use <code>with_</code> , it will be exclusive per iteration of the loop.</div>
|
||||
<div>If you want multiple keys in the file you need to pass them all to <code>key</code> in a single batch as mentioned above.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>follow</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Follow path symlink instead of replacing it.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Follow path symlink instead of replacing it.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>key</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys).</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys).</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>key_options</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>A string of ssh key options to be prepended to the key in the authorized_keys file.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>A string of ssh key options to be prepended to the key in the authorized_keys file.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>manage_dir</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether this module should manage the directory of the authorized key file.</div>
|
||||
<div>If set to <code>yes</code>, the module will create the directory, as well as set the owner and permissions of an existing directory.</div>
|
||||
<div>Be sure to set <code>manage_dir=no</code> if you are using an alternate directory for authorized_keys, as set with <code>path</code>, since you could lock yourself out of SSH access.</div>
|
||||
<div>See the example below.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether this module should manage the directory of the authorized key file.</div>
|
||||
<div>If set to <code>yes</code>, the module will create the directory, as well as set the owner and permissions of an existing directory.</div>
|
||||
<div>Be sure to set <code>manage_dir=no</code> if you are using an alternate directory for authorized_keys, as set with <code>path</code>, since you could lock yourself out of SSH access.</div>
|
||||
<div>See the example below.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>path</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Alternate path to the authorized_keys file.</div>
|
||||
<div>When unset, this value defaults to <em>~/.ssh/authorized_keys</em>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Alternate path to the authorized_keys file.</div>
|
||||
<div>When unset, this value defaults to <em>~/.ssh/authorized_keys</em>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether the given key (with the given key_options) should or should not be in the file.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether the given key (with the given key_options) should or should not be in the file.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>user</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The username on the remote host whose authorized_keys file will be modified.</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The username on the remote host whose authorized_keys file will be modified.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>validate_certs</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>This only applies if using a https url as the source of the keys.</div>
|
||||
<div>If set to <code>no</code>, the SSL certificates will not be validated.</div>
|
||||
<div>This should only set to <code>no</code> used on personally controlled sites using self-signed certificates as it avoids verifying the source site.</div>
|
||||
<div>Prior to 2.1 the code worked as if this was set to <code>yes</code>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>This only applies if using a https url as the source of the keys.</div>
|
||||
<div>If set to <code>no</code>, the SSL certificates will not be validated.</div>
|
||||
<div>This should only set to <code>no</code> used on personally controlled sites using self-signed certificates as it avoids verifying the source site.</div>
|
||||
<div>Prior to 2.1 the code worked as if this was set to <code>yes</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -224,9 +226,8 @@ Parameters
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
- name: Set authorized key taken from file
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
@@ -239,6 +240,12 @@ Examples
|
||||
state: present
|
||||
key: https://github.com/charlie.keys
|
||||
|
||||
- name: Set authorized keys taken from url using lookup
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: "{{ lookup('url', 'https://github.com/charlie.keys', split_lines=False) }}"
|
||||
|
||||
- name: Set authorized key in alternate location
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
@@ -285,7 +292,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Return Values
|
||||
-------------
|
||||
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||
@@ -298,169 +304,169 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
||||
<th>Returned</th>
|
||||
<th width="100%">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>exclusive</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>If the key has been forced to be exclusive or not.</div>
|
||||
<br/>
|
||||
</td>
|
||||
<div>If the key has been forced to be exclusive or not.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>key</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The key that the module was running against.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">https://github.com/user.keys</div>
|
||||
</td>
|
||||
<div>The key that the module was running against.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">https://github.com/user.keys</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>key_option</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Key options related to the key.</div>
|
||||
<br/>
|
||||
</td>
|
||||
<div>Key options related to the key.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>keyfile</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Path for authorized key file.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">/home/user/.ssh/authorized_keys</div>
|
||||
</td>
|
||||
<div>Path for authorized key file.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">/home/user/.ssh/authorized_keys</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>manage_dir</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Whether this module managed the directory of the authorized key file.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">True</div>
|
||||
</td>
|
||||
<div>Whether this module managed the directory of the authorized key file.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">True</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>path</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Alternate path to the authorized_keys file</div>
|
||||
<br/>
|
||||
</td>
|
||||
<div>Alternate path to the authorized_keys file</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Whether the given key (with the given key_options) should or should not be in the file</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">present</div>
|
||||
</td>
|
||||
<div>Whether the given key (with the given key_options) should or should not be in the file</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">present</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>unique</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Whether the key is unique</div>
|
||||
<br/>
|
||||
</td>
|
||||
<div>Whether the key is unique</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>user</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The username on the remote host whose authorized_keys file will be modified</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">user</div>
|
||||
</td>
|
||||
<div>The username on the remote host whose authorized_keys file will be modified</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">user</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>validate_certs</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>This only applies if using a https url as the source of the keys. If set to <code>no</code>, the SSL certificates will not be validated.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">True</div>
|
||||
</td>
|
||||
<div>This only applies if using a https url as the source of the keys. If set to <code>no</code>, the SSL certificates will not be validated.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">True</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/><br/>
|
||||
|
||||
|
||||
@@ -472,5 +478,3 @@ Authors
|
||||
~~~~~~~
|
||||
|
||||
- Ansible Core Team
|
||||
|
||||
|
||||
|
||||
520
docs/ansible.posix.firewalld_info_module.rst
Normal file
520
docs/ansible.posix.firewalld_info_module.rst
Normal file
@@ -0,0 +1,520 @@
|
||||
.. _ansible.posix.firewalld_info_module:
|
||||
|
||||
|
||||
****************************
|
||||
ansible.posix.firewalld_info
|
||||
****************************
|
||||
|
||||
**Gather information about firewalld**
|
||||
|
||||
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
:depth: 1
|
||||
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
- This module gathers information about firewalld rules.
|
||||
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
The below requirements are needed on the host that executes this module.
|
||||
|
||||
- firewalld >= 0.2.11
|
||||
- python-firewall
|
||||
- python-dbus
|
||||
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<table border=0 cellpadding=0 class="documentation-table">
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>active_zones</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Gather information about active zones.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>zones</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
/ <span style="color: purple">elements=string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Gather information about specific zones.</div>
|
||||
<div>If only works if <code>active_zones</code> is set to <code>false</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: Gather information about active zones
|
||||
ansible.posix.firewalld_info:
|
||||
active_zones: yes
|
||||
|
||||
- name: Gather information about specific zones
|
||||
ansible.posix.firewalld_info:
|
||||
zones:
|
||||
- public
|
||||
- external
|
||||
- internal
|
||||
|
||||
|
||||
|
||||
Return Values
|
||||
-------------
|
||||
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<table border=0 cellpadding=0 class="documentation-table">
|
||||
<tr>
|
||||
<th colspan="4">Key</th>
|
||||
<th>Returned</th>
|
||||
<th width="100%">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>active_zones</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Gather active zones only if turn it <code>true</code>.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>collected_zones</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of collected zones.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['external', 'internal']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>firewalld_info</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">complex</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>Returns various information about firewalld configuration.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="3">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>default_zones</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The zone name of default zone.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">public</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="3">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>version</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The version information of firewalld.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">0.8.2</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="3">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>zones</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">complex</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A dict of zones to gather information.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>zone</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">complex</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The zone name registered in firewalld.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">external</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>forward</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The network interface forwarding.</div>
|
||||
<div>This parameter supports on python-firewall 0.9.0(or later) and is not collected in earlier versions.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>forward_ports</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of forwarding port pair with protocol.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['icmp', 'ipv6-icmp']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>icmp_block_inversion</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The ICMP block inversion to block all ICMP requests.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>icmp_blocks</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of blocking icmp protocol.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['echo-request']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>interfaces</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of network interfaces.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['eth0', 'eth1']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>masquerade</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>The network interface masquerading.</div>
|
||||
<br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>ports</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of network port with protocol.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[['22', 'tcp'], ['80', 'tcp']]</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>protocols</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of network protocol.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['icmp', 'ipv6-icmp']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>rich_rules</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of rich language rule.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['rule protocol value="icmp" reject', 'rule priority="32767" reject']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>services</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of network services.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['dhcp', 'dns', 'ssh']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>source_ports</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of network source port with protocol.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[['30000', 'tcp'], ['30001', 'tcp']]</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>sources</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of source network address.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['172.16.30.0/24', '172.16.31.0/24']</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td class="elbow-placeholder"> </td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>target</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of services in the zone.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">ACCEPT</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>undefined_zones</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>success</td>
|
||||
<td>
|
||||
<div>A list of undefined zones in <code>zones</code> option.</div>
|
||||
<div><code>undefined_zones</code> will be ignored for gathering process.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['foo', 'bar']</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/><br/>
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
- Hideki Saito (@saito-hideki)
|
||||
500
docs/ansible.posix.firewalld_module.rst
Normal file
500
docs/ansible.posix.firewalld_module.rst
Normal file
@@ -0,0 +1,500 @@
|
||||
.. _ansible.posix.firewalld_module:
|
||||
|
||||
|
||||
***********************
|
||||
ansible.posix.firewalld
|
||||
***********************
|
||||
|
||||
**Manage arbitrary ports/services with firewalld**
|
||||
|
||||
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
:depth: 1
|
||||
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
- This module allows for addition or deletion of services and ports (either TCP or UDP) in either running or permanent firewalld rules.
|
||||
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
The below requirements are needed on the host that executes this module.
|
||||
|
||||
- firewalld >= 0.2.11
|
||||
- python-firewall >= 0.2.11
|
||||
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<table border=0 cellpadding=0 class="documentation-table">
|
||||
<tr>
|
||||
<th colspan="2">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>icmp_block</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The ICMP block you would like to add/remove to/from a zone in firewalld.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>icmp_block_inversion</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Enable/Disable inversion of ICMP blocks for a zone in firewalld.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>immediate</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Should this configuration be applied immediately, if set as permanent.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>interface</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The interface you would like to add/remove to/from a zone in firewalld.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>masquerade</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The masquerade setting you would like to enable/disable to/from zones within firewalld.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>offline</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether to run this module even when firewalld is offline.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>permanent</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Should this configuration be in the running firewalld configuration or persist across reboots.</div>
|
||||
<div>As of Ansible 2.3, permanent operations can operate on firewalld configs when it is not running (requires firewalld >= 0.3.9).</div>
|
||||
<div>Note that if this is <code>no</code>, immediate is assumed <code>yes</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>port</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Name of a port or port range to add/remove to/from firewalld.</div>
|
||||
<div>Must be in the form PORT/PROTOCOL or PORT-PORT/PROTOCOL for port ranges.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>port_forward</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
/ <span style="color: purple">elements=dictionary</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Port and protocol to forward using firewalld.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"></td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>port</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Source port to forward from</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"></td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>proto</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>udp</li>
|
||||
<li>tcp</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>protocol to forward</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"></td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>toaddr</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Optional address to forward to</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="elbow-placeholder"></td>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>toport</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>destination port</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>rich_rule</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Rich rule to add/remove to/from firewalld.</div>
|
||||
<div>See <a href='https://firewalld.org/documentation/man-pages/firewalld.richlanguage.html'>Syntax for firewalld rich language rules</a>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>service</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Name of a service to add/remove to/from firewalld.</div>
|
||||
<div>The service must be listed in output of firewall-cmd --get-services.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>source</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The source/network you would like to add/remove to/from firewalld.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li>disabled</li>
|
||||
<li>enabled</li>
|
||||
<li>present</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Enable or disable a setting.</div>
|
||||
<div>For ports: Should this port accept (enabled) or reject (disabled) connections.</div>
|
||||
<div>The states <code>present</code> and <code>absent</code> can only be used in zone level operations (i.e. when no other parameters but zone and state are set).</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>target</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
<div style="font-style: italic; font-size: small; color: darkgreen">added in 1.2.0</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>default</li>
|
||||
<li>ACCEPT</li>
|
||||
<li>DROP</li>
|
||||
<li>%%REJECT%%</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>firewalld Zone target</div>
|
||||
<div>If state is set to <code>absent</code>, this will reset the target to default</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>timeout</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">integer</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">0</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>The amount of time in seconds the rule should be in effect for when non-permanent.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>zone</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The firewalld zone to add/remove to/from.</div>
|
||||
<div>Note that the default zone can be configured per system but <code>public</code> is default from upstream.</div>
|
||||
<div>Available choices can be extended based on per-system configs, listed here are "out of the box" defaults.</div>
|
||||
<div>Possible values include <code>block</code>, <code>dmz</code>, <code>drop</code>, <code>external</code>, <code>home</code>, <code>internal</code>, <code>public</code>, <code>trusted</code>, <code>work</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
.. note::
|
||||
- Not tested on any Debian based system.
|
||||
- Requires the python2 bindings of firewalld, which may not be installed by default.
|
||||
- For distributions where the python2 firewalld bindings are unavailable (e.g Fedora 28 and later) you will have to set the ansible_python_interpreter for these hosts to the python3 interpreter path and install the python3 bindings.
|
||||
- Zone transactions (creating, deleting) can be performed by using only the zone and state parameters "present" or "absent". Note that zone transactions must explicitly be permanent. This is a limitation in firewalld. This also means that you will have to reload firewalld after adding a zone that you wish to perform immediate actions on. The module will not take care of this for you implicitly because that would undo any previously performed immediate actions which were not permanent. Therefore, if you require immediate access to a newly created zone it is recommended you reload firewalld immediately after the zone creation returns with a changed state and before you perform any other immediate, non-permanent actions on that zone.
|
||||
- This module needs ``python-firewall`` or ``python3-firewall`` on managed nodes. It is usually provided as a subset with ``firewalld`` from the OS distributor for the OS default Python interpreter.
|
||||
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: permit traffic in default zone for https service
|
||||
ansible.posix.firewalld:
|
||||
service: https
|
||||
permanent: yes
|
||||
state: enabled
|
||||
|
||||
- name: do not permit traffic in default zone on port 8081/tcp
|
||||
ansible.posix.firewalld:
|
||||
port: 8081/tcp
|
||||
permanent: yes
|
||||
state: disabled
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
port: 161-162/udp
|
||||
permanent: yes
|
||||
state: enabled
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
zone: dmz
|
||||
service: http
|
||||
permanent: yes
|
||||
state: enabled
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
rich_rule: rule service name="ftp" audit limit value="1/m" accept
|
||||
permanent: yes
|
||||
state: enabled
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
source: 192.0.2.0/24
|
||||
zone: internal
|
||||
state: enabled
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
zone: trusted
|
||||
interface: eth2
|
||||
permanent: yes
|
||||
state: enabled
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
masquerade: yes
|
||||
state: enabled
|
||||
permanent: yes
|
||||
zone: dmz
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
zone: custom
|
||||
state: present
|
||||
permanent: yes
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
zone: drop
|
||||
state: enabled
|
||||
permanent: yes
|
||||
icmp_block_inversion: yes
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
zone: drop
|
||||
state: enabled
|
||||
permanent: yes
|
||||
icmp_block: echo-request
|
||||
|
||||
- ansible.posix.firewalld:
|
||||
zone: internal
|
||||
state: present
|
||||
permanent: yes
|
||||
target: ACCEPT
|
||||
|
||||
- name: Redirect port 443 to 8443 with Rich Rule
|
||||
ansible.posix.firewalld:
|
||||
rich_rule: rule family=ipv4 forward-port port=443 protocol=tcp to-port=8443
|
||||
zone: public
|
||||
permanent: yes
|
||||
immediate: yes
|
||||
state: enabled
|
||||
|
||||
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
- Adam Miller (@maxamillion)
|
||||
@@ -31,193 +31,198 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>backup</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>boot</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Determines if the filesystem should be mounted on boot.</div>
|
||||
<div>Only applies to Solaris systems.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Determines if the filesystem should be mounted on boot.</div>
|
||||
<div>Only applies to Solaris and Linux systems.</div>
|
||||
<div>For Solaris systems, <code>true</code> will set <code>yes</code> as the value of mount at boot in <em>/etc/vfstab</em>.</div>
|
||||
<div>For Linux, FreeBSD, NetBSD and OpenBSD systems, <code>false</code> will add <code>noauto</code> to mount options in <em>/etc/fstab</em>.</div>
|
||||
<div>To avoid mount option conflicts, if <code>noauto</code> specified in <code>opts</code>, mount module will ignore <code>boot</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>dump</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">0</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Dump (see fstab(5)).</div>
|
||||
<div>Note that if set to <code>null</code> and <em>state</em> set to <code>present</code>, it will cease to work and duplicate entries will be made with subsequent runs.</div>
|
||||
<div>Has no effect on Solaris systems.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">"0"</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Dump (see fstab(5)).</div>
|
||||
<div>Note that if set to <code>null</code> and <em>state</em> set to <code>present</code>, it will cease to work and duplicate entries will be made with subsequent runs.</div>
|
||||
<div>Has no effect on Solaris systems.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>fstab</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>File to use instead of <code>/etc/fstab</code>.</div>
|
||||
<div>You should not use this option unless you really know what you are doing.</div>
|
||||
<div>This might be useful if you need to configure mountpoints in a chroot environment.</div>
|
||||
<div>OpenBSD does not allow specifying alternate fstab files with mount so do not use this on OpenBSD with any state that operates on the live filesystem.</div>
|
||||
<div>This parameter defaults to /etc/fstab or /etc/vfstab on Solaris.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>File to use instead of <code>/etc/fstab</code>.</div>
|
||||
<div>You should not use this option unless you really know what you are doing.</div>
|
||||
<div>This might be useful if you need to configure mountpoints in a chroot environment.</div>
|
||||
<div>OpenBSD does not allow specifying alternate fstab files with mount so do not use this on OpenBSD with any state that operates on the live filesystem.</div>
|
||||
<div>This parameter defaults to /etc/fstab or /etc/vfstab on Solaris.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>fstype</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Filesystem type.</div>
|
||||
<div>Required when <em>state</em> is <code>present</code> or <code>mounted</code>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Filesystem type.</div>
|
||||
<div>Required when <em>state</em> is <code>present</code> or <code>mounted</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>opts</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Mount options (see fstab(5), or vfstab(4) on Solaris).</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Mount options (see fstab(5), or vfstab(4) on Solaris).</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>passno</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">0</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Passno (see fstab(5)).</div>
|
||||
<div>Note that if set to <code>null</code> and <em>state</em> set to <code>present</code>, it will cease to work and duplicate entries will be made with subsequent runs.</div>
|
||||
<div>Deprecated on Solaris systems.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">"0"</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Passno (see fstab(5)).</div>
|
||||
<div>Note that if set to <code>null</code> and <em>state</em> set to <code>present</code>, it will cease to work and duplicate entries will be made with subsequent runs.</div>
|
||||
<div>Deprecated on Solaris systems.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>path</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path to the mount point (e.g. <code>/mnt/files</code>).</div>
|
||||
<div>Before Ansible 2.3 this option was only usable as <em>dest</em>, <em>destfile</em> and <em>name</em>.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: name</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path to the mount point (e.g. <code>/mnt/files</code>).</div>
|
||||
<div>Before Ansible 2.3 this option was only usable as <em>dest</em>, <em>destfile</em> and <em>name</em>.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: name</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>src</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Device (or NFS volume, or something else) to be mounted on <em>path</em>.</div>
|
||||
<div>Required when <em>state</em> set to <code>present</code> or <code>mounted</code>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Device (or NFS volume, or something else) to be mounted on <em>path</em>.</div>
|
||||
<div>Required when <em>state</em> set to <code>present</code> or <code>mounted</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li>mounted</li>
|
||||
<li>present</li>
|
||||
<li>unmounted</li>
|
||||
<li>remounted</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If <code>mounted</code>, the device will be actively mounted and appropriately configured in <em>fstab</em>. If the mount point is not present, the mount point will be created.</div>
|
||||
<div>If <code>unmounted</code>, the device will be unmounted without changing <em>fstab</em>.</div>
|
||||
<div><code>present</code> only specifies that the device is to be configured in <em>fstab</em> and does not trigger or require a mount.</div>
|
||||
<div><code>absent</code> specifies that the device mount's entry will be removed from <em>fstab</em> and will also unmount the device and remove the mount point.</div>
|
||||
<div><code>remounted</code> specifies that the device will be remounted for when you want to force a refresh on the mount itself (added in 2.9). This will always return changed=true. If <em>opts</em> is set, the options will be applied to the remount, but will not change <em>fstab</em>. Additionally, if <em>opts</em> is set, and the remount command fails, the module will error to prevent unexpected mount changes. Try using <code>mounted</code> instead to work around this issue.</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li>mounted</li>
|
||||
<li>present</li>
|
||||
<li>unmounted</li>
|
||||
<li>remounted</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If <code>mounted</code>, the device will be actively mounted and appropriately configured in <em>fstab</em>. If the mount point is not present, the mount point will be created.</div>
|
||||
<div>If <code>unmounted</code>, the device will be unmounted without changing <em>fstab</em>.</div>
|
||||
<div><code>present</code> only specifies that the device is to be configured in <em>fstab</em> and does not trigger or require a mount.</div>
|
||||
<div><code>absent</code> specifies that the device mount's entry will be removed from <em>fstab</em> and will also unmount the device and remove the mount point.</div>
|
||||
<div><code>remounted</code> specifies that the device will be remounted for when you want to force a refresh on the mount itself (added in 2.9). This will always return changed=true. If <em>opts</em> is set, the options will be applied to the remount, but will not change <em>fstab</em>. Additionally, if <em>opts</em> is set, and the remount command fails, the module will error to prevent unexpected mount changes. Try using <code>mounted</code> instead to work around this issue.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -233,9 +238,8 @@ Notes
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
# Before 2.3, option 'name' was used instead of 'path'
|
||||
- name: Mount DVD read-only
|
||||
ansible.posix.mount:
|
||||
@@ -291,10 +295,18 @@ Examples
|
||||
ansible.posix.mount:
|
||||
src: 192.168.1.100:/nfs/ssd/shared_data
|
||||
path: /mnt/shared_data
|
||||
opts: rw,sync,hard,intr
|
||||
opts: rw,sync,hard
|
||||
state: mounted
|
||||
fstype: nfs
|
||||
|
||||
- name: Mount NFS volumes with noauto according to boot option
|
||||
ansible.posix.mount:
|
||||
src: 192.168.1.100:/nfs/ssd/shared_data
|
||||
path: /mnt/shared_data
|
||||
opts: rw,sync,hard
|
||||
boot: no
|
||||
state: mounted
|
||||
fstype: nfs
|
||||
|
||||
|
||||
|
||||
@@ -308,5 +320,3 @@ Authors
|
||||
|
||||
- Ansible Core Team
|
||||
- Seth Vidal (@skvidal)
|
||||
|
||||
|
||||
|
||||
@@ -31,153 +31,173 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>backup</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Passes <code>--backup --version-control=numbered</code> to patch, producing numbered backup copies.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Passes <code>--backup --version-control=numbered</code> to patch, producing numbered backup copies.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>basedir</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path of a base directory in which the patch file will be applied.</div>
|
||||
<div>May be omitted when <code>dest</code> option is specified, otherwise required.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path of a base directory in which the patch file will be applied.</div>
|
||||
<div>May be omitted when <code>dest</code> option is specified, otherwise required.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>binary</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Setting to <code>yes</code> will disable patch's heuristic for transforming CRLF line endings into LF.</div>
|
||||
<div>Line endings of src and dest must match.</div>
|
||||
<div>If set to <code>no</code>, <code>patch</code> will replace CRLF in <code>src</code> files on POSIX.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Setting to <code>yes</code> will disable patch's heuristic for transforming CRLF line endings into LF.</div>
|
||||
<div>Line endings of src and dest must match.</div>
|
||||
<div>If set to <code>no</code>, <code>patch</code> will replace CRLF in <code>src</code> files on POSIX.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>dest</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path of the file on the remote machine to be patched.</div>
|
||||
<div>The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified with this option.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: originalfile</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path of the file on the remote machine to be patched.</div>
|
||||
<div>The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified with this option.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: originalfile</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>ignore_whitespace</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Setting to <code>yes</code> will ignore white space changes between patch and input..</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>remote_src</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If <code>no</code>, it will search for src at originating/master machine, if <code>yes</code> it will go to the remote/target machine for the <code>src</code>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If <code>no</code>, it will search for src at originating/controller machine, if <code>yes</code> it will go to the remote/target machine for the <code>src</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>src</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path of the patch file as accepted by the GNU patch tool. If <code>remote_src</code> is 'no', the patch source file is looked up from the module's <em>files</em> directory.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: patchfile</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path of the patch file as accepted by the GNU patch tool. If <code>remote_src</code> is 'no', the patch source file is looked up from the module's <em>files</em> directory.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: patchfile</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether the patch should be applied or reverted.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>absent</li>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether the patch should be applied or reverted.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>strip</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">integer</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">0</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Number that indicates the smallest prefix containing leading slashes that will be stripped from each file name found in the patch file.</div>
|
||||
<div>For more information see the strip parameter of the GNU patch tool.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">0</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Number that indicates the smallest prefix containing leading slashes that will be stripped from each file name found in the patch file.</div>
|
||||
<div>For more information see the strip parameter of the GNU patch tool.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -192,9 +212,8 @@ Notes
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
- name: Apply patch to one file
|
||||
ansible.posix.patch:
|
||||
src: /tmp/index.html.patch
|
||||
@@ -215,7 +234,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
@@ -225,5 +243,3 @@ Authors
|
||||
|
||||
- Jakub Jirutka (@jirutka)
|
||||
- Luis Alberto Perez Lazaro (@luisperlaz)
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ The below requirements are needed on the host that executes this module.
|
||||
|
||||
- libselinux-python
|
||||
- libsemanage-python
|
||||
- python3-libsemanage
|
||||
|
||||
|
||||
Parameters
|
||||
@@ -38,81 +39,83 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>ignore_selinux_state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Useful for scenarios (chrooted environment) that you can't get the real SELinux state.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Useful for scenarios (chrooted environment) that you can't get the real SELinux state.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>name</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Name of the boolean to configure.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Name of the boolean to configure.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>persistent</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Set to <code>yes</code> if the boolean setting should survive a reboot.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Set to <code>yes</code> if the boolean setting should survive a reboot.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Desired boolean value</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Desired boolean value</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -127,9 +130,8 @@ Notes
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
- name: Set httpd_can_network_connect flag on and keep it persistent across reboots
|
||||
ansible.posix.seboolean:
|
||||
name: httpd_can_network_connect
|
||||
@@ -139,7 +141,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
@@ -148,5 +149,3 @@ Authors
|
||||
~~~~~~~
|
||||
|
||||
- Stephen Fromm (@sfromm)
|
||||
|
||||
|
||||
|
||||
@@ -39,61 +39,83 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>configfile</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">"/etc/selinux/config"</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>The path to the SELinux configuration file, if non-standard.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: conf, file</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">"/etc/selinux/config"</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>The path to the SELinux configuration file, if non-standard.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: conf, file</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>policy</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The name of the SELinux policy to use (e.g. <code>targeted</code>) will be required if state is not <code>disabled</code>.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The name of the SELinux policy to use (e.g. <code>targeted</code>) will be required if <em>state</em> is not <code>disabled</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>disabled</li>
|
||||
<li>enforcing</li>
|
||||
<li>permissive</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The SELinux mode.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>disabled</li>
|
||||
<li>enforcing</li>
|
||||
<li>permissive</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>The SELinux mode.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>update_kernel_param</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
<div style="font-style: italic; font-size: small; color: darkgreen">added in 1.4.0</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If set to <em>true</em>, will update also the kernel boot parameters when disabling/enabling SELinux.</div>
|
||||
<div>The <code>grubby</code> tool must be present on the target system for this to work.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -102,9 +124,8 @@ Parameters
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
- name: Enable SELinux
|
||||
ansible.posix.selinux:
|
||||
policy: targeted
|
||||
@@ -121,7 +142,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Return Values
|
||||
-------------
|
||||
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
|
||||
@@ -134,92 +154,92 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
|
||||
<th>Returned</th>
|
||||
<th width="100%">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>configfile</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>Path to SELinux configuration file.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">/etc/selinux/config</div>
|
||||
</td>
|
||||
<div>Path to SELinux configuration file.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">/etc/selinux/config</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>msg</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>Messages that describe changes that were made.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">Config SELinux state changed from 'disabled' to 'permissive'</div>
|
||||
</td>
|
||||
<div>Messages that describe changes that were made.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">Config SELinux state changed from 'disabled' to 'permissive'</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>policy</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>Name of the SELinux policy.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">targeted</div>
|
||||
</td>
|
||||
<div>Name of the SELinux policy.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">targeted</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>reboot_required</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>Whether or not an reboot is required for the changes to take effect.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">True</div>
|
||||
</td>
|
||||
<div>Whether or not an reboot is required for the changes to take effect.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">True</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="return-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>always</td>
|
||||
<td>
|
||||
<div>SELinux mode.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">enforcing</div>
|
||||
</td>
|
||||
<div>SELinux mode.</div>
|
||||
<br/>
|
||||
<div style="font-size: smaller"><b>Sample:</b></div>
|
||||
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">enforcing</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/><br/>
|
||||
|
||||
|
||||
@@ -231,5 +251,3 @@ Authors
|
||||
~~~~~~~
|
||||
|
||||
- Derek Carter (@goozbach) <goozbach@friocorte.com>
|
||||
|
||||
|
||||
|
||||
@@ -34,492 +34,538 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>archive</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>checksum</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will not disable it.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will not disable it.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>compress</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Compress file data during the transfer.</div>
|
||||
<div>In most cases, leave this enabled unless it causes problems.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Compress file data during the transfer.</div>
|
||||
<div>In most cases, leave this enabled unless it causes problems.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>copy_links</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Copy symlinks as the item that they point to (the referent) is copied, rather than the symlink.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Copy symlinks as the item that they point to (the referent) is copied, rather than the symlink.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>delay_updates</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
<div style="font-style: italic; font-size: small; color: darkgreen">added in 1.3.0</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>This option puts the temporary file from each updated file into a holding directory until the end of the transfer, at which time all the files are renamed into place in rapid succession.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>delete</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Delete files in <code>dest</code> that don't exist (after transfer, not before) in the <code>src</code> path.</div>
|
||||
<div>This option requires <code>recursive=yes</code>.</div>
|
||||
<div>This option ignores excluded files and behaves like the rsync opt --delete-excluded.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Delete files in <em>dest</em> that do not exist (after transfer, not before) in the <em>src</em> path.</div>
|
||||
<div>This option requires <em>recursive=yes</em>.</div>
|
||||
<div>This option ignores excluded files and behaves like the rsync opt <code>--delete-after</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>dest</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path on the destination host that will be synchronized from the source.</div>
|
||||
<div>The path can be absolute or relative.</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path on the destination host that will be synchronized from the source.</div>
|
||||
<div>The path can be absolute or relative.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>dest_port</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">integer</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Port number for ssh on the destination host.</div>
|
||||
<div>Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value.</div>
|
||||
<div>This parameter defaults to the value of <code>ansible_ssh_port</code> or <code>ansible_port</code>, the <code>remote_port</code> config setting or the value from ssh client configuration if none of the former have been set.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Port number for ssh on the destination host.</div>
|
||||
<div>Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value.</div>
|
||||
<div>This parameter defaults to the value of <code>ansible_port</code>, the <code>remote_port</code> config setting or the value from ssh client configuration if none of the former have been set.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>dirs</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Transfer directories without recursing.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Transfer directories without recursing.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>existing_only</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Skip creating new files on receiver.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Skip creating new files on receiver.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>group</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve group.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve group.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>link_dest</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">null</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Add a destination to hard link against during the rsync.</div>
|
||||
</td>
|
||||
/ <span style="color: purple">elements=string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">null</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Add a destination to hard link against during the rsync.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>links</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Copy symlinks as symlinks.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Copy symlinks as symlinks.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>mode</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>pull</li>
|
||||
<li><div style="color: blue"><b>push</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify the direction of the synchronization.</div>
|
||||
<div>In push mode the localhost or delegate is the source.</div>
|
||||
<div>In pull mode the remote host in context is the source.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>pull</li>
|
||||
<li><div style="color: blue"><b>push</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify the direction of the synchronization.</div>
|
||||
<div>In push mode the localhost or delegate is the source.</div>
|
||||
<div>In pull mode the remote host in context is the source.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>owner</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve owner (super user only).</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve owner (super user only).</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>partial</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>perms</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve permissions.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve permissions.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>private_key</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">path</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify the private key to use for SSH-based rsync connections (e.g. <code>~/.ssh/id_rsa</code>).</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify the private key to use for SSH-based rsync connections (e.g. <code>~/.ssh/id_rsa</code>).</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>recursive</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Recurse into directories.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Recurse into directories.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>rsync_opts</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">list</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">null</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify additional rsync options by passing in an array.</div>
|
||||
<div>Note that an empty string in <code>rsync_opts</code> will end up transfer the current working directory.</div>
|
||||
</td>
|
||||
/ <span style="color: purple">elements=string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">null</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify additional rsync options by passing in an array.</div>
|
||||
<div>Note that an empty string in <code>rsync_opts</code> will end up transfer the current working directory.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>rsync_path</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify the rsync command to run on the remote host. See <code>--rsync-path</code> on the rsync man page.</div>
|
||||
<div>To specify the rsync command to run on the local host, you need to set this your task var <code>ansible_rsync_path</code>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify the rsync command to run on the remote host. See <code>--rsync-path</code> on the rsync man page.</div>
|
||||
<div>To specify the rsync command to run on the local host, you need to set this your task var <code>ansible_rsync_path</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>rsync_timeout</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">integer</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">0</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify a <code>--timeout</code> for the rsync command in seconds.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">0</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specify a <code>--timeout</code> for the rsync command in seconds.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>set_remote_user</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Put user@ for the remote paths.</div>
|
||||
<div>If you have a custom ssh config to define the remote user for a host that does not match the inventory user, you should set this parameter to <code>no</code>.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Put user@ for the remote paths.</div>
|
||||
<div>If you have a custom ssh config to define the remote user for a host that does not match the inventory user, you should set this parameter to <code>no</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>src</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path on the source host that will be synchronized to the destination.</div>
|
||||
<div>The path can be absolute or relative.</div>
|
||||
</td>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Path on the source host that will be synchronized to the destination.</div>
|
||||
<div>The path can be absolute or relative.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>ssh_connection_multiplexing</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>SSH connection multiplexing for rsync is disabled by default to prevent misconfigured ControlSockets from resulting in failed SSH connections. This is accomplished by setting the SSH <code>ControlSocket</code> to <code>none</code>.</div>
|
||||
<div>Set this option to <code>yes</code> to allow multiplexing and reduce SSH connection overhead.</div>
|
||||
<div>Note that simply setting this option to <code>yes</code> is not enough; You must also configure SSH connection multiplexing in your SSH client config by setting values for <code>ControlMaster</code>, <code>ControlPersist</code> and <code>ControlPath</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>times</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve modification times.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Preserve modification times.</div>
|
||||
<div>This parameter defaults to the value of the archive option.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>use_ssh_args</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Use the ssh_args specified in ansible.cfg.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>In Ansible 2.10 and lower, it uses the ssh_args specified in <code>ansible.cfg</code>.</div>
|
||||
<div>In Ansible 2.11 and onwards, when set to <code>true</code>, it uses all SSH connection configurations like <code>ansible_ssh_args</code>, <code>ansible_ssh_common_args</code>, and <code>ansible_ssh_extra_args</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>verify_host</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Verify destination host key.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Verify destination host key.</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -540,7 +586,7 @@ Notes
|
||||
- Inspect the verbose output to validate the destination user/host/path are what was expected.
|
||||
- To exclude files and directories from being synchronized, you may add ``.rsync-filter`` files to the source directory.
|
||||
- rsync daemon must be up and running with correct permission when using rsync protocol in source or destination path.
|
||||
- The ``synchronize`` module forces `--delay-updates` to avoid leaving a destination in a broken in-between state if the underlying rsync process encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should call rsync directly.
|
||||
- The ``synchronize`` module enables `--delay-updates` by default to avoid leaving a destination in a broken in-between state if the underlying rsync process encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should disable this option.
|
||||
- link_destination is subject to the same limitations as the underlying rsync daemon. Hard links are only preserved if the relative subtrees of the source and destination are the same. Attempts to hardlink into a directory that is a subdirectory of the source will be prevented.
|
||||
|
||||
|
||||
@@ -558,9 +604,8 @@ See Also
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
- name: Synchronization of src on the control machine to dest on the remote hosts
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
@@ -677,7 +722,7 @@ Examples
|
||||
# Specify the rsync binary to use on remote host and on local host
|
||||
- hosts: groupofhosts
|
||||
vars:
|
||||
ansible_rsync_path: /usr/gnu/bin/rsync
|
||||
ansible_rsync_path: /usr/gnu/bin/rsync
|
||||
|
||||
tasks:
|
||||
- name: copy /tmp/localpath/ to remote location /tmp/remotepath
|
||||
@@ -689,7 +734,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
@@ -698,5 +742,3 @@ Authors
|
||||
~~~~~~~
|
||||
|
||||
- Timothy Appnel (@tima)
|
||||
|
||||
|
||||
|
||||
@@ -31,133 +31,134 @@ Parameters
|
||||
<tr>
|
||||
<th colspan="1">Parameter</th>
|
||||
<th>Choices/<font color="blue">Defaults</font></th>
|
||||
<th width="100%">Comments</th>
|
||||
<th width="100%">Comments</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>ignoreerrors</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Use this option to ignore errors about unknown keys.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Use this option to ignore errors about unknown keys.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>name</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
/ <span style="color: red">required</span> </div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The dot-separated path (aka <em>key</em>) specifying the sysctl variable.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: key</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
/ <span style="color: red">required</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>The dot-separated path (also known as <em>key</em>) specifying the sysctl variable.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: key</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>reload</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If <code>yes</code>, performs a <em>/sbin/sysctl -p</em> if the <code>sysctl_file</code> is updated. If <code>no</code>, does not reload <em>sysctl</em> even if the <code>sysctl_file</code> is updated.</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li>no</li>
|
||||
<li><div style="color: blue"><b>yes</b> ←</div></li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>If <code>yes</code>, performs a <em>/sbin/sysctl -p</em> if the <code>sysctl_file</code> is updated. If <code>no</code>, does not reload <em>sysctl</em> even if the <code>sysctl_file</code> is updated.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>state</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
<li>absent</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether the entry should be present or absent in the sysctl file.</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>present</b> ←</div></li>
|
||||
<li>absent</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Whether the entry should be present or absent in the sysctl file.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>sysctl_file</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">"/etc/sysctl.conf"</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specifies the absolute path to <code>sysctl.conf</code>, if not <code>/etc/sysctl.conf</code>.</div>
|
||||
</td>
|
||||
<span style="color: purple">path</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<b>Default:</b><br/><div style="color: blue">"/etc/sysctl.conf"</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>Specifies the absolute path to <code>sysctl.conf</code>, if not <code>/etc/sysctl.conf</code>.</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>sysctl_set</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">boolean</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Verify token value with the sysctl command and set with -w if necessary</div>
|
||||
</td>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul style="margin: 0; padding: 0"><b>Choices:</b>
|
||||
<li><div style="color: blue"><b>no</b> ←</div></li>
|
||||
<li>yes</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<div>Verify token value with the sysctl command and set with -w if necessary</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<tr>
|
||||
<td colspan="1">
|
||||
<div class="ansibleOptionAnchor" id="parameter-"></div>
|
||||
<b>value</b>
|
||||
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
|
||||
<div style="font-size: small">
|
||||
<span style="color: purple">-</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Desired value of the sysctl key.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: val</div>
|
||||
</td>
|
||||
<span style="color: purple">string</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<div>Desired value of the sysctl key.</div>
|
||||
<div style="font-size: small; color: darkgreen"><br/>aliases: val</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -166,9 +167,8 @@ Parameters
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
.. code-block:: yaml
|
||||
|
||||
|
||||
# Set vm.swappiness to 5 in /etc/sysctl.conf
|
||||
- ansible.posix.sysctl:
|
||||
name: vm.swappiness
|
||||
@@ -205,7 +205,6 @@ Examples
|
||||
|
||||
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
@@ -213,6 +212,4 @@ Status
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
- David CHANIAL (@davixx) <david.chanial@gmail.com>
|
||||
|
||||
|
||||
- David CHANIAL (@davixx)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
namespace: ansible
|
||||
name: posix
|
||||
version: 1.0.0
|
||||
version: 1.5.0
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (github.com/ansible)
|
||||
description: null
|
||||
description: Ansible Collection targeting POSIX and POSIX-ish platforms.
|
||||
license_file: COPYING
|
||||
tags: [posix, networking, shell, unix]
|
||||
dependencies: {}
|
||||
repository: https://github.com/ansible-collections/ansible.posix
|
||||
documentation: https://github.com/ansible-collections/ansible.posix/tree/master/docs
|
||||
documentation: https://github.com/ansible-collections/ansible.posix/tree/main/docs
|
||||
homepage: https://github.com/ansible-collections/ansible.posix
|
||||
issues: https://github.com/ansible-collections/ansible.posix
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
---
|
||||
requires_ansible: '>=2.9,<2.11'
|
||||
requires_ansible: '>=2.9'
|
||||
plugin_routing:
|
||||
callback:
|
||||
skippy:
|
||||
deprecation:
|
||||
removal_date: '2022-06-01'
|
||||
warning_text: See the plugin documentation for more details
|
||||
|
||||
@@ -21,6 +21,7 @@ import os.path
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.common._collections_compat import MutableSequence
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
@@ -28,12 +29,23 @@ from ansible.plugins.action import ActionBase
|
||||
from ansible.plugins.loader import connection_loader
|
||||
|
||||
|
||||
DOCKER = ['docker', 'community.general.docker', 'community.docker.docker']
|
||||
PODMAN = ['podman', 'ansible.builtin.podman', 'containers.podman.podman']
|
||||
BUILDAH = ['buildah', 'containers.podman.buildah']
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
||||
def _get_absolute_path(self, path):
|
||||
original_path = path
|
||||
|
||||
if path.startswith('rsync://'):
|
||||
#
|
||||
# Check if we have a local relative path and do not process
|
||||
# * remote paths (some.server.domain:/some/remote/path/...)
|
||||
# * URLs (rsync://...)
|
||||
# * local absolute paths (/some/local/path/...)
|
||||
#
|
||||
if ':' in path or path.startswith('/'):
|
||||
return path
|
||||
|
||||
if self._task._role is not None:
|
||||
@@ -60,21 +72,19 @@ class ActionModule(ActionBase):
|
||||
return path
|
||||
|
||||
# If using docker or buildah, do not add user information
|
||||
if self._remote_transport not in ['docker', 'buildah'] and user:
|
||||
if self._remote_transport not in DOCKER + PODMAN + BUILDAH and user:
|
||||
user_prefix = '%s@' % (user, )
|
||||
|
||||
if self._host_is_ipv6_address(host):
|
||||
return '[%s%s]:%s' % (user_prefix, host, path)
|
||||
else:
|
||||
return '%s%s:%s' % (user_prefix, host, path)
|
||||
return '%s%s:%s' % (user_prefix, host, path)
|
||||
|
||||
def _process_origin(self, host, path, user):
|
||||
|
||||
if host not in C.LOCALHOST:
|
||||
return self._format_rsync_rsh_target(host, path, user)
|
||||
|
||||
if ':' not in path and not path.startswith('/'):
|
||||
path = self._get_absolute_path(path=path)
|
||||
path = self._get_absolute_path(path=path)
|
||||
return path
|
||||
|
||||
def _process_remote(self, task_args, host, path, user, port_matches_localhost_port):
|
||||
@@ -103,8 +113,7 @@ class ActionModule(ActionBase):
|
||||
task_args['_substitute_controller'] = True
|
||||
return self._format_rsync_rsh_target(host, path, user)
|
||||
|
||||
if ':' not in path and not path.startswith('/'):
|
||||
path = self._get_absolute_path(path=path)
|
||||
path = self._get_absolute_path(path=path)
|
||||
return path
|
||||
|
||||
def _override_module_replaced_vars(self, task_vars):
|
||||
@@ -168,12 +177,25 @@ class ActionModule(ActionBase):
|
||||
|
||||
# Store remote connection type
|
||||
self._remote_transport = self._connection.transport
|
||||
use_ssh_args = _tmp_args.pop('use_ssh_args', None)
|
||||
|
||||
if use_ssh_args and self._connection.transport == 'ssh':
|
||||
ssh_args = [
|
||||
self._connection.get_option('ssh_args'),
|
||||
self._connection.get_option('ssh_common_args'),
|
||||
self._connection.get_option('ssh_extra_args'),
|
||||
]
|
||||
_tmp_args['ssh_args'] = ' '.join([a for a in ssh_args if a])
|
||||
|
||||
# Handle docker connection options
|
||||
if self._remote_transport == 'docker':
|
||||
if self._remote_transport in DOCKER:
|
||||
self._docker_cmd = self._connection.docker_cmd
|
||||
if self._play_context.docker_extra_args:
|
||||
self._docker_cmd = "%s %s" % (self._docker_cmd, self._play_context.docker_extra_args)
|
||||
elif self._remote_transport in PODMAN:
|
||||
self._docker_cmd = self._connection._options['podman_executable']
|
||||
if self._connection._options.get('podman_extra_args'):
|
||||
self._docker_cmd = "%s %s" % (self._docker_cmd, self._connection._options['podman_extra_args'])
|
||||
|
||||
# self._connection accounts for delegate_to so
|
||||
# remote_transport is the transport ansible thought it would need
|
||||
@@ -191,8 +213,8 @@ class ActionModule(ActionBase):
|
||||
|
||||
# ssh paramiko docker buildah and local are fully supported transports. Anything
|
||||
# else only works with delegate_to
|
||||
if delegate_to is None and self._connection.transport not in \
|
||||
('ssh', 'paramiko', 'local', 'docker', 'buildah'):
|
||||
if delegate_to is None and self._connection.transport not in [
|
||||
'ssh', 'paramiko', 'local'] + DOCKER + PODMAN + BUILDAH:
|
||||
result['failed'] = True
|
||||
result['msg'] = (
|
||||
"synchronize uses rsync to function. rsync needs to connect to the remote "
|
||||
@@ -201,11 +223,8 @@ class ActionModule(ActionBase):
|
||||
"so it cannot work." % self._connection.transport)
|
||||
return result
|
||||
|
||||
use_ssh_args = _tmp_args.pop('use_ssh_args', None)
|
||||
|
||||
# Parameter name needed by the ansible module
|
||||
_tmp_args['_local_rsync_path'] = task_vars.get('ansible_rsync_path') or 'rsync'
|
||||
_tmp_args['_local_rsync_password'] = task_vars.get('ansible_ssh_pass') or task_vars.get('ansible_password')
|
||||
|
||||
# rsync thinks that one end of the connection is localhost and the
|
||||
# other is the host we're running the task for (Note: We use
|
||||
@@ -215,14 +234,10 @@ class ActionModule(ActionBase):
|
||||
src_host = '127.0.0.1'
|
||||
inventory_hostname = task_vars.get('inventory_hostname')
|
||||
dest_host_inventory_vars = task_vars['hostvars'].get(inventory_hostname)
|
||||
try:
|
||||
dest_host = dest_host_inventory_vars['ansible_host']
|
||||
except KeyError:
|
||||
dest_host = dest_host_inventory_vars.get('ansible_ssh_host', inventory_hostname)
|
||||
dest_host = dest_host_inventory_vars.get('ansible_host', inventory_hostname)
|
||||
|
||||
dest_host_ids = [hostid for hostid in (dest_host_inventory_vars.get('inventory_hostname'),
|
||||
dest_host_inventory_vars.get('ansible_host'),
|
||||
dest_host_inventory_vars.get('ansible_ssh_host'))
|
||||
dest_host_inventory_vars.get('ansible_host'))
|
||||
if hostid is not None]
|
||||
|
||||
localhost_ports = set()
|
||||
@@ -246,7 +261,7 @@ class ActionModule(ActionBase):
|
||||
dest_is_local = True
|
||||
|
||||
# CHECK FOR NON-DEFAULT SSH PORT
|
||||
inv_port = task_vars.get('ansible_ssh_port', None) or C.DEFAULT_REMOTE_PORT
|
||||
inv_port = task_vars.get('ansible_port', None) or C.DEFAULT_REMOTE_PORT
|
||||
if _tmp_args.get('dest_port', None) is None:
|
||||
if inv_port is not None:
|
||||
_tmp_args['dest_port'] = inv_port
|
||||
@@ -317,26 +332,27 @@ class ActionModule(ActionBase):
|
||||
if src is None or dest is None:
|
||||
return dict(failed=True, msg="synchronize requires both src and dest parameters are set")
|
||||
|
||||
# Determine if we need a user@
|
||||
# Determine if we need a user@ and a password
|
||||
user = None
|
||||
password = task_vars.get('ansible_ssh_pass', None) or task_vars.get('ansible_password', None)
|
||||
if not dest_is_local:
|
||||
# Src and dest rsync "path" handling
|
||||
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
|
||||
if use_delegate:
|
||||
user = task_vars.get('ansible_delegated_vars', dict()).get('ansible_ssh_user', None)
|
||||
user = task_vars.get('ansible_delegated_vars', dict()).get('ansible_user', None)
|
||||
if not user:
|
||||
user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
|
||||
user = task_vars.get('ansible_user') or self._play_context.remote_user
|
||||
if not user:
|
||||
user = C.DEFAULT_REMOTE_USER
|
||||
|
||||
else:
|
||||
user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
|
||||
user = task_vars.get('ansible_user') or self._play_context.remote_user
|
||||
|
||||
if self._templar is not None:
|
||||
user = self._templar.template(user)
|
||||
|
||||
# Private key handling
|
||||
private_key = self._play_context.private_key_file
|
||||
|
||||
if private_key is not None:
|
||||
_tmp_args['private_key'] = private_key
|
||||
# Use the private_key parameter if passed else use context private_key_file
|
||||
_tmp_args['private_key'] = _tmp_args.get('private_key', self._play_context.private_key_file)
|
||||
|
||||
# use the mode to define src and dest's url
|
||||
if _tmp_args.get('mode', 'push') == 'pull':
|
||||
@@ -347,14 +363,17 @@ class ActionModule(ActionBase):
|
||||
# src is a local path, dest is a remote path: <user>@<host>
|
||||
src = self._process_origin(src_host, src, user)
|
||||
dest = self._process_remote(_tmp_args, dest_host, dest, user, inv_port in localhost_ports)
|
||||
|
||||
password = dest_host_inventory_vars.get('ansible_ssh_pass', None) or dest_host_inventory_vars.get('ansible_password', None)
|
||||
if self._templar is not None:
|
||||
password = self._templar.template(password)
|
||||
else:
|
||||
# Still need to munge paths (to account for roles) even if we aren't
|
||||
# copying files between hosts
|
||||
if not src.startswith('/'):
|
||||
src = self._get_absolute_path(path=src)
|
||||
if not dest.startswith('/'):
|
||||
dest = self._get_absolute_path(path=dest)
|
||||
src = self._get_absolute_path(path=src)
|
||||
dest = self._get_absolute_path(path=dest)
|
||||
|
||||
_tmp_args['_local_rsync_password'] = password
|
||||
_tmp_args['src'] = src
|
||||
_tmp_args['dest'] = dest
|
||||
|
||||
@@ -367,11 +386,14 @@ class ActionModule(ActionBase):
|
||||
if not dest_is_local:
|
||||
# don't escalate for docker. doing --rsync-path with docker exec fails
|
||||
# and we can switch directly to the user via docker arguments
|
||||
if self._play_context.become and not rsync_path and self._remote_transport != 'docker':
|
||||
if self._play_context.become and not rsync_path and self._remote_transport not in DOCKER + PODMAN:
|
||||
# If no rsync_path is set, become was originally set, and dest is
|
||||
# remote then add privilege escalation here.
|
||||
if self._play_context.become_method == 'sudo':
|
||||
rsync_path = 'sudo rsync'
|
||||
if self._play_context.become_user:
|
||||
rsync_path = 'sudo -u %s rsync' % self._play_context.become_user
|
||||
else:
|
||||
rsync_path = 'sudo rsync'
|
||||
# TODO: have to add in the rest of the become methods here
|
||||
|
||||
# We cannot use privilege escalation on the machine running the
|
||||
@@ -381,17 +403,9 @@ class ActionModule(ActionBase):
|
||||
|
||||
_tmp_args['rsync_path'] = rsync_path
|
||||
|
||||
if use_ssh_args:
|
||||
ssh_args = [
|
||||
getattr(self._play_context, 'ssh_args', ''),
|
||||
getattr(self._play_context, 'ssh_common_args', ''),
|
||||
getattr(self._play_context, 'ssh_extra_args', ''),
|
||||
]
|
||||
_tmp_args['ssh_args'] = ' '.join([a for a in ssh_args if a])
|
||||
|
||||
# If launching synchronize against docker container
|
||||
# use rsync_opts to support container to override rsh options
|
||||
if self._remote_transport in ['docker', 'buildah'] and not use_delegate:
|
||||
if self._remote_transport in DOCKER + BUILDAH + PODMAN and not use_delegate:
|
||||
# Replicate what we do in the module argumentspec handling for lists
|
||||
if not isinstance(_tmp_args.get('rsync_opts'), MutableSequence):
|
||||
tmp_rsync_opts = _tmp_args.get('rsync_opts', [])
|
||||
@@ -404,15 +418,15 @@ class ActionModule(ActionBase):
|
||||
if '--blocking-io' not in _tmp_args['rsync_opts']:
|
||||
_tmp_args['rsync_opts'].append('--blocking-io')
|
||||
|
||||
if self._remote_transport in ['docker']:
|
||||
if self._remote_transport in DOCKER + PODMAN:
|
||||
if become and self._play_context.become_user:
|
||||
_tmp_args['rsync_opts'].append("--rsh=%s exec -u %s -i" % (self._docker_cmd, self._play_context.become_user))
|
||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('%s exec -u %s -i' % (self._docker_cmd, self._play_context.become_user)))
|
||||
elif user is not None:
|
||||
_tmp_args['rsync_opts'].append("--rsh=%s exec -u %s -i" % (self._docker_cmd, user))
|
||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('%s exec -u %s -i' % (self._docker_cmd, user)))
|
||||
else:
|
||||
_tmp_args['rsync_opts'].append("--rsh=%s exec -i" % self._docker_cmd)
|
||||
elif self._remote_transport in ['buildah']:
|
||||
_tmp_args['rsync_opts'].append("--rsh=buildah run --")
|
||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('%s exec -i' % self._docker_cmd))
|
||||
elif self._remote_transport in BUILDAH:
|
||||
_tmp_args['rsync_opts'].append('--rsh=' + shlex_quote('buildah run --'))
|
||||
|
||||
# run the module and store the result
|
||||
result.update(self._execute_module('ansible.posix.synchronize', module_args=_tmp_args, task_vars=task_vars))
|
||||
|
||||
@@ -11,8 +11,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'supported_by': 'community'}
|
||||
|
||||
DOCUMENTATION = '''
|
||||
callback: cgroup_perf_recap
|
||||
callback_type: aggregate
|
||||
name: cgroup_perf_recap
|
||||
type: aggregate
|
||||
requirements:
|
||||
- whitelist in configuration
|
||||
- cgroups
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
callback: debug
|
||||
name: debug
|
||||
type: stdout
|
||||
short_description: formatted stdout/stderr display
|
||||
description:
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
callback: json
|
||||
name: json
|
||||
short_description: Ansible screen output as JSON
|
||||
description:
|
||||
- This callback converts all events into JSON output to stdout
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
callback: profile_roles
|
||||
name: profile_roles
|
||||
type: aggregate
|
||||
short_description: adds timing information to roles
|
||||
description:
|
||||
|
||||
@@ -10,7 +10,7 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
callback: profile_tasks
|
||||
name: profile_tasks
|
||||
type: aggregate
|
||||
short_description: adds time information to tasks
|
||||
description:
|
||||
@@ -21,7 +21,7 @@ DOCUMENTATION = '''
|
||||
- It also lists the top/bottom time consuming tasks in the summary (configurable)
|
||||
- Before 2.4 only the environment variables were available for configuration.
|
||||
requirements:
|
||||
- whitelisting in configuration - see examples section below for details.
|
||||
- enable in configuration - see examples section below for details.
|
||||
options:
|
||||
output_limit:
|
||||
description: Number of tasks to display in the summary
|
||||
@@ -46,7 +46,7 @@ EXAMPLES = '''
|
||||
example: >
|
||||
To enable, add this to your ansible.cfg file in the defaults block
|
||||
[defaults]
|
||||
callback_whitelist = ansible.posix.profile_tasks
|
||||
callbacks_enabled=ansible.posix.profile_tasks
|
||||
sample output: >
|
||||
#
|
||||
# TASK: [ensure messaging security group exists] ********************************
|
||||
@@ -92,7 +92,8 @@ def filled(msg, fchar="*"):
|
||||
|
||||
def timestamp(self):
|
||||
if self.current is not None:
|
||||
self.stats[self.current]['time'] = time.time() - self.stats[self.current]['time']
|
||||
elapsed = time.time() - self.stats[self.current]['started']
|
||||
self.stats[self.current]['elapsed'] += elapsed
|
||||
|
||||
|
||||
def tasktime():
|
||||
@@ -151,8 +152,15 @@ class CallbackModule(CallbackBase):
|
||||
timestamp(self)
|
||||
|
||||
# Record the start time of the current task
|
||||
# stats[TASK_UUID]:
|
||||
# started: Current task start time. This value will be updated each time a task
|
||||
# with the same UUID is executed when `serial` is specified in a playbook.
|
||||
# elapsed: Elapsed time since the first serialized task was started
|
||||
self.current = task._uuid
|
||||
self.stats[self.current] = {'time': time.time(), 'name': task.get_name()}
|
||||
if self.current not in self.stats:
|
||||
self.stats[self.current] = {'started': time.time(), 'elapsed': 0.0, 'name': task.get_name()}
|
||||
else:
|
||||
self.stats[self.current]['started'] = time.time()
|
||||
if self._display.verbosity >= 2:
|
||||
self.stats[self.current]['path'] = task.get_path()
|
||||
|
||||
@@ -178,7 +186,7 @@ class CallbackModule(CallbackBase):
|
||||
if self.sort_order is not None:
|
||||
results = sorted(
|
||||
self.stats.items(),
|
||||
key=lambda x: x[1]['time'],
|
||||
key=lambda x: x[1]['elapsed'],
|
||||
reverse=self.sort_order,
|
||||
)
|
||||
|
||||
@@ -187,7 +195,7 @@ class CallbackModule(CallbackBase):
|
||||
|
||||
# Print the timings
|
||||
for uuid, result in results:
|
||||
msg = u"{0:-<{2}}{1:->9}".format(result['name'] + u' ', u' {0:.02f}s'.format(result['time']), self._display.columns - 9)
|
||||
msg = u"{0:-<{2}}{1:->9}".format(result['name'] + u' ', u' {0:.02f}s'.format(result['elapsed']), self._display.columns - 9)
|
||||
if 'path' in result:
|
||||
msg += u"\n{0:-<{1}}".format(result['path'] + u' ', self._display.columns)
|
||||
self._display.display(msg)
|
||||
|
||||
@@ -7,19 +7,19 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
callback: skippy
|
||||
callback_type: stdout
|
||||
name: skippy
|
||||
type: stdout
|
||||
requirements:
|
||||
- set as main display callback
|
||||
short_description: Ansible screen output that ignores skipped status
|
||||
deprecated:
|
||||
why: The 'default' callback plugin now supports this functionality
|
||||
removed_in: '2.11'
|
||||
alternative: "'default' callback plugin with 'display_skipped_hosts = no' option"
|
||||
why: The 'default' callback plugin now supports this functionality
|
||||
removed_at_date: '2022-06-01'
|
||||
alternative: "'default' callback plugin with 'display_skipped_hosts = no' option"
|
||||
extends_documentation_fragment:
|
||||
- default_callback
|
||||
description:
|
||||
- This callback does the same as the default except it does not output skipped host/task/item status
|
||||
- This callback does the same as the default except it does not output skipped host/task/item status
|
||||
'''
|
||||
|
||||
from ansible.plugins.callback.default import CallbackModule as CallbackModule_default
|
||||
|
||||
@@ -6,8 +6,8 @@ from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
callback: timer
|
||||
callback_type: aggregate
|
||||
name: timer
|
||||
type: aggregate
|
||||
requirements:
|
||||
- whitelist in configuration
|
||||
short_description: Adds time to play stats
|
||||
|
||||
344
plugins/module_utils/_version.py
Normal file
344
plugins/module_utils/_version.py
Normal file
@@ -0,0 +1,344 @@
|
||||
# Vendored copy of distutils/version.py from CPython 3.9.5
|
||||
#
|
||||
# Implements multiple version numbering conventions for the
|
||||
# Python Module Distribution Utilities.
|
||||
#
|
||||
# PSF License (see PSF-license.txt or https://opensource.org/licenses/Python-2.0)
|
||||
#
|
||||
|
||||
"""Provides classes to represent module version numbers (one class for
|
||||
each style of version numbering). There are currently two such classes
|
||||
implemented: StrictVersion and LooseVersion.
|
||||
|
||||
Every version number class implements the following interface:
|
||||
* the 'parse' method takes a string and parses it to some internal
|
||||
representation; if the string is an invalid version number,
|
||||
'parse' raises a ValueError exception
|
||||
* the class constructor takes an optional string argument which,
|
||||
if supplied, is passed to 'parse'
|
||||
* __str__ reconstructs the string that was passed to 'parse' (or
|
||||
an equivalent string -- ie. one that will generate an equivalent
|
||||
version number instance)
|
||||
* __repr__ generates Python code to recreate the version number instance
|
||||
* _cmp compares the current instance with either another instance
|
||||
of the same class or a string (which will be parsed to an instance
|
||||
of the same class, thus must follow the same rules)
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import re
|
||||
|
||||
try:
|
||||
RE_FLAGS = re.VERBOSE | re.ASCII
|
||||
except AttributeError:
|
||||
RE_FLAGS = re.VERBOSE
|
||||
|
||||
|
||||
class Version:
|
||||
"""Abstract base class for version numbering classes. Just provides
|
||||
constructor (__init__) and reproducer (__repr__), because those
|
||||
seem to be the same for all version numbering classes; and route
|
||||
rich comparisons to _cmp.
|
||||
"""
|
||||
|
||||
def __init__(self, vstring=None):
|
||||
if vstring:
|
||||
self.parse(vstring)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s ('%s')" % (self.__class__.__name__, str(self))
|
||||
|
||||
def __eq__(self, other):
|
||||
c = self._cmp(other)
|
||||
if c is NotImplemented:
|
||||
return c
|
||||
return c == 0
|
||||
|
||||
def __lt__(self, other):
|
||||
c = self._cmp(other)
|
||||
if c is NotImplemented:
|
||||
return c
|
||||
return c < 0
|
||||
|
||||
def __le__(self, other):
|
||||
c = self._cmp(other)
|
||||
if c is NotImplemented:
|
||||
return c
|
||||
return c <= 0
|
||||
|
||||
def __gt__(self, other):
|
||||
c = self._cmp(other)
|
||||
if c is NotImplemented:
|
||||
return c
|
||||
return c > 0
|
||||
|
||||
def __ge__(self, other):
|
||||
c = self._cmp(other)
|
||||
if c is NotImplemented:
|
||||
return c
|
||||
return c >= 0
|
||||
|
||||
|
||||
# Interface for version-number classes -- must be implemented
|
||||
# by the following classes (the concrete ones -- Version should
|
||||
# be treated as an abstract class).
|
||||
# __init__ (string) - create and take same action as 'parse'
|
||||
# (string parameter is optional)
|
||||
# parse (string) - convert a string representation to whatever
|
||||
# internal representation is appropriate for
|
||||
# this style of version numbering
|
||||
# __str__ (self) - convert back to a string; should be very similar
|
||||
# (if not identical to) the string supplied to parse
|
||||
# __repr__ (self) - generate Python code to recreate
|
||||
# the instance
|
||||
# _cmp (self, other) - compare two version numbers ('other' may
|
||||
# be an unparsed version string, or another
|
||||
# instance of your version class)
|
||||
|
||||
|
||||
class StrictVersion(Version):
|
||||
"""Version numbering for anal retentives and software idealists.
|
||||
Implements the standard interface for version number classes as
|
||||
described above. A version number consists of two or three
|
||||
dot-separated numeric components, with an optional "pre-release" tag
|
||||
on the end. The pre-release tag consists of the letter 'a' or 'b'
|
||||
followed by a number. If the numeric components of two version
|
||||
numbers are equal, then one with a pre-release tag will always
|
||||
be deemed earlier (lesser) than one without.
|
||||
|
||||
The following are valid version numbers (shown in the order that
|
||||
would be obtained by sorting according to the supplied cmp function):
|
||||
|
||||
0.4 0.4.0 (these two are equivalent)
|
||||
0.4.1
|
||||
0.5a1
|
||||
0.5b3
|
||||
0.5
|
||||
0.9.6
|
||||
1.0
|
||||
1.0.4a3
|
||||
1.0.4b1
|
||||
1.0.4
|
||||
|
||||
The following are examples of invalid version numbers:
|
||||
|
||||
1
|
||||
2.7.2.2
|
||||
1.3.a4
|
||||
1.3pl1
|
||||
1.3c4
|
||||
|
||||
The rationale for this version numbering system will be explained
|
||||
in the distutils documentation.
|
||||
"""
|
||||
|
||||
version_re = re.compile(r"^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$", RE_FLAGS)
|
||||
|
||||
def parse(self, vstring):
|
||||
match = self.version_re.match(vstring)
|
||||
if not match:
|
||||
raise ValueError("invalid version number '%s'" % vstring)
|
||||
|
||||
(major, minor, patch, prerelease, prerelease_num) = match.group(1, 2, 4, 5, 6)
|
||||
|
||||
if patch:
|
||||
self.version = tuple(map(int, [major, minor, patch]))
|
||||
else:
|
||||
self.version = tuple(map(int, [major, minor])) + (0,)
|
||||
|
||||
if prerelease:
|
||||
self.prerelease = (prerelease[0], int(prerelease_num))
|
||||
else:
|
||||
self.prerelease = None
|
||||
|
||||
def __str__(self):
|
||||
if self.version[2] == 0:
|
||||
vstring = ".".join(map(str, self.version[0:2]))
|
||||
else:
|
||||
vstring = ".".join(map(str, self.version))
|
||||
|
||||
if self.prerelease:
|
||||
vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
|
||||
|
||||
return vstring
|
||||
|
||||
def _cmp(self, other):
|
||||
if isinstance(other, str):
|
||||
other = StrictVersion(other)
|
||||
elif not isinstance(other, StrictVersion):
|
||||
return NotImplemented
|
||||
|
||||
if self.version != other.version:
|
||||
# numeric versions don't match
|
||||
# prerelease stuff doesn't matter
|
||||
if self.version < other.version:
|
||||
return -1
|
||||
else:
|
||||
return 1
|
||||
|
||||
# have to compare prerelease
|
||||
# case 1: neither has prerelease; they're equal
|
||||
# case 2: self has prerelease, other doesn't; other is greater
|
||||
# case 3: self doesn't have prerelease, other does: self is greater
|
||||
# case 4: both have prerelease: must compare them!
|
||||
|
||||
if not self.prerelease and not other.prerelease:
|
||||
return 0
|
||||
elif self.prerelease and not other.prerelease:
|
||||
return -1
|
||||
elif not self.prerelease and other.prerelease:
|
||||
return 1
|
||||
elif self.prerelease and other.prerelease:
|
||||
if self.prerelease == other.prerelease:
|
||||
return 0
|
||||
elif self.prerelease < other.prerelease:
|
||||
return -1
|
||||
else:
|
||||
return 1
|
||||
else:
|
||||
raise AssertionError("never get here")
|
||||
|
||||
|
||||
# end class StrictVersion
|
||||
|
||||
# The rules according to Greg Stein:
|
||||
# 1) a version number has 1 or more numbers separated by a period or by
|
||||
# sequences of letters. If only periods, then these are compared
|
||||
# left-to-right to determine an ordering.
|
||||
# 2) sequences of letters are part of the tuple for comparison and are
|
||||
# compared lexicographically
|
||||
# 3) recognize the numeric components may have leading zeroes
|
||||
#
|
||||
# The LooseVersion class below implements these rules: a version number
|
||||
# string is split up into a tuple of integer and string components, and
|
||||
# comparison is a simple tuple comparison. This means that version
|
||||
# numbers behave in a predictable and obvious way, but a way that might
|
||||
# not necessarily be how people *want* version numbers to behave. There
|
||||
# wouldn't be a problem if people could stick to purely numeric version
|
||||
# numbers: just split on period and compare the numbers as tuples.
|
||||
# However, people insist on putting letters into their version numbers;
|
||||
# the most common purpose seems to be:
|
||||
# - indicating a "pre-release" version
|
||||
# ('alpha', 'beta', 'a', 'b', 'pre', 'p')
|
||||
# - indicating a post-release patch ('p', 'pl', 'patch')
|
||||
# but of course this can't cover all version number schemes, and there's
|
||||
# no way to know what a programmer means without asking him.
|
||||
#
|
||||
# The problem is what to do with letters (and other non-numeric
|
||||
# characters) in a version number. The current implementation does the
|
||||
# obvious and predictable thing: keep them as strings and compare
|
||||
# lexically within a tuple comparison. This has the desired effect if
|
||||
# an appended letter sequence implies something "post-release":
|
||||
# eg. "0.99" < "0.99pl14" < "1.0", and "5.001" < "5.001m" < "5.002".
|
||||
#
|
||||
# However, if letters in a version number imply a pre-release version,
|
||||
# the "obvious" thing isn't correct. Eg. you would expect that
|
||||
# "1.5.1" < "1.5.2a2" < "1.5.2", but under the tuple/lexical comparison
|
||||
# implemented here, this just isn't so.
|
||||
#
|
||||
# Two possible solutions come to mind. The first is to tie the
|
||||
# comparison algorithm to a particular set of semantic rules, as has
|
||||
# been done in the StrictVersion class above. This works great as long
|
||||
# as everyone can go along with bondage and discipline. Hopefully a
|
||||
# (large) subset of Python module programmers will agree that the
|
||||
# particular flavour of bondage and discipline provided by StrictVersion
|
||||
# provides enough benefit to be worth using, and will submit their
|
||||
# version numbering scheme to its domination. The free-thinking
|
||||
# anarchists in the lot will never give in, though, and something needs
|
||||
# to be done to accommodate them.
|
||||
#
|
||||
# Perhaps a "moderately strict" version class could be implemented that
|
||||
# lets almost anything slide (syntactically), and makes some heuristic
|
||||
# assumptions about non-digits in version number strings. This could
|
||||
# sink into special-case-hell, though; if I was as talented and
|
||||
# idiosyncratic as Larry Wall, I'd go ahead and implement a class that
|
||||
# somehow knows that "1.2.1" < "1.2.2a2" < "1.2.2" < "1.2.2pl3", and is
|
||||
# just as happy dealing with things like "2g6" and "1.13++". I don't
|
||||
# think I'm smart enough to do it right though.
|
||||
#
|
||||
# In any case, I've coded the test suite for this module (see
|
||||
# ../test/test_version.py) specifically to fail on things like comparing
|
||||
# "1.2a2" and "1.2". That's not because the *code* is doing anything
|
||||
# wrong, it's because the simple, obvious design doesn't match my
|
||||
# complicated, hairy expectations for real-world version numbers. It
|
||||
# would be a snap to fix the test suite to say, "Yep, LooseVersion does
|
||||
# the Right Thing" (ie. the code matches the conception). But I'd rather
|
||||
# have a conception that matches common notions about version numbers.
|
||||
|
||||
|
||||
class LooseVersion(Version):
|
||||
"""Version numbering for anarchists and software realists.
|
||||
Implements the standard interface for version number classes as
|
||||
described above. A version number consists of a series of numbers,
|
||||
separated by either periods or strings of letters. When comparing
|
||||
version numbers, the numeric components will be compared
|
||||
numerically, and the alphabetic components lexically. The following
|
||||
are all valid version numbers, in no particular order:
|
||||
|
||||
1.5.1
|
||||
1.5.2b2
|
||||
161
|
||||
3.10a
|
||||
8.02
|
||||
3.4j
|
||||
1996.07.12
|
||||
3.2.pl0
|
||||
3.1.1.6
|
||||
2g6
|
||||
11g
|
||||
0.960923
|
||||
2.2beta29
|
||||
1.13++
|
||||
5.5.kw
|
||||
2.0b1pl0
|
||||
|
||||
In fact, there is no such thing as an invalid version number under
|
||||
this scheme; the rules for comparison are simple and predictable,
|
||||
but may not always give the results you want (for some definition
|
||||
of "want").
|
||||
"""
|
||||
|
||||
component_re = re.compile(r"(\d+ | [a-z]+ | \.)", re.VERBOSE)
|
||||
|
||||
def __init__(self, vstring=None):
|
||||
if vstring:
|
||||
self.parse(vstring)
|
||||
|
||||
def parse(self, vstring):
|
||||
# I've given up on thinking I can reconstruct the version string
|
||||
# from the parsed tuple -- so I just store the string here for
|
||||
# use by __str__
|
||||
self.vstring = vstring
|
||||
components = [x for x in self.component_re.split(vstring) if x and x != "."]
|
||||
for i, obj in enumerate(components):
|
||||
try:
|
||||
components[i] = int(obj)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
self.version = components
|
||||
|
||||
def __str__(self):
|
||||
return self.vstring
|
||||
|
||||
def __repr__(self):
|
||||
return "LooseVersion ('%s')" % str(self)
|
||||
|
||||
def _cmp(self, other):
|
||||
if isinstance(other, str):
|
||||
other = LooseVersion(other)
|
||||
elif not isinstance(other, LooseVersion):
|
||||
return NotImplemented
|
||||
|
||||
if self.version == other.version:
|
||||
return 0
|
||||
if self.version < other.version:
|
||||
return -1
|
||||
if self.version > other.version:
|
||||
return 1
|
||||
|
||||
|
||||
# end class LooseVersion
|
||||
319
plugins/module_utils/firewalld.py
Normal file
319
plugins/module_utils/firewalld.py
Normal file
@@ -0,0 +1,319 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# (c) 2013-2018, Adam Miller (maxamillion@fedoraproject.org)
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
from ansible_collections.ansible.posix.plugins.module_utils.version import LooseVersion
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
FW_VERSION = None
|
||||
fw = None
|
||||
fw_offline = False
|
||||
import_failure = True
|
||||
try:
|
||||
import firewall.config
|
||||
FW_VERSION = firewall.config.VERSION
|
||||
|
||||
from firewall.client import FirewallClient
|
||||
from firewall.client import FirewallClientZoneSettings
|
||||
from firewall.errors import FirewallError
|
||||
import_failure = False
|
||||
|
||||
try:
|
||||
fw = FirewallClient()
|
||||
fw.getDefaultZone()
|
||||
|
||||
except (AttributeError, FirewallError):
|
||||
# Firewalld is not currently running, permanent-only operations
|
||||
fw_offline = True
|
||||
|
||||
# Import other required parts of the firewalld API
|
||||
#
|
||||
# NOTE:
|
||||
# online and offline operations do not share a common firewalld API
|
||||
try:
|
||||
from firewall.core.fw_test import Firewall_test
|
||||
fw = Firewall_test()
|
||||
except (ModuleNotFoundError):
|
||||
# In firewalld version 0.7.0 this behavior changed
|
||||
from firewall.core.fw import Firewall
|
||||
fw = Firewall(offline=True)
|
||||
|
||||
fw.start()
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class FirewallTransaction(object):
|
||||
"""
|
||||
FirewallTransaction
|
||||
|
||||
This is the base class for all firewalld transactions we might want to have
|
||||
"""
|
||||
|
||||
def __init__(self, module, action_args=(), zone=None, desired_state=None,
|
||||
permanent=False, immediate=False, enabled_values=None, disabled_values=None):
|
||||
# type: (firewall.client, tuple, str, bool, bool, bool)
|
||||
"""
|
||||
initializer the transaction
|
||||
|
||||
:module: AnsibleModule, instance of AnsibleModule
|
||||
:action_args: tuple, args to pass for the action to take place
|
||||
:zone: str, firewall zone
|
||||
:desired_state: str, the desired state (enabled, disabled, etc)
|
||||
:permanent: bool, action should be permanent
|
||||
:immediate: bool, action should take place immediately
|
||||
:enabled_values: str[], acceptable values for enabling something (default: enabled)
|
||||
:disabled_values: str[], acceptable values for disabling something (default: disabled)
|
||||
"""
|
||||
|
||||
self.module = module
|
||||
self.fw = fw
|
||||
self.action_args = action_args
|
||||
|
||||
if zone:
|
||||
self.zone = zone
|
||||
else:
|
||||
if fw_offline:
|
||||
self.zone = fw.get_default_zone()
|
||||
else:
|
||||
self.zone = fw.getDefaultZone()
|
||||
|
||||
self.desired_state = desired_state
|
||||
self.permanent = permanent
|
||||
self.immediate = immediate
|
||||
self.fw_offline = fw_offline
|
||||
self.enabled_values = enabled_values or ["enabled"]
|
||||
self.disabled_values = disabled_values or ["disabled"]
|
||||
|
||||
# List of messages that we'll call module.fail_json or module.exit_json
|
||||
# with.
|
||||
self.msgs = []
|
||||
|
||||
# Allow for custom messages to be added for certain subclass transaction
|
||||
# types
|
||||
self.enabled_msg = None
|
||||
self.disabled_msg = None
|
||||
|
||||
#####################
|
||||
# exception handling
|
||||
#
|
||||
def action_handler(self, action_func, action_func_args):
|
||||
"""
|
||||
Function to wrap calls to make actions on firewalld in try/except
|
||||
logic and emit (hopefully) useful error messages
|
||||
"""
|
||||
|
||||
try:
|
||||
return action_func(*action_func_args)
|
||||
except Exception as e:
|
||||
|
||||
# If there are any commonly known errors that we should provide more
|
||||
# context for to help the users diagnose what's wrong. Handle that here
|
||||
if "INVALID_SERVICE" in "%s" % e:
|
||||
self.msgs.append("Services are defined by port/tcp relationship and named as they are in /etc/services (on most systems)")
|
||||
|
||||
if len(self.msgs) > 0:
|
||||
self.module.fail_json(
|
||||
msg='ERROR: Exception caught: %s %s' % (e, ', '.join(self.msgs))
|
||||
)
|
||||
else:
|
||||
self.module.fail_json(msg='ERROR: Exception caught: %s' % e)
|
||||
|
||||
def get_fw_zone_settings(self):
|
||||
if self.fw_offline:
|
||||
fw_zone = self.fw.config.get_zone(self.zone)
|
||||
fw_settings = FirewallClientZoneSettings(
|
||||
list(self.fw.config.get_zone_config(fw_zone))
|
||||
)
|
||||
else:
|
||||
fw_zone = self.fw.config().getZoneByName(self.zone)
|
||||
fw_settings = fw_zone.getSettings()
|
||||
|
||||
return (fw_zone, fw_settings)
|
||||
|
||||
def update_fw_settings(self, fw_zone, fw_settings):
|
||||
if self.fw_offline:
|
||||
self.fw.config.set_zone_config(fw_zone, fw_settings.settings)
|
||||
else:
|
||||
fw_zone.update(fw_settings)
|
||||
|
||||
def get_enabled_immediate(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_enabled_permanent(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def set_enabled_immediate(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def set_enabled_permanent(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def set_disabled_immediate(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def set_disabled_permanent(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def run(self):
|
||||
"""
|
||||
run
|
||||
|
||||
This function contains the "transaction logic" where as all operations
|
||||
follow a similar pattern in order to perform their action but simply
|
||||
call different functions to carry that action out.
|
||||
"""
|
||||
|
||||
self.changed = False
|
||||
|
||||
if self.immediate and self.permanent:
|
||||
is_enabled_permanent = self.action_handler(
|
||||
self.get_enabled_permanent,
|
||||
self.action_args
|
||||
)
|
||||
is_enabled_immediate = self.action_handler(
|
||||
self.get_enabled_immediate,
|
||||
self.action_args
|
||||
)
|
||||
self.msgs.append('Permanent and Non-Permanent(immediate) operation')
|
||||
|
||||
if self.desired_state in self.enabled_values:
|
||||
if not is_enabled_permanent or not is_enabled_immediate:
|
||||
if self.module.check_mode:
|
||||
self.module.exit_json(changed=True)
|
||||
if not is_enabled_permanent:
|
||||
self.action_handler(
|
||||
self.set_enabled_permanent,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if not is_enabled_immediate:
|
||||
self.action_handler(
|
||||
self.set_enabled_immediate,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if self.changed and self.enabled_msg:
|
||||
self.msgs.append(self.enabled_msg)
|
||||
|
||||
elif self.desired_state in self.disabled_values:
|
||||
if is_enabled_permanent or is_enabled_immediate:
|
||||
if self.module.check_mode:
|
||||
self.module.exit_json(changed=True)
|
||||
if is_enabled_permanent:
|
||||
self.action_handler(
|
||||
self.set_disabled_permanent,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if is_enabled_immediate:
|
||||
self.action_handler(
|
||||
self.set_disabled_immediate,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if self.changed and self.disabled_msg:
|
||||
self.msgs.append(self.disabled_msg)
|
||||
|
||||
elif self.permanent and not self.immediate:
|
||||
is_enabled = self.action_handler(
|
||||
self.get_enabled_permanent,
|
||||
self.action_args
|
||||
)
|
||||
self.msgs.append('Permanent operation')
|
||||
|
||||
if self.desired_state in self.enabled_values:
|
||||
if not is_enabled:
|
||||
if self.module.check_mode:
|
||||
self.module.exit_json(changed=True)
|
||||
|
||||
self.action_handler(
|
||||
self.set_enabled_permanent,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if self.changed and self.enabled_msg:
|
||||
self.msgs.append(self.enabled_msg)
|
||||
|
||||
elif self.desired_state in self.disabled_values:
|
||||
if is_enabled:
|
||||
if self.module.check_mode:
|
||||
self.module.exit_json(changed=True)
|
||||
|
||||
self.action_handler(
|
||||
self.set_disabled_permanent,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if self.changed and self.disabled_msg:
|
||||
self.msgs.append(self.disabled_msg)
|
||||
|
||||
elif self.immediate and not self.permanent:
|
||||
is_enabled = self.action_handler(
|
||||
self.get_enabled_immediate,
|
||||
self.action_args
|
||||
)
|
||||
self.msgs.append('Non-permanent operation')
|
||||
|
||||
if self.desired_state in self.enabled_values:
|
||||
if not is_enabled:
|
||||
if self.module.check_mode:
|
||||
self.module.exit_json(changed=True)
|
||||
|
||||
self.action_handler(
|
||||
self.set_enabled_immediate,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if self.changed and self.enabled_msg:
|
||||
self.msgs.append(self.enabled_msg)
|
||||
|
||||
elif self.desired_state in self.disabled_values:
|
||||
if is_enabled:
|
||||
if self.module.check_mode:
|
||||
self.module.exit_json(changed=True)
|
||||
|
||||
self.action_handler(
|
||||
self.set_disabled_immediate,
|
||||
self.action_args
|
||||
)
|
||||
self.changed = True
|
||||
if self.changed and self.disabled_msg:
|
||||
self.msgs.append(self.disabled_msg)
|
||||
|
||||
return (self.changed, self.msgs)
|
||||
|
||||
@staticmethod
|
||||
def sanity_check(module):
|
||||
"""
|
||||
Perform sanity checking, version checks, etc
|
||||
|
||||
:module: AnsibleModule instance
|
||||
"""
|
||||
|
||||
if FW_VERSION and fw_offline:
|
||||
# Pre-run version checking
|
||||
if LooseVersion(FW_VERSION) < LooseVersion("0.3.9"):
|
||||
module.fail_json(msg='unsupported version of firewalld, offline operations require >= 0.3.9 - found: {0}'.format(FW_VERSION))
|
||||
elif FW_VERSION and not fw_offline:
|
||||
# Pre-run version checking
|
||||
if LooseVersion(FW_VERSION) < LooseVersion("0.2.11"):
|
||||
module.fail_json(msg='unsupported version of firewalld, requires >= 0.2.11 - found: {0}'.format(FW_VERSION))
|
||||
|
||||
# Check for firewalld running
|
||||
try:
|
||||
if fw.connected is False:
|
||||
module.fail_json(msg='firewalld service must be running, or try with offline=true')
|
||||
except AttributeError:
|
||||
module.fail_json(msg="firewalld connection can't be established,\
|
||||
installed version (%s) likely too old. Requires firewalld >= 0.2.11" % FW_VERSION)
|
||||
|
||||
if import_failure:
|
||||
module.fail_json(
|
||||
msg=missing_required_lib('firewall') + '. Version 0.2.11 or newer required (0.3.9 or newer for offline operations)'
|
||||
)
|
||||
@@ -48,6 +48,10 @@
|
||||
# agrees to be bound by the terms and conditions of this License
|
||||
# Agreement.
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
|
||||
|
||||
|
||||
18
plugins/module_utils/version.py
Normal file
18
plugins/module_utils/version.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2021, Felix Fontein <felix@fontein.de>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
"""Provide version object to compare version numbers."""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
# Once we drop support for Ansible 2.9, ansible-base 2.10, and ansible-core 2.11, we can
|
||||
# remove the _version.py file, and replace the following import by
|
||||
#
|
||||
# from ansible.module_utils.compat.version import LooseVersion
|
||||
|
||||
from ._version import LooseVersion, StrictVersion
|
||||
@@ -20,7 +20,7 @@ options:
|
||||
description:
|
||||
- The full path of the file or object.
|
||||
type: path
|
||||
required: yes
|
||||
required: true
|
||||
aliases: [ name ]
|
||||
state:
|
||||
description:
|
||||
@@ -28,27 +28,33 @@ options:
|
||||
- The C(query) state gets the current ACL without changing it, for use in C(register) operations.
|
||||
choices: [ absent, present, query ]
|
||||
default: query
|
||||
type: str
|
||||
follow:
|
||||
description:
|
||||
- Whether to follow symlinks on the path if a symlink is encountered.
|
||||
type: bool
|
||||
default: yes
|
||||
default: true
|
||||
default:
|
||||
description:
|
||||
- If the target is a directory, setting this to C(yes) will make it the default ACL for entities created inside the directory.
|
||||
- Setting C(default) to C(yes) causes an error if the path is a file.
|
||||
- If the target is a directory, setting this to C(true) will make it the default ACL for entities created inside the directory.
|
||||
- Setting C(default) to C(true) causes an error if the path is a file.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
entity:
|
||||
description:
|
||||
- The actual user or group that the ACL applies to when matching entity types user or group are selected.
|
||||
type: str
|
||||
default: ""
|
||||
etype:
|
||||
description:
|
||||
- The entity type of the ACL to apply, see C(setfacl) documentation for more info.
|
||||
choices: [ group, mask, other, user ]
|
||||
type: str
|
||||
permissions:
|
||||
description:
|
||||
- The permissions to apply/remove can be any combination of C(r), C(w) and C(x) (read, write and execute respectively)
|
||||
- The permissions to apply/remove can be any combination of C(r), C(w), C(x)
|
||||
- (read, write and execute respectively), and C(X) (execute permission if the file is a directory or already has execute permission for some user)
|
||||
type: str
|
||||
entry:
|
||||
description:
|
||||
- DEPRECATED.
|
||||
@@ -57,17 +63,20 @@ options:
|
||||
- The qualifier may be empty for some types, but the type and perms are always required.
|
||||
- C(-) can be used as placeholder when you do not care about permissions.
|
||||
- This is now superseded by entity, type and permissions fields.
|
||||
type: str
|
||||
recursive:
|
||||
description:
|
||||
- Recursively sets the specified ACL.
|
||||
- Incompatible with C(state=query).
|
||||
- Alias C(recurse) added in version 1.3.0.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
aliases: [ recurse ]
|
||||
use_nfsv4_acls:
|
||||
description:
|
||||
- Use NFSv4 ACLs instead of POSIX ACLs.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
recalculate_mask:
|
||||
description:
|
||||
- Select if and when to recalculate the effective right masks of the files.
|
||||
@@ -75,6 +84,7 @@ options:
|
||||
- Incompatible with C(state=query).
|
||||
choices: [ default, mask, no_mask ]
|
||||
default: default
|
||||
type: str
|
||||
author:
|
||||
- Brian Coca (@bcoca)
|
||||
- Jérémie Astori (@astorije)
|
||||
@@ -106,7 +116,7 @@ EXAMPLES = r'''
|
||||
entity: joe
|
||||
etype: user
|
||||
permissions: rw
|
||||
default: yes
|
||||
default: true
|
||||
state: present
|
||||
|
||||
- name: Same as previous but using entry shorthand
|
||||
@@ -266,7 +276,7 @@ def main():
|
||||
),
|
||||
follow=dict(type='bool', default=True),
|
||||
default=dict(type='bool', default=False),
|
||||
recursive=dict(type='bool', default=False),
|
||||
recursive=dict(type='bool', default=False, aliases=['recurse']),
|
||||
recalculate_mask=dict(
|
||||
type='str',
|
||||
default='default',
|
||||
|
||||
@@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: at
|
||||
short_description: Schedule the execution of a command or script file via the at command
|
||||
@@ -29,12 +29,10 @@ options:
|
||||
description:
|
||||
- The count of units in the future to execute the command or script file.
|
||||
type: int
|
||||
required: true
|
||||
units:
|
||||
description:
|
||||
- The type of units in the future to execute the command or script file.
|
||||
type: str
|
||||
required: true
|
||||
choices: [ minutes, hours, days, weeks ]
|
||||
state:
|
||||
description:
|
||||
@@ -46,7 +44,7 @@ options:
|
||||
description:
|
||||
- If a matching job is present a new job will not be added.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
requirements:
|
||||
- at
|
||||
author:
|
||||
@@ -70,10 +68,11 @@ EXAMPLES = r'''
|
||||
command: ls -d / >/dev/null
|
||||
count: 20
|
||||
units: minutes
|
||||
unique: yes
|
||||
unique: true
|
||||
'''
|
||||
|
||||
import os
|
||||
import platform
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
@@ -89,7 +88,7 @@ def add_job(module, result, at_cmd, count, units, command, script_file):
|
||||
|
||||
def delete_job(module, result, at_cmd, command, script_file):
|
||||
for matching_job in get_matching_jobs(module, at_cmd, script_file):
|
||||
at_command = "%s -d %s" % (at_cmd, matching_job)
|
||||
at_command = "%s -r %s" % (at_cmd, matching_job)
|
||||
rc, out, err = module.run_command(at_command, check_rc=True)
|
||||
result['changed'] = True
|
||||
if command:
|
||||
@@ -117,7 +116,8 @@ def get_matching_jobs(module, at_cmd, script_file):
|
||||
# If the script text is contained in a job add job number to list.
|
||||
for current_job in current_jobs:
|
||||
split_current_job = current_job.split()
|
||||
at_command = "%s -c %s" % (at_cmd, split_current_job[0])
|
||||
at_opt = '-c' if platform.system() != 'AIX' else '-lv'
|
||||
at_command = "%s %s %s" % (at_cmd, at_opt, split_current_job[0])
|
||||
rc, out, err = module.run_command(at_command, check_rc=True)
|
||||
if script_file_string in out:
|
||||
matching_jobs.append(split_current_job[0])
|
||||
@@ -129,7 +129,7 @@ def get_matching_jobs(module, at_cmd, script_file):
|
||||
def create_tempfile(command):
|
||||
filed, script_file = tempfile.mkstemp(prefix='at')
|
||||
fileh = os.fdopen(filed, 'w')
|
||||
fileh.write(command)
|
||||
fileh.write(command + os.linesep)
|
||||
fileh.close()
|
||||
return script_file
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ options:
|
||||
manage_dir:
|
||||
description:
|
||||
- Whether this module should manage the directory of the authorized key file.
|
||||
- If set to C(yes), the module will create the directory, as well as set the owner and permissions
|
||||
- If set to C(true), the module will create the directory, as well as set the owner and permissions
|
||||
of an existing directory.
|
||||
- Be sure to set C(manage_dir=no) if you are using an alternate directory for authorized_keys,
|
||||
- Be sure to set C(manage_dir=false) if you are using an alternate directory for authorized_keys,
|
||||
as set with C(path), since you could lock yourself out of SSH access.
|
||||
- See the example below.
|
||||
type: bool
|
||||
default: yes
|
||||
default: true
|
||||
state:
|
||||
description:
|
||||
- Whether the given key (with the given key_options) should or should not be in the file.
|
||||
@@ -50,6 +50,7 @@ options:
|
||||
key_options:
|
||||
description:
|
||||
- A string of ssh key options to be prepended to the key in the authorized_keys file.
|
||||
type: str
|
||||
exclusive:
|
||||
description:
|
||||
- Whether to remove all other non-specified keys from the authorized_keys file.
|
||||
@@ -57,15 +58,15 @@ options:
|
||||
- This option is not loop aware, so if you use C(with_) , it will be exclusive per iteration of the loop.
|
||||
- If you want multiple keys in the file you need to pass them all to C(key) in a single batch as mentioned above.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
validate_certs:
|
||||
description:
|
||||
- This only applies if using a https url as the source of the keys.
|
||||
- If set to C(no), the SSL certificates will not be validated.
|
||||
- This should only set to C(no) used on personally controlled sites using self-signed certificates as it avoids verifying the source site.
|
||||
- Prior to 2.1 the code worked as if this was set to C(yes).
|
||||
- If set to C(false), the SSL certificates will not be validated.
|
||||
- This should only set to C(false) used on personally controlled sites using self-signed certificates as it avoids verifying the source site.
|
||||
- Prior to 2.1 the code worked as if this was set to C(true).
|
||||
type: bool
|
||||
default: yes
|
||||
default: true
|
||||
comment:
|
||||
description:
|
||||
- Change the comment on the public key.
|
||||
@@ -76,7 +77,7 @@ options:
|
||||
description:
|
||||
- Follow path symlink instead of replacing it.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
author: Ansible Core Team
|
||||
'''
|
||||
|
||||
@@ -93,13 +94,19 @@ EXAMPLES = r'''
|
||||
state: present
|
||||
key: https://github.com/charlie.keys
|
||||
|
||||
- name: Set authorized keys taken from url using lookup
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: "{{ lookup('url', 'https://github.com/charlie.keys', split_lines=False) }}"
|
||||
|
||||
- name: Set authorized key in alternate location
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
|
||||
path: /etc/ssh/authorized_keys/charlie
|
||||
manage_dir: False
|
||||
manage_dir: false
|
||||
|
||||
- name: Set up multiple authorized keys
|
||||
ansible.posix.authorized_key:
|
||||
@@ -122,14 +129,14 @@ EXAMPLES = r'''
|
||||
user: charlie
|
||||
state: present
|
||||
key: https://github.com/user.keys
|
||||
validate_certs: False
|
||||
validate_certs: false
|
||||
|
||||
- name: Set authorized key, removing all the authorized keys already set
|
||||
ansible.posix.authorized_key:
|
||||
user: root
|
||||
key: "{{ lookup('file', 'public_keys/doe-jane') }}"
|
||||
state: present
|
||||
exclusive: True
|
||||
exclusive: true
|
||||
|
||||
- name: Set authorized key for user ubuntu copying it from current user
|
||||
ansible.posix.authorized_key:
|
||||
@@ -143,7 +150,7 @@ exclusive:
|
||||
description: If the key has been forced to be exclusive or not.
|
||||
returned: success
|
||||
type: bool
|
||||
sample: False
|
||||
sample: false
|
||||
key:
|
||||
description: The key that the module was running against.
|
||||
returned: success
|
||||
@@ -163,7 +170,7 @@ manage_dir:
|
||||
description: Whether this module managed the directory of the authorized key file.
|
||||
returned: success
|
||||
type: bool
|
||||
sample: True
|
||||
sample: true
|
||||
path:
|
||||
description: Alternate path to the authorized_keys file
|
||||
returned: success
|
||||
@@ -185,7 +192,7 @@ user:
|
||||
type: str
|
||||
sample: user
|
||||
validate_certs:
|
||||
description: This only applies if using a https url as the source of the keys. If set to C(no), the SSL certificates will not be validated.
|
||||
description: This only applies if using a https url as the source of the keys. If set to C(false), the SSL certificates will not be validated.
|
||||
returned: success
|
||||
type: bool
|
||||
sample: true
|
||||
@@ -340,6 +347,8 @@ def keyfile(module, user, write=False, path=None, manage_dir=True, follow=False)
|
||||
basedir = os.path.dirname(keysfile)
|
||||
if not os.path.exists(basedir):
|
||||
os.makedirs(basedir)
|
||||
|
||||
f = None
|
||||
try:
|
||||
f = open(keysfile, "w") # touches file so we can set ownership and perms
|
||||
finally:
|
||||
@@ -388,13 +397,28 @@ def parsekey(module, raw_key, rank=None):
|
||||
|
||||
VALID_SSH2_KEY_TYPES = [
|
||||
'sk-ecdsa-sha2-nistp256@openssh.com',
|
||||
'sk-ecdsa-sha2-nistp256-cert-v01@openssh.com',
|
||||
'webauthn-sk-ecdsa-sha2-nistp256@openssh.com',
|
||||
'ecdsa-sha2-nistp256',
|
||||
'ecdsa-sha2-nistp256-cert-v01@openssh.com',
|
||||
'ecdsa-sha2-nistp384',
|
||||
'ecdsa-sha2-nistp384-cert-v01@openssh.com',
|
||||
'ecdsa-sha2-nistp521',
|
||||
'ecdsa-sha2-nistp521-cert-v01@openssh.com',
|
||||
'sk-ssh-ed25519@openssh.com',
|
||||
'sk-ssh-ed25519-cert-v01@openssh.com',
|
||||
'ssh-ed25519',
|
||||
'ssh-ed25519-cert-v01@openssh.com',
|
||||
'ssh-dss',
|
||||
'ssh-rsa',
|
||||
'ssh-xmss@openssh.com',
|
||||
'ssh-xmss-cert-v01@openssh.com',
|
||||
'rsa-sha2-256',
|
||||
'rsa-sha2-512',
|
||||
'ssh-rsa-cert-v01@openssh.com',
|
||||
'rsa-sha2-256-cert-v01@openssh.com',
|
||||
'rsa-sha2-512-cert-v01@openssh.com',
|
||||
'ssh-dss-cert-v01@openssh.com',
|
||||
]
|
||||
|
||||
options = None # connection options
|
||||
@@ -647,11 +671,11 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
user=dict(type='str', required=True),
|
||||
key=dict(type='str', required=True),
|
||||
key=dict(type='str', required=True, no_log=False),
|
||||
path=dict(type='path'),
|
||||
manage_dir=dict(type='bool', default=True),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||
key_options=dict(type='str'),
|
||||
key_options=dict(type='str', no_log=False),
|
||||
exclusive=dict(type='bool', default=False),
|
||||
comment=dict(type='str'),
|
||||
validate_certs=dict(type='bool', default=True),
|
||||
|
||||
1035
plugins/modules/firewalld.py
Normal file
1035
plugins/modules/firewalld.py
Normal file
File diff suppressed because it is too large
Load Diff
392
plugins/modules/firewalld_info.py
Normal file
392
plugins/modules/firewalld_info.py
Normal file
@@ -0,0 +1,392 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2021, Hideki Saito <saito@fgrep.org>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: firewalld_info
|
||||
short_description: Gather information about firewalld
|
||||
description:
|
||||
- This module gathers information about firewalld rules.
|
||||
options:
|
||||
active_zones:
|
||||
description: Gather information about active zones.
|
||||
type: bool
|
||||
default: false
|
||||
zones:
|
||||
description:
|
||||
- Gather information about specific zones.
|
||||
- If only works if C(active_zones) is set to C(false).
|
||||
required: false
|
||||
type: list
|
||||
elements: str
|
||||
requirements:
|
||||
- firewalld >= 0.2.11
|
||||
- python-firewall
|
||||
- python-dbus
|
||||
author:
|
||||
- Hideki Saito (@saito-hideki)
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Gather information about active zones
|
||||
ansible.posix.firewalld_info:
|
||||
active_zones: true
|
||||
|
||||
- name: Gather information about specific zones
|
||||
ansible.posix.firewalld_info:
|
||||
zones:
|
||||
- public
|
||||
- external
|
||||
- internal
|
||||
'''
|
||||
|
||||
RETURN = r'''
|
||||
active_zones:
|
||||
description:
|
||||
- Gather active zones only if turn it C(true).
|
||||
returned: success
|
||||
type: bool
|
||||
sample: false
|
||||
collected_zones:
|
||||
description:
|
||||
- A list of collected zones.
|
||||
returned: success
|
||||
type: list
|
||||
sample: [external, internal]
|
||||
undefined_zones:
|
||||
description:
|
||||
- A list of undefined zones in C(zones) option.
|
||||
- C(undefined_zones) will be ignored for gathering process.
|
||||
returned: success
|
||||
type: list
|
||||
sample: [foo, bar]
|
||||
firewalld_info:
|
||||
description:
|
||||
- Returns various information about firewalld configuration.
|
||||
returned: success
|
||||
type: complex
|
||||
contains:
|
||||
version:
|
||||
description:
|
||||
- The version information of firewalld.
|
||||
returned: success
|
||||
type: str
|
||||
sample: 0.8.2
|
||||
default_zones:
|
||||
description:
|
||||
- The zone name of default zone.
|
||||
returned: success
|
||||
type: str
|
||||
sample: public
|
||||
zones:
|
||||
description:
|
||||
- A dict of zones to gather information.
|
||||
returned: success
|
||||
type: complex
|
||||
contains:
|
||||
zone:
|
||||
description:
|
||||
- The zone name registered in firewalld.
|
||||
returned: success
|
||||
type: complex
|
||||
sample: external
|
||||
contains:
|
||||
target:
|
||||
description:
|
||||
- A list of services in the zone.
|
||||
returned: success
|
||||
type: str
|
||||
sample: ACCEPT
|
||||
icmp_block_inversion:
|
||||
description:
|
||||
- The ICMP block inversion to block
|
||||
all ICMP requests.
|
||||
returned: success
|
||||
type: bool
|
||||
sample: false
|
||||
interfaces:
|
||||
description:
|
||||
- A list of network interfaces.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- 'eth0'
|
||||
- 'eth1'
|
||||
sources:
|
||||
description:
|
||||
- A list of source network address.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- '172.16.30.0/24'
|
||||
- '172.16.31.0/24'
|
||||
services:
|
||||
description:
|
||||
- A list of network services.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- 'dhcp'
|
||||
- 'dns'
|
||||
- 'ssh'
|
||||
ports:
|
||||
description:
|
||||
- A list of network port with protocol.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- - "22"
|
||||
- "tcp"
|
||||
- - "80"
|
||||
- "tcp"
|
||||
protocols:
|
||||
description:
|
||||
- A list of network protocol.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- "icmp"
|
||||
- "ipv6-icmp"
|
||||
forward:
|
||||
description:
|
||||
- The network interface forwarding.
|
||||
- This parameter supports on python-firewall
|
||||
0.9.0(or later) and is not collected in earlier
|
||||
versions.
|
||||
returned: success
|
||||
type: bool
|
||||
sample: false
|
||||
masquerade:
|
||||
description:
|
||||
- The network interface masquerading.
|
||||
returned: success
|
||||
type: bool
|
||||
sample: false
|
||||
forward_ports:
|
||||
description:
|
||||
- A list of forwarding port pair with protocol.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- "icmp"
|
||||
- "ipv6-icmp"
|
||||
source_ports:
|
||||
description:
|
||||
- A list of network source port with protocol.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- - "30000"
|
||||
- "tcp"
|
||||
- - "30001"
|
||||
- "tcp"
|
||||
icmp_blocks:
|
||||
description:
|
||||
- A list of blocking icmp protocol.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- "echo-request"
|
||||
rich_rules:
|
||||
description:
|
||||
- A list of rich language rule.
|
||||
returned: success
|
||||
type: list
|
||||
sample:
|
||||
- "rule protocol value=\"icmp\" reject"
|
||||
- "rule priority=\"32767\" reject"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.six import raise_from
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible_collections.ansible.posix.plugins.module_utils.version import StrictVersion
|
||||
|
||||
|
||||
try:
|
||||
import dbus
|
||||
HAS_DBUS = True
|
||||
except ImportError:
|
||||
HAS_DBUS = False
|
||||
|
||||
try:
|
||||
import firewall.client as fw_client
|
||||
import firewall.config as fw_config
|
||||
HAS_FIREWALLD = True
|
||||
except ImportError:
|
||||
HAS_FIREWALLD = False
|
||||
|
||||
|
||||
def get_version():
|
||||
return fw_config.VERSION
|
||||
|
||||
|
||||
def get_active_zones(client):
|
||||
return client.getActiveZones().keys()
|
||||
|
||||
|
||||
def get_all_zones(client):
|
||||
return client.getZones()
|
||||
|
||||
|
||||
def get_default_zone(client):
|
||||
return client.getDefaultZone()
|
||||
|
||||
|
||||
def get_zone_settings(client, zone):
|
||||
return client.getZoneSettings(zone)
|
||||
|
||||
|
||||
def get_zone_target(zone_settings):
|
||||
return zone_settings.getTarget()
|
||||
|
||||
|
||||
def get_zone_icmp_block_inversion(zone_settings):
|
||||
return zone_settings.getIcmpBlockInversion()
|
||||
|
||||
|
||||
def get_zone_interfaces(zone_settings):
|
||||
return zone_settings.getInterfaces()
|
||||
|
||||
|
||||
def get_zone_sources(zone_settings):
|
||||
return zone_settings.getSources()
|
||||
|
||||
|
||||
def get_zone_services(zone_settings):
|
||||
return zone_settings.getServices()
|
||||
|
||||
|
||||
def get_zone_ports(zone_settings):
|
||||
return zone_settings.getPorts()
|
||||
|
||||
|
||||
def get_zone_protocols(zone_settings):
|
||||
return zone_settings.getProtocols()
|
||||
|
||||
|
||||
# This function supports python-firewall 0.9.0(or later).
|
||||
def get_zone_forward(zone_settings):
|
||||
return zone_settings.getForward()
|
||||
|
||||
|
||||
def get_zone_masquerade(zone_settings):
|
||||
return zone_settings.getMasquerade()
|
||||
|
||||
|
||||
def get_zone_forward_ports(zone_settings):
|
||||
return zone_settings.getForwardPorts()
|
||||
|
||||
|
||||
def get_zone_source_ports(zone_settings):
|
||||
return zone_settings.getSourcePorts()
|
||||
|
||||
|
||||
def get_zone_icmp_blocks(zone_settings):
|
||||
return zone_settings.getIcmpBlocks()
|
||||
|
||||
|
||||
def get_zone_rich_rules(zone_settings):
|
||||
return zone_settings.getRichRules()
|
||||
|
||||
|
||||
def main():
|
||||
module_args = dict(
|
||||
active_zones=dict(required=False, type='bool', default=False),
|
||||
zones=dict(required=False, type='list', elements='str'),
|
||||
)
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
firewalld_info = dict()
|
||||
result = dict(
|
||||
changed=False,
|
||||
active_zones=module.params['active_zones'],
|
||||
collected_zones=list(),
|
||||
undefined_zones=list(),
|
||||
warnings=list(),
|
||||
)
|
||||
|
||||
# Exit with failure message if requirements modules are not installed.
|
||||
if not HAS_DBUS:
|
||||
module.fail_json(msg=missing_required_lib('python-dbus'))
|
||||
if not HAS_FIREWALLD:
|
||||
module.fail_json(msg=missing_required_lib('python-firewall'))
|
||||
|
||||
# If you want to show warning messages in the task running process,
|
||||
# you can append the message to the 'warn' list.
|
||||
warn = list()
|
||||
|
||||
try:
|
||||
client = fw_client.FirewallClient()
|
||||
|
||||
# Gather general information of firewalld.
|
||||
firewalld_info['version'] = get_version()
|
||||
firewalld_info['default_zone'] = get_default_zone(client)
|
||||
|
||||
# Gather information for zones.
|
||||
zones_info = dict()
|
||||
collect_zones = list()
|
||||
ignore_zones = list()
|
||||
if module.params['active_zones']:
|
||||
collect_zones = get_active_zones(client)
|
||||
elif module.params['zones']:
|
||||
all_zones = get_all_zones(client)
|
||||
specified_zones = module.params['zones']
|
||||
collect_zones = list(set(specified_zones) & set(all_zones))
|
||||
ignore_zones = list(set(specified_zones) - set(collect_zones))
|
||||
warn.append(
|
||||
'Please note: zone:(%s) have been ignored in the gathering process.' % ','.join(ignore_zones))
|
||||
else:
|
||||
collect_zones = get_all_zones(client)
|
||||
|
||||
for zone in collect_zones:
|
||||
# Gather settings for each zone based on the output of
|
||||
# 'firewall-cmd --info-zone=<ZONE>' command.
|
||||
zone_info = dict()
|
||||
zone_settings = get_zone_settings(client, zone)
|
||||
zone_info['target'] = get_zone_target(zone_settings)
|
||||
zone_info['icmp_block_inversion'] = get_zone_icmp_block_inversion(zone_settings)
|
||||
zone_info['interfaces'] = get_zone_interfaces(zone_settings)
|
||||
zone_info['sources'] = get_zone_sources(zone_settings)
|
||||
zone_info['services'] = get_zone_services(zone_settings)
|
||||
zone_info['ports'] = get_zone_ports(zone_settings)
|
||||
zone_info['protocols'] = get_zone_protocols(zone_settings)
|
||||
zone_info['masquerade'] = get_zone_masquerade(zone_settings)
|
||||
zone_info['forward_ports'] = get_zone_forward_ports(zone_settings)
|
||||
zone_info['source_ports'] = get_zone_source_ports(zone_settings)
|
||||
zone_info['icmp_blocks'] = get_zone_icmp_blocks(zone_settings)
|
||||
zone_info['rich_rules'] = get_zone_rich_rules(zone_settings)
|
||||
|
||||
# The 'forward' parameter supports on python-firewall 0.9.0(or later).
|
||||
if StrictVersion(firewalld_info['version']) >= StrictVersion('0.9.0'):
|
||||
zone_info['forward'] = get_zone_forward(zone_settings)
|
||||
|
||||
zones_info[zone] = zone_info
|
||||
firewalld_info['zones'] = zones_info
|
||||
except AttributeError as e:
|
||||
module.fail_json(msg=('firewalld probably not be running, Or the following method '
|
||||
'is not supported with your python-firewall version. (Error: %s)') % to_native(e))
|
||||
except dbus.exceptions.DBusException as e:
|
||||
module.fail_json(msg=('Unable to gather firewalld settings.'
|
||||
' You may need to run as the root user or'
|
||||
' use become. (Error: %s)' % to_native(e)))
|
||||
|
||||
result['collected_zones'] = collect_zones
|
||||
result['undefined_zones'] = ignore_zones
|
||||
result['firewalld_info'] = firewalld_info
|
||||
result['warnings'] = warn
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -31,12 +31,12 @@ options:
|
||||
src:
|
||||
description:
|
||||
- Device (or NFS volume, or something else) to be mounted on I(path).
|
||||
- Required when I(state) set to C(present) or C(mounted).
|
||||
- Required when I(state) set to C(present), C(mounted) or C(ephemeral).
|
||||
type: path
|
||||
fstype:
|
||||
description:
|
||||
- Filesystem type.
|
||||
- Required when I(state) is C(present) or C(mounted).
|
||||
- Required when I(state) is C(present), C(mounted) or C(ephemeral).
|
||||
type: str
|
||||
opts:
|
||||
description:
|
||||
@@ -48,18 +48,18 @@ options:
|
||||
- Note that if set to C(null) and I(state) set to C(present),
|
||||
it will cease to work and duplicate entries will be made
|
||||
with subsequent runs.
|
||||
- Has no effect on Solaris systems.
|
||||
- Has no effect on Solaris systems or when used with C(ephemeral).
|
||||
type: str
|
||||
default: 0
|
||||
default: '0'
|
||||
passno:
|
||||
description:
|
||||
- Passno (see fstab(5)).
|
||||
- Note that if set to C(null) and I(state) set to C(present),
|
||||
it will cease to work and duplicate entries will be made
|
||||
with subsequent runs.
|
||||
- Deprecated on Solaris systems.
|
||||
- Deprecated on Solaris systems. Has no effect when used with C(ephemeral).
|
||||
type: str
|
||||
default: 0
|
||||
default: '0'
|
||||
state:
|
||||
description:
|
||||
- If C(mounted), the device will be actively mounted and appropriately
|
||||
@@ -68,6 +68,13 @@ options:
|
||||
- If C(unmounted), the device will be unmounted without changing I(fstab).
|
||||
- C(present) only specifies that the device is to be configured in
|
||||
I(fstab) and does not trigger or require a mount.
|
||||
- C(ephemeral) only specifies that the device is to be mounted, without changing
|
||||
I(fstab). If it is already mounted, a remount will be triggered.
|
||||
This will always return changed=True. If the mount point I(path)
|
||||
has already a device mounted on, and its source is different than I(src),
|
||||
the module will fail to avoid unexpected unmount or mount point override.
|
||||
If the mount point is not present, the mount point will be created.
|
||||
The I(fstab) is completely ignored. This option is added in version 1.5.0.
|
||||
- C(absent) specifies that the device mount's entry will be removed from
|
||||
I(fstab) and will also unmount the device and remove the mount
|
||||
point.
|
||||
@@ -77,10 +84,15 @@ options:
|
||||
applied to the remount, but will not change I(fstab). Additionally,
|
||||
if I(opts) is set, and the remount command fails, the module will
|
||||
error to prevent unexpected mount changes. Try using C(mounted)
|
||||
instead to work around this issue.
|
||||
instead to work around this issue. C(remounted) expects the mount point
|
||||
to be present in the I(fstab). To remount a mount point not registered
|
||||
in I(fstab), use C(ephemeral) instead, especially with BSD nodes.
|
||||
- C(absent_from_fstab) specifies that the device mount's entry will be
|
||||
removed from I(fstab). This option does not unmount it or delete the
|
||||
mountpoint.
|
||||
type: str
|
||||
required: true
|
||||
choices: [ absent, mounted, present, unmounted, remounted ]
|
||||
choices: [ absent, absent_from_fstab, mounted, present, unmounted, remounted, ephemeral ]
|
||||
fstab:
|
||||
description:
|
||||
- File to use instead of C(/etc/fstab).
|
||||
@@ -89,19 +101,27 @@ options:
|
||||
- OpenBSD does not allow specifying alternate fstab files with mount so do not
|
||||
use this on OpenBSD with any state that operates on the live filesystem.
|
||||
- This parameter defaults to /etc/fstab or /etc/vfstab on Solaris.
|
||||
- This parameter is ignored when I(state) is set to C(ephemeral).
|
||||
type: str
|
||||
boot:
|
||||
description:
|
||||
- Determines if the filesystem should be mounted on boot.
|
||||
- Only applies to Solaris systems.
|
||||
- Only applies to Solaris and Linux systems.
|
||||
- For Solaris systems, C(true) will set C(yes) as the value of mount at boot
|
||||
in I(/etc/vfstab).
|
||||
- For Linux, FreeBSD, NetBSD and OpenBSD systems, C(false) will add C(noauto)
|
||||
to mount options in I(/etc/fstab).
|
||||
- To avoid mount option conflicts, if C(noauto) specified in C(opts),
|
||||
mount module will ignore C(boot).
|
||||
- This parameter is ignored when I(state) is set to C(ephemeral).
|
||||
type: bool
|
||||
default: yes
|
||||
default: true
|
||||
backup:
|
||||
description:
|
||||
- Create a backup file including the timestamp information so you can get
|
||||
the original file back if you somehow clobbered it incorrectly.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
notes:
|
||||
- As of Ansible 2.3, the I(name) option has been changed to I(path) as
|
||||
default, but I(name) still works as well.
|
||||
@@ -166,11 +186,27 @@ EXAMPLES = r'''
|
||||
ansible.posix.mount:
|
||||
src: 192.168.1.100:/nfs/ssd/shared_data
|
||||
path: /mnt/shared_data
|
||||
opts: rw,sync,hard,intr
|
||||
opts: rw,sync,hard
|
||||
state: mounted
|
||||
fstype: nfs
|
||||
'''
|
||||
|
||||
- name: Mount NFS volumes with noauto according to boot option
|
||||
ansible.posix.mount:
|
||||
src: 192.168.1.100:/nfs/ssd/shared_data
|
||||
path: /mnt/shared_data
|
||||
opts: rw,sync,hard
|
||||
boot: false
|
||||
state: mounted
|
||||
fstype: nfs
|
||||
|
||||
- name: Mount ephemeral SMB volume
|
||||
ansible.posix.mount:
|
||||
src: //192.168.1.200/share
|
||||
path: /mnt/smb_share
|
||||
opts: "rw,vers=3,file_mode=0600,dir_mode=0700,dom={{ ad_domain }},username={{ ad_username }},password={{ ad_password }}"
|
||||
fstype: cifs
|
||||
state: ephemeral
|
||||
'''
|
||||
|
||||
import errno
|
||||
import os
|
||||
@@ -180,11 +216,15 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.ansible.posix.plugins.module_utils.mount import ismount
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils._text import to_bytes, to_native
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
|
||||
|
||||
def write_fstab(module, lines, path):
|
||||
|
||||
if module.params['backup']:
|
||||
module.backup_local(path)
|
||||
backup_file = module.backup_local(path)
|
||||
else:
|
||||
backup_file = ""
|
||||
|
||||
fs_w = open(path, 'w')
|
||||
|
||||
@@ -194,6 +234,8 @@ def write_fstab(module, lines, path):
|
||||
fs_w.flush()
|
||||
fs_w.close()
|
||||
|
||||
return backup_file
|
||||
|
||||
|
||||
def _escape_fstab(v):
|
||||
"""Escape invalid characters in fstab fields.
|
||||
@@ -206,7 +248,7 @@ def _escape_fstab(v):
|
||||
if isinstance(v, int):
|
||||
return v
|
||||
else:
|
||||
return(
|
||||
return (
|
||||
v.
|
||||
replace('\\', '\\134').
|
||||
replace(' ', '\\040').
|
||||
@@ -226,7 +268,7 @@ def _set_mount_save_old(module, args):
|
||||
old_lines = []
|
||||
exists = False
|
||||
changed = False
|
||||
escaped_args = dict([(k, _escape_fstab(v)) for k, v in iteritems(args)])
|
||||
escaped_args = dict([(k, _escape_fstab(v)) for k, v in iteritems(args) if k != 'warnings'])
|
||||
new_line = '%(src)s %(name)s %(fstype)s %(opts)s %(dump)s %(passno)s\n'
|
||||
|
||||
if platform.system() == 'SunOS':
|
||||
@@ -234,6 +276,10 @@ def _set_mount_save_old(module, args):
|
||||
'%(src)s - %(name)s %(fstype)s %(passno)s %(boot)s %(opts)s\n')
|
||||
|
||||
for line in open(args['fstab'], 'r').readlines():
|
||||
# Append newline if the line in fstab does not finished with newline.
|
||||
if not line.endswith('\n'):
|
||||
line += '\n'
|
||||
|
||||
old_lines.append(line)
|
||||
|
||||
if not line.strip():
|
||||
@@ -316,7 +362,7 @@ def _set_mount_save_old(module, args):
|
||||
changed = True
|
||||
|
||||
if changed and not module.check_mode:
|
||||
write_fstab(module, to_write, args['fstab'])
|
||||
args['backup_file'] = write_fstab(module, to_write, args['fstab'])
|
||||
|
||||
return (args['name'], old_lines, changed)
|
||||
|
||||
@@ -406,6 +452,24 @@ def _set_fstab_args(fstab_file):
|
||||
return result
|
||||
|
||||
|
||||
def _set_ephemeral_args(args):
|
||||
result = []
|
||||
# Set fstype switch according to platform. SunOS/Solaris use -F
|
||||
if platform.system().lower() == 'sunos':
|
||||
result.append('-F')
|
||||
else:
|
||||
result.append('-t')
|
||||
result.append(args['fstype'])
|
||||
|
||||
# Even if '-o remount' is already set, specifying multiple -o is valid
|
||||
if args['opts'] != 'defaults':
|
||||
result += ['-o', args['opts']]
|
||||
|
||||
result.append(args['src'])
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def mount(module, args):
|
||||
"""Mount up a path or remount if needed."""
|
||||
|
||||
@@ -422,7 +486,11 @@ def mount(module, args):
|
||||
'OpenBSD does not support alternate fstab files. Do not '
|
||||
'specify the fstab parameter for OpenBSD hosts'))
|
||||
else:
|
||||
cmd += _set_fstab_args(args['fstab'])
|
||||
if module.params['state'] != 'ephemeral':
|
||||
cmd += _set_fstab_args(args['fstab'])
|
||||
|
||||
if module.params['state'] == 'ephemeral':
|
||||
cmd += _set_ephemeral_args(args)
|
||||
|
||||
cmd += [name]
|
||||
|
||||
@@ -474,18 +542,24 @@ def remount(module, args):
|
||||
'OpenBSD does not support alternate fstab files. Do not '
|
||||
'specify the fstab parameter for OpenBSD hosts'))
|
||||
else:
|
||||
cmd += _set_fstab_args(args['fstab'])
|
||||
if module.params['state'] != 'ephemeral':
|
||||
cmd += _set_fstab_args(args['fstab'])
|
||||
|
||||
if module.params['state'] == 'ephemeral':
|
||||
cmd += _set_ephemeral_args(args)
|
||||
|
||||
cmd += [args['name']]
|
||||
out = err = ''
|
||||
|
||||
try:
|
||||
if platform.system().lower().endswith('bsd'):
|
||||
if module.params['state'] != 'ephemeral' and platform.system().lower().endswith('bsd'):
|
||||
# Note: Forcing BSDs to do umount/mount due to BSD remount not
|
||||
# working as expected (suspect bug in the BSD mount command)
|
||||
# Interested contributor could rework this to use mount options on
|
||||
# the CLI instead of relying on fstab
|
||||
# https://github.com/ansible/ansible-modules-core/issues/5591
|
||||
# Note: this does not affect ephemeral state as all options
|
||||
# are set on the CLI and fstab is expected to be ignored.
|
||||
rc = 1
|
||||
else:
|
||||
rc, out, err = module.run_command(cmd)
|
||||
@@ -639,24 +713,66 @@ def get_linux_mounts(module, mntinfo_file="/proc/self/mountinfo"):
|
||||
return mounts
|
||||
|
||||
|
||||
def _is_same_mount_src(module, src, mountpoint, linux_mounts):
|
||||
"""Return True if the mounted fs on mountpoint is the same source than src. Return False if mountpoint is not a mountpoint"""
|
||||
# If the provided mountpoint is not a mountpoint, don't waste time
|
||||
if (
|
||||
not ismount(mountpoint) and
|
||||
not is_bind_mounted(module, linux_mounts, mountpoint)):
|
||||
return False
|
||||
|
||||
# Treat Linux bind mounts
|
||||
if platform.system() == 'Linux' and linux_mounts is not None:
|
||||
# For Linux bind mounts only: the mount command does not return
|
||||
# the actual source for bind mounts, but the device of the source.
|
||||
# is_bind_mounted() called with the 'src' parameter will return True if
|
||||
# the mountpoint is a bind mount AND the source FS is the same than 'src'.
|
||||
# is_bind_mounted() is not reliable on Solaris, NetBSD and OpenBSD.
|
||||
# But we can rely on 'mount -v' on all other platforms, and Linux non-bind mounts.
|
||||
if is_bind_mounted(module, linux_mounts, mountpoint, src):
|
||||
return True
|
||||
|
||||
# mount with parameter -v has a close behavior on Linux, *BSD, SunOS
|
||||
# Requires -v with SunOS. Without -v, source and destination are reversed
|
||||
# Output format differs from a system to another, but field[0:3] are consistent: [src, 'on', dest]
|
||||
cmd = '%s -v' % module.get_bin_path('mount', required=True)
|
||||
rc, out, err = module.run_command(cmd)
|
||||
mounts = []
|
||||
|
||||
if len(out):
|
||||
mounts = to_native(out).strip().split('\n')
|
||||
else:
|
||||
module.fail_json(msg="Unable to retrieve mount info with command '%s'" % cmd)
|
||||
|
||||
for mnt in mounts:
|
||||
fields = mnt.split()
|
||||
mp_src = fields[0]
|
||||
mp_dst = fields[2]
|
||||
if mp_src == src and mp_dst == mountpoint:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
boot=dict(type='bool', default=True),
|
||||
dump=dict(type='str'),
|
||||
dump=dict(type='str', default='0'),
|
||||
fstab=dict(type='str'),
|
||||
fstype=dict(type='str'),
|
||||
path=dict(type='path', required=True, aliases=['name']),
|
||||
opts=dict(type='str'),
|
||||
passno=dict(type='str'),
|
||||
passno=dict(type='str', no_log=False, default='0'),
|
||||
src=dict(type='path'),
|
||||
backup=dict(type='bool', default=False),
|
||||
state=dict(type='str', required=True, choices=['absent', 'mounted', 'present', 'unmounted', 'remounted']),
|
||||
state=dict(type='str', required=True, choices=['absent', 'absent_from_fstab', 'mounted', 'present', 'unmounted', 'remounted', 'ephemeral']),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
required_if=(
|
||||
['state', 'mounted', ['src', 'fstype']],
|
||||
['state', 'present', ['src', 'fstype']],
|
||||
['state', 'ephemeral', ['src', 'fstype']]
|
||||
),
|
||||
)
|
||||
|
||||
@@ -672,7 +788,8 @@ def main():
|
||||
opts='-',
|
||||
passno='-',
|
||||
fstab=module.params['fstab'],
|
||||
boot='yes'
|
||||
boot='yes' if module.params['boot'] else 'no',
|
||||
warnings=[]
|
||||
)
|
||||
if args['fstab'] is None:
|
||||
args['fstab'] = '/etc/vfstab'
|
||||
@@ -682,7 +799,9 @@ def main():
|
||||
opts='defaults',
|
||||
dump='0',
|
||||
passno='0',
|
||||
fstab=module.params['fstab']
|
||||
fstab=module.params['fstab'],
|
||||
boot='yes',
|
||||
warnings=[]
|
||||
)
|
||||
if args['fstab'] is None:
|
||||
args['fstab'] = '/etc/fstab'
|
||||
@@ -691,6 +810,7 @@ def main():
|
||||
if platform.system() == 'FreeBSD':
|
||||
args['opts'] = 'rw'
|
||||
|
||||
args['backup_file'] = ""
|
||||
linux_mounts = []
|
||||
|
||||
# Cache all mounts here in order we have consistent results if we need to
|
||||
@@ -699,26 +819,41 @@ def main():
|
||||
linux_mounts = get_linux_mounts(module)
|
||||
|
||||
if linux_mounts is None:
|
||||
args['warnings'] = (
|
||||
'Cannot open file /proc/self/mountinfo. '
|
||||
'Bind mounts might be misinterpreted.')
|
||||
args['warnings'].append('Cannot open file /proc/self/mountinfo.'
|
||||
' Bind mounts might be misinterpreted.')
|
||||
|
||||
# Override defaults with user specified params
|
||||
for key in ('src', 'fstype', 'passno', 'opts', 'dump', 'fstab'):
|
||||
if module.params[key] is not None:
|
||||
args[key] = module.params[key]
|
||||
if platform.system().lower() == 'linux' or platform.system().lower().endswith('bsd'):
|
||||
# Linux, FreeBSD, NetBSD and OpenBSD have 'noauto' as mount option to
|
||||
# handle mount on boot. To avoid mount option conflicts, if 'noauto'
|
||||
# specified in 'opts', mount module will ignore 'boot'.
|
||||
opts = args['opts'].split(',')
|
||||
if 'noauto' in opts:
|
||||
args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'noauto'.")
|
||||
elif not module.params['boot']:
|
||||
args['boot'] = 'no'
|
||||
if 'defaults' in opts:
|
||||
args['warnings'].append("Ignore the 'boot' due to 'opts' contains 'defaults'.")
|
||||
else:
|
||||
opts.append('noauto')
|
||||
args['opts'] = ','.join(opts)
|
||||
|
||||
# If fstab file does not exist, we first need to create it. This mainly
|
||||
# happens when fstab option is passed to the module.
|
||||
if not os.path.exists(args['fstab']):
|
||||
if not os.path.exists(os.path.dirname(args['fstab'])):
|
||||
os.makedirs(os.path.dirname(args['fstab']))
|
||||
try:
|
||||
open(args['fstab'], 'a').close()
|
||||
except PermissionError as e:
|
||||
module.fail_json(msg="Failed to open %s due to permission issue" % args['fstab'])
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to open %s due to %s" % (args['fstab'], to_native(e)))
|
||||
# If state is 'ephemeral', we do not need fstab file
|
||||
if module.params['state'] != 'ephemeral':
|
||||
if not os.path.exists(args['fstab']):
|
||||
if not os.path.exists(os.path.dirname(args['fstab'])):
|
||||
os.makedirs(os.path.dirname(args['fstab']))
|
||||
try:
|
||||
open(args['fstab'], 'a').close()
|
||||
except PermissionError as e:
|
||||
module.fail_json(msg="Failed to open %s due to permission issue" % args['fstab'])
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to open %s due to %s" % (args['fstab'], to_native(e)))
|
||||
|
||||
# absent:
|
||||
# Remove from fstab and unmounted.
|
||||
@@ -729,12 +864,16 @@ def main():
|
||||
# mounted:
|
||||
# Add to fstab if not there and make sure it is mounted. If it has
|
||||
# changed in fstab then remount it.
|
||||
# ephemeral:
|
||||
# Do not change fstab state, but mount.
|
||||
|
||||
state = module.params['state']
|
||||
name = module.params['path']
|
||||
changed = False
|
||||
|
||||
if state == 'absent':
|
||||
if state == 'absent_from_fstab':
|
||||
name, changed = unset_mount(module, args)
|
||||
elif state == 'absent':
|
||||
name, changed = unset_mount(module, args)
|
||||
|
||||
if changed and not module.check_mode:
|
||||
@@ -760,7 +899,7 @@ def main():
|
||||
msg="Error unmounting %s: %s" % (name, msg))
|
||||
|
||||
changed = True
|
||||
elif state == 'mounted':
|
||||
elif state == 'mounted' or state == 'ephemeral':
|
||||
dirs_created = []
|
||||
if not os.path.exists(name) and not module.check_mode:
|
||||
try:
|
||||
@@ -788,7 +927,11 @@ def main():
|
||||
module.fail_json(
|
||||
msg="Error making dir %s: %s" % (name, to_native(e)))
|
||||
|
||||
name, backup_lines, changed = _set_mount_save_old(module, args)
|
||||
# ephemeral: completely ignore fstab
|
||||
if state != 'ephemeral':
|
||||
name, backup_lines, changed = _set_mount_save_old(module, args)
|
||||
else:
|
||||
name, backup_lines, changed = args['name'], [], False
|
||||
res = 0
|
||||
|
||||
if (
|
||||
@@ -798,7 +941,26 @@ def main():
|
||||
if changed and not module.check_mode:
|
||||
res, msg = remount(module, args)
|
||||
changed = True
|
||||
|
||||
# When 'state' == 'ephemeral', we don't know what is in fstab, and 'changed' is always False
|
||||
if state == 'ephemeral':
|
||||
# If state == 'ephemeral', check if the mountpoint src == module.params['src']
|
||||
# If it doesn't, fail to prevent unwanted unmount or unwanted mountpoint override
|
||||
if _is_same_mount_src(module, args['src'], args['name'], linux_mounts):
|
||||
changed = True
|
||||
if not module.check_mode:
|
||||
res, msg = remount(module, args)
|
||||
else:
|
||||
module.fail_json(
|
||||
msg=(
|
||||
'Ephemeral mount point is already mounted with a different '
|
||||
'source than the specified one. Failing in order to prevent an '
|
||||
'unwanted unmount or override operation. Try replacing this command with '
|
||||
'a "state: unmounted" followed by a "state: ephemeral", or use '
|
||||
'a different destination path.'))
|
||||
|
||||
else:
|
||||
# If not already mounted, mount it
|
||||
changed = True
|
||||
|
||||
if not module.check_mode:
|
||||
@@ -810,7 +972,8 @@ def main():
|
||||
# A non-working fstab entry may break the system at the reboot,
|
||||
# so undo all the changes if possible.
|
||||
try:
|
||||
write_fstab(module, backup_lines, args['fstab'])
|
||||
if state != 'ephemeral':
|
||||
write_fstab(module, backup_lines, args['fstab'])
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -834,6 +997,10 @@ def main():
|
||||
else:
|
||||
module.fail_json(msg='Unexpected position reached')
|
||||
|
||||
# If the managed node is Solaris, convert the boot value type to Boolean
|
||||
# to match the type of return value with the module argument.
|
||||
if platform.system().lower() == 'sunos':
|
||||
args['boot'] = boolean(args['boot'])
|
||||
module.exit_json(changed=changed, **args)
|
||||
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ options:
|
||||
default: present
|
||||
remote_src:
|
||||
description:
|
||||
- If C(no), it will search for src at originating/master machine, if C(yes) it will
|
||||
- If C(false), it will search for src at originating/controller machine, if C(true) it will
|
||||
go to the remote/target machine for the C(src).
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
strip:
|
||||
description:
|
||||
- Number that indicates the smallest prefix containing leading slashes
|
||||
@@ -65,15 +65,20 @@ options:
|
||||
description:
|
||||
- Passes C(--backup --version-control=numbered) to patch, producing numbered backup copies.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
binary:
|
||||
description:
|
||||
- Setting to C(yes) will disable patch's heuristic for transforming CRLF
|
||||
- Setting to C(true) will disable patch's heuristic for transforming CRLF
|
||||
line endings into LF.
|
||||
- Line endings of src and dest must match.
|
||||
- If set to C(no), C(patch) will replace CRLF in C(src) files on POSIX.
|
||||
- If set to C(false), C(patch) will replace CRLF in C(src) files on POSIX.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
ignore_whitespace:
|
||||
description:
|
||||
- Setting to C(true) will ignore white space changes between patch and input.
|
||||
type: bool
|
||||
default: false
|
||||
notes:
|
||||
- This module requires GNU I(patch) utility to be installed on the remote host.
|
||||
'''
|
||||
@@ -116,13 +121,15 @@ def add_dry_run_option(opts):
|
||||
opts.append('--dry-run')
|
||||
|
||||
|
||||
def is_already_applied(patch_func, patch_file, basedir, dest_file=None, binary=False, strip=0, state='present'):
|
||||
def is_already_applied(patch_func, patch_file, basedir, dest_file=None, binary=False, ignore_whitespace=False, strip=0, state='present'):
|
||||
opts = ['--quiet', '--forward',
|
||||
"--strip=%s" % strip, "--directory='%s'" % basedir,
|
||||
"--input='%s'" % patch_file]
|
||||
add_dry_run_option(opts)
|
||||
if binary:
|
||||
opts.append('--binary')
|
||||
if ignore_whitespace:
|
||||
opts.append('--ignore-whitespace')
|
||||
if dest_file:
|
||||
opts.append("'%s'" % dest_file)
|
||||
if state == 'present':
|
||||
@@ -132,7 +139,7 @@ def is_already_applied(patch_func, patch_file, basedir, dest_file=None, binary=F
|
||||
return rc == 0
|
||||
|
||||
|
||||
def apply_patch(patch_func, patch_file, basedir, dest_file=None, binary=False, strip=0, dry_run=False, backup=False, state='present'):
|
||||
def apply_patch(patch_func, patch_file, basedir, dest_file=None, binary=False, ignore_whitespace=False, strip=0, dry_run=False, backup=False, state='present'):
|
||||
opts = ['--quiet', '--forward', '--batch', '--reject-file=-',
|
||||
"--strip=%s" % strip, "--directory='%s'" % basedir,
|
||||
"--input='%s'" % patch_file]
|
||||
@@ -140,6 +147,8 @@ def apply_patch(patch_func, patch_file, basedir, dest_file=None, binary=False, s
|
||||
add_dry_run_option(opts)
|
||||
if binary:
|
||||
opts.append('--binary')
|
||||
if ignore_whitespace:
|
||||
opts.append('--ignore-whitespace')
|
||||
if dest_file:
|
||||
opts.append("'%s'" % dest_file)
|
||||
if backup:
|
||||
@@ -165,6 +174,7 @@ def main():
|
||||
# since patch will create numbered copies, not strftime("%Y-%m-%d@%H:%M:%S~")
|
||||
backup=dict(type='bool', default=False),
|
||||
binary=dict(type='bool', default=False),
|
||||
ignore_whitespace=dict(type='bool', default=False),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||
),
|
||||
required_one_of=[['dest', 'basedir']],
|
||||
@@ -197,9 +207,10 @@ def main():
|
||||
p.src = os.path.abspath(p.src)
|
||||
|
||||
changed = False
|
||||
if not is_already_applied(patch_func, p.src, p.basedir, dest_file=p.dest, binary=p.binary, strip=p.strip, state=p.state):
|
||||
if not is_already_applied(patch_func, p.src, p.basedir, dest_file=p.dest, binary=p.binary,
|
||||
ignore_whitespace=p.ignore_whitespace, strip=p.strip, state=p.state):
|
||||
try:
|
||||
apply_patch(patch_func, p.src, p.basedir, dest_file=p.dest, binary=p.binary, strip=p.strip,
|
||||
apply_patch(patch_func, p.src, p.basedir, dest_file=p.dest, binary=p.binary, ignore_whitespace=p.ignore_whitespace, strip=p.strip,
|
||||
dry_run=module.check_mode, backup=p.backup, state=p.state)
|
||||
changed = True
|
||||
except PatchError as e:
|
||||
|
||||
76
plugins/modules/rhel_facts.py
Normal file
76
plugins/modules/rhel_facts.py
Normal file
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: Red Hat Inc.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: rhel_facts
|
||||
version_added: 1.5.0
|
||||
short_description: Facts module to set or override RHEL specific facts.
|
||||
description:
|
||||
- Compatibility layer for using the "package" module for rpm-ostree based systems via setting the "pkg_mgr" fact correctly.
|
||||
author:
|
||||
- Adam Miller (@maxamillion)
|
||||
requirements:
|
||||
- rpm-ostree
|
||||
seealso:
|
||||
- module: ansible.builtin.package
|
||||
options: {}
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Playbook to use the package module on all RHEL footprints
|
||||
vars:
|
||||
ansible_facts_modules:
|
||||
- setup # REQUIRED to be run before all custom fact modules
|
||||
- ansible.posix.rhel_facts
|
||||
tasks:
|
||||
- name: Ensure packages are installed
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- htop
|
||||
- ansible
|
||||
state: present
|
||||
'''
|
||||
|
||||
RETURN = """
|
||||
ansible_facts:
|
||||
description: Relevant Ansible Facts
|
||||
returned: when needed
|
||||
type: complex
|
||||
contains:
|
||||
pkg_mgr:
|
||||
description: System-level package manager override
|
||||
returned: when needed
|
||||
type: str
|
||||
sample: {'pkg_mgr': 'ansible.posix.rhel_facts'}
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
ansible_facts = {}
|
||||
|
||||
# Verify that the platform is an rpm-ostree based system
|
||||
if os.path.exists("/run/ostree-booted"):
|
||||
ansible_facts['pkg_mgr'] = 'ansible.posix.rhel_rpm_ostree'
|
||||
|
||||
module.exit_json(ansible_facts, changed=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
124
plugins/modules/rhel_rpm_ostree.py
Normal file
124
plugins/modules/rhel_rpm_ostree.py
Normal file
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: Red Hat Inc.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: rhel_rpm_ostree
|
||||
version_added: 1.5.0
|
||||
short_description: Ensure packages exist in a RHEL for Edge rpm-ostree based system
|
||||
description:
|
||||
- Compatibility layer for using the "package" module for RHEL for Edge systems utilizing the RHEL System Roles.
|
||||
author:
|
||||
- Adam Miller (@maxamillion)
|
||||
requirements:
|
||||
- rpm-ostree
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- A package name or package specifier with version, like C(name-1.0).
|
||||
- Comparison operators for package version are valid here C(>), C(<), C(>=), C(<=). Example - C(name>=1.0)
|
||||
- If a previous version is specified, the task also needs to turn C(allow_downgrade) on.
|
||||
See the C(allow_downgrade) documentation for caveats with downgrading packages.
|
||||
- When using state=latest, this can be C('*') which means run C(yum -y update).
|
||||
- You can also pass a url or a local path to a rpm file (using state=present).
|
||||
To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages.
|
||||
aliases: [ pkg ]
|
||||
type: list
|
||||
elements: str
|
||||
default: []
|
||||
state:
|
||||
description:
|
||||
- Whether to install (C(present) or C(installed), C(latest)), or remove (C(absent) or C(removed)) a package.
|
||||
- C(present) and C(installed) will simply ensure that a desired package is installed.
|
||||
- C(latest) will update the specified package if it's not of the latest available version.
|
||||
- C(absent) and C(removed) will remove the specified package.
|
||||
- Default is C(None), however in effect the default action is C(present) unless the C(autoremove) option is
|
||||
enabled for this module, then C(absent) is inferred.
|
||||
type: str
|
||||
choices: [ absent, installed, latest, present, removed ]
|
||||
notes:
|
||||
- This module does not support installing or removing packages to/from an overlay as this is not supported
|
||||
by RHEL for Edge, packages needed should be defined in the osbuild Blueprint and provided to Image Builder
|
||||
at build time. This module exists only for C(package) module compatibility.
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Ensure htop and ansible are installed on rpm-ostree based RHEL
|
||||
ansible.posix.rhel_rpm_ostree:
|
||||
name:
|
||||
- htop
|
||||
- ansible
|
||||
state: present
|
||||
'''
|
||||
|
||||
RETURN = """
|
||||
msg:
|
||||
description: status of rpm transaction
|
||||
returned: always
|
||||
type: str
|
||||
sample: "No changes made."
|
||||
"""
|
||||
|
||||
import os
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_text
|
||||
|
||||
|
||||
def locally_installed(module, pkgname):
|
||||
(rc, out, err) = module.run_command('{0} -q {1}'.format(module.get_bin_path("rpm"), pkgname).split())
|
||||
return (rc == 0)
|
||||
|
||||
|
||||
def rpm_ostree_transaction(module):
|
||||
pkgs = []
|
||||
|
||||
if module.params['state'] in ['present', 'installed', 'latest']:
|
||||
for pkg in module.params['name']:
|
||||
if not locally_installed(module, pkg):
|
||||
pkgs.append(pkg)
|
||||
elif module.params['state'] in ['absent', 'removed']:
|
||||
for pkg in module.params['name']:
|
||||
if locally_installed(module, pkg):
|
||||
pkgs.append(pkg)
|
||||
|
||||
if not pkgs:
|
||||
module.exit_json(msg="No changes made.")
|
||||
else:
|
||||
if module.params['state'] in ['present', 'installed', 'latest']:
|
||||
module.fail_json(msg="The following packages are absent in the currently booted rpm-ostree commit: %s" ' '.join(pkgs))
|
||||
else:
|
||||
module.fail_json(msg="The following packages are present in the currently booted rpm-ostree commit: %s" ' '.join(pkgs))
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
name=dict(type='list', elements='str', aliases=['pkg'], default=[]),
|
||||
state=dict(type='str', default=None, choices=['absent', 'installed', 'latest', 'present', 'removed']),
|
||||
),
|
||||
)
|
||||
|
||||
# Verify that the platform is an rpm-ostree based system
|
||||
if not os.path.exists("/run/ostree-booted"):
|
||||
module.fail_json(msg="Module rpm_ostree is only applicable for rpm-ostree based systems.")
|
||||
|
||||
try:
|
||||
rpm_ostree_transaction(module)
|
||||
except Exception as e:
|
||||
module.fail_json(msg=to_text(e), exception=traceback.format_exc())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
125
plugins/modules/rpm_ostree_upgrade.py
Normal file
125
plugins/modules/rpm_ostree_upgrade.py
Normal file
@@ -0,0 +1,125 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: Red Hat Inc.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: rpm_ostree_upgrade
|
||||
short_description: Manage rpm-ostree upgrade transactions
|
||||
description:
|
||||
- Manage an rpm-ostree upgrade transactions.
|
||||
version_added: 1.5.0
|
||||
author:
|
||||
- Adam Miller (@maxamillion)
|
||||
requirements:
|
||||
- rpm-ostree
|
||||
options:
|
||||
os:
|
||||
description:
|
||||
- The OSNAME upon which to operate.
|
||||
type: str
|
||||
default: ""
|
||||
required: false
|
||||
cache_only:
|
||||
description:
|
||||
- Perform the transaction using only pre-cached data, do not download.
|
||||
type: bool
|
||||
default: false
|
||||
required: false
|
||||
allow_downgrade:
|
||||
description:
|
||||
- Allow for the upgrade to be a chronologically older tree.
|
||||
type: bool
|
||||
default: false
|
||||
required: false
|
||||
peer:
|
||||
description:
|
||||
- Force peer-to-peer connection instead of using a system message bus.
|
||||
type: bool
|
||||
default: false
|
||||
required: false
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Upgrade the rpm-ostree image without options, accept all defaults
|
||||
ansible.posix.rpm_ostree_upgrade:
|
||||
|
||||
- name: Upgrade the rpm-ostree image allowing downgrades
|
||||
ansible.posix.rpm_ostree_upgrade:
|
||||
allow_downgrade: true
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
msg:
|
||||
description: The command standard output
|
||||
returned: always
|
||||
type: str
|
||||
sample: 'No upgrade available.'
|
||||
'''
|
||||
|
||||
import os
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native, to_text
|
||||
|
||||
|
||||
def rpm_ostree_transaction(module):
|
||||
cmd = []
|
||||
cmd.append(module.get_bin_path("rpm-ostree"))
|
||||
cmd.append('upgrade')
|
||||
|
||||
if module.params['os']:
|
||||
cmd += ['--os', module.params['os']]
|
||||
if module.params['cache_only']:
|
||||
cmd += ['--cache-only']
|
||||
if module.params['allow_downgrade']:
|
||||
cmd += ['--allow-downgrade']
|
||||
if module.params['peer']:
|
||||
cmd += ['--peer']
|
||||
|
||||
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||
|
||||
rc, out, err = module.run_command(cmd)
|
||||
|
||||
if rc != 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
else:
|
||||
if to_text("No upgrade available.") in to_text(out):
|
||||
module.exit_json(msg=out, changed=False)
|
||||
else:
|
||||
module.exit_json(msg=out, changed=True)
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
os=dict(type='str', default=''),
|
||||
cache_only=dict(type='bool', default=False),
|
||||
allow_downgrade=dict(type='bool', default=False),
|
||||
peer=dict(type='bool', default=False),
|
||||
),
|
||||
)
|
||||
|
||||
# Verify that the platform is an rpm-ostree based system
|
||||
if not os.path.exists("/run/ostree-booted"):
|
||||
module.fail_json(msg="Module rpm_ostree_upgrade is only applicable for rpm-ostree based systems.")
|
||||
|
||||
try:
|
||||
rpm_ostree_transaction(module)
|
||||
except Exception as e:
|
||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: seboolean
|
||||
short_description: Toggles SELinux booleans
|
||||
@@ -19,11 +19,12 @@ options:
|
||||
description:
|
||||
- Name of the boolean to configure.
|
||||
required: true
|
||||
type: str
|
||||
persistent:
|
||||
description:
|
||||
- Set to C(yes) if the boolean setting should survive a reboot.
|
||||
- Set to C(true) if the boolean setting should survive a reboot.
|
||||
type: bool
|
||||
default: 'no'
|
||||
default: false
|
||||
state:
|
||||
description:
|
||||
- Desired boolean value
|
||||
@@ -39,6 +40,7 @@ notes:
|
||||
requirements:
|
||||
- libselinux-python
|
||||
- libsemanage-python
|
||||
- python3-libsemanage
|
||||
author:
|
||||
- Stephen Fromm (@sfromm)
|
||||
'''
|
||||
@@ -47,8 +49,8 @@ EXAMPLES = r'''
|
||||
- name: Set httpd_can_network_connect flag on and keep it persistent across reboots
|
||||
ansible.posix.seboolean:
|
||||
name: httpd_can_network_connect
|
||||
state: yes
|
||||
persistent: yes
|
||||
state: true
|
||||
persistent: true
|
||||
'''
|
||||
|
||||
import os
|
||||
@@ -283,7 +285,7 @@ def main():
|
||||
module.fail_json(msg=missing_required_lib('libselinux-python'), exception=SELINUX_IMP_ERR)
|
||||
|
||||
if not HAVE_SEMANAGE:
|
||||
module.fail_json(msg=missing_required_lib('libsemanage-python'), exception=SEMANAGE_IMP_ERR)
|
||||
module.fail_json(msg=missing_required_lib('libsemanage-python or python3-libsemanage'), exception=SEMANAGE_IMP_ERR)
|
||||
|
||||
ignore_selinux_state = module.params['ignore_selinux_state']
|
||||
|
||||
|
||||
@@ -20,17 +20,27 @@ version_added: "1.0.0"
|
||||
options:
|
||||
policy:
|
||||
description:
|
||||
- The name of the SELinux policy to use (e.g. C(targeted)) will be required if state is not C(disabled).
|
||||
- The name of the SELinux policy to use (e.g. C(targeted)) will be required if I(state) is not C(disabled).
|
||||
type: str
|
||||
state:
|
||||
description:
|
||||
- The SELinux mode.
|
||||
required: true
|
||||
choices: [ disabled, enforcing, permissive ]
|
||||
type: str
|
||||
update_kernel_param:
|
||||
description:
|
||||
- If set to I(true), will update also the kernel boot parameters when disabling/enabling SELinux.
|
||||
- The C(grubby) tool must be present on the target system for this to work.
|
||||
default: false
|
||||
type: bool
|
||||
version_added: '1.4.0'
|
||||
configfile:
|
||||
description:
|
||||
- The path to the SELinux configuration file, if non-standard.
|
||||
default: /etc/selinux/config
|
||||
aliases: [ conf, file ]
|
||||
type: str
|
||||
requirements: [ libselinux-python ]
|
||||
author:
|
||||
- Derek Carter (@goozbach) <goozbach@friocorte.com>
|
||||
@@ -94,6 +104,7 @@ except ImportError:
|
||||
HAS_SELINUX = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
from ansible.module_utils.common.process import get_bin_path
|
||||
from ansible.module_utils.facts.utils import get_file_lines
|
||||
|
||||
|
||||
@@ -116,6 +127,34 @@ def get_config_policy(configfile):
|
||||
return line.split('=')[1].strip()
|
||||
|
||||
|
||||
def get_kernel_enabled(module, grubby_bin):
|
||||
if grubby_bin is None:
|
||||
module.fail_json(msg="'grubby' command not found on host",
|
||||
details="In order to update the kernel command line"
|
||||
"enabled/disabled setting, the grubby package"
|
||||
"needs to be present on the system.")
|
||||
|
||||
rc, stdout, stderr = module.run_command([grubby_bin, '--info=ALL'])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="unable to run grubby")
|
||||
|
||||
all_enabled = True
|
||||
all_disabled = True
|
||||
for line in stdout.split('\n'):
|
||||
match = re.match('^args="(.*)"$', line)
|
||||
if match is None:
|
||||
continue
|
||||
args = match.group(1).split(' ')
|
||||
if 'selinux=0' in args:
|
||||
all_enabled = False
|
||||
else:
|
||||
all_disabled = False
|
||||
if all_disabled == all_enabled:
|
||||
# inconsistent config - return None to force update
|
||||
return None
|
||||
return all_enabled
|
||||
|
||||
|
||||
# setter subroutines
|
||||
def set_config_state(module, state, configfile):
|
||||
# SELINUX=permissive
|
||||
@@ -150,6 +189,17 @@ def set_state(module, state):
|
||||
module.fail_json(msg=msg)
|
||||
|
||||
|
||||
def set_kernel_enabled(module, grubby_bin, value):
|
||||
rc, stdout, stderr = module.run_command([grubby_bin, '--update-kernel=ALL',
|
||||
'--remove-args' if value else '--args',
|
||||
'selinux=0'])
|
||||
if rc != 0:
|
||||
if value:
|
||||
module.fail_json(msg='unable to remove selinux=0 from kernel config')
|
||||
else:
|
||||
module.fail_json(msg='unable to add selinux=0 to kernel config')
|
||||
|
||||
|
||||
def set_config_policy(module, policy, configfile):
|
||||
if not os.path.exists('/etc/selinux/%s/policy' % policy):
|
||||
module.fail_json(msg='Policy %s does not exist in /etc/selinux/' % policy)
|
||||
@@ -178,8 +228,9 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
policy=dict(type='str'),
|
||||
state=dict(type='str', required='True', choices=['enforcing', 'permissive', 'disabled']),
|
||||
state=dict(type='str', required=True, choices=['enforcing', 'permissive', 'disabled']),
|
||||
configfile=dict(type='str', default='/etc/selinux/config', aliases=['conf', 'file']),
|
||||
update_kernel_param=dict(type='bool', default=False),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
@@ -193,9 +244,11 @@ def main():
|
||||
configfile = module.params['configfile']
|
||||
policy = module.params['policy']
|
||||
state = module.params['state']
|
||||
update_kernel_param = module.params['update_kernel_param']
|
||||
runtime_enabled = selinux.is_selinux_enabled()
|
||||
runtime_policy = selinux.selinux_getpolicytype()[1]
|
||||
runtime_state = 'disabled'
|
||||
kernel_enabled = None
|
||||
reboot_required = False
|
||||
|
||||
if runtime_enabled:
|
||||
@@ -212,6 +265,12 @@ def main():
|
||||
|
||||
config_policy = get_config_policy(configfile)
|
||||
config_state = get_config_state(configfile)
|
||||
if update_kernel_param:
|
||||
try:
|
||||
grubby_bin = get_bin_path('grubby')
|
||||
except ValueError:
|
||||
grubby_bin = None
|
||||
kernel_enabled = get_kernel_enabled(module, grubby_bin)
|
||||
|
||||
# check to see if policy is set if state is not 'disabled'
|
||||
if state != 'disabled':
|
||||
@@ -266,6 +325,21 @@ def main():
|
||||
msgs.append("Config SELinux state changed from '%s' to '%s'" % (config_state, state))
|
||||
changed = True
|
||||
|
||||
requested_kernel_enabled = state in ('enforcing', 'permissive')
|
||||
# Update kernel enabled/disabled config only when setting is consistent
|
||||
# across all kernels AND the requested state differs from the current state
|
||||
if update_kernel_param and kernel_enabled != requested_kernel_enabled:
|
||||
if not module.check_mode:
|
||||
set_kernel_enabled(module, grubby_bin, requested_kernel_enabled)
|
||||
if requested_kernel_enabled:
|
||||
states = ('disabled', 'enabled')
|
||||
else:
|
||||
states = ('enabled', 'disabled')
|
||||
if kernel_enabled is None:
|
||||
states = ('<inconsistent>', states[1])
|
||||
msgs.append("Kernel SELinux state changed from '%s' to '%s'" % states)
|
||||
changed = True
|
||||
|
||||
module.exit_json(changed=changed, msg=', '.join(msgs), configfile=configfile, policy=policy, state=state, reboot_required=reboot_required)
|
||||
|
||||
|
||||
|
||||
@@ -38,9 +38,8 @@ options:
|
||||
description:
|
||||
- Port number for ssh on the destination host.
|
||||
- Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value.
|
||||
- This parameter defaults to the value of C(ansible_ssh_port) or C(ansible_port),
|
||||
the C(remote_port) config setting or the value from ssh client configuration
|
||||
if none of the former have been set.
|
||||
- This parameter defaults to the value of C(ansible_port), the C(remote_port) config setting
|
||||
or the value from ssh client configuration if none of the former have been set.
|
||||
type: int
|
||||
mode:
|
||||
description:
|
||||
@@ -54,36 +53,36 @@ options:
|
||||
description:
|
||||
- Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D.
|
||||
type: bool
|
||||
default: yes
|
||||
default: true
|
||||
checksum:
|
||||
description:
|
||||
- Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will
|
||||
not disable it.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
compress:
|
||||
description:
|
||||
- Compress file data during the transfer.
|
||||
- In most cases, leave this enabled unless it causes problems.
|
||||
type: bool
|
||||
default: yes
|
||||
default: true
|
||||
existing_only:
|
||||
description:
|
||||
- Skip creating new files on receiver.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
delete:
|
||||
description:
|
||||
- Delete files in C(dest) that don't exist (after transfer, not before) in the C(src) path.
|
||||
- This option requires C(recursive=yes).
|
||||
- This option ignores excluded files and behaves like the rsync opt --delete-excluded.
|
||||
- Delete files in I(dest) that do not exist (after transfer, not before) in the I(src) path.
|
||||
- This option requires I(recursive=true).
|
||||
- This option ignores excluded files and behaves like the rsync opt C(--delete-after).
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
dirs:
|
||||
description:
|
||||
- Transfer directories without recursing.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
recursive:
|
||||
description:
|
||||
- Recurse into directories.
|
||||
@@ -98,7 +97,7 @@ options:
|
||||
description:
|
||||
- Copy symlinks as the item that they point to (the referent) is copied, rather than the symlink.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
perms:
|
||||
description:
|
||||
- Preserve permissions.
|
||||
@@ -133,30 +132,43 @@ options:
|
||||
description:
|
||||
- Put user@ for the remote paths.
|
||||
- If you have a custom ssh config to define the remote user for a host
|
||||
that does not match the inventory user, you should set this parameter to C(no).
|
||||
that does not match the inventory user, you should set this parameter to C(false).
|
||||
type: bool
|
||||
default: yes
|
||||
default: true
|
||||
use_ssh_args:
|
||||
description:
|
||||
- Use the ssh_args specified in ansible.cfg.
|
||||
- In Ansible 2.10 and lower, it uses the ssh_args specified in C(ansible.cfg).
|
||||
- In Ansible 2.11 and onwards, when set to C(true), it uses all SSH connection configurations like
|
||||
C(ansible_ssh_args), C(ansible_ssh_common_args), and C(ansible_ssh_extra_args).
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
ssh_connection_multiplexing:
|
||||
description:
|
||||
- SSH connection multiplexing for rsync is disabled by default to prevent misconfigured ControlSockets from resulting in failed SSH connections.
|
||||
This is accomplished by setting the SSH C(ControlSocket) to C(none).
|
||||
- Set this option to C(true) to allow multiplexing and reduce SSH connection overhead.
|
||||
- Note that simply setting this option to C(true) is not enough;
|
||||
You must also configure SSH connection multiplexing in your SSH client config by setting values for
|
||||
C(ControlMaster), C(ControlPersist) and C(ControlPath).
|
||||
type: bool
|
||||
default: false
|
||||
rsync_opts:
|
||||
description:
|
||||
- Specify additional rsync options by passing in an array.
|
||||
- Note that an empty string in C(rsync_opts) will end up transfer the current working directory.
|
||||
type: list
|
||||
default:
|
||||
elements: str
|
||||
partial:
|
||||
description:
|
||||
- Tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
verify_host:
|
||||
description:
|
||||
- Verify destination host key.
|
||||
type: bool
|
||||
default: no
|
||||
default: false
|
||||
private_key:
|
||||
description:
|
||||
- Specify the private key to use for SSH-based rsync connections (e.g. C(~/.ssh/id_rsa)).
|
||||
@@ -166,6 +178,15 @@ options:
|
||||
- Add a destination to hard link against during the rsync.
|
||||
type: list
|
||||
default:
|
||||
elements: str
|
||||
delay_updates:
|
||||
description:
|
||||
- This option puts the temporary file from each updated file into a holding directory until the end of the transfer,
|
||||
at which time all the files are renamed into place in rapid succession.
|
||||
type: bool
|
||||
default: true
|
||||
version_added: '1.3.0'
|
||||
|
||||
notes:
|
||||
- rsync must be installed on both the local and remote host.
|
||||
- For the C(synchronize) module, the "local host" is the host `the synchronize task originates on`, and the "destination host" is the host
|
||||
@@ -186,8 +207,8 @@ notes:
|
||||
- Inspect the verbose output to validate the destination user/host/path are what was expected.
|
||||
- To exclude files and directories from being synchronized, you may add C(.rsync-filter) files to the source directory.
|
||||
- rsync daemon must be up and running with correct permission when using rsync protocol in source or destination path.
|
||||
- The C(synchronize) module forces `--delay-updates` to avoid leaving a destination in a broken in-between state if the underlying rsync process
|
||||
encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should call rsync directly.
|
||||
- The C(synchronize) module enables `--delay-updates` by default to avoid leaving a destination in a broken in-between state if the underlying rsync process
|
||||
encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should disable this option.
|
||||
- link_destination is subject to the same limitations as the underlying rsync daemon. Hard links are only preserved if the relative subtrees
|
||||
of the source and destination are the same. Attempts to hardlink into a directory that is a subdirectory of the source will be prevented.
|
||||
seealso:
|
||||
@@ -231,27 +252,27 @@ EXAMPLES = r'''
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
archive: no
|
||||
archive: false
|
||||
|
||||
- name: Synchronization with --archive options enabled except for --recursive
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
recursive: no
|
||||
recursive: false
|
||||
|
||||
- name: Synchronization with --archive options enabled except for --times, with --checksum option enabled
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
checksum: yes
|
||||
times: no
|
||||
checksum: true
|
||||
times: false
|
||||
|
||||
- name: Synchronization without --archive options enabled except use --links
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
archive: no
|
||||
links: yes
|
||||
archive: false
|
||||
links: true
|
||||
|
||||
- name: Synchronization of two paths both on the control machine
|
||||
ansible.posix.synchronize:
|
||||
@@ -281,8 +302,8 @@ EXAMPLES = r'''
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
delete: yes
|
||||
recursive: yes
|
||||
delete: true
|
||||
recursive: true
|
||||
|
||||
# This specific command is granted su privileges on the destination
|
||||
- name: Synchronize using an alternate rsync command
|
||||
@@ -314,7 +335,7 @@ EXAMPLES = r'''
|
||||
# Specify the rsync binary to use on remote host and on local host
|
||||
- hosts: groupofhosts
|
||||
vars:
|
||||
ansible_rsync_path: /usr/gnu/bin/rsync
|
||||
ansible_rsync_path: /usr/gnu/bin/rsync
|
||||
|
||||
tasks:
|
||||
- name: copy /tmp/localpath/ to remote location /tmp/remotepath
|
||||
@@ -390,12 +411,14 @@ def main():
|
||||
group=dict(type='bool'),
|
||||
set_remote_user=dict(type='bool', default=True),
|
||||
rsync_timeout=dict(type='int', default=0),
|
||||
rsync_opts=dict(type='list', default=[]),
|
||||
rsync_opts=dict(type='list', default=[], elements='str'),
|
||||
ssh_args=dict(type='str'),
|
||||
ssh_connection_multiplexing=dict(type='bool', default=False),
|
||||
partial=dict(type='bool', default=False),
|
||||
verify_host=dict(type='bool', default=False),
|
||||
delay_updates=dict(type='bool', default=True),
|
||||
mode=dict(type='str', default='push', choices=['pull', 'push']),
|
||||
link_dest=dict(type='list')
|
||||
link_dest=dict(type='list', elements='str'),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
@@ -432,13 +455,15 @@ def main():
|
||||
group = module.params['group']
|
||||
rsync_opts = module.params['rsync_opts']
|
||||
ssh_args = module.params['ssh_args']
|
||||
ssh_connection_multiplexing = module.params['ssh_connection_multiplexing']
|
||||
verify_host = module.params['verify_host']
|
||||
link_dest = module.params['link_dest']
|
||||
delay_updates = module.params['delay_updates']
|
||||
|
||||
if '/' not in rsync:
|
||||
rsync = module.get_bin_path(rsync, required=True)
|
||||
|
||||
cmd = [rsync, '--delay-updates', '-F']
|
||||
cmd = [rsync]
|
||||
_sshpass_pipe = None
|
||||
if rsync_password:
|
||||
try:
|
||||
@@ -449,6 +474,9 @@ def main():
|
||||
)
|
||||
_sshpass_pipe = os.pipe()
|
||||
cmd = ['sshpass', '-d' + to_native(_sshpass_pipe[0], errors='surrogate_or_strict')] + cmd
|
||||
if delay_updates:
|
||||
cmd.append('--delay-updates')
|
||||
cmd.append('-F')
|
||||
if compress:
|
||||
cmd.append('--compress')
|
||||
if rsync_timeout:
|
||||
@@ -507,7 +535,9 @@ def main():
|
||||
|
||||
# if the user has not supplied an --rsh option go ahead and add ours
|
||||
if not has_rsh:
|
||||
ssh_cmd = [module.get_bin_path('ssh', required=True), '-S', 'none']
|
||||
ssh_cmd = [module.get_bin_path('ssh', required=True)]
|
||||
if not ssh_connection_multiplexing:
|
||||
ssh_cmd.extend(['-S', 'none'])
|
||||
if private_key is not None:
|
||||
ssh_cmd.extend(['-i', private_key])
|
||||
# If the user specified a port value
|
||||
@@ -520,10 +550,10 @@ def main():
|
||||
ssh_cmd_str = ' '.join(shlex_quote(arg) for arg in ssh_cmd)
|
||||
if ssh_args:
|
||||
ssh_cmd_str += ' %s' % ssh_args
|
||||
cmd.append('--rsh=%s' % ssh_cmd_str)
|
||||
cmd.append('--rsh=%s' % shlex_quote(ssh_cmd_str))
|
||||
|
||||
if rsync_path:
|
||||
cmd.append('--rsync-path=%s' % rsync_path)
|
||||
cmd.append('--rsync-path=%s' % shlex_quote(rsync_path))
|
||||
|
||||
if rsync_opts:
|
||||
if '' in rsync_opts:
|
||||
@@ -549,7 +579,7 @@ def main():
|
||||
cmd.append('--link-dest=%s' % link_path)
|
||||
|
||||
changed_marker = '<<CHANGED>>'
|
||||
cmd.append('--out-format=' + changed_marker + '%i %n%L')
|
||||
cmd.append('--out-format=%s' % shlex_quote(changed_marker + '%i %n%L'))
|
||||
|
||||
# expand the paths
|
||||
if '@' not in source:
|
||||
@@ -557,8 +587,8 @@ def main():
|
||||
if '@' not in dest:
|
||||
dest = os.path.expanduser(dest)
|
||||
|
||||
cmd.append(source)
|
||||
cmd.append(dest)
|
||||
cmd.append(shlex_quote(source))
|
||||
cmd.append(shlex_quote(dest))
|
||||
cmdstr = ' '.join(cmd)
|
||||
|
||||
# If we are using password authentication, write the password into the pipe
|
||||
@@ -573,10 +603,10 @@ def main():
|
||||
raise
|
||||
|
||||
(rc, out, err) = module.run_command(
|
||||
cmd, pass_fds=_sshpass_pipe,
|
||||
cmdstr, pass_fds=_sshpass_pipe,
|
||||
before_communicate_callback=_write_password_to_pipe)
|
||||
else:
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
(rc, out, err) = module.run_command(cmdstr)
|
||||
|
||||
if rc:
|
||||
return module.fail_json(msg=err, rc=rc, cmd=cmdstr)
|
||||
|
||||
@@ -9,7 +9,7 @@ from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: sysctl
|
||||
short_description: Manage entries in sysctl.conf.
|
||||
@@ -19,40 +19,45 @@ version_added: "1.0.0"
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- The dot-separated path (aka I(key)) specifying the sysctl variable.
|
||||
- The dot-separated path (also known as I(key)) specifying the sysctl variable.
|
||||
required: true
|
||||
aliases: [ 'key' ]
|
||||
type: str
|
||||
value:
|
||||
description:
|
||||
- Desired value of the sysctl key.
|
||||
aliases: [ 'val' ]
|
||||
type: str
|
||||
state:
|
||||
description:
|
||||
- Whether the entry should be present or absent in the sysctl file.
|
||||
choices: [ "present", "absent" ]
|
||||
default: present
|
||||
type: str
|
||||
ignoreerrors:
|
||||
description:
|
||||
- Use this option to ignore errors about unknown keys.
|
||||
type: bool
|
||||
default: 'no'
|
||||
default: false
|
||||
reload:
|
||||
description:
|
||||
- If C(yes), performs a I(/sbin/sysctl -p) if the C(sysctl_file) is
|
||||
updated. If C(no), does not reload I(sysctl) even if the
|
||||
- If C(true), performs a I(/sbin/sysctl -p) if the C(sysctl_file) is
|
||||
updated. If C(false), does not reload I(sysctl) even if the
|
||||
C(sysctl_file) is updated.
|
||||
type: bool
|
||||
default: 'yes'
|
||||
default: true
|
||||
sysctl_file:
|
||||
description:
|
||||
- Specifies the absolute path to C(sysctl.conf), if not C(/etc/sysctl.conf).
|
||||
default: /etc/sysctl.conf
|
||||
type: path
|
||||
sysctl_set:
|
||||
description:
|
||||
- Verify token value with the sysctl command and set with -w if necessary
|
||||
- Verify token value with the sysctl command and set with -w if necessary.
|
||||
type: bool
|
||||
default: 'no'
|
||||
author: "David CHANIAL (@davixx) <david.chanial@gmail.com>"
|
||||
default: false
|
||||
author:
|
||||
- David CHANIAL (@davixx)
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
@@ -73,21 +78,21 @@ EXAMPLES = r'''
|
||||
name: kernel.panic
|
||||
value: '3'
|
||||
sysctl_file: /tmp/test_sysctl.conf
|
||||
reload: no
|
||||
reload: false
|
||||
|
||||
# Set ip forwarding on in /proc and verify token value with the sysctl command
|
||||
- ansible.posix.sysctl:
|
||||
name: net.ipv4.ip_forward
|
||||
value: '1'
|
||||
sysctl_set: yes
|
||||
sysctl_set: true
|
||||
|
||||
# Set ip forwarding on in /proc and in the sysctl file and reload if necessary
|
||||
- ansible.posix.sysctl:
|
||||
name: net.ipv4.ip_forward
|
||||
value: '1'
|
||||
sysctl_set: yes
|
||||
sysctl_set: true
|
||||
state: present
|
||||
reload: yes
|
||||
reload: true
|
||||
'''
|
||||
|
||||
# ==============================================================
|
||||
@@ -182,12 +187,12 @@ class SysctlModule(object):
|
||||
|
||||
# Do the work
|
||||
if not self.module.check_mode:
|
||||
if self.set_proc:
|
||||
self.set_token_value(self.args['name'], self.args['value'])
|
||||
if self.write_file:
|
||||
self.write_sysctl()
|
||||
if self.changed and self.args['reload']:
|
||||
self.reload_sysctl()
|
||||
if self.set_proc:
|
||||
self.set_token_value(self.args['name'], self.args['value'])
|
||||
|
||||
def _values_is_equal(self, a, b):
|
||||
"""Expects two string values. It will split the string by whitespace
|
||||
|
||||
@@ -4,13 +4,8 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.module_utils.six import text_type
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.plugins.shell import ShellBase
|
||||
|
||||
DOCUMENTATION = '''
|
||||
name: csh
|
||||
plugin_type: shell
|
||||
short_description: C shell (/bin/csh)
|
||||
description:
|
||||
- When you have no other option than to use csh
|
||||
@@ -18,6 +13,10 @@ DOCUMENTATION = '''
|
||||
- shell_common
|
||||
'''
|
||||
|
||||
from ansible.module_utils.six import text_type
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.plugins.shell import ShellBase
|
||||
|
||||
|
||||
class ShellModule(ShellBase):
|
||||
|
||||
@@ -26,6 +25,10 @@ class ShellModule(ShellBase):
|
||||
# Family of shells this has. Must match the filename without extension
|
||||
SHELL_FAMILY = 'csh'
|
||||
|
||||
# commonly used
|
||||
ECHO = 'echo'
|
||||
COMMAND_SEP = ';'
|
||||
|
||||
# How to end lines in a python script one-liner
|
||||
_SHELL_EMBEDDED_PY_EOL = '\\\n'
|
||||
_SHELL_REDIRECT_ALLNULL = '>& /dev/null'
|
||||
|
||||
@@ -4,13 +4,8 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible.module_utils.six import text_type
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.plugins.shell.sh import ShellModule as ShModule
|
||||
|
||||
DOCUMENTATION = '''
|
||||
name: fish
|
||||
plugin_type: shell
|
||||
short_description: fish shell (/bin/fish)
|
||||
description:
|
||||
- This is here because some people are restricted to fish.
|
||||
@@ -18,6 +13,10 @@ DOCUMENTATION = '''
|
||||
- shell_common
|
||||
'''
|
||||
|
||||
from ansible.module_utils.six import text_type
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.plugins.shell.sh import ShellModule as ShModule
|
||||
|
||||
|
||||
class ShellModule(ShModule):
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user