mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-28 09:26:44 +00:00
Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abc786bddd | ||
|
|
85a1eea4e6 | ||
|
|
ca385c8a45 | ||
|
|
bb689550b3 | ||
|
|
41aacb1472 | ||
|
|
3f92a6b738 | ||
|
|
ebdd8c88ec | ||
|
|
b24d27d4bd | ||
|
|
7b3319dd81 | ||
|
|
94b2e9d9ca | ||
|
|
82060a7b21 | ||
|
|
580cced80a | ||
|
|
a4d1d064c8 | ||
|
|
4e3d85798c | ||
|
|
28458b2477 | ||
|
|
e21ddcb5b6 | ||
|
|
4006db89bf | ||
|
|
62557a0e10 | ||
|
|
c305178950 | ||
|
|
8ba08ae383 | ||
|
|
ffafcb34b2 | ||
|
|
2ed03d7fb6 | ||
|
|
a007eebba8 | ||
|
|
a0a5a10c67 | ||
|
|
f01ac6f31f | ||
|
|
055b7fe4c1 | ||
|
|
906fd97c24 | ||
|
|
e91c22bbe6 | ||
|
|
ab6b2346a6 | ||
|
|
01b47a8a1f | ||
|
|
2b2386b6af | ||
|
|
c7736ab921 | ||
|
|
457c92c8e2 | ||
|
|
79f68629ff | ||
|
|
4167832db3 | ||
|
|
a57689f118 | ||
|
|
6d804ed77a | ||
|
|
90e22b93fd | ||
|
|
b372b3241a | ||
|
|
5a5ed8c3f0 | ||
|
|
f72029a518 | ||
|
|
71e894ab68 | ||
|
|
c82bc7f041 | ||
|
|
c28cade77e | ||
|
|
7ee401ab14 | ||
|
|
5652423dce | ||
|
|
0fbb0039b1 | ||
|
|
c38420d741 | ||
|
|
eb5695845e | ||
|
|
7481436027 | ||
|
|
4b54805693 | ||
|
|
5b33b0f61f | ||
|
|
83370ee97d | ||
|
|
f534ecbd2c | ||
|
|
e32de4841a | ||
|
|
611f3ed3a9 | ||
|
|
cf144df715 | ||
|
|
f717c1f4fd | ||
|
|
f51cdb367f | ||
|
|
12d3c4e174 | ||
|
|
0d1f2fd513 | ||
|
|
3b6ceeba0d | ||
|
|
20939e340e | ||
|
|
69b3489527 | ||
|
|
e734cf9384 | ||
|
|
0d23047f12 | ||
|
|
6227260432 | ||
|
|
3d923f06ed | ||
|
|
9a647554b6 | ||
|
|
fa32c1376e | ||
|
|
f7cb57677f | ||
|
|
bc97d291aa | ||
|
|
4860420c07 |
@@ -14,12 +14,24 @@ pr:
|
||||
|
||||
schedules:
|
||||
- cron: 0 8 * * *
|
||||
displayName: Nightly
|
||||
displayName: Nightly (main)
|
||||
always: true
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- stable-*
|
||||
- cron: 0 10 * * *
|
||||
displayName: Nightly (active stable branches)
|
||||
always: true
|
||||
branches:
|
||||
include:
|
||||
- stable-2
|
||||
- stable-3
|
||||
- cron: 0 11 * * 0
|
||||
displayName: Weekly (old stable branches)
|
||||
always: true
|
||||
branches:
|
||||
include:
|
||||
- stable-1
|
||||
|
||||
variables:
|
||||
- name: checkoutPath
|
||||
@@ -36,20 +48,20 @@ variables:
|
||||
resources:
|
||||
containers:
|
||||
- container: default
|
||||
image: quay.io/ansible/azure-pipelines-test-container:1.8.0
|
||||
image: quay.io/ansible/azure-pipelines-test-container:1.9.0
|
||||
|
||||
pool: Standard
|
||||
|
||||
stages:
|
||||
### Sanity
|
||||
- stage: Sanity_devel
|
||||
displayName: Sanity devel
|
||||
- stage: Sanity_2_11
|
||||
displayName: Sanity 2.11
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Test {0}
|
||||
testFormat: devel/sanity/{0}
|
||||
testFormat: 2.11/sanity/{0}
|
||||
targets:
|
||||
- test: 1
|
||||
- test: 2
|
||||
@@ -83,14 +95,14 @@ stages:
|
||||
- test: 3
|
||||
- test: 4
|
||||
### Units
|
||||
- stage: Units_devel
|
||||
displayName: Units devel
|
||||
- stage: Units_2_11
|
||||
displayName: Units 2.11
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Python {0}
|
||||
testFormat: devel/units/{0}/1
|
||||
testFormat: 2.11/units/{0}/1
|
||||
targets:
|
||||
- test: 2.6
|
||||
- test: 2.7
|
||||
@@ -132,13 +144,13 @@ stages:
|
||||
- test: 3.8
|
||||
|
||||
## Remote
|
||||
- stage: Remote_devel
|
||||
displayName: Remote devel
|
||||
- stage: Remote_2_11
|
||||
displayName: Remote 2.11
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: devel/{0}
|
||||
testFormat: 2.11/{0}
|
||||
targets:
|
||||
- name: macOS 11.1
|
||||
test: macos/11.1
|
||||
@@ -196,13 +208,13 @@ stages:
|
||||
- 2
|
||||
|
||||
### Docker
|
||||
- stage: Docker_devel
|
||||
displayName: Docker devel
|
||||
- stage: Docker_2_11
|
||||
displayName: Docker 2.11
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: devel/linux/{0}
|
||||
testFormat: 2.11/linux/{0}
|
||||
targets:
|
||||
- name: CentOS 6
|
||||
test: centos6
|
||||
@@ -270,14 +282,14 @@ stages:
|
||||
- 5
|
||||
|
||||
### Cloud
|
||||
- stage: Cloud_devel
|
||||
displayName: Cloud devel
|
||||
- stage: Cloud_2_11
|
||||
displayName: Cloud 2.11
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Python {0}
|
||||
testFormat: devel/cloud/{0}/1
|
||||
testFormat: 2.11/cloud/{0}/1
|
||||
targets:
|
||||
- test: 2.7
|
||||
- test: 3.6
|
||||
@@ -304,19 +316,19 @@ stages:
|
||||
- stage: Summary
|
||||
condition: succeededOrFailed()
|
||||
dependsOn:
|
||||
- Sanity_devel
|
||||
- Sanity_2_11
|
||||
- Sanity_2_9
|
||||
- Sanity_2_10
|
||||
- Units_devel
|
||||
- Units_2_11
|
||||
- Units_2_9
|
||||
- Units_2_10
|
||||
- Remote_devel
|
||||
- Remote_2_11
|
||||
- Remote_2_9
|
||||
- Remote_2_10
|
||||
- Docker_devel
|
||||
- Docker_2_11
|
||||
- Docker_2_9
|
||||
- Docker_2_10
|
||||
- Cloud_devel
|
||||
- Cloud_2_11
|
||||
- Cloud_2_9
|
||||
- Cloud_2_10
|
||||
jobs:
|
||||
|
||||
@@ -7,7 +7,7 @@ set -o pipefail -eu
|
||||
|
||||
output_path="$1"
|
||||
|
||||
curl --silent --show-error https://codecov.io/bash > codecov.sh
|
||||
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}"
|
||||
|
||||
29
.github/BOTMETA.yml
vendored
29
.github/BOTMETA.yml
vendored
@@ -1,5 +1,7 @@
|
||||
automerge: true
|
||||
files:
|
||||
plugins/:
|
||||
supershipit: quidame Ajpantuso
|
||||
changelogs/fragments/:
|
||||
support: community
|
||||
$actions:
|
||||
@@ -106,6 +108,8 @@ files:
|
||||
maintainers: $team_linode
|
||||
labels: cloud linode
|
||||
keywords: linode dynamic inventory script
|
||||
$inventories/proxmox.py:
|
||||
maintainers: $team_virt ilijamt
|
||||
$inventories/scaleway.py:
|
||||
maintainers: $team_scaleway
|
||||
labels: cloud scaleway
|
||||
@@ -258,6 +262,8 @@ files:
|
||||
maintainers: zbal
|
||||
$modules/cloud/lxc/lxc_container.py:
|
||||
maintainers: cloudnull
|
||||
$modules/cloud/lxc/lxc_profile.py:
|
||||
maintainers: conloos
|
||||
$modules/cloud/lxd/:
|
||||
ignore: hnakamur
|
||||
$modules/cloud/memset/:
|
||||
@@ -373,6 +379,7 @@ files:
|
||||
maintainers: bvitnik
|
||||
$modules/clustering/consul/:
|
||||
maintainers: $team_consul
|
||||
ignore: colin-nolan
|
||||
$modules/clustering/etcd3.py:
|
||||
maintainers: evrardjp
|
||||
ignore: vfauth
|
||||
@@ -523,7 +530,7 @@ files:
|
||||
$modules/net_tools/dnsmadeeasy.py:
|
||||
maintainers: briceburg
|
||||
$modules/net_tools/haproxy.py:
|
||||
maintainers: ravibhure
|
||||
maintainers: ravibhure Normo
|
||||
$modules/net_tools/hetzner_failover_ip.py:
|
||||
maintainers: felixfontein
|
||||
$modules/net_tools/hetzner_failover_ip_info.py:
|
||||
@@ -821,7 +828,7 @@ files:
|
||||
$modules/remote_management/oneview/oneview_fcoe_network.py:
|
||||
maintainers: fgbulsoni
|
||||
$modules/remote_management/redfish/:
|
||||
maintainers: $team_redfish billdodd
|
||||
maintainers: $team_redfish
|
||||
ignore: jose-delarosa
|
||||
$modules/remote_management/stacki/stacki_host.py:
|
||||
maintainers: bsanders bbyhuy
|
||||
@@ -846,6 +853,8 @@ files:
|
||||
ignore: erydo
|
||||
$modules/source_control/github/github_release.py:
|
||||
maintainers: adrianmoisey
|
||||
$modules/source_control/github/github_repo.py:
|
||||
maintainers: atorrescogollo
|
||||
$modules/source_control/github/:
|
||||
maintainers: stpierre
|
||||
$modules/source_control/gitlab/:
|
||||
@@ -929,7 +938,7 @@ files:
|
||||
$modules/system/iptables_state.py:
|
||||
maintainers: quidame
|
||||
$modules/system/java_cert.py:
|
||||
maintainers: haad
|
||||
maintainers: haad absynth76
|
||||
$modules/system/java_keystore.py:
|
||||
maintainers: Mogztter
|
||||
$modules/system/kernel_blacklist.py:
|
||||
@@ -1012,7 +1021,7 @@ files:
|
||||
maintainers: ahtik ovcharenko pyykkis
|
||||
labels: ufw
|
||||
$modules/system/vdo.py:
|
||||
maintainers: bgurney-rh
|
||||
maintainers: rhawalsh
|
||||
$modules/system/xfconf.py:
|
||||
maintainers: russoz jbenden
|
||||
labels: xfconf
|
||||
@@ -1097,16 +1106,16 @@ macros:
|
||||
terminals: plugins/terminal
|
||||
team_aix: MorrisA bcoca d-little flynn1973 gforster kairoaraujo marvin-sinister mator molekuul ramooncamacho wtcross
|
||||
team_bsd: JoergFiedler MacLemon bcoca dch jasperla mekanix opoplawski overhacked tuxillo
|
||||
team_consul: colin-nolan sgargan
|
||||
team_consul: sgargan
|
||||
team_cyberark_conjur: jvanderhoof ryanprior
|
||||
team_docker: DBendit WojciechowskiPiotr akshay196 danihodovic dariko felixfontein jwitko kassiansun tbouvet chouseknecht
|
||||
team_e_spirit: MatrixCrawler getjack
|
||||
team_flatpak: JayKayy oolongbrothers
|
||||
team_gitlab: Lunik Shaps dj-wasabi marwatk waheedi zanssa scodeman
|
||||
team_gitlab: Lunik Shaps dj-wasabi marwatk waheedi zanssa scodeman metanovii
|
||||
team_google: erjohnso rambleraptor
|
||||
team_hpux: bcoca davx8342
|
||||
team_huawei: QijunPan TommyLike edisonxiang freesky-edward hwDCN niuzhenguo xuxiaowei0512 yanzhangi zengchen1024 zhongjun2
|
||||
team_ipa: Akasurde Nosmoht fxfitz
|
||||
team_ipa: Akasurde Nosmoht fxfitz justchris1
|
||||
team_jboss: Wolfant jairojunior wbrefvem
|
||||
team_keycloak: eikef ndclt
|
||||
team_kubevirt: machacekondra mmazur pkliczewski
|
||||
@@ -1115,13 +1124,13 @@ macros:
|
||||
team_manageiq: abellotti cben gtanzillo yaacov zgalor dkorn evertmulder
|
||||
team_netapp: amit0701 carchi8py hulquest lmprice lonico ndswartz schmots1
|
||||
team_networking: NilashishC Qalthos danielmellado ganeshrn justjais trishnaguha sganesh-infoblox privateip
|
||||
team_opennebula: ilicmilan meerkampdvv rsmontero xorel
|
||||
team_opennebula: ilicmilan meerkampdvv rsmontero xorel nilsding
|
||||
team_oracle: manojmeda mross22 nalsaber
|
||||
team_postgresql: Andersson007 Dorn- andytom jbscalia kostiantyn-nemchenko matburt nerzhul sebasmannem tcraxs ilicmilan
|
||||
team_purestorage: bannaych dnix101 genegr lionmax opslounge raekins sdodsley sile16
|
||||
team_redfish: billdodd mraineri tomasg2012 xmadsen renxulei
|
||||
team_redfish: mraineri tomasg2012 xmadsen renxulei
|
||||
team_rhn: FlossWare alikins barnabycourt vritant
|
||||
team_scaleway: QuentinBrosse abarbare jerome-quere kindermoumoute remyleone sieben
|
||||
team_solaris: bcoca fishman jasperla jpdasma mator scathatheworm troy2914 xen0l
|
||||
team_suse: commel dcermak evrardjp lrupp toabctl AnderEnder alxgu andytom
|
||||
team_virt: joshainglis karmab Aversiste
|
||||
team_virt: joshainglis karmab tleguern Thulium-Drake Ajpantuso
|
||||
|
||||
@@ -5,6 +5,74 @@ Community General Release Notes
|
||||
.. contents:: Topics
|
||||
|
||||
|
||||
v1.3.11
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Maintenance release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- ovirt* modules - remove bad unnecessary import for current ansible-core development version (https://github.com/ansible-collections/community.general/pull/2381).
|
||||
|
||||
v1.3.10
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Last regular bugfix release. There will only be new bugfix releases for security fixes and major bugfixes.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- atomic_container - using ``get_bin_path()`` before calling ``run_command()`` (https://github.com/ansible-collections/community.general/pull/2144).
|
||||
- atomic_host - using ``get_bin_path()`` before calling ``run_command()`` (https://github.com/ansible-collections/community.general/pull/2144).
|
||||
- atomic_image - using ``get_bin_path()`` before calling ``run_command()`` (https://github.com/ansible-collections/community.general/pull/2144).
|
||||
- beadm - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- bitbucket_pipeline_variable - removed unreachable code (https://github.com/ansible-collections/community.general/pull/2157).
|
||||
- hiera lookup - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- ipwcli_dns - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- known_hosts module utils - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- nictagadm - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- ovh_ip_failover - removed unreachable code (https://github.com/ansible-collections/community.general/pull/2157).
|
||||
- rhevm - removed unreachable code (https://github.com/ansible-collections/community.general/pull/2157).
|
||||
- smartos_image_info - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- svr4pkg - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- xattr - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- zfs_facts - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- zpool_facts - minor refactor converting multiple statements to a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
|
||||
Security Fixes
|
||||
--------------
|
||||
|
||||
- java_keystore - pass secret to keytool through an environment variable to not expose it as a commandline argument (https://github.com/ansible-collections/community.general/issues/1668).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- dimensiondata_network - bug when formatting message, instead of % a simple comma was used (https://github.com/ansible-collections/community.general/pull/2139).
|
||||
- funcd connection plugin - can now load (https://github.com/ansible-collections/community.general/pull/2235).
|
||||
- haproxy - fix a bug preventing haproxy from properly entering ``DRAIN`` mode (https://github.com/ansible-collections/community.general/issues/1913).
|
||||
- hiera lookup plugin - converts the return type of plugin to unicode string (https://github.com/ansible-collections/community.general/pull/2329).
|
||||
- ipa_user - allow ``sshpubkey`` to permit multiple word comments (https://github.com/ansible-collections/community.general/pull/2159).
|
||||
- java_keystore - improve error handling and return ``cmd`` as documented. Force ``LANG``, ``LC_ALL`` and ``LC_MESSAGES`` environment variables to ``C`` to rely on ``keytool`` output parsing. Fix pylint's ``unused-variable`` and ``no-else-return`` hints (https://github.com/ansible-collections/community.general/pull/2183).
|
||||
- java_keystore - use tempfile lib to create temporary files with randomized names, and remove the temporary PKCS#12 keystore as well as other materials (https://github.com/ansible-collections/community.general/issues/1667).
|
||||
- jenkins_plugin - fixes Python 2 compatibility issue (https://github.com/ansible-collections/community.general/pull/2340).
|
||||
- kibana_plugin - added missing parameter to ``remove_plugin`` when using ``state=present force=true``, and fix potential quoting errors when invoking ``kibana`` (https://github.com/ansible-collections/community.general/pull/2143).
|
||||
- module_helper module utils - fixed decorator ``cause_changes`` (https://github.com/ansible-collections/community.general/pull/2203).
|
||||
- nmap inventory plugin - fix cache and constructed group support (https://github.com/ansible-collections/community.general/issues/2242).
|
||||
- pkgutil - fixed calls to ``list.extend()`` (https://github.com/ansible-collections/community.general/pull/2161).
|
||||
- terraform - fix issue that cause the destroy to fail because from Terraform 0.15 on, the ``terraform destroy -force`` option is replaced with ``terraform destroy -auto-approve`` (https://github.com/ansible-collections/community.general/issues/2247).
|
||||
- terraform - fix issue that cause the execution fail because from Terraform 0.15 on, the ``-var`` and ``-var-file`` options are no longer available on ``terraform validate`` (https://github.com/ansible-collections/community.general/pull/2246).
|
||||
- terraform - remove uses of ``use_unsafe_shell=True`` (https://github.com/ansible-collections/community.general/pull/2246).
|
||||
- vmadm - correct type of list elements in ``resolvers`` parameter (https://github.com/ansible-collections/community.general/issues/2135).
|
||||
- xfconf - module was not honoring check mode when ``state`` was ``absent`` (https://github.com/ansible-collections/community.general/pull/2185).
|
||||
- zypper, zypper_repository - respect ``PATH`` environment variable when resolving zypper executable path (https://github.com/ansible-collections/community.general/pull/2094).
|
||||
|
||||
v1.3.9
|
||||
======
|
||||
|
||||
|
||||
32
CONTRIBUTING.md
Normal file
32
CONTRIBUTING.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Contributing
|
||||
|
||||
We follow [Ansible Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) in all our contributions and interactions within this repository.
|
||||
|
||||
If you are a committer, also refer to the [collection's committer guidelines](https://github.com/ansible-collections/community.general/blob/main/commit-rights.md).
|
||||
|
||||
## Issue tracker
|
||||
|
||||
Whether you are looking for an opportunity to contribute or you found a bug and already know how to solve it, please go to the [issue tracker](https://github.com/ansible-collections/community.general/issues).
|
||||
There you can find feature ideas to implement, reports about bugs to solve, or submit an issue to discuss your idea before implementing it which can help choose a right direction at the beginning of your work and potentially save a lot of time and effort.
|
||||
Also somebody may already have started discussing or working on implementing the same or a similar idea,
|
||||
so you can cooperate to create a better solution together.
|
||||
|
||||
* If you are interested in starting with an easy issue, look for [issues with an `easyfix` label](https://github.com/ansible-collections/community.general/labels/easyfix).
|
||||
* Often issues that are waiting for contributors to pick up have [the `waiting_on_contributor` label](https://github.com/ansible-collections/community.general/labels/waiting_on_contributor).
|
||||
|
||||
## Open pull requests
|
||||
|
||||
Look through currently [open pull requests](https://github.com/ansible-collections/community.general/pulls).
|
||||
You can help by reviewing them. Reviews help move pull requests to merge state. Some good pull requests cannot be merged only due to a lack of reviews. And it is always worth saying that good reviews are often more valuable than pull requests themselves.
|
||||
Note that reviewing does not only mean code review, but also offering comments on new interfaces added to existing plugins/modules, interfaces of new plugins/modules, improving language (not everyone is a native english speaker), or testing bugfixes and new features!
|
||||
|
||||
Also, consider taking up a valuable, reviewed, but abandoned pull request which you could politely ask the original authors to complete yourself.
|
||||
|
||||
* Try committing your changes with an informative but short commit message.
|
||||
* All commits of a pull request branch will be squashed into one commit at last. That does not mean you must have only one commit on your pull request, though!
|
||||
* Please try not to force-push if it is not needed, so reviewers and other users looking at your pull request later can see the pull request commit history.
|
||||
* Do not add merge commits to your PR. The bot will complain and you will have to rebase ([instructions for rebasing](https://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html)) to remove them before your PR can be merged. To avoid that git automatically does merges during pulls, you can configure it to do rebases instead by running `git config pull.rebase true` inside the respository checkout.
|
||||
|
||||
You can also read [our Quick-start development guide](https://github.com/ansible/community-docs/blob/main/create_pr_quick_start_guide.rst).
|
||||
|
||||
If you find any inconsistencies or places in this document which can be improved, feel free to raise an issue or pull request to fix it.
|
||||
12
README.md
12
README.md
@@ -7,9 +7,11 @@ This repo contains the `community.general` Ansible Collection. The collection in
|
||||
|
||||
You can find [documentation for this collection on the Ansible docs site](https://docs.ansible.com/ansible/latest/collections/community/general/).
|
||||
|
||||
Please note that this collection does **not** support Windows targets. Only connection plugins included in this collection might support Windows targets, and will explicitly mention that in their documentation if they do so.
|
||||
|
||||
## Tested with Ansible
|
||||
|
||||
Tested with the current Ansible 2.9 and 2.10 releases and the current development version of Ansible. Ansible versions before 2.9.10 are not supported.
|
||||
Tested with the current Ansible 2.9, ansible-base 2.10 and ansible-core 2.11 releases. Ansible versions before 2.9.10 are not supported.
|
||||
|
||||
## External requirements
|
||||
|
||||
@@ -48,6 +50,8 @@ export COLLECTIONS_PATH=$(pwd)/collections:$COLLECTIONS_PATH
|
||||
|
||||
You can find more information in the [developer guide for collections](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#contributing-to-collections), and in the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html).
|
||||
|
||||
Also for some notes specific to this collection see [our CONTRIBUTING documentation](https://github.com/ansible-collections/community.general/blob/main/CONTRIBUTING.md).
|
||||
|
||||
### Running tests
|
||||
|
||||
See [here](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#testing-collections).
|
||||
@@ -56,10 +60,10 @@ See [here](https://docs.ansible.com/ansible/devel/dev_guide/developing_collectio
|
||||
|
||||
We have a dedicated Working Group for Ansible development.
|
||||
|
||||
You can find other people interested on the following Freenode IRC channels -
|
||||
You can find other people interested on the following [Libera.chat](https://libera.chat/) IRC channels -
|
||||
- `#ansible` - For general use questions and support.
|
||||
- `#ansible-devel` - For discussions on developer topics and code related to features or bugs.
|
||||
- `#ansible-community` - For discussions on community topics and community meetings.
|
||||
- `#ansible-devel` - For discussions on developer topics and code related to features or bugs in ansible-core.
|
||||
- `#ansible-community` - For discussions on community topics and community meetings, and for general development questions for community collections.
|
||||
|
||||
For more information about communities, meetings and agendas see [Community Wiki](https://github.com/ansible/community/wiki/Community).
|
||||
|
||||
|
||||
@@ -1627,6 +1627,108 @@ releases:
|
||||
- fix_parsing_array_values_in_osx_defaults.yml
|
||||
- nios_host_record-fix-aliases-removal.yml
|
||||
release_date: '2020-12-21'
|
||||
1.3.10:
|
||||
changes:
|
||||
bugfixes:
|
||||
- dimensiondata_network - bug when formatting message, instead of % a simple
|
||||
comma was used (https://github.com/ansible-collections/community.general/pull/2139).
|
||||
- funcd connection plugin - can now load (https://github.com/ansible-collections/community.general/pull/2235).
|
||||
- haproxy - fix a bug preventing haproxy from properly entering ``DRAIN`` mode
|
||||
(https://github.com/ansible-collections/community.general/issues/1913).
|
||||
- hiera lookup plugin - converts the return type of plugin to unicode string
|
||||
(https://github.com/ansible-collections/community.general/pull/2329).
|
||||
- ipa_user - allow ``sshpubkey`` to permit multiple word comments (https://github.com/ansible-collections/community.general/pull/2159).
|
||||
- java_keystore - improve error handling and return ``cmd`` as documented. Force
|
||||
``LANG``, ``LC_ALL`` and ``LC_MESSAGES`` environment variables to ``C`` to
|
||||
rely on ``keytool`` output parsing. Fix pylint's ``unused-variable`` and ``no-else-return``
|
||||
hints (https://github.com/ansible-collections/community.general/pull/2183).
|
||||
- java_keystore - use tempfile lib to create temporary files with randomized
|
||||
names, and remove the temporary PKCS#12 keystore as well as other materials
|
||||
(https://github.com/ansible-collections/community.general/issues/1667).
|
||||
- jenkins_plugin - fixes Python 2 compatibility issue (https://github.com/ansible-collections/community.general/pull/2340).
|
||||
- kibana_plugin - added missing parameter to ``remove_plugin`` when using ``state=present
|
||||
force=true``, and fix potential quoting errors when invoking ``kibana`` (https://github.com/ansible-collections/community.general/pull/2143).
|
||||
- module_helper module utils - fixed decorator ``cause_changes`` (https://github.com/ansible-collections/community.general/pull/2203).
|
||||
- nmap inventory plugin - fix cache and constructed group support (https://github.com/ansible-collections/community.general/issues/2242).
|
||||
- pkgutil - fixed calls to ``list.extend()`` (https://github.com/ansible-collections/community.general/pull/2161).
|
||||
- terraform - fix issue that cause the destroy to fail because from Terraform
|
||||
0.15 on, the ``terraform destroy -force`` option is replaced with ``terraform
|
||||
destroy -auto-approve`` (https://github.com/ansible-collections/community.general/issues/2247).
|
||||
- terraform - fix issue that cause the execution fail because from Terraform
|
||||
0.15 on, the ``-var`` and ``-var-file`` options are no longer available on
|
||||
``terraform validate`` (https://github.com/ansible-collections/community.general/pull/2246).
|
||||
- terraform - remove uses of ``use_unsafe_shell=True`` (https://github.com/ansible-collections/community.general/pull/2246).
|
||||
- vmadm - correct type of list elements in ``resolvers`` parameter (https://github.com/ansible-collections/community.general/issues/2135).
|
||||
- xfconf - module was not honoring check mode when ``state`` was ``absent``
|
||||
(https://github.com/ansible-collections/community.general/pull/2185).
|
||||
- zypper, zypper_repository - respect ``PATH`` environment variable when resolving
|
||||
zypper executable path (https://github.com/ansible-collections/community.general/pull/2094).
|
||||
minor_changes:
|
||||
- atomic_container - using ``get_bin_path()`` before calling ``run_command()``
|
||||
(https://github.com/ansible-collections/community.general/pull/2144).
|
||||
- atomic_host - using ``get_bin_path()`` before calling ``run_command()`` (https://github.com/ansible-collections/community.general/pull/2144).
|
||||
- atomic_image - using ``get_bin_path()`` before calling ``run_command()`` (https://github.com/ansible-collections/community.general/pull/2144).
|
||||
- beadm - minor refactor converting multiple statements to a single list literal
|
||||
(https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- bitbucket_pipeline_variable - removed unreachable code (https://github.com/ansible-collections/community.general/pull/2157).
|
||||
- hiera lookup - minor refactor converting multiple statements to a single list
|
||||
literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- ipwcli_dns - minor refactor converting multiple statements to a single list
|
||||
literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- known_hosts module utils - minor refactor converting multiple statements to
|
||||
a single list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- nictagadm - minor refactor converting multiple statements to a single list
|
||||
literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- ovh_ip_failover - removed unreachable code (https://github.com/ansible-collections/community.general/pull/2157).
|
||||
- rhevm - removed unreachable code (https://github.com/ansible-collections/community.general/pull/2157).
|
||||
- smartos_image_info - minor refactor converting multiple statements to a single
|
||||
list literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- svr4pkg - minor refactor converting multiple statements to a single list literal
|
||||
(https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- xattr - minor refactor converting multiple statements to a single list literal
|
||||
(https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- zfs_facts - minor refactor converting multiple statements to a single list
|
||||
literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
- zpool_facts - minor refactor converting multiple statements to a single list
|
||||
literal (https://github.com/ansible-collections/community.general/pull/2160).
|
||||
release_summary: Last regular bugfix release. There will only be new bugfix
|
||||
releases for security fixes and major bugfixes.
|
||||
security_fixes:
|
||||
- java_keystore - pass secret to keytool through an environment variable to
|
||||
not expose it as a commandline argument (https://github.com/ansible-collections/community.general/issues/1668).
|
||||
fragments:
|
||||
- 1.3.10.yml
|
||||
- 1993-haproxy-fix-draining.yml
|
||||
- 2094-bugfix-respect-PATH-env-variable-in-zypper-modules.yaml
|
||||
- 2135-vmadm-resolvers-type-fix.yml
|
||||
- 2139-dimensiondata_network-str-format.yml
|
||||
- 2143-kibana_plugin-fixed-function-calls.yml
|
||||
- 2144-atomic_get_bin_path.yml
|
||||
- 2157-unreachable-code.yml
|
||||
- 2159-ipa-user-sshpubkey-multi-word-comments.yaml
|
||||
- 2160-list-literals.yml
|
||||
- 2161-pkgutil-list-extend.yml
|
||||
- 2163-java_keystore_1667_improve_temp_files_storage.yml
|
||||
- 2177-java_keystore_1668_dont_expose_secrets_on_cmdline.yml
|
||||
- 2183-java_keystore_improve_error_handling.yml
|
||||
- 2185-xfconf-absent-check-mode.yml
|
||||
- 2203-modhelper-cause-changes-deco.yml
|
||||
- 2246-terraform.yaml
|
||||
- 2282-nmap-fix-cache-support.yml
|
||||
- 2329-hiera-lookup-plugin-return-type.yaml
|
||||
- 2340-jenkins_plugin-py2.yml
|
||||
- allow_funcd_to_load.yml
|
||||
release_date: '2021-04-26'
|
||||
1.3.11:
|
||||
changes:
|
||||
bugfixes:
|
||||
- ovirt* modules - remove bad unnecessary import for current ansible-core development
|
||||
version (https://github.com/ansible-collections/community.general/pull/2381).
|
||||
release_summary: Maintenance release.
|
||||
fragments:
|
||||
- 1.3.11.yml
|
||||
- ovirt-fixup.yml
|
||||
release_date: '2021-06-28'
|
||||
1.3.2:
|
||||
changes:
|
||||
bugfixes:
|
||||
|
||||
74
commit-rights.md
Normal file
74
commit-rights.md
Normal file
@@ -0,0 +1,74 @@
|
||||
Committers Guidelines for community.general
|
||||
===========================================
|
||||
|
||||
This document is based on the [Ansible committer guidelines](https://github.com/ansible/ansible/blob/b57444af14062ec96e0af75fdfc2098c74fe2d9a/docs/docsite/rst/community/committer_guidelines.rst) ([latest version](https://docs.ansible.com/ansible/devel/community/committer_guidelines.html)).
|
||||
|
||||
These are the guidelines for people with commit privileges on the Ansible Community General Collection GitHub repository. Please read the guidelines before you commit.
|
||||
|
||||
These guidelines apply to everyone. At the same time, this is NOT a process document. So just use good judgment. You have been given commit access because we trust your judgment.
|
||||
|
||||
That said, use the trust wisely.
|
||||
|
||||
If you abuse the trust and break components and builds, and so on, the trust level falls and you may be asked not to commit or you may lose your commit privileges.
|
||||
|
||||
Our workflow on GitHub
|
||||
----------------------
|
||||
|
||||
As a committer, you may already know this, but our workflow forms a lot of our team policies. Please ensure you are aware of the following workflow steps:
|
||||
|
||||
* Fork the repository upon which you want to do some work to your own personal repository
|
||||
* Work on the specific branch upon which you need to commit
|
||||
* Create a Pull Request back to the collection repository and await reviews
|
||||
* Adjust code as necessary based on the Comments provided
|
||||
* Ask someone from the other committers to do a final review and merge
|
||||
|
||||
Sometimes, committers merge their own pull requests. This section is a set of guidelines. If you are changing a comma in a doc or making a very minor change, you can use your best judgement. This is another trust thing. The process is critical for any major change, but for little things or getting something done quickly, use your best judgement and make sure people on the team are aware of your work.
|
||||
|
||||
Roles
|
||||
-----
|
||||
* Release managers: Merge pull requests to `stable-X` branches, create tags to do releases.
|
||||
* Committers: Fine to do PRs for most things, but we should have a timebox. Hanging PRs may merge on the judgement of these devs.
|
||||
* Module maintainers: Module maintainers own specific modules and have indirect commit access through the current module PR mechanisms. This is primary [ansibullbot](https://github.com/ansibullbot)'s `shipit` mechanism.
|
||||
|
||||
General rules
|
||||
-------------
|
||||
Individuals with direct commit access to this collection repository are entrusted with powers that allow them to do a broad variety of things--probably more than we can write down. Rather than rules, treat these as general *guidelines*, individuals with this power are expected to use their best judgement.
|
||||
|
||||
* Do NOTs:
|
||||
|
||||
- Do not commit directly.
|
||||
- Do not merge your own PRs. Someone else should have a chance to review and approve the PR merge. You have a small amount of leeway here for very minor changes.
|
||||
- Do not forget about non-standard / alternate environments. Consider the alternatives. Yes, people have bad/unusual/strange environments (like binaries from multiple init systems installed), but they are the ones who need us the most.
|
||||
- Do not drag your community team members down. Discuss the technical merits of any pull requests you review. Avoid negativity and personal comments. For more guidance on being a good community member, read the [Ansible Community Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html).
|
||||
- Do not forget about the maintenance burden. High-maintenance features may not be worth adding.
|
||||
- Do not break playbooks. Always keep backwards compatibility in mind.
|
||||
- Do not forget to keep it simple. Complexity breeds all kinds of problems.
|
||||
- Do not merge to branches other than `main`, especially not to `stable-X`, if you do not have explicit permission to do so.
|
||||
- Do not create tags. Tags are used in the release process, and should only be created by the people responsible for managing the stable branches.
|
||||
|
||||
* Do:
|
||||
|
||||
- Squash, avoid merges whenever possible, use GitHub's squash commits or cherry pick if needed (bisect thanks you).
|
||||
- Be active. Committers who have no activity on the project (through merges, triage, commits, and so on) will have their permissions suspended.
|
||||
- Consider backwards compatibility (goes back to "do not break existing playbooks").
|
||||
- Write tests. PRs with tests are looked at with more priority than PRs without tests that should have them included. While not all changes require tests, be sure to add them for bug fixes or functionality changes.
|
||||
- Discuss with other committers, specially when you are unsure of something.
|
||||
- Document! If your PR is a new feature or a change to behavior, make sure you've updated all associated documentation or have notified the right people to do so.
|
||||
- Consider scope, sometimes a fix can be generalized.
|
||||
- Keep it simple, then things are maintainable, debuggable and intelligible.
|
||||
|
||||
Committers are expected to continue to follow the same community and contribution guidelines followed by the rest of the Ansible community.
|
||||
|
||||
|
||||
People
|
||||
------
|
||||
|
||||
Individuals who have been asked to become a part of this group have generally been contributing in significant ways to the community.general collection for some time. Should they agree, they are requested to add their names and GitHub IDs to this file, in the section below, through a pull request. Doing so indicates that these individuals agree to act in the ways that their fellow committers trust that they will act.
|
||||
|
||||
| Name | GitHub ID | IRC Nick | Other |
|
||||
| ------------------- | -------------------- | ------------------ | -------------------- |
|
||||
| Alexei Znamensky | russoz | russoz | |
|
||||
| Amin Vakil | aminvakil | aminvakil | |
|
||||
| Andrew Klychkov | andersson007 | andersson007_ | |
|
||||
| Felix Fontein | felixfontein | felixfontein | |
|
||||
| John R Barker | gundalow | gundalow | |
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace: community
|
||||
name: general
|
||||
version: 1.3.9
|
||||
version: 1.3.11
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (https://github.com/ansible)
|
||||
|
||||
@@ -37,12 +37,13 @@ import tempfile
|
||||
import shutil
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.connection import ConnectionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(object):
|
||||
class Connection(ConnectionBase):
|
||||
''' Func-based connections '''
|
||||
|
||||
has_pipelining = False
|
||||
|
||||
@@ -13,12 +13,32 @@ class ModuleDocFragment(object):
|
||||
DOCUMENTATION = r'''
|
||||
options:
|
||||
config:
|
||||
description:
|
||||
description:
|
||||
- Path to a .json configuration file containing the OneView client configuration.
|
||||
The configuration file is optional and when used should be present in the host running the ansible commands.
|
||||
If the file path is not provided, the configuration will be loaded from environment variables.
|
||||
For links to example configuration files or how to use the environment variables verify the notes section.
|
||||
type: path
|
||||
type: path
|
||||
api_version:
|
||||
description:
|
||||
- OneView API Version.
|
||||
type: int
|
||||
image_streamer_hostname:
|
||||
description:
|
||||
- IP address or hostname for the HPE Image Streamer REST API.
|
||||
type: str
|
||||
hostname:
|
||||
description:
|
||||
- IP address or hostname for the appliance.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- Username for API authentication.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for API authentication.
|
||||
type: str
|
||||
|
||||
requirements:
|
||||
- python >= 2.7.9
|
||||
|
||||
@@ -72,6 +72,25 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
self._nmap = None
|
||||
super(InventoryModule, self).__init__()
|
||||
|
||||
def _populate(self, hosts):
|
||||
# Use constructed if applicable
|
||||
strict = self.get_option('strict')
|
||||
|
||||
for host in hosts:
|
||||
hostname = host['name']
|
||||
self.inventory.add_host(hostname)
|
||||
for var, value in host.items():
|
||||
self.inventory.set_variable(hostname, var, value)
|
||||
|
||||
# Composed variables
|
||||
self._set_composite_vars(self.get_option('compose'), host, hostname, strict=strict)
|
||||
|
||||
# Complex groups based on jinja2 conditionals, hosts that meet the conditional are added to group
|
||||
self._add_host_to_composed_groups(self.get_option('groups'), host, hostname, strict=strict)
|
||||
|
||||
# Create groups based on variable values and add the corresponding hosts to it
|
||||
self._add_host_to_keyed_groups(self.get_option('keyed_groups'), host, hostname, strict=strict)
|
||||
|
||||
def verify_file(self, path):
|
||||
|
||||
valid = False
|
||||
@@ -83,7 +102,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
|
||||
return valid
|
||||
|
||||
def parse(self, inventory, loader, path, cache=False):
|
||||
def parse(self, inventory, loader, path, cache=True):
|
||||
|
||||
try:
|
||||
self._nmap = get_bin_path('nmap')
|
||||
@@ -94,75 +113,101 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
|
||||
self._read_config_data(path)
|
||||
|
||||
# setup command
|
||||
cmd = [self._nmap]
|
||||
if not self._options['ports']:
|
||||
cmd.append('-sP')
|
||||
cache_key = self.get_cache_key(path)
|
||||
|
||||
if self._options['ipv4'] and not self._options['ipv6']:
|
||||
cmd.append('-4')
|
||||
elif self._options['ipv6'] and not self._options['ipv4']:
|
||||
cmd.append('-6')
|
||||
elif not self._options['ipv6'] and not self._options['ipv4']:
|
||||
raise AnsibleParserError('One of ipv4 or ipv6 must be enabled for this plugin')
|
||||
# cache may be True or False at this point to indicate if the inventory is being refreshed
|
||||
# get the user's cache option too to see if we should save the cache if it is changing
|
||||
user_cache_setting = self.get_option('cache')
|
||||
|
||||
if self._options['exclude']:
|
||||
cmd.append('--exclude')
|
||||
cmd.append(','.join(self._options['exclude']))
|
||||
|
||||
cmd.append(self._options['address'])
|
||||
try:
|
||||
# execute
|
||||
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
if p.returncode != 0:
|
||||
raise AnsibleParserError('Failed to run nmap, rc=%s: %s' % (p.returncode, to_native(stderr)))
|
||||
|
||||
# parse results
|
||||
host = None
|
||||
ip = None
|
||||
ports = []
|
||||
# read if the user has caching enabled and the cache isn't being refreshed
|
||||
attempt_to_read_cache = user_cache_setting and cache
|
||||
# update if the user has caching enabled and the cache is being refreshed; update this value to True if the cache has expired below
|
||||
cache_needs_update = user_cache_setting and not cache
|
||||
|
||||
if attempt_to_read_cache:
|
||||
try:
|
||||
t_stdout = to_text(stdout, errors='surrogate_or_strict')
|
||||
except UnicodeError as e:
|
||||
raise AnsibleParserError('Invalid (non unicode) input returned: %s' % to_native(e))
|
||||
results = self._cache[cache_key]
|
||||
except KeyError:
|
||||
# This occurs if the cache_key is not in the cache or if the cache_key expired, so the cache needs to be updated
|
||||
cache_needs_update = True
|
||||
|
||||
for line in t_stdout.splitlines():
|
||||
hits = self.find_host.match(line)
|
||||
if hits:
|
||||
if host is not None:
|
||||
self.inventory.set_variable(host, 'ports', ports)
|
||||
if cache_needs_update:
|
||||
# setup command
|
||||
cmd = [self._nmap]
|
||||
if not self._options['ports']:
|
||||
cmd.append('-sP')
|
||||
|
||||
# if dns only shows arpa, just use ip instead as hostname
|
||||
if hits.group(1).endswith('.in-addr.arpa'):
|
||||
host = hits.group(2)
|
||||
else:
|
||||
host = hits.group(1)
|
||||
if self._options['ipv4'] and not self._options['ipv6']:
|
||||
cmd.append('-4')
|
||||
elif self._options['ipv6'] and not self._options['ipv4']:
|
||||
cmd.append('-6')
|
||||
elif not self._options['ipv6'] and not self._options['ipv4']:
|
||||
raise AnsibleParserError('One of ipv4 or ipv6 must be enabled for this plugin')
|
||||
|
||||
# if no reverse dns exists, just use ip instead as hostname
|
||||
if hits.group(2) is not None:
|
||||
ip = hits.group(2)
|
||||
else:
|
||||
ip = hits.group(1)
|
||||
if self._options['exclude']:
|
||||
cmd.append('--exclude')
|
||||
cmd.append(','.join(self._options['exclude']))
|
||||
|
||||
if host is not None:
|
||||
# update inventory
|
||||
self.inventory.add_host(host)
|
||||
self.inventory.set_variable(host, 'ip', ip)
|
||||
ports = []
|
||||
continue
|
||||
cmd.append(self._options['address'])
|
||||
try:
|
||||
# execute
|
||||
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
if p.returncode != 0:
|
||||
raise AnsibleParserError('Failed to run nmap, rc=%s: %s' % (p.returncode, to_native(stderr)))
|
||||
|
||||
host_ports = self.find_port.match(line)
|
||||
if host is not None and host_ports:
|
||||
ports.append({'port': host_ports.group(1), 'protocol': host_ports.group(2), 'state': host_ports.group(3), 'service': host_ports.group(4)})
|
||||
continue
|
||||
# parse results
|
||||
host = None
|
||||
ip = None
|
||||
ports = []
|
||||
results = []
|
||||
|
||||
# TODO: parse more data, OS?
|
||||
try:
|
||||
t_stdout = to_text(stdout, errors='surrogate_or_strict')
|
||||
except UnicodeError as e:
|
||||
raise AnsibleParserError('Invalid (non unicode) input returned: %s' % to_native(e))
|
||||
|
||||
# if any leftovers
|
||||
if host and ports:
|
||||
self.inventory.set_variable(host, 'ports', ports)
|
||||
for line in t_stdout.splitlines():
|
||||
hits = self.find_host.match(line)
|
||||
if hits:
|
||||
if host is not None and ports:
|
||||
results[-1]['ports'] = ports
|
||||
|
||||
except Exception as e:
|
||||
raise AnsibleParserError("failed to parse %s: %s " % (to_native(path), to_native(e)))
|
||||
# if dns only shows arpa, just use ip instead as hostname
|
||||
if hits.group(1).endswith('.in-addr.arpa'):
|
||||
host = hits.group(2)
|
||||
else:
|
||||
host = hits.group(1)
|
||||
|
||||
# if no reverse dns exists, just use ip instead as hostname
|
||||
if hits.group(2) is not None:
|
||||
ip = hits.group(2)
|
||||
else:
|
||||
ip = hits.group(1)
|
||||
|
||||
if host is not None:
|
||||
# update inventory
|
||||
results.append(dict())
|
||||
results[-1]['name'] = host
|
||||
results[-1]['ip'] = ip
|
||||
ports = []
|
||||
continue
|
||||
|
||||
host_ports = self.find_port.match(line)
|
||||
if host is not None and host_ports:
|
||||
ports.append({'port': host_ports.group(1),
|
||||
'protocol': host_ports.group(2),
|
||||
'state': host_ports.group(3),
|
||||
'service': host_ports.group(4)})
|
||||
continue
|
||||
|
||||
# if any leftovers
|
||||
if host and ports:
|
||||
results[-1]['ports'] = ports
|
||||
|
||||
except Exception as e:
|
||||
raise AnsibleParserError("failed to parse %s: %s " % (to_native(path), to_native(e)))
|
||||
|
||||
self._cache[cache_key] = results
|
||||
|
||||
self._populate(results)
|
||||
|
||||
@@ -11,6 +11,8 @@ DOCUMENTATION = '''
|
||||
plugin_type: inventory
|
||||
short_description: StackPath Edge Computing inventory source
|
||||
version_added: 1.2.0
|
||||
author:
|
||||
- UNKNOWN (@shayrybak)
|
||||
extends_documentation_fragment:
|
||||
- inventory_cache
|
||||
- constructed
|
||||
|
||||
@@ -31,7 +31,9 @@ EXAMPLES = r"""
|
||||
- name: Template files (explicitly skip directories in order to use the 'src' attribute)
|
||||
ansible.builtin.template:
|
||||
src: '{{ item.src }}'
|
||||
dest: /web/{{ item.path }}
|
||||
# Your template files should be stored with a .j2 file extension,
|
||||
# but should not be deployed with it. splitext|first removes it.
|
||||
dest: /web/{{ item.path | splitext | first }}
|
||||
mode: '{{ item.mode }}'
|
||||
with_community.general.filetree: web/
|
||||
when: item.state == 'file'
|
||||
@@ -41,6 +43,7 @@ EXAMPLES = r"""
|
||||
src: '{{ item.src }}'
|
||||
dest: /web/{{ item.path }}
|
||||
state: link
|
||||
follow: false # avoid corrupting target files if the link already exists
|
||||
force: yes
|
||||
mode: '{{ item.mode }}'
|
||||
with_community.general.filetree: web/
|
||||
|
||||
@@ -63,6 +63,7 @@ import os
|
||||
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
from ansible.utils.cmd_functions import run_cmd
|
||||
from ansible.module_utils._text import to_text
|
||||
|
||||
ANSIBLE_HIERA_CFG = os.getenv('ANSIBLE_HIERA_CFG', '/etc/hiera.yaml')
|
||||
ANSIBLE_HIERA_BIN = os.getenv('ANSIBLE_HIERA_BIN', '/usr/bin/hiera')
|
||||
@@ -78,13 +79,11 @@ class Hiera(object):
|
||||
rc, output, err = run_cmd("{0} -c {1} {2}".format(
|
||||
ANSIBLE_HIERA_BIN, ANSIBLE_HIERA_CFG, hiera_key[0]))
|
||||
|
||||
return output.strip()
|
||||
return to_text(output.strip())
|
||||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
def run(self, terms, variables=''):
|
||||
hiera = Hiera()
|
||||
ret = []
|
||||
|
||||
ret.append(hiera.get(terms))
|
||||
ret = [hiera.get(terms)]
|
||||
return ret
|
||||
|
||||
@@ -87,11 +87,12 @@ def not_in_host_file(self, host):
|
||||
user_host_file = "~/.ssh/known_hosts"
|
||||
user_host_file = os.path.expanduser(user_host_file)
|
||||
|
||||
host_file_list = []
|
||||
host_file_list.append(user_host_file)
|
||||
host_file_list.append("/etc/ssh/ssh_known_hosts")
|
||||
host_file_list.append("/etc/ssh/ssh_known_hosts2")
|
||||
host_file_list.append("/etc/openssh/ssh_known_hosts")
|
||||
host_file_list = [
|
||||
user_host_file,
|
||||
"/etc/ssh/ssh_known_hosts",
|
||||
"/etc/ssh/ssh_known_hosts2",
|
||||
"/etc/openssh/ssh_known_hosts",
|
||||
]
|
||||
|
||||
hfiles_not_found = 0
|
||||
for hf in host_file_list:
|
||||
|
||||
@@ -81,18 +81,27 @@ class ArgFormat(object):
|
||||
return [str(p) for p in func(value)]
|
||||
|
||||
|
||||
def cause_changes(func, on_success=True, on_failure=False):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
try:
|
||||
func(*args, **kwargs)
|
||||
if on_success:
|
||||
self.changed = True
|
||||
except Exception as e:
|
||||
if on_failure:
|
||||
self.changed = True
|
||||
raise
|
||||
return wrapper
|
||||
def cause_changes(on_success=None, on_failure=None):
|
||||
|
||||
def deco(func):
|
||||
if on_success is None and on_failure is None:
|
||||
return func
|
||||
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
self = args[0]
|
||||
func(*args, **kwargs)
|
||||
if on_success is not None:
|
||||
self.changed = on_success
|
||||
except Exception:
|
||||
if on_failure is not None:
|
||||
self.changed = on_failure
|
||||
raise
|
||||
|
||||
return wrapper
|
||||
|
||||
return deco
|
||||
|
||||
|
||||
def module_fails_on_exception(func):
|
||||
|
||||
@@ -102,7 +102,8 @@ def do_install(module, mode, rootfs, container, image, values_list, backend):
|
||||
system_list = ["--system"] if mode == 'system' else []
|
||||
user_list = ["--user"] if mode == 'user' else []
|
||||
rootfs_list = ["--rootfs=%s" % rootfs] if rootfs else []
|
||||
args = ['atomic', 'install', "--storage=%s" % backend, '--name=%s' % container] + system_list + user_list + rootfs_list + values_list + [image]
|
||||
atomic_bin = module.get_bin_path('atomic')
|
||||
args = [atomic_bin, 'install', "--storage=%s" % backend, '--name=%s' % container] + system_list + user_list + rootfs_list + values_list + [image]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -112,7 +113,8 @@ def do_install(module, mode, rootfs, container, image, values_list, backend):
|
||||
|
||||
|
||||
def do_update(module, container, image, values_list):
|
||||
args = ['atomic', 'containers', 'update', "--rebase=%s" % image] + values_list + [container]
|
||||
atomic_bin = module.get_bin_path('atomic')
|
||||
args = [atomic_bin, 'containers', 'update', "--rebase=%s" % image] + values_list + [container]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -122,7 +124,8 @@ def do_update(module, container, image, values_list):
|
||||
|
||||
|
||||
def do_uninstall(module, name, backend):
|
||||
args = ['atomic', 'uninstall', "--storage=%s" % backend, name]
|
||||
atomic_bin = module.get_bin_path('atomic')
|
||||
args = [atomic_bin, 'uninstall', "--storage=%s" % backend, name]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -130,7 +133,8 @@ def do_uninstall(module, name, backend):
|
||||
|
||||
|
||||
def do_rollback(module, name):
|
||||
args = ['atomic', 'containers', 'rollback', name]
|
||||
atomic_bin = module.get_bin_path('atomic')
|
||||
args = [atomic_bin, 'containers', 'rollback', name]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -148,14 +152,12 @@ def core(module):
|
||||
backend = module.params['backend']
|
||||
state = module.params['state']
|
||||
|
||||
atomic_bin = module.get_bin_path('atomic')
|
||||
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||
out = {}
|
||||
err = {}
|
||||
rc = 0
|
||||
|
||||
values_list = ["--set=%s" % x for x in values] if values else []
|
||||
|
||||
args = ['atomic', 'containers', 'list', '--no-trunc', '-n', '--all', '-f', 'backend=%s' % backend, '-f', 'container=%s' % name]
|
||||
args = [atomic_bin, 'containers', 'list', '--no-trunc', '-n', '--all', '-f', 'backend=%s' % backend, '-f', 'container=%s' % name]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -194,9 +196,7 @@ def main():
|
||||
module.fail_json(msg="values is supported only with user or system mode")
|
||||
|
||||
# Verify that the platform supports atomic command
|
||||
rc, out, err = module.run_command('atomic -v', check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Error in running atomic command", err=err)
|
||||
dummy = module.get_bin_path('atomic', required=True)
|
||||
|
||||
try:
|
||||
core(module)
|
||||
|
||||
@@ -57,18 +57,14 @@ from ansible.module_utils._text import to_native
|
||||
|
||||
def core(module):
|
||||
revision = module.params['revision']
|
||||
args = []
|
||||
atomic_bin = module.get_bin_path('atomic', required=True)
|
||||
|
||||
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||
|
||||
if revision == 'latest':
|
||||
args = ['atomic', 'host', 'upgrade']
|
||||
args = [atomic_bin, 'host', 'upgrade']
|
||||
else:
|
||||
args = ['atomic', 'host', 'deploy', revision]
|
||||
|
||||
out = {}
|
||||
err = {}
|
||||
rc = 0
|
||||
args = [atomic_bin, 'host', 'deploy', revision]
|
||||
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
|
||||
|
||||
@@ -73,7 +73,8 @@ from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def do_upgrade(module, image):
|
||||
args = ['atomic', 'update', '--force', image]
|
||||
atomic_bin = module.get_bin_path('atomic')
|
||||
args = [atomic_bin, 'update', '--force', image]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc != 0: # something went wrong emit the msg
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -91,20 +92,21 @@ def core(module):
|
||||
is_upgraded = False
|
||||
|
||||
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||
atomic_bin = module.get_bin_path('atomic')
|
||||
out = {}
|
||||
err = {}
|
||||
rc = 0
|
||||
|
||||
if backend:
|
||||
if state == 'present' or state == 'latest':
|
||||
args = ['atomic', 'pull', "--storage=%s" % backend, image]
|
||||
args = [atomic_bin, 'pull', "--storage=%s" % backend, image]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc < 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
else:
|
||||
out_run = ""
|
||||
if started:
|
||||
args = ['atomic', 'run', "--storage=%s" % backend, image]
|
||||
args = [atomic_bin, 'run', "--storage=%s" % backend, image]
|
||||
rc, out_run, err = module.run_command(args, check_rc=False)
|
||||
if rc < 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -112,7 +114,7 @@ def core(module):
|
||||
changed = "Extracting" in out or "Copying blob" in out
|
||||
module.exit_json(msg=(out + out_run), changed=changed)
|
||||
elif state == 'absent':
|
||||
args = ['atomic', 'images', 'delete', "--storage=%s" % backend, image]
|
||||
args = [atomic_bin, 'images', 'delete', "--storage=%s" % backend, image]
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
if rc < 0:
|
||||
module.fail_json(rc=rc, msg=err)
|
||||
@@ -126,11 +128,11 @@ def core(module):
|
||||
is_upgraded = do_upgrade(module, image)
|
||||
|
||||
if started:
|
||||
args = ['atomic', 'run', image]
|
||||
args = [atomic_bin, 'run', image]
|
||||
else:
|
||||
args = ['atomic', 'install', image]
|
||||
args = [atomic_bin, 'install', image]
|
||||
elif state == 'absent':
|
||||
args = ['atomic', 'uninstall', image]
|
||||
args = [atomic_bin, 'uninstall', image]
|
||||
|
||||
rc, out, err = module.run_command(args, check_rc=False)
|
||||
|
||||
@@ -155,9 +157,7 @@ def main():
|
||||
)
|
||||
|
||||
# Verify that the platform supports atomic command
|
||||
rc, out, err = module.run_command('atomic -v', check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Error in running atomic command", err=err)
|
||||
dummy = module.get_bin_path('atomic', required=True)
|
||||
|
||||
try:
|
||||
core(module)
|
||||
|
||||
@@ -260,7 +260,7 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||
)
|
||||
|
||||
self.module.fail_json(
|
||||
"Unexpected failure deleting network with id %s", network.id
|
||||
"Unexpected failure deleting network with id %s" % network.id
|
||||
)
|
||||
|
||||
except DimensionDataAPIException as e:
|
||||
|
||||
@@ -243,7 +243,6 @@ except ImportError:
|
||||
HAS_OVIRTSDK = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
|
||||
|
||||
# ------------------------------------------------------------------- #
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright: Tristan Le Guern (@Aversiste) <tleguern at bouledef.eu>
|
||||
# Copyright: Tristan Le Guern (@tleguern) <tleguern at bouledef.eu>
|
||||
# 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
|
||||
@@ -21,7 +21,7 @@ options:
|
||||
- Restrict results to a specific authentication realm.
|
||||
aliases: ['realm', 'name']
|
||||
type: str
|
||||
author: Tristan Le Guern (@Aversiste)
|
||||
author: Tristan Le Guern (@tleguern)
|
||||
extends_documentation_fragment: community.general.proxmox.documentation
|
||||
'''
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ options:
|
||||
- Restrict results to a specific group.
|
||||
aliases: ['groupid', 'name']
|
||||
type: str
|
||||
author: Tristan Le Guern (@Aversiste)
|
||||
author: Tristan Le Guern (@tleguern)
|
||||
extends_documentation_fragment: community.general.proxmox.documentation
|
||||
'''
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ options:
|
||||
description:
|
||||
- Restrict results to a specific user ID, which is a concatenation of a user and domain parts.
|
||||
type: str
|
||||
author: Tristan Le Guern (@Aversiste)
|
||||
author: Tristan Le Guern (@tleguern)
|
||||
extends_documentation_fragment: community.general.proxmox.documentation
|
||||
'''
|
||||
|
||||
|
||||
@@ -1229,24 +1229,6 @@ class RHEV(object):
|
||||
self.__get_conn()
|
||||
return self.conn.set_VM_Host(vmname, vmhost)
|
||||
|
||||
# pylint: disable=unreachable
|
||||
VM = self.conn.get_VM(vmname)
|
||||
HOST = self.conn.get_Host(vmhost)
|
||||
|
||||
if VM.placement_policy.host is None:
|
||||
self.conn.set_VM_Host(vmname, vmhost)
|
||||
elif str(VM.placement_policy.host.id) != str(HOST.id):
|
||||
self.conn.set_VM_Host(vmname, vmhost)
|
||||
else:
|
||||
setMsg("VM's startup host was already set to " + vmhost)
|
||||
checkFail()
|
||||
|
||||
if str(VM.status.state) == "up":
|
||||
self.conn.migrate_VM(vmname, vmhost)
|
||||
checkFail()
|
||||
|
||||
return True
|
||||
|
||||
def setHost(self, hostname, cluster, ifaces):
|
||||
self.__get_conn()
|
||||
return self.conn.set_Host(hostname, cluster, ifaces)
|
||||
|
||||
@@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: terraform
|
||||
short_description: Manages a Terraform deployment (and plans)
|
||||
@@ -177,24 +177,31 @@ command:
|
||||
import os
|
||||
import json
|
||||
import tempfile
|
||||
from distutils.version import LooseVersion
|
||||
from ansible.module_utils.six.moves import shlex_quote
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
DESTROY_ARGS = ('destroy', '-no-color', '-force')
|
||||
APPLY_ARGS = ('apply', '-no-color', '-input=false', '-auto-approve=true')
|
||||
module = None
|
||||
|
||||
|
||||
def preflight_validation(bin_path, project_path, variables_args=None, plan_file=None):
|
||||
def get_version(bin_path):
|
||||
extract_version = module.run_command([bin_path, 'version', '-json'])
|
||||
terraform_version = (json.loads(extract_version[1]))['terraform_version']
|
||||
return terraform_version
|
||||
|
||||
|
||||
def preflight_validation(bin_path, project_path, version, variables_args=None, plan_file=None):
|
||||
if project_path in [None, ''] or '/' not in project_path:
|
||||
module.fail_json(msg="Path for Terraform project can not be None or ''.")
|
||||
if not os.path.exists(bin_path):
|
||||
module.fail_json(msg="Path for Terraform binary '{0}' doesn't exist on this host - check the path and try again please.".format(bin_path))
|
||||
if not os.path.isdir(project_path):
|
||||
module.fail_json(msg="Path for Terraform project '{0}' doesn't exist on this host - check the path and try again please.".format(project_path))
|
||||
|
||||
rc, out, err = module.run_command([bin_path, 'validate'] + variables_args, check_rc=True, cwd=project_path, use_unsafe_shell=True)
|
||||
if LooseVersion(version) < LooseVersion('0.15.0'):
|
||||
rc, out, err = module.run_command([bin_path, 'validate'] + variables_args, check_rc=True, cwd=project_path)
|
||||
else:
|
||||
rc, out, err = module.run_command([bin_path, 'validate'], check_rc=True, cwd=project_path)
|
||||
|
||||
|
||||
def _state_args(state_file):
|
||||
@@ -267,7 +274,7 @@ def build_plan(command, project_path, variables_args, state_file, targets, state
|
||||
|
||||
plan_command.extend(_state_args(state_file))
|
||||
|
||||
rc, out, err = module.run_command(plan_command + variables_args, cwd=project_path, use_unsafe_shell=True)
|
||||
rc, out, err = module.run_command(plan_command + variables_args, cwd=project_path)
|
||||
|
||||
if rc == 0:
|
||||
# no changes
|
||||
@@ -326,6 +333,15 @@ def main():
|
||||
else:
|
||||
command = [module.get_bin_path('terraform', required=True)]
|
||||
|
||||
checked_version = get_version(command[0])
|
||||
|
||||
if LooseVersion(checked_version) < LooseVersion('0.15.0'):
|
||||
DESTROY_ARGS = ('destroy', '-no-color', '-force')
|
||||
APPLY_ARGS = ('apply', '-no-color', '-input=false', '-auto-approve=true')
|
||||
else:
|
||||
DESTROY_ARGS = ('destroy', '-no-color', '-auto-approve')
|
||||
APPLY_ARGS = ('apply', '-no-color', '-input=false', '-auto-approve')
|
||||
|
||||
if force_init:
|
||||
init_plugins(command[0], project_path, backend_config, backend_config_files, init_reconfigure)
|
||||
|
||||
@@ -351,7 +367,7 @@ def main():
|
||||
for f in variables_files:
|
||||
variables_args.extend(['-var-file', f])
|
||||
|
||||
preflight_validation(command[0], project_path, variables_args)
|
||||
preflight_validation(command[0], project_path, checked_version, variables_args)
|
||||
|
||||
if module.params.get('lock') is not None:
|
||||
if module.params.get('lock'):
|
||||
|
||||
@@ -162,7 +162,6 @@ def waitForTaskDone(client, name, taskId, timeout):
|
||||
currentTimeout -= 5
|
||||
if currentTimeout < 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -111,7 +111,6 @@ ovirt_affinity_labels:
|
||||
import fnmatch
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -52,7 +52,6 @@ ovirt_api:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -73,7 +73,6 @@ ovirt_clusters:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -56,7 +56,6 @@ ovirt_datacenters:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -72,7 +72,6 @@ ovirt_disks:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -103,7 +103,6 @@ ovirt_events:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -87,7 +87,6 @@ ovirt_external_providers:
|
||||
import fnmatch
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -71,7 +71,6 @@ ovirt_groups:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -78,7 +78,6 @@ ovirt_hosts:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -92,7 +92,6 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -73,7 +73,6 @@ ovirt_networks:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -76,7 +76,6 @@ ovirt_nics:
|
||||
import fnmatch
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -88,7 +88,6 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -76,7 +76,6 @@ ovirt_quotas:
|
||||
import fnmatch
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -65,7 +65,6 @@ ovirt_snapshots:
|
||||
import fnmatch
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -74,7 +74,6 @@ ovirt_storage_domains:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -79,7 +79,6 @@ ovirt_storage_templates:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -79,7 +79,6 @@ ovirt_storage_vms:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -95,7 +95,6 @@ ovirt_tags:
|
||||
import fnmatch
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -72,7 +72,6 @@ ovirt_templates:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -71,7 +71,6 @@ ovirt_users:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -102,7 +102,6 @@ ovirt_vms:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -71,7 +71,6 @@ ovirt_vm_pools:
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.common.removed import removed_module
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
||||
check_sdk,
|
||||
|
||||
@@ -119,20 +119,13 @@ class NicTag(object):
|
||||
return is_mac(self.mac.lower())
|
||||
|
||||
def nictag_exists(self):
|
||||
cmd = [self.nictagadm_bin]
|
||||
|
||||
cmd.append('exists')
|
||||
cmd.append(self.name)
|
||||
|
||||
cmd = [self.nictagadm_bin, 'exists', self.name]
|
||||
(rc, dummy, dummy) = self.module.run_command(cmd)
|
||||
|
||||
return rc == 0
|
||||
|
||||
def add_nictag(self):
|
||||
cmd = [self.nictagadm_bin]
|
||||
|
||||
cmd.append('-v')
|
||||
cmd.append('add')
|
||||
cmd = [self.nictagadm_bin, '-v', 'add']
|
||||
|
||||
if self.etherstub:
|
||||
cmd.append('-l')
|
||||
@@ -150,10 +143,7 @@ class NicTag(object):
|
||||
return self.module.run_command(cmd)
|
||||
|
||||
def delete_nictag(self):
|
||||
cmd = [self.nictagadm_bin]
|
||||
|
||||
cmd.append('-v')
|
||||
cmd.append('delete')
|
||||
cmd = [self.nictagadm_bin, '-v', 'delete']
|
||||
|
||||
if self.force:
|
||||
cmd.append('-f')
|
||||
|
||||
@@ -71,10 +71,7 @@ class ImageFacts(object):
|
||||
self.filters = module.params['filters']
|
||||
|
||||
def return_all_installed_images(self):
|
||||
cmd = [self.module.get_bin_path('imgadm')]
|
||||
|
||||
cmd.append('list')
|
||||
cmd.append('-j')
|
||||
cmd = [self.module.get_bin_path('imgadm'), 'list', '-j']
|
||||
|
||||
if self.filters:
|
||||
cmd.append(self.filters)
|
||||
|
||||
@@ -233,7 +233,7 @@ options:
|
||||
description:
|
||||
- List of resolvers to be put into C(/etc/resolv.conf).
|
||||
type: list
|
||||
elements: dict
|
||||
elements: str
|
||||
routes:
|
||||
required: false
|
||||
description:
|
||||
@@ -702,7 +702,7 @@ def main():
|
||||
vnc_password=dict(type='str', no_log=True),
|
||||
disks=dict(type='list', elements='dict'),
|
||||
nics=dict(type='list', elements='dict'),
|
||||
resolvers=dict(type='list', elements='dict'),
|
||||
resolvers=dict(type='list', elements='str'),
|
||||
filesystems=dict(type='list', elements='dict'),
|
||||
)
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ EXAMPLES = '''
|
||||
datacenter: dal09
|
||||
tags:
|
||||
- ansible-module-test
|
||||
- ansible-module-test-slaves
|
||||
- ansible-module-test-replicas
|
||||
hourly: yes
|
||||
private: no
|
||||
dedicated: no
|
||||
@@ -235,7 +235,7 @@ EXAMPLES = '''
|
||||
datacenter: dal09
|
||||
tags:
|
||||
- ansible-module-test
|
||||
- ansible-module-test-slaves
|
||||
- ansible-module-test-replicas
|
||||
hourly: yes
|
||||
private: no
|
||||
dedicated: no
|
||||
|
||||
@@ -36,13 +36,13 @@ seealso:
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get info for job awx
|
||||
community.general.nomad_job:
|
||||
community.general.nomad_job_info:
|
||||
host: localhost
|
||||
name: awx
|
||||
register: result
|
||||
|
||||
- name: List Nomad jobs
|
||||
community.general.nomad_job:
|
||||
community.general.nomad_job_info:
|
||||
host: localhost
|
||||
register: result
|
||||
|
||||
|
||||
@@ -164,22 +164,20 @@ def install_plugin(module, plugin_bin, plugin_name, url, timeout, kibana_version
|
||||
cmd_args = [plugin_bin, "plugin", PACKAGE_STATE_MAP["present"], plugin_name]
|
||||
|
||||
if url:
|
||||
cmd_args.append("--url %s" % url)
|
||||
cmd_args.extend(["--url", url])
|
||||
|
||||
if timeout:
|
||||
cmd_args.append("--timeout %s" % timeout)
|
||||
|
||||
cmd = " ".join(cmd_args)
|
||||
cmd_args.extend(["--timeout", timeout])
|
||||
|
||||
if module.check_mode:
|
||||
return True, cmd, "check mode", ""
|
||||
return True, " ".join(cmd_args), "check mode", ""
|
||||
|
||||
rc, out, err = module.run_command(cmd)
|
||||
rc, out, err = module.run_command(cmd_args)
|
||||
if rc != 0:
|
||||
reason = parse_error(out)
|
||||
module.fail_json(msg=reason)
|
||||
|
||||
return True, cmd, out, err
|
||||
return True, " ".join(cmd_args), out, err
|
||||
|
||||
|
||||
def remove_plugin(module, plugin_bin, plugin_name, kibana_version='4.6'):
|
||||
@@ -189,23 +187,21 @@ def remove_plugin(module, plugin_bin, plugin_name, kibana_version='4.6'):
|
||||
else:
|
||||
cmd_args = [plugin_bin, "plugin", PACKAGE_STATE_MAP["absent"], plugin_name]
|
||||
|
||||
cmd = " ".join(cmd_args)
|
||||
|
||||
if module.check_mode:
|
||||
return True, cmd, "check mode", ""
|
||||
return True, " ".join(cmd_args), "check mode", ""
|
||||
|
||||
rc, out, err = module.run_command(cmd)
|
||||
rc, out, err = module.run_command(cmd_args)
|
||||
if rc != 0:
|
||||
reason = parse_error(out)
|
||||
module.fail_json(msg=reason)
|
||||
|
||||
return True, cmd, out, err
|
||||
return True, " ".join(cmd_args), out, err
|
||||
|
||||
|
||||
def get_kibana_version(module, plugin_bin):
|
||||
cmd_args = [plugin_bin, '--version']
|
||||
cmd = " ".join(cmd_args)
|
||||
rc, out, err = module.run_command(cmd)
|
||||
|
||||
rc, out, err = module.run_command(cmd_args)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to get Kibana version : %s" % err)
|
||||
|
||||
@@ -251,7 +247,7 @@ def main():
|
||||
|
||||
if state == "present":
|
||||
if force:
|
||||
remove_plugin(module, plugin_bin, name)
|
||||
remove_plugin(module, plugin_bin, name, kibana_version)
|
||||
changed, cmd, out, err = install_plugin(module, plugin_bin, name, url, timeout, kibana_version)
|
||||
|
||||
elif state == "absent":
|
||||
|
||||
@@ -98,9 +98,8 @@ from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def get_xattr_keys(module, path, follow):
|
||||
cmd = [module.get_bin_path('getfattr', True)]
|
||||
# prevents warning and not sure why it's not default
|
||||
cmd.append('--absolute-names')
|
||||
cmd = [module.get_bin_path('getfattr', True), '--absolute-names']
|
||||
|
||||
if not follow:
|
||||
cmd.append('-h')
|
||||
cmd.append(path)
|
||||
@@ -109,10 +108,8 @@ def get_xattr_keys(module, path, follow):
|
||||
|
||||
|
||||
def get_xattr(module, path, key, follow):
|
||||
cmd = [module.get_bin_path('getfattr', True), '--absolute-names']
|
||||
|
||||
cmd = [module.get_bin_path('getfattr', True)]
|
||||
# prevents warning and not sure why it's not default
|
||||
cmd.append('--absolute-names')
|
||||
if not follow:
|
||||
cmd.append('-h')
|
||||
if key is None:
|
||||
|
||||
@@ -63,7 +63,7 @@ EXAMPLES = r'''
|
||||
- name: Changing Managing hosts list
|
||||
community.general.ipa_service:
|
||||
name: http/host01.example.com
|
||||
host:
|
||||
hosts:
|
||||
- host01.example.com
|
||||
- host02.example.com
|
||||
ipa_host: ipa.example.com
|
||||
|
||||
@@ -269,16 +269,18 @@ def get_user_diff(client, ipa_user, module_user):
|
||||
def get_ssh_key_fingerprint(ssh_key, hash_algo='sha256'):
|
||||
"""
|
||||
Return the public key fingerprint of a given public SSH key
|
||||
in format "[fp] [user@host] (ssh-rsa)" where fp is of the format:
|
||||
in format "[fp] [comment] (ssh-rsa)" where fp is of the format:
|
||||
FB:0C:AC:0A:07:94:5B:CE:75:6E:63:32:13:AD:AD:D7
|
||||
for md5 or
|
||||
SHA256:[base64]
|
||||
for sha256
|
||||
Comments are assumed to be all characters past the second
|
||||
whitespace character in the sshpubkey string.
|
||||
:param ssh_key:
|
||||
:param hash_algo:
|
||||
:return:
|
||||
"""
|
||||
parts = ssh_key.strip().split()
|
||||
parts = ssh_key.strip().split(None, 2)
|
||||
if len(parts) == 0:
|
||||
return None
|
||||
key_type = parts[0]
|
||||
@@ -293,8 +295,8 @@ def get_ssh_key_fingerprint(ssh_key, hash_algo='sha256'):
|
||||
if len(parts) < 3:
|
||||
return "%s (%s)" % (key_fp, key_type)
|
||||
else:
|
||||
user_host = parts[2]
|
||||
return "%s %s (%s)" % (key_fp, user_host, key_type)
|
||||
comment = parts[2]
|
||||
return "%s %s (%s)" % (key_fp, comment, key_type)
|
||||
|
||||
|
||||
def ensure(module, client):
|
||||
|
||||
@@ -367,10 +367,9 @@ class HAProxy(object):
|
||||
# We can assume there will only be 1 element in state because both svname and pxname are always set when we get here
|
||||
# When using track we get a status like this: MAINT (via pxname/svname) so we need to do substring matching
|
||||
if status in state[0]['status']:
|
||||
if not self._drain or (state[0]['scur'] == '0' and 'MAINT' in state):
|
||||
if not self._drain or state[0]['scur'] == '0':
|
||||
return True
|
||||
else:
|
||||
time.sleep(self.wait_interval)
|
||||
time.sleep(self.wait_interval)
|
||||
|
||||
self.module.fail_json(msg="server %s/%s not status '%s' after %d retries. Aborting." %
|
||||
(pxname, svname, status, self.wait_retries))
|
||||
@@ -409,15 +408,17 @@ class HAProxy(object):
|
||||
def drain(self, host, backend, status='DRAIN'):
|
||||
"""
|
||||
Drain action, sets the server to DRAIN mode.
|
||||
In this mode mode, the server will not accept any new connections
|
||||
In this mode, the server will not accept any new connections
|
||||
other than those that are accepted via persistence.
|
||||
"""
|
||||
haproxy_version = self.discover_version()
|
||||
|
||||
# check if haproxy version suppots DRAIN state (starting with 1.5)
|
||||
# check if haproxy version supports DRAIN state (starting with 1.5)
|
||||
if haproxy_version and (1, 5) <= haproxy_version:
|
||||
cmd = "set server $pxname/$svname state drain"
|
||||
self.execute_for_backends(cmd, backend, host, status)
|
||||
self.execute_for_backends(cmd, backend, host, "DRAIN")
|
||||
if status == "MAINT":
|
||||
self.disabled(host, backend, self.shutdown_sessions)
|
||||
|
||||
def act(self):
|
||||
"""
|
||||
@@ -426,7 +427,7 @@ class HAProxy(object):
|
||||
# Get the state before the run
|
||||
self.command_results['state_before'] = self.get_state_for(self.backend, self.host)
|
||||
|
||||
# toggle enable/disbale server
|
||||
# toggle enable/disable server
|
||||
if self.state == 'enabled':
|
||||
self.enabled(self.host, self.backend, self.weight)
|
||||
elif self.state == 'disabled' and self._drain:
|
||||
|
||||
@@ -205,9 +205,11 @@ class ResourceRecord(object):
|
||||
def list_record(self, record):
|
||||
# check if the record exists via list on ipwcli
|
||||
search = 'list %s' % (record.replace(';', '&&').replace('set', 'where'))
|
||||
cmd = [self.module.get_bin_path('ipwcli', True)]
|
||||
cmd.append('-user=%s' % (self.user))
|
||||
cmd.append('-password=%s' % (self.password))
|
||||
cmd = [
|
||||
self.module.get_bin_path('ipwcli', True),
|
||||
'-user=%s' % self.user,
|
||||
'-password=%s' % self.password,
|
||||
]
|
||||
rc, out, err = self.module.run_command(cmd, data=search)
|
||||
|
||||
if 'Invalid username or password' in out:
|
||||
@@ -222,9 +224,11 @@ class ResourceRecord(object):
|
||||
def deploy_record(self, record):
|
||||
# check what happens if create fails on ipworks
|
||||
stdin = 'create %s' % (record)
|
||||
cmd = [self.module.get_bin_path('ipwcli', True)]
|
||||
cmd.append('-user=%s' % (self.user))
|
||||
cmd.append('-password=%s' % (self.password))
|
||||
cmd = [
|
||||
self.module.get_bin_path('ipwcli', True),
|
||||
'-user=%s' % self.user,
|
||||
'-password=%s' % self.password,
|
||||
]
|
||||
rc, out, err = self.module.run_command(cmd, data=stdin)
|
||||
|
||||
if 'Invalid username or password' in out:
|
||||
@@ -238,9 +242,11 @@ class ResourceRecord(object):
|
||||
def delete_record(self, record):
|
||||
# check what happens if create fails on ipworks
|
||||
stdin = 'delete %s' % (record.replace(';', '&&').replace('set', 'where'))
|
||||
cmd = [self.module.get_bin_path('ipwcli', True)]
|
||||
cmd.append('-user=%s' % (self.user))
|
||||
cmd.append('-password=%s' % (self.password))
|
||||
cmd = [
|
||||
self.module.get_bin_path('ipwcli', True),
|
||||
'-user=%s' % self.user,
|
||||
'-password=%s' % self.password,
|
||||
]
|
||||
rc, out, err = self.module.run_command(cmd, data=stdin)
|
||||
|
||||
if 'Invalid username or password' in out:
|
||||
|
||||
@@ -130,7 +130,7 @@ def packages_not_latest(module, names, site, update_catalog):
|
||||
cmd.append('-U')
|
||||
cmd.append('-c')
|
||||
if site is not None:
|
||||
cmd.extend('-t', site)
|
||||
cmd.extend(['-t', site])
|
||||
if names != ['*']:
|
||||
cmd.extend(names)
|
||||
rc, out, err = run_command(module, cmd)
|
||||
@@ -159,7 +159,7 @@ def package_install(module, state, pkgs, site, update_catalog, force):
|
||||
if update_catalog:
|
||||
cmd.append('-U')
|
||||
if site is not None:
|
||||
cmd.extend('-t', site)
|
||||
cmd.extend(['-t', site])
|
||||
if force:
|
||||
cmd.append('-f')
|
||||
cmd.extend(pkgs)
|
||||
@@ -174,7 +174,7 @@ def package_upgrade(module, pkgs, site, update_catalog, force):
|
||||
if update_catalog:
|
||||
cmd.append('-U')
|
||||
if site is not None:
|
||||
cmd.extend('-t', site)
|
||||
cmd.extend(['-t', site])
|
||||
if force:
|
||||
cmd.append('-f')
|
||||
cmd += pkgs
|
||||
|
||||
@@ -16,6 +16,7 @@ author: "Joe Adams (@sysadmind)"
|
||||
short_description: Add or remove Pulp repos from a remote host.
|
||||
description:
|
||||
- Add or remove Pulp repos from a remote host.
|
||||
- Note, this is for Pulp 2 only.
|
||||
options:
|
||||
add_export_distributor:
|
||||
description:
|
||||
|
||||
@@ -108,8 +108,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def package_installed(module, name, category):
|
||||
cmd = [module.get_bin_path('pkginfo', True)]
|
||||
cmd.append('-q')
|
||||
cmd = [module.get_bin_path('pkginfo', True), '-q']
|
||||
if category:
|
||||
cmd.append('-c')
|
||||
cmd.append(name)
|
||||
|
||||
@@ -336,7 +336,7 @@ def get_cmd(m, subcommand):
|
||||
"puts together the basic zypper command arguments with those passed to the module"
|
||||
is_install = subcommand in ['install', 'update', 'patch', 'dist-upgrade']
|
||||
is_refresh = subcommand == 'refresh'
|
||||
cmd = ['/usr/bin/zypper', '--quiet', '--non-interactive', '--xmlout']
|
||||
cmd = [m.get_bin_path('zypper', required=True), '--quiet', '--non-interactive', '--xmlout']
|
||||
if m.params['extra_args_precommand']:
|
||||
args_list = m.params['extra_args_precommand'].split()
|
||||
cmd.extend(args_list)
|
||||
|
||||
@@ -141,9 +141,9 @@ from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
||||
REPO_OPTS = ['alias', 'name', 'priority', 'enabled', 'autorefresh', 'gpgcheck']
|
||||
|
||||
|
||||
def _get_cmd(*args):
|
||||
def _get_cmd(module, *args):
|
||||
"""Combines the non-interactive zypper command with arguments/subcommands"""
|
||||
cmd = ['/usr/bin/zypper', '--quiet', '--non-interactive']
|
||||
cmd = [module.get_bin_path('zypper', required=True), '--quiet', '--non-interactive']
|
||||
cmd.extend(args)
|
||||
|
||||
return cmd
|
||||
@@ -151,7 +151,7 @@ def _get_cmd(*args):
|
||||
|
||||
def _parse_repos(module):
|
||||
"""parses the output of zypper --xmlout repos and return a parse repo dictionary"""
|
||||
cmd = _get_cmd('--xmlout', 'repos')
|
||||
cmd = _get_cmd(module, '--xmlout', 'repos')
|
||||
|
||||
if not HAS_XML:
|
||||
module.fail_json(msg=missing_required_lib("python-xml"), exception=XML_IMP_ERR)
|
||||
@@ -230,7 +230,7 @@ def repo_exists(module, repodata, overwrite_multiple):
|
||||
def addmodify_repo(module, repodata, old_repos, zypper_version, warnings):
|
||||
"Adds the repo, removes old repos before, that would conflict."
|
||||
repo = repodata['url']
|
||||
cmd = _get_cmd('addrepo', '--check')
|
||||
cmd = _get_cmd(module, 'addrepo', '--check')
|
||||
if repodata['name']:
|
||||
cmd.extend(['--name', repodata['name']])
|
||||
|
||||
@@ -274,14 +274,14 @@ def addmodify_repo(module, repodata, old_repos, zypper_version, warnings):
|
||||
|
||||
def remove_repo(module, repo):
|
||||
"Removes the repo."
|
||||
cmd = _get_cmd('removerepo', repo)
|
||||
cmd = _get_cmd(module, 'removerepo', repo)
|
||||
|
||||
rc, stdout, stderr = module.run_command(cmd, check_rc=True)
|
||||
return rc, stdout, stderr
|
||||
|
||||
|
||||
def get_zypper_version(module):
|
||||
rc, stdout, stderr = module.run_command(['/usr/bin/zypper', '--version'])
|
||||
rc, stdout, stderr = module.run_command([module.get_bin_path('zypper', required=True), '--version'])
|
||||
if rc != 0 or not stdout.startswith('zypper '):
|
||||
return LooseVersion('1.0')
|
||||
return LooseVersion(stdout.split()[1])
|
||||
@@ -290,9 +290,9 @@ def get_zypper_version(module):
|
||||
def runrefreshrepo(module, auto_import_keys=False, shortname=None):
|
||||
"Forces zypper to refresh repo metadata."
|
||||
if auto_import_keys:
|
||||
cmd = _get_cmd('--gpg-auto-import-keys', 'refresh', '--force')
|
||||
cmd = _get_cmd(module, '--gpg-auto-import-keys', 'refresh', '--force')
|
||||
else:
|
||||
cmd = _get_cmd('refresh', '--force')
|
||||
cmd = _get_cmd(module, 'refresh', '--force')
|
||||
if shortname is not None:
|
||||
cmd.extend(['-r', shortname])
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Data Center name.
|
||||
type: str
|
||||
options:
|
||||
description:
|
||||
- "Retrieve additional information. Options available: 'visualContent'."
|
||||
|
||||
@@ -24,6 +24,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Enclosure name.
|
||||
type: str
|
||||
options:
|
||||
description:
|
||||
- "List with options to gather additional information about an Enclosure and related resources.
|
||||
|
||||
@@ -24,11 +24,13 @@ options:
|
||||
- C(present) will ensure data properties are compliant with OneView.
|
||||
- C(absent) will remove the resource from OneView, if it exists.
|
||||
- C(default_bandwidth_reset) will reset the network connection template to the default.
|
||||
type: str
|
||||
default: present
|
||||
choices: [present, absent, default_bandwidth_reset]
|
||||
data:
|
||||
description:
|
||||
- List with Ethernet Network properties.
|
||||
type: dict
|
||||
required: true
|
||||
extends_documentation_fragment:
|
||||
- community.general.oneview
|
||||
|
||||
@@ -23,6 +23,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Ethernet Network name.
|
||||
type: str
|
||||
options:
|
||||
description:
|
||||
- "List with options to gather additional information about an Ethernet Network and related resources.
|
||||
|
||||
@@ -20,11 +20,13 @@ options:
|
||||
- Indicates the desired state for the Fibre Channel Network resource.
|
||||
C(present) will ensure data properties are compliant with OneView.
|
||||
C(absent) will remove the resource from OneView, if it exists.
|
||||
type: str
|
||||
choices: ['present', 'absent']
|
||||
required: true
|
||||
data:
|
||||
description:
|
||||
- List with the Fibre Channel Network properties.
|
||||
type: dict
|
||||
required: true
|
||||
|
||||
extends_documentation_fragment:
|
||||
|
||||
@@ -23,6 +23,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Fibre Channel Network name.
|
||||
type: str
|
||||
|
||||
extends_documentation_fragment:
|
||||
- community.general.oneview
|
||||
|
||||
@@ -21,11 +21,13 @@ options:
|
||||
- Indicates the desired state for the FCoE Network resource.
|
||||
C(present) will ensure data properties are compliant with OneView.
|
||||
C(absent) will remove the resource from OneView, if it exists.
|
||||
type: str
|
||||
default: present
|
||||
choices: ['present', 'absent']
|
||||
data:
|
||||
description:
|
||||
- List with FCoE Network properties.
|
||||
type: dict
|
||||
required: true
|
||||
|
||||
extends_documentation_fragment:
|
||||
|
||||
@@ -23,6 +23,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- FCoE Network name.
|
||||
type: str
|
||||
extends_documentation_fragment:
|
||||
- community.general.oneview
|
||||
- community.general.oneview.factsparams
|
||||
|
||||
@@ -24,11 +24,13 @@ options:
|
||||
- Indicates the desired state for the Logical Interconnect Group resource.
|
||||
C(absent) will remove the resource from OneView, if it exists.
|
||||
C(present) will ensure data properties are compliant with OneView.
|
||||
type: str
|
||||
choices: [absent, present]
|
||||
default: present
|
||||
data:
|
||||
description:
|
||||
- List with the Logical Interconnect Group properties.
|
||||
type: dict
|
||||
required: true
|
||||
extends_documentation_fragment:
|
||||
- community.general.oneview
|
||||
|
||||
@@ -24,6 +24,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Logical Interconnect Group name.
|
||||
type: str
|
||||
extends_documentation_fragment:
|
||||
- community.general.oneview
|
||||
- community.general.oneview.factsparams
|
||||
|
||||
@@ -23,11 +23,13 @@ options:
|
||||
- Indicates the desired state for the Network Set resource.
|
||||
- C(present) will ensure data properties are compliant with OneView.
|
||||
- C(absent) will remove the resource from OneView, if it exists.
|
||||
type: str
|
||||
default: present
|
||||
choices: ['present', 'absent']
|
||||
data:
|
||||
description:
|
||||
- List with the Network Set properties.
|
||||
type: dict
|
||||
required: true
|
||||
|
||||
extends_documentation_fragment:
|
||||
|
||||
@@ -23,6 +23,7 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Network Set name.
|
||||
type: str
|
||||
|
||||
options:
|
||||
description:
|
||||
|
||||
@@ -24,12 +24,14 @@ options:
|
||||
- C(present) ensures data properties are compliant with OneView.
|
||||
- C(absent) removes the resource from OneView, if it exists.
|
||||
- C(connection_information_set) updates the connection information for the SAN Manager. This operation is non-idempotent.
|
||||
type: str
|
||||
default: present
|
||||
choices: [present, absent, connection_information_set]
|
||||
data:
|
||||
description:
|
||||
- List with SAN Manager properties.
|
||||
required: true
|
||||
description:
|
||||
- List with SAN Manager properties.
|
||||
type: dict
|
||||
required: true
|
||||
|
||||
extends_documentation_fragment:
|
||||
- community.general.oneview
|
||||
|
||||
@@ -23,6 +23,7 @@ options:
|
||||
provider_display_name:
|
||||
description:
|
||||
- Provider Display Name.
|
||||
type: str
|
||||
params:
|
||||
description:
|
||||
- List of params to delimit, filter and sort the list of resources.
|
||||
@@ -31,6 +32,7 @@ options:
|
||||
- C(count): The number of resources to return.
|
||||
- C(query): A general query string to narrow the list of resources returned.
|
||||
- C(sort): The sort order of the returned data set."
|
||||
type: dict
|
||||
extends_documentation_fragment:
|
||||
- community.general.oneview
|
||||
|
||||
|
||||
@@ -149,8 +149,6 @@ def get_existing_pipeline_variable(module, bitbucket):
|
||||
var['name'] = var.pop('key')
|
||||
return var
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def create_pipeline_variable(module, bitbucket):
|
||||
info, content = bitbucket.request(
|
||||
|
||||
@@ -175,10 +175,7 @@ class ZFSFacts(object):
|
||||
self.facts = []
|
||||
|
||||
def dataset_exists(self):
|
||||
cmd = [self.module.get_bin_path('zfs')]
|
||||
|
||||
cmd.append('list')
|
||||
cmd.append(self.name)
|
||||
cmd = [self.module.get_bin_path('zfs'), 'list', self.name]
|
||||
|
||||
(rc, out, err) = self.module.run_command(cmd)
|
||||
|
||||
@@ -188,10 +185,7 @@ class ZFSFacts(object):
|
||||
return False
|
||||
|
||||
def get_facts(self):
|
||||
cmd = [self.module.get_bin_path('zfs')]
|
||||
|
||||
cmd.append('get')
|
||||
cmd.append('-H')
|
||||
cmd = [self.module.get_bin_path('zfs'), 'get', '-H']
|
||||
if self.parsable:
|
||||
cmd.append('-p')
|
||||
if self.recurse:
|
||||
@@ -202,10 +196,7 @@ class ZFSFacts(object):
|
||||
if self.type:
|
||||
cmd.append('-t')
|
||||
cmd.append(self.type)
|
||||
cmd.append('-o')
|
||||
cmd.append('name,property,value')
|
||||
cmd.append(self.properties)
|
||||
cmd.append(self.name)
|
||||
cmd.extend(['-o', 'name,property,value', self.properties, self.name])
|
||||
|
||||
(rc, out, err) = self.module.run_command(cmd)
|
||||
|
||||
|
||||
@@ -134,10 +134,7 @@ class ZPoolFacts(object):
|
||||
self.facts = []
|
||||
|
||||
def pool_exists(self):
|
||||
cmd = [self.module.get_bin_path('zpool')]
|
||||
|
||||
cmd.append('list')
|
||||
cmd.append(self.name)
|
||||
cmd = [self.module.get_bin_path('zpool'), 'list', self.name]
|
||||
|
||||
(rc, out, err) = self.module.run_command(cmd)
|
||||
|
||||
@@ -147,10 +144,7 @@ class ZPoolFacts(object):
|
||||
return False
|
||||
|
||||
def get_facts(self):
|
||||
cmd = [self.module.get_bin_path('zpool')]
|
||||
|
||||
cmd.append('get')
|
||||
cmd.append('-H')
|
||||
cmd = [self.module.get_bin_path('zpool'), 'get', '-H']
|
||||
if self.parsable:
|
||||
cmd.append('-p')
|
||||
cmd.append('-o')
|
||||
|
||||
@@ -154,9 +154,7 @@ class BE(object):
|
||||
self.is_freebsd = os.uname()[0] == 'FreeBSD'
|
||||
|
||||
def _beadm_list(self):
|
||||
cmd = [self.module.get_bin_path('beadm')]
|
||||
cmd.append('list')
|
||||
cmd.append('-H')
|
||||
cmd = [self.module.get_bin_path('beadm'), 'list', '-H']
|
||||
if '@' in self.name:
|
||||
cmd.append('-s')
|
||||
return self.module.run_command(cmd)
|
||||
@@ -218,42 +216,26 @@ class BE(object):
|
||||
return False
|
||||
|
||||
def activate_be(self):
|
||||
cmd = [self.module.get_bin_path('beadm')]
|
||||
|
||||
cmd.append('activate')
|
||||
cmd.append(self.name)
|
||||
|
||||
cmd = [self.module.get_bin_path('beadm'), 'activate', self.name]
|
||||
return self.module.run_command(cmd)
|
||||
|
||||
def create_be(self):
|
||||
cmd = [self.module.get_bin_path('beadm')]
|
||||
|
||||
cmd.append('create')
|
||||
cmd = [self.module.get_bin_path('beadm'), 'create']
|
||||
|
||||
if self.snapshot:
|
||||
cmd.append('-e')
|
||||
cmd.append(self.snapshot)
|
||||
|
||||
cmd.extend(['-e', self.snapshot])
|
||||
if not self.is_freebsd:
|
||||
if self.description:
|
||||
cmd.append('-d')
|
||||
cmd.append(self.description)
|
||||
|
||||
cmd.extend(['-d', self.description])
|
||||
if self.options:
|
||||
cmd.append('-o')
|
||||
cmd.append(self.options)
|
||||
cmd.extend(['-o', self.options])
|
||||
|
||||
cmd.append(self.name)
|
||||
|
||||
return self.module.run_command(cmd)
|
||||
|
||||
def destroy_be(self):
|
||||
cmd = [self.module.get_bin_path('beadm')]
|
||||
|
||||
cmd.append('destroy')
|
||||
cmd.append('-F')
|
||||
cmd.append(self.name)
|
||||
|
||||
cmd = [self.module.get_bin_path('beadm'), 'destroy', '-F', self.name]
|
||||
return self.module.run_command(cmd)
|
||||
|
||||
def is_mounted(self):
|
||||
@@ -276,10 +258,7 @@ class BE(object):
|
||||
return False
|
||||
|
||||
def mount_be(self):
|
||||
cmd = [self.module.get_bin_path('beadm')]
|
||||
|
||||
cmd.append('mount')
|
||||
cmd.append(self.name)
|
||||
cmd = [self.module.get_bin_path('beadm'), 'mount', self.name]
|
||||
|
||||
if self.mountpoint:
|
||||
cmd.append(self.mountpoint)
|
||||
@@ -287,9 +266,7 @@ class BE(object):
|
||||
return self.module.run_command(cmd)
|
||||
|
||||
def unmount_be(self):
|
||||
cmd = [self.module.get_bin_path('beadm')]
|
||||
|
||||
cmd.append('unmount')
|
||||
cmd = [self.module.get_bin_path('beadm'), 'unmount']
|
||||
if self.force:
|
||||
cmd.append('-f')
|
||||
cmd.append(self.name)
|
||||
|
||||
@@ -114,13 +114,15 @@ cmd:
|
||||
description: Executed command to get action done
|
||||
returned: changed and failure
|
||||
type: str
|
||||
sample: "openssl x509 -noout -in /tmp/cert.crt -fingerprint -sha256"
|
||||
sample: "/usr/bin/openssl x509 -noout -in /tmp/user/1000/tmp8jd_lh23 -fingerprint -sha256"
|
||||
'''
|
||||
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def read_certificate_fingerprint(module, openssl_bin, certificate_path):
|
||||
@@ -129,59 +131,70 @@ def read_certificate_fingerprint(module, openssl_bin, certificate_path):
|
||||
if rc != 0:
|
||||
return module.fail_json(msg=current_certificate_fingerprint_out,
|
||||
err=current_certificate_fingerprint_err,
|
||||
rc=rc,
|
||||
cmd=current_certificate_fingerprint_cmd)
|
||||
cmd=current_certificate_fingerprint_cmd,
|
||||
rc=rc)
|
||||
|
||||
current_certificate_match = re.search(r"=([\w:]+)", current_certificate_fingerprint_out)
|
||||
if not current_certificate_match:
|
||||
return module.fail_json(
|
||||
msg="Unable to find the current certificate fingerprint in %s" % current_certificate_fingerprint_out,
|
||||
rc=rc,
|
||||
cmd=current_certificate_fingerprint_err
|
||||
)
|
||||
return module.fail_json(msg="Unable to find the current certificate fingerprint in %s" % current_certificate_fingerprint_out,
|
||||
cmd=current_certificate_fingerprint_cmd,
|
||||
rc=rc)
|
||||
|
||||
return current_certificate_match.group(1)
|
||||
|
||||
|
||||
def read_stored_certificate_fingerprint(module, keytool_bin, alias, keystore_path, keystore_password):
|
||||
stored_certificate_fingerprint_cmd = [keytool_bin, "-list", "-alias", alias, "-keystore", keystore_path, "-storepass", keystore_password, "-v"]
|
||||
(rc, stored_certificate_fingerprint_out, stored_certificate_fingerprint_err) = run_commands(module, stored_certificate_fingerprint_cmd)
|
||||
stored_certificate_fingerprint_cmd = [keytool_bin, "-list", "-alias", alias, "-keystore", keystore_path, "-storepass:env", "STOREPASS", "-v"]
|
||||
(rc, stored_certificate_fingerprint_out, stored_certificate_fingerprint_err) = run_commands(
|
||||
module, stored_certificate_fingerprint_cmd, environ_update=dict(STOREPASS=keystore_password))
|
||||
if rc != 0:
|
||||
if "keytool error: java.lang.Exception: Alias <%s> does not exist" % alias not in stored_certificate_fingerprint_out:
|
||||
return module.fail_json(msg=stored_certificate_fingerprint_out,
|
||||
err=stored_certificate_fingerprint_err,
|
||||
rc=rc,
|
||||
cmd=stored_certificate_fingerprint_cmd)
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
stored_certificate_match = re.search(r"SHA256: ([\w:]+)", stored_certificate_fingerprint_out)
|
||||
if not stored_certificate_match:
|
||||
return module.fail_json(
|
||||
msg="Unable to find the stored certificate fingerprint in %s" % stored_certificate_fingerprint_out,
|
||||
rc=rc,
|
||||
cmd=stored_certificate_fingerprint_cmd
|
||||
)
|
||||
# First intention was to not fail, and overwrite the keystore instead,
|
||||
# in case of alias mismatch; but an issue in error handling caused the
|
||||
# module to fail anyway.
|
||||
# See: https://github.com/ansible-collections/community.general/issues/1671
|
||||
# And: https://github.com/ansible-collections/community.general/pull/2183
|
||||
# if "keytool error: java.lang.Exception: Alias <%s> does not exist" % alias in stored_certificate_fingerprint_out:
|
||||
# return "alias mismatch"
|
||||
# if re.match(r'keytool error: java\.io\.IOException: [Kk]eystore( was tampered with, or)? password was incorrect',
|
||||
# stored_certificate_fingerprint_out):
|
||||
# return "password mismatch"
|
||||
return module.fail_json(msg=stored_certificate_fingerprint_out,
|
||||
err=stored_certificate_fingerprint_err,
|
||||
cmd=stored_certificate_fingerprint_cmd,
|
||||
rc=rc)
|
||||
|
||||
return stored_certificate_match.group(1)
|
||||
stored_certificate_match = re.search(r"SHA256: ([\w:]+)", stored_certificate_fingerprint_out)
|
||||
if not stored_certificate_match:
|
||||
return module.fail_json(msg="Unable to find the stored certificate fingerprint in %s" % stored_certificate_fingerprint_out,
|
||||
cmd=stored_certificate_fingerprint_cmd,
|
||||
rc=rc)
|
||||
|
||||
return stored_certificate_match.group(1)
|
||||
|
||||
|
||||
def run_commands(module, cmd, data=None, check_rc=True):
|
||||
return module.run_command(cmd, check_rc=check_rc, data=data)
|
||||
def run_commands(module, cmd, data=None, environ_update=None, check_rc=False):
|
||||
return module.run_command(cmd, check_rc=check_rc, data=data, environ_update=environ_update)
|
||||
|
||||
|
||||
def create_file(path, content):
|
||||
with open(path, 'w') as f:
|
||||
def create_path():
|
||||
dummy, tmpfile = tempfile.mkstemp()
|
||||
os.remove(tmpfile)
|
||||
return tmpfile
|
||||
|
||||
|
||||
def create_file(content):
|
||||
tmpfd, tmpfile = tempfile.mkstemp()
|
||||
with os.fdopen(tmpfd, 'w') as f:
|
||||
f.write(content)
|
||||
return path
|
||||
return tmpfile
|
||||
|
||||
|
||||
def create_tmp_certificate(module):
|
||||
return create_file("/tmp/%s.crt" % module.params['name'], module.params['certificate'])
|
||||
return create_file(module.params['certificate'])
|
||||
|
||||
|
||||
def create_tmp_private_key(module):
|
||||
return create_file("/tmp/%s.key" % module.params['name'], module.params['private_key'])
|
||||
return create_file(module.params['private_key'])
|
||||
|
||||
|
||||
def cert_changed(module, openssl_bin, keytool_bin, keystore_path, keystore_pass, alias):
|
||||
@@ -196,59 +209,57 @@ def cert_changed(module, openssl_bin, keytool_bin, keystore_path, keystore_pass,
|
||||
|
||||
def create_jks(module, name, openssl_bin, keytool_bin, keystore_path, password, keypass):
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
certificate_path = create_tmp_certificate(module)
|
||||
private_key_path = create_tmp_private_key(module)
|
||||
try:
|
||||
if os.path.exists(keystore_path):
|
||||
os.remove(keystore_path)
|
||||
return module.exit_json(changed=True)
|
||||
|
||||
keystore_p12_path = "/tmp/keystore.p12"
|
||||
if os.path.exists(keystore_p12_path):
|
||||
os.remove(keystore_p12_path)
|
||||
certificate_path = create_tmp_certificate(module)
|
||||
private_key_path = create_tmp_private_key(module)
|
||||
keystore_p12_path = create_path()
|
||||
try:
|
||||
if os.path.exists(keystore_path):
|
||||
os.remove(keystore_path)
|
||||
|
||||
export_p12_cmd = [openssl_bin, "pkcs12", "-export", "-name", name, "-in", certificate_path,
|
||||
"-inkey", private_key_path, "-out",
|
||||
keystore_p12_path, "-passout", "stdin"]
|
||||
export_p12_cmd = [openssl_bin, "pkcs12", "-export", "-name", name, "-in", certificate_path,
|
||||
"-inkey", private_key_path, "-out", keystore_p12_path, "-passout", "stdin"]
|
||||
|
||||
# when keypass is provided, add -passin
|
||||
cmd_stdin = ""
|
||||
if keypass:
|
||||
export_p12_cmd.append("-passin")
|
||||
export_p12_cmd.append("stdin")
|
||||
cmd_stdin = "%s\n" % keypass
|
||||
# when keypass is provided, add -passin
|
||||
cmd_stdin = ""
|
||||
if keypass:
|
||||
export_p12_cmd.append("-passin")
|
||||
export_p12_cmd.append("stdin")
|
||||
cmd_stdin = "%s\n" % keypass
|
||||
cmd_stdin += "%s\n%s" % (password, password)
|
||||
|
||||
cmd_stdin += "%s\n%s" % (password, password)
|
||||
(rc, export_p12_out, export_p12_err) = run_commands(module, export_p12_cmd, data=cmd_stdin)
|
||||
if rc != 0:
|
||||
return module.fail_json(msg=export_p12_out,
|
||||
rc=rc,
|
||||
cmd=export_p12_cmd)
|
||||
(rc, export_p12_out, dummy) = run_commands(module, export_p12_cmd, data=cmd_stdin)
|
||||
if rc != 0:
|
||||
return module.fail_json(msg=export_p12_out,
|
||||
cmd=export_p12_cmd,
|
||||
rc=rc)
|
||||
|
||||
import_keystore_cmd = [keytool_bin, "-importkeystore",
|
||||
"-destkeystore", keystore_path,
|
||||
"-srckeystore", keystore_p12_path,
|
||||
"-srcstoretype", "pkcs12",
|
||||
"-alias", name,
|
||||
"-deststorepass", password,
|
||||
"-srcstorepass", password,
|
||||
"-noprompt"]
|
||||
(rc, import_keystore_out, import_keystore_err) = run_commands(module, import_keystore_cmd, data=None)
|
||||
if rc == 0:
|
||||
update_jks_perm(module, keystore_path)
|
||||
return module.exit_json(changed=True,
|
||||
msg=import_keystore_out,
|
||||
rc=rc,
|
||||
cmd=import_keystore_cmd,
|
||||
stdout_lines=import_keystore_out)
|
||||
else:
|
||||
return module.fail_json(msg=import_keystore_out,
|
||||
rc=rc,
|
||||
cmd=import_keystore_cmd)
|
||||
finally:
|
||||
os.remove(certificate_path)
|
||||
os.remove(private_key_path)
|
||||
import_keystore_cmd = [keytool_bin, "-importkeystore",
|
||||
"-destkeystore", keystore_path,
|
||||
"-srckeystore", keystore_p12_path,
|
||||
"-srcstoretype", "pkcs12",
|
||||
"-alias", name,
|
||||
"-deststorepass:env", "STOREPASS",
|
||||
"-srcstorepass:env", "STOREPASS",
|
||||
"-noprompt"]
|
||||
|
||||
(rc, import_keystore_out, dummy) = run_commands(module, import_keystore_cmd, data=None,
|
||||
environ_update=dict(STOREPASS=password))
|
||||
if rc != 0:
|
||||
return module.fail_json(msg=import_keystore_out,
|
||||
cmd=import_keystore_cmd,
|
||||
rc=rc)
|
||||
|
||||
update_jks_perm(module, keystore_path)
|
||||
return module.exit_json(changed=True,
|
||||
msg=import_keystore_out,
|
||||
cmd=import_keystore_cmd,
|
||||
rc=rc)
|
||||
finally:
|
||||
os.remove(certificate_path)
|
||||
os.remove(private_key_path)
|
||||
os.remove(keystore_p12_path)
|
||||
|
||||
|
||||
def update_jks_perm(module, keystore_path):
|
||||
@@ -280,7 +291,7 @@ def process_jks(module):
|
||||
else:
|
||||
if not module.check_mode:
|
||||
update_jks_perm(module, keystore_path)
|
||||
return module.exit_json(changed=False)
|
||||
module.exit_json(changed=False)
|
||||
else:
|
||||
create_jks(module, name, openssl_bin, keytool_bin, keystore_path, password, keypass)
|
||||
|
||||
@@ -308,6 +319,7 @@ def main():
|
||||
add_file_common_args=spec.add_file_common_args,
|
||||
supports_check_mode=spec.supports_check_mode
|
||||
)
|
||||
module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||
process_jks(module)
|
||||
|
||||
|
||||
|
||||
@@ -219,8 +219,9 @@ class XFConfProperty(CmdMixin, StateMixin, ModuleHelper):
|
||||
self.update_xfconf_output(value=self.vars.value)
|
||||
|
||||
def state_absent(self):
|
||||
if not self.module.check_mode:
|
||||
self.run_command(params=('channel', 'property', 'reset'), extra_params={"reset": True})
|
||||
self.vars.value = None
|
||||
self.run_command(params=('channel', 'property', 'reset'), extra_params={"reset": True})
|
||||
self.update_xfconf_output(previous_value=self.vars.previous_value,
|
||||
value=None)
|
||||
|
||||
|
||||
@@ -276,6 +276,7 @@ from ansible.module_utils.six import text_type, binary_type
|
||||
from ansible.module_utils._text import to_native
|
||||
import base64
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
@@ -560,7 +561,7 @@ class JenkinsPlugin(object):
|
||||
|
||||
# Open the updates file
|
||||
try:
|
||||
f = open(updates_file, encoding='utf-8')
|
||||
f = io.open(updates_file, encoding='utf-8')
|
||||
except IOError as e:
|
||||
self.module.fail_json(
|
||||
msg="Cannot open temporal updates file.",
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
language: python
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- T=none
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- env: T=none
|
||||
include:
|
||||
- env: T=devel/sanity/1
|
||||
- env: T=devel/sanity/2
|
||||
- env: T=devel/sanity/3
|
||||
- env: T=devel/sanity/4
|
||||
|
||||
- env: T=2.10/sanity/1
|
||||
- env: T=2.10/sanity/2
|
||||
- env: T=2.10/sanity/3
|
||||
- env: T=2.10/sanity/4
|
||||
|
||||
- env: T=2.9/sanity/1
|
||||
- env: T=2.9/sanity/2
|
||||
- env: T=2.9/sanity/3
|
||||
- env: T=2.9/sanity/4
|
||||
|
||||
branches:
|
||||
except:
|
||||
- "*-patch-*"
|
||||
- "revert-*-*"
|
||||
- "patchback/backports/*"
|
||||
|
||||
build:
|
||||
ci:
|
||||
- tests/utils/shippable/timing.sh tests/utils/shippable/shippable.sh $T
|
||||
|
||||
integrations:
|
||||
notifications:
|
||||
- integrationName: email
|
||||
type: email
|
||||
on_success: never
|
||||
on_failure: never
|
||||
on_start: never
|
||||
on_pull_request: never
|
||||
@@ -174,7 +174,7 @@
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_gz_stat.changed == False "
|
||||
- archive_02_gz_stat is not changed
|
||||
- "archive_02_gz_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_bz2_result_02"
|
||||
- "{{ archive_bz2_result_02['archived']| length}} == 3"
|
||||
@@ -199,7 +199,7 @@
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_zip_stat.changed == False"
|
||||
- archive_02_zip_stat is not changed
|
||||
- "archive_02_zip_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_zip_result_02"
|
||||
- "{{ archive_zip_result_02['archived']| length}} == 3"
|
||||
@@ -224,7 +224,7 @@
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_bz2_stat.changed == False"
|
||||
- archive_02_bz2_stat is not changed
|
||||
- "archive_02_bz2_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_bz2_result_02"
|
||||
- "{{ archive_bz2_result_02['archived']| length}} == 3"
|
||||
@@ -248,7 +248,7 @@
|
||||
- name: Test that the file modes were changed
|
||||
assert:
|
||||
that:
|
||||
- "archive_02_xz_stat.changed == False"
|
||||
- archive_02_xz_stat is not changed
|
||||
- "archive_02_xz_stat.stat.mode == '0600'"
|
||||
- "'archived' in archive_xz_result_02"
|
||||
- "{{ archive_xz_result_02['archived']| length}} == 3"
|
||||
@@ -294,7 +294,7 @@
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_0.changed == true"
|
||||
- nonascii_result_0 is changed
|
||||
- "nonascii_stat0.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
@@ -315,7 +315,7 @@
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_1.changed == true"
|
||||
- nonascii_result_1 is changed
|
||||
- "nonascii_stat_1.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
@@ -336,7 +336,7 @@
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_1.changed == true"
|
||||
- nonascii_result_1 is changed
|
||||
- "nonascii_stat_1.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
@@ -357,7 +357,7 @@
|
||||
- name: Assert that nonascii tests succeeded
|
||||
assert:
|
||||
that:
|
||||
- "nonascii_result_2.changed == true"
|
||||
- nonascii_result_2 is changed
|
||||
- "nonascii_stat_2.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
- name: Verify addition of absent flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "addition_result.changed == true"
|
||||
- addition_result is changed
|
||||
msg: "Adding an absent flatpak shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of addition of absent flatpak (check mode)
|
||||
@@ -27,7 +27,7 @@
|
||||
- name: Verify non-existent idempotency of addition of absent flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "double_addition_result.changed == true"
|
||||
- double_addition_result is changed
|
||||
msg: |
|
||||
Adding an absent flatpak a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
@@ -44,7 +44,7 @@
|
||||
- name: Verify removal of absent flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "removal_result.changed == false"
|
||||
- removal_result is not changed
|
||||
msg: "Removing an absent flatpak shall mark module execution as not changed"
|
||||
|
||||
# state=present with url on absent flatpak
|
||||
@@ -60,7 +60,7 @@
|
||||
- name: Verify addition of absent flatpak with url test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "url_addition_result.changed == true"
|
||||
- url_addition_result is changed
|
||||
msg: "Adding an absent flatpak from URL shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of addition of absent flatpak with url (check mode)
|
||||
@@ -76,7 +76,7 @@
|
||||
result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "double_url_addition_result.changed == true"
|
||||
- double_url_addition_result is changed
|
||||
msg: |
|
||||
Adding an absent flatpak from URL a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
@@ -93,7 +93,7 @@
|
||||
- name: Verify removal of absent flatpak with url test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "url_removal_result.changed == false"
|
||||
- url_removal_result is not changed
|
||||
msg: "Removing an absent flatpak shall mark module execution as not changed"
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
- name: Verify addition test result of present flatpak (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "addition_present_result.changed == false"
|
||||
- addition_present_result is not changed
|
||||
msg: "Adding an present flatpak shall mark module execution as not changed"
|
||||
|
||||
# state=absent on present flatpak
|
||||
@@ -127,7 +127,7 @@
|
||||
- name: Verify removal of present flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "removal_present_result.changed == true"
|
||||
- removal_present_result is changed
|
||||
msg: "Removing a present flatpak shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of removal (check mode)
|
||||
@@ -140,7 +140,7 @@
|
||||
- name: Verify non-existent idempotency of removal (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "double_removal_present_result.changed == true"
|
||||
- double_removal_present_result is changed
|
||||
msg: |
|
||||
Removing a present flatpak a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
@@ -158,7 +158,7 @@
|
||||
- name: Verify addition with url of present flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "url_addition_present_result.changed == false"
|
||||
- url_addition_present_result is not changed
|
||||
msg: "Adding a present flatpak from URL shall mark module execution as not changed"
|
||||
|
||||
# state=absent with url on present flatpak
|
||||
@@ -173,7 +173,7 @@
|
||||
- name: Verify removal with url of present flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "url_removal_present_result.changed == true"
|
||||
- url_removal_present_result is changed
|
||||
msg: "Removing an absent flatpak shall mark module execution as not changed"
|
||||
|
||||
- name: Test non-existent idempotency of removal with url of present flatpak (check mode)
|
||||
@@ -189,5 +189,5 @@
|
||||
flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "double_url_removal_present_result.changed == true"
|
||||
- double_url_removal_present_result is changed
|
||||
msg: Removing an absent flatpak a second time shall still mark module execution as changed
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
- name: Verify executable override test result
|
||||
assert:
|
||||
that:
|
||||
- "executable_override_result.failed == true"
|
||||
- "executable_override_result.changed == false"
|
||||
- executable_override_result is failed
|
||||
- executable_override_result is not changed
|
||||
msg: "Specifying non-existing executable shall fail module execution"
|
||||
|
||||
- import_tasks: check_mode.yml
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- name: Verify addition test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "addition_result.changed == true"
|
||||
- addition_result is changed
|
||||
msg: "state=present shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of addition - {{ method }}
|
||||
@@ -25,7 +25,7 @@
|
||||
- name: Verify idempotency of addition test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "double_addition_result.changed == false"
|
||||
- double_addition_result is not changed
|
||||
msg: "state=present shall not do anything when flatpak is already present"
|
||||
|
||||
# state=absent
|
||||
@@ -40,7 +40,7 @@
|
||||
- name: Verify removal test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "removal_result.changed == true"
|
||||
- removal_result is changed
|
||||
msg: "state=absent shall remove flatpak when present"
|
||||
|
||||
- name: Test idempotency of removal - {{ method }}
|
||||
@@ -53,7 +53,7 @@
|
||||
- name: Verify idempotency of removal test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "double_removal_result.changed == false"
|
||||
- double_removal_result is not changed
|
||||
msg: "state=absent shall not do anything when flatpak is not present"
|
||||
|
||||
# state=present with url as name
|
||||
@@ -69,7 +69,7 @@
|
||||
- name: Verify addition test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "url_addition_result.changed == true"
|
||||
- url_addition_result is changed
|
||||
msg: "state=present with url as name shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of addition with url - {{ method }}
|
||||
@@ -83,7 +83,7 @@
|
||||
- name: Verify idempotency of addition with url test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "double_url_addition_result.changed == false"
|
||||
- double_url_addition_result is not changed
|
||||
msg: "state=present with url as name shall not do anything when flatpak is already present"
|
||||
|
||||
# state=absent with url as name
|
||||
@@ -98,7 +98,7 @@
|
||||
- name: Verify removal test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "url_removal_result.changed == true"
|
||||
- url_removal_result is changed
|
||||
msg: "state=absent with url as name shall remove flatpak when present"
|
||||
|
||||
- name: Test idempotency of removal with url - {{ method }}
|
||||
@@ -111,5 +111,5 @@
|
||||
- name: Verify idempotency of removal with url test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "double_url_removal_result.changed == false"
|
||||
- double_url_removal_result is not changed
|
||||
msg: "state=absent with url as name shall not do anything when flatpak is not present"
|
||||
|
||||
@@ -6,4 +6,3 @@ skip/osx
|
||||
skip/macos
|
||||
skip/rhel
|
||||
needs/root
|
||||
disabled # FIXME
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
- name: Verify addition of absent flatpak remote test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "addition_result.changed == true"
|
||||
- addition_result is changed
|
||||
msg: "Adding an absent flatpak remote shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of addition of absent flatpak remote (check mode)
|
||||
@@ -29,7 +29,7 @@
|
||||
test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "double_addition_result.changed == true"
|
||||
- double_addition_result is changed
|
||||
msg: |
|
||||
Adding an absent flatpak remote a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
@@ -46,7 +46,7 @@
|
||||
- name: Verify removal of absent flatpak remote test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "removal_result.changed == false"
|
||||
- removal_result is not changed
|
||||
msg: "Removing an absent flatpak remote shall mark module execution as not changed"
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
- name: Verify addition of present flatpak remote test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "addition_result.changed == false"
|
||||
- addition_result is not changed
|
||||
msg: "Adding a present flatpak remote shall mark module execution as not changed"
|
||||
|
||||
# state=absent
|
||||
@@ -80,7 +80,7 @@
|
||||
- name: Verify removal of present flatpak remote test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "removal_result.changed == true"
|
||||
- removal_result is changed
|
||||
msg: "Removing a present flatpak remote shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of removal of present flatpak remote (check mode)
|
||||
@@ -95,7 +95,7 @@
|
||||
test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- "double_removal_result.changed == true"
|
||||
- double_removal_result is changed
|
||||
msg: |
|
||||
Removing a present flatpak remote a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
- name: Verify executable override test result
|
||||
assert:
|
||||
that:
|
||||
- "executable_override_result.failed == true"
|
||||
- "executable_override_result.changed == false"
|
||||
- executable_override_result is failed
|
||||
- executable_override_result is not changed
|
||||
msg: "Specifying non-existing executable shall fail module execution"
|
||||
|
||||
- import_tasks: check_mode.yml
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- name: Verify addition test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "addition_result.changed == true"
|
||||
- addition_result is changed
|
||||
msg: "state=present shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of addition - {{ method }}
|
||||
@@ -25,7 +25,7 @@
|
||||
- name: Verify idempotency of addition test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "double_addition_result.changed == false"
|
||||
- double_addition_result is not changed
|
||||
msg: "state=present shall not do anything when flatpak is already present"
|
||||
|
||||
- name: Test updating remote url does not do anything - {{ method }}
|
||||
@@ -39,7 +39,7 @@
|
||||
- name: Verify updating remote url does not do anything - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "url_update_result.changed == false"
|
||||
- url_update_result is not changed
|
||||
msg: "Trying to update the URL of an existing flatpak remote shall not do anything"
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
- name: Verify removal test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "removal_result.changed == true"
|
||||
- removal_result is changed
|
||||
msg: "state=absent shall remove flatpak when present"
|
||||
|
||||
- name: Test idempotency of removal - {{ method }}
|
||||
@@ -68,5 +68,5 @@
|
||||
- name: Verify idempotency of removal test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- "double_removal_result.changed == false"
|
||||
- double_removal_result is not changed
|
||||
msg: "state=absent shall not do anything when flatpak is not present"
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
- name: assert set changed and value is correct
|
||||
assert:
|
||||
that:
|
||||
- set_result.changed == true
|
||||
- set_result is changed
|
||||
- set_result.diff.before == "\n"
|
||||
- set_result.diff.after == option_value + "\n"
|
||||
- get_result.changed == false
|
||||
- get_result is not changed
|
||||
- get_result.config_value == option_value
|
||||
...
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
- name: assert set changed and value is correct with state=present
|
||||
assert:
|
||||
that:
|
||||
- set_result.changed == true
|
||||
- set_result is changed
|
||||
- set_result.diff.before == "\n"
|
||||
- set_result.diff.after == option_value + "\n"
|
||||
- get_result.changed == false
|
||||
- get_result is not changed
|
||||
- get_result.config_value == option_value
|
||||
...
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
- name: assert unset changed and deleted value
|
||||
assert:
|
||||
that:
|
||||
- unset_result.changed == true
|
||||
- unset_result is changed
|
||||
- unset_result.diff.before == option_value + "\n"
|
||||
- unset_result.diff.after == "\n"
|
||||
- get_result.config_value == ''
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user