mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-29 09:56:53 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b81ba747ba | ||
|
|
7ab1aa8894 | ||
|
|
d272f7731c | ||
|
|
d58472ec39 | ||
|
|
25d5574089 | ||
|
|
ab43b88d95 | ||
|
|
0b13c1eb45 | ||
|
|
ad5b8a813f | ||
|
|
9cccc9f0cd | ||
|
|
b7368b9802 | ||
|
|
be54f11a7d | ||
|
|
07b147d90f | ||
|
|
8f0f6ffc43 | ||
|
|
30622754a9 | ||
|
|
6f1e585da5 | ||
|
|
65861d3482 | ||
|
|
5a54ddfab9 | ||
|
|
e1576ca00d | ||
|
|
1aa26662ef | ||
|
|
4b9696023a | ||
|
|
8a95fe8b00 | ||
|
|
a389969ace | ||
|
|
3221b25393 | ||
|
|
cc3fefd325 | ||
|
|
90c278ad87 | ||
|
|
5ece46c56e | ||
|
|
f158b6e6c1 | ||
|
|
2d84387d84 | ||
|
|
12618ddbd4 | ||
|
|
7fac03ec56 | ||
|
|
199e53112c | ||
|
|
f8237ce76d | ||
|
|
8a9d18cc86 | ||
|
|
b7b69d918a | ||
|
|
a3f08377b2 | ||
|
|
4c9c8e0514 | ||
|
|
3911b83145 |
@@ -212,10 +212,10 @@ stages:
|
||||
test: centos7
|
||||
- name: CentOS 8
|
||||
test: centos8
|
||||
- name: Fedora 31
|
||||
test: fedora31
|
||||
- name: Fedora 32
|
||||
test: fedora32
|
||||
- name: Fedora 33
|
||||
test: fedora33
|
||||
- name: openSUSE 15 py2
|
||||
test: opensuse15py2
|
||||
- name: openSUSE 15 py3
|
||||
|
||||
@@ -5,6 +5,104 @@ Community General Release Notes
|
||||
.. contents:: Topics
|
||||
|
||||
|
||||
v1.3.6
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix and security bugfix (potential information leaks in multiple modules, CVE-2021-20191) release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- scaleway modules and inventory plugin - update regions and zones to add the new ones (https://github.com/ansible-collections/community.general/pull/1690).
|
||||
|
||||
Breaking Changes / Porting Guide
|
||||
--------------------------------
|
||||
|
||||
- utm_proxy_auth_profile - the ``frontend_cookie_secret`` return value now contains a placeholder string instead of the module's ``frontend_cookie_secret`` parameter (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
|
||||
Security Fixes
|
||||
--------------
|
||||
|
||||
- dnsmadeeasy - mark the ``account_key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- docker_swarm - enabled ``no_log`` for the option ``signing_ca_key`` to prevent accidental disclosure (CVE-2021-20191, https://github.com/ansible-collections/community.general/pull/1728).
|
||||
- gitlab_runner - mark the ``registration_token`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- hwc_ecs_instance - mark the ``admin_pass`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- ibm_sa_host - mark the ``iscsi_chap_secret`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- keycloak_* modules - mark the ``auth_client_secret`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- keycloak_client - mark the ``registration_access_token`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- librato_annotation - mark the ``api_key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- logentries_msg - mark the ``token`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- module_utils/_netapp, na_ontap_gather_facts - enabled ``no_log`` for the options ``api_key`` and ``secret_key`` to prevent accidental disclosure (CVE-2021-20191, https://github.com/ansible-collections/community.general/pull/1725).
|
||||
- module_utils/identity/keycloak, keycloak_client, keycloak_clienttemplate, keycloak_group - enabled ``no_log`` for the option ``auth_client_secret`` to prevent accidental disclosure (CVE-2021-20191, https://github.com/ansible-collections/community.general/pull/1725).
|
||||
- nios_nsgroup - mark the ``tsig_key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- oneandone_firewall_policy, oneandone_load_balancer, oneandone_monitoring_policy, oneandone_private_network, oneandone_public_ip - mark the ``auth_token`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- ovirt - mark the ``instance_key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- ovirt - mark the ``instance_rootpw`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pagerduty_alert - mark the ``api_key``, ``service_key`` and ``integration_key`` parameters as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pagerduty_change - mark the ``integration_key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pingdom - mark the ``key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pulp_repo - mark the ``feed_client_key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- rax_clb_ssl - mark the ``private_key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- redfish_command - mark the ``update_creds.password`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- rollbar_deployment - mark the ``token`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- spotinst_aws_elastigroup - mark the ``multai_token`` and ``token`` parameters as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- stackdriver - mark the ``key`` parameter as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- utm_proxy_auth_profile - enabled ``no_log`` for the option ``frontend_cookie_secret`` to prevent accidental disclosure (CVE-2021-20191, https://github.com/ansible-collections/community.general/pull/1725).
|
||||
- utm_proxy_auth_profile - mark the ``frontend_cookie_secret`` parameter as ``no_log`` to avoid leakage of secrets. This causes the ``utm_proxy_auth_profile`` return value to no longer containing the correct value, but a placeholder (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- docker connection plugin - fix Docker version parsing, as some docker versions have a leading ``v`` in the output of the command ``docker version --format "{{.Server.Version}}"`` (https://github.com/ansible-collections/community.docker/pull/76).
|
||||
- filesystem - do not fail when ``resizefs=yes`` and ``fstype=xfs`` if there is nothing to do, even if the filesystem is not mounted. This only covers systems supporting access to unmounted XFS filesystems. Others will still fail (https://github.com/ansible-collections/community.general/issues/1457, https://github.com/ansible-collections/community.general/pull/1478).
|
||||
- gitlab_user - make updates to the ``isadmin``, ``password`` and ``confirm`` options of an already existing GitLab user work (https://github.com/ansible-collections/community.general/pull/1724).
|
||||
- parted - change the regex that decodes the partition size to better support different formats that parted uses. Change the regex that validates parted's version string (https://github.com/ansible-collections/community.general/pull/1695).
|
||||
- redfish_info module, redfish_utils module utils - add ``Name`` and ``Id`` properties to output of Redfish inventory commands (https://github.com/ansible-collections/community.general/issues/1650).
|
||||
- sensu-silence module - fix json parsing of sensu API responses on Python 3.5 (https://github.com/ansible-collections/community.general/pull/1703).
|
||||
|
||||
v1.3.5
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- dnsmadeeasy - fix HTTP 400 errors when creating a TXT record (https://github.com/ansible-collections/community.general/issues/1237).
|
||||
- docker_container - allow IPv6 zones (RFC 4007) in bind IPs (https://github.com/ansible-collections/community.docker/pull/66).
|
||||
- docker_image - fix crash on loading images with versions of Docker SDK for Python before 2.5.0 (https://github.com/ansible-collections/community.docker/issues/72, https://github.com/ansible-collections/community.docker/pull/73).
|
||||
- homebrew - add default search path for ``brew`` on Apple silicon hardware (https://github.com/ansible-collections/community.general/pull/1679).
|
||||
- homebrew_cask - add default search path for ``brew`` on Apple silicon hardware (https://github.com/ansible-collections/community.general/pull/1679).
|
||||
- homebrew_tap - add default search path for ``brew`` on Apple silicon hardware (https://github.com/ansible-collections/community.general/pull/1679).
|
||||
- lldp - use ``get_bin_path`` to locate the ``lldpctl`` executable (https://github.com/ansible-collections/community.general/pull/1643).
|
||||
- onepassword lookup plugin - updated to support password items, which place the password field directly in the payload's ``details`` attribute (https://github.com/ansible-collections/community.general/pull/1610).
|
||||
- passwordstore lookup plugin - fix compatibility with gopass when used with ``create=true``. While pass returns 1 on a non-existent password, gopass returns 10, or 11, depending on whether a similar named password was stored. We now just check standard output and that the return code is not zero (https://github.com/ansible-collections/community.general/pull/1589).
|
||||
- terraform - improve result code checking when executing terraform commands (https://github.com/ansible-collections/community.general/pull/1632).
|
||||
|
||||
v1.3.4
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix/security release that addresses CVE-2021-20180.
|
||||
|
||||
Security Fixes
|
||||
--------------
|
||||
|
||||
- bitbucket_pipeline_variable - **CVE-2021-20180** - hide user sensitive information which are marked as ``secured`` from logging into the console (https://github.com/ansible-collections/community.general/pull/1635).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- npm - handle json decode exception while parsing command line output (https://github.com/ansible-collections/community.general/issues/1614).
|
||||
|
||||
v1.3.3
|
||||
======
|
||||
|
||||
|
||||
@@ -1802,3 +1802,151 @@ releases:
|
||||
- kubevirt-migration.yml
|
||||
- snmp_facts.yml
|
||||
release_date: '2021-01-13'
|
||||
1.3.4:
|
||||
changes:
|
||||
bugfixes:
|
||||
- npm - handle json decode exception while parsing command line output (https://github.com/ansible-collections/community.general/issues/1614).
|
||||
release_summary: Bugfix/security release that addresses CVE-2021-20180.
|
||||
security_fixes:
|
||||
- bitbucket_pipeline_variable - **CVE-2021-20180** - hide user sensitive information
|
||||
which are marked as ``secured`` from logging into the console (https://github.com/ansible-collections/community.general/pull/1635).
|
||||
fragments:
|
||||
- 1.3.4.yml
|
||||
- 1614_npm.yml
|
||||
- cve_bitbucket_pipeline_variable.yml
|
||||
release_date: '2021-01-14'
|
||||
1.3.5:
|
||||
changes:
|
||||
bugfixes:
|
||||
- dnsmadeeasy - fix HTTP 400 errors when creating a TXT record (https://github.com/ansible-collections/community.general/issues/1237).
|
||||
- docker_container - allow IPv6 zones (RFC 4007) in bind IPs (https://github.com/ansible-collections/community.docker/pull/66).
|
||||
- docker_image - fix crash on loading images with versions of Docker SDK for
|
||||
Python before 2.5.0 (https://github.com/ansible-collections/community.docker/issues/72,
|
||||
https://github.com/ansible-collections/community.docker/pull/73).
|
||||
- homebrew - add default search path for ``brew`` on Apple silicon hardware
|
||||
(https://github.com/ansible-collections/community.general/pull/1679).
|
||||
- homebrew_cask - add default search path for ``brew`` on Apple silicon hardware
|
||||
(https://github.com/ansible-collections/community.general/pull/1679).
|
||||
- homebrew_tap - add default search path for ``brew`` on Apple silicon hardware
|
||||
(https://github.com/ansible-collections/community.general/pull/1679).
|
||||
- lldp - use ``get_bin_path`` to locate the ``lldpctl`` executable (https://github.com/ansible-collections/community.general/pull/1643).
|
||||
- onepassword lookup plugin - updated to support password items, which place
|
||||
the password field directly in the payload's ``details`` attribute (https://github.com/ansible-collections/community.general/pull/1610).
|
||||
- passwordstore lookup plugin - fix compatibility with gopass when used with
|
||||
``create=true``. While pass returns 1 on a non-existent password, gopass returns
|
||||
10, or 11, depending on whether a similar named password was stored. We now
|
||||
just check standard output and that the return code is not zero (https://github.com/ansible-collections/community.general/pull/1589).
|
||||
- terraform - improve result code checking when executing terraform commands
|
||||
(https://github.com/ansible-collections/community.general/pull/1632).
|
||||
release_summary: Regular bugfix release.
|
||||
fragments:
|
||||
- 1.3.5.yml
|
||||
- 1589-passwordstore-fix-passwordstore.py-to-be-compatible-with-gopass.yaml
|
||||
- 1610-bugfix-onepassword-lookup-plugin.yaml
|
||||
- 1632-using_check_rc_in_terraform.yml
|
||||
- 1654-dnsmadeeasy-http-400-fixes.yaml
|
||||
- 1679-homebrew_search_path.yml
|
||||
- community.docker-66-ipv6-zones.yml
|
||||
- community.docker-73-docker_image-fix-old-docker-py-version.yml
|
||||
- lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml
|
||||
release_date: '2021-01-26'
|
||||
1.3.6:
|
||||
changes:
|
||||
breaking_changes:
|
||||
- utm_proxy_auth_profile - the ``frontend_cookie_secret`` return value now contains
|
||||
a placeholder string instead of the module's ``frontend_cookie_secret`` parameter
|
||||
(https://github.com/ansible-collections/community.general/pull/1736).
|
||||
bugfixes:
|
||||
- docker connection plugin - fix Docker version parsing, as some docker versions
|
||||
have a leading ``v`` in the output of the command ``docker version --format
|
||||
"{{.Server.Version}}"`` (https://github.com/ansible-collections/community.docker/pull/76).
|
||||
- filesystem - do not fail when ``resizefs=yes`` and ``fstype=xfs`` if there
|
||||
is nothing to do, even if the filesystem is not mounted. This only covers
|
||||
systems supporting access to unmounted XFS filesystems. Others will still
|
||||
fail (https://github.com/ansible-collections/community.general/issues/1457,
|
||||
https://github.com/ansible-collections/community.general/pull/1478).
|
||||
- gitlab_user - make updates to the ``isadmin``, ``password`` and ``confirm``
|
||||
options of an already existing GitLab user work (https://github.com/ansible-collections/community.general/pull/1724).
|
||||
- parted - change the regex that decodes the partition size to better support
|
||||
different formats that parted uses. Change the regex that validates parted's
|
||||
version string (https://github.com/ansible-collections/community.general/pull/1695).
|
||||
- redfish_info module, redfish_utils module utils - add ``Name`` and ``Id``
|
||||
properties to output of Redfish inventory commands (https://github.com/ansible-collections/community.general/issues/1650).
|
||||
- sensu-silence module - fix json parsing of sensu API responses on Python 3.5
|
||||
(https://github.com/ansible-collections/community.general/pull/1703).
|
||||
minor_changes:
|
||||
- scaleway modules and inventory plugin - update regions and zones to add the
|
||||
new ones (https://github.com/ansible-collections/community.general/pull/1690).
|
||||
release_summary: Regular bugfix and security bugfix (potential information leaks
|
||||
in multiple modules, CVE-2021-20191) release.
|
||||
security_fixes:
|
||||
- dnsmadeeasy - mark the ``account_key`` parameter as ``no_log`` to avoid leakage
|
||||
of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- docker_swarm - enabled ``no_log`` for the option ``signing_ca_key`` to prevent
|
||||
accidental disclosure (CVE-2021-20191, https://github.com/ansible-collections/community.general/pull/1728).
|
||||
- gitlab_runner - mark the ``registration_token`` parameter as ``no_log`` to
|
||||
avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- hwc_ecs_instance - mark the ``admin_pass`` parameter as ``no_log`` to avoid
|
||||
leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- ibm_sa_host - mark the ``iscsi_chap_secret`` parameter as ``no_log`` to avoid
|
||||
leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- keycloak_* modules - mark the ``auth_client_secret`` parameter as ``no_log``
|
||||
to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- keycloak_client - mark the ``registration_access_token`` parameter as ``no_log``
|
||||
to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- librato_annotation - mark the ``api_key`` parameter as ``no_log`` to avoid
|
||||
leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- logentries_msg - mark the ``token`` parameter as ``no_log`` to avoid leakage
|
||||
of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- module_utils/_netapp, na_ontap_gather_facts - enabled ``no_log`` for the options
|
||||
``api_key`` and ``secret_key`` to prevent accidental disclosure (CVE-2021-20191,
|
||||
https://github.com/ansible-collections/community.general/pull/1725).
|
||||
- module_utils/identity/keycloak, keycloak_client, keycloak_clienttemplate,
|
||||
keycloak_group - enabled ``no_log`` for the option ``auth_client_secret``
|
||||
to prevent accidental disclosure (CVE-2021-20191, https://github.com/ansible-collections/community.general/pull/1725).
|
||||
- nios_nsgroup - mark the ``tsig_key`` parameter as ``no_log`` to avoid leakage
|
||||
of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- oneandone_firewall_policy, oneandone_load_balancer, oneandone_monitoring_policy,
|
||||
oneandone_private_network, oneandone_public_ip - mark the ``auth_token`` parameter
|
||||
as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- ovirt - mark the ``instance_key`` parameter as ``no_log`` to avoid leakage
|
||||
of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- ovirt - mark the ``instance_rootpw`` parameter as ``no_log`` to avoid leakage
|
||||
of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pagerduty_alert - mark the ``api_key``, ``service_key`` and ``integration_key``
|
||||
parameters as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pagerduty_change - mark the ``integration_key`` parameter as ``no_log`` to
|
||||
avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pingdom - mark the ``key`` parameter as ``no_log`` to avoid leakage of secrets
|
||||
(https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- pulp_repo - mark the ``feed_client_key`` parameter as ``no_log`` to avoid
|
||||
leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- rax_clb_ssl - mark the ``private_key`` parameter as ``no_log`` to avoid leakage
|
||||
of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- redfish_command - mark the ``update_creds.password`` parameter as ``no_log``
|
||||
to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- rollbar_deployment - mark the ``token`` parameter as ``no_log`` to avoid leakage
|
||||
of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- spotinst_aws_elastigroup - mark the ``multai_token`` and ``token`` parameters
|
||||
as ``no_log`` to avoid leakage of secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- stackdriver - mark the ``key`` parameter as ``no_log`` to avoid leakage of
|
||||
secrets (https://github.com/ansible-collections/community.general/pull/1736).
|
||||
- utm_proxy_auth_profile - enabled ``no_log`` for the option ``frontend_cookie_secret``
|
||||
to prevent accidental disclosure (CVE-2021-20191, https://github.com/ansible-collections/community.general/pull/1725).
|
||||
- utm_proxy_auth_profile - mark the ``frontend_cookie_secret`` parameter as
|
||||
``no_log`` to avoid leakage of secrets. This causes the ``utm_proxy_auth_profile``
|
||||
return value to no longer containing the correct value, but a placeholder
|
||||
(https://github.com/ansible-collections/community.general/pull/1736).
|
||||
fragments:
|
||||
- 1.3.6.yml
|
||||
- 1478-filesystem-fix-1457-resizefs-idempotency.yml
|
||||
- 1690-scaleway-regions.yaml
|
||||
- 1691-add-name-and-id-props-to-redfish-inventory-output.yml
|
||||
- 1695-parted-updatedregex.yaml
|
||||
- 1703-sensu_silence-fix_json_parsing.yml
|
||||
- 1724-various-fixes-for-updating-existing-gitlab-user.yml
|
||||
- CVE-2021-20191_no_log.yml
|
||||
- CVE-2021-20191_no_log_docker.yml
|
||||
- community.docker-76-leading-v-support-in-docker-version.yml
|
||||
- no_log-fixes.yml
|
||||
release_date: '2021-02-09'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace: community
|
||||
name: general
|
||||
version: 1.3.3
|
||||
version: 1.3.6
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (https://github.com/ansible)
|
||||
|
||||
@@ -116,7 +116,9 @@ class Connection(ConnectionBase):
|
||||
|
||||
@staticmethod
|
||||
def _sanitize_version(version):
|
||||
return re.sub(u'[^0-9a-zA-Z.]', u'', version)
|
||||
version = re.sub(u'[^0-9a-zA-Z.]', u'', version)
|
||||
version = re.sub(u'^v', u'', version)
|
||||
return version
|
||||
|
||||
def _old_docker_version(self):
|
||||
cmd_args = []
|
||||
|
||||
@@ -24,6 +24,8 @@ DOCUMENTATION = '''
|
||||
default:
|
||||
- ams1
|
||||
- par1
|
||||
- par2
|
||||
- waw1
|
||||
tags:
|
||||
description: Filter results on a specific tag
|
||||
type: list
|
||||
|
||||
@@ -187,8 +187,63 @@ class OnePass(object):
|
||||
return rc, out, err
|
||||
|
||||
def _parse_field(self, data_json, field_name, section_title=None):
|
||||
"""
|
||||
Retrieves the desired field from the `op` response payload
|
||||
|
||||
When the item is a `password` type, the password is a key within the `details` key:
|
||||
|
||||
$ op get item 'test item' | jq
|
||||
{
|
||||
[...]
|
||||
"templateUuid": "005",
|
||||
"details": {
|
||||
"notesPlain": "",
|
||||
"password": "foobar",
|
||||
"passwordHistory": [],
|
||||
"sections": [
|
||||
{
|
||||
"name": "linked items",
|
||||
"title": "Related Items"
|
||||
}
|
||||
]
|
||||
},
|
||||
[...]
|
||||
}
|
||||
|
||||
However, when the item is a `login` type, the password is within a fields array:
|
||||
|
||||
$ op get item 'test item' | jq
|
||||
{
|
||||
[...]
|
||||
"details": {
|
||||
"fields": [
|
||||
{
|
||||
"designation": "username",
|
||||
"name": "username",
|
||||
"type": "T",
|
||||
"value": "foo"
|
||||
},
|
||||
{
|
||||
"designation": "password",
|
||||
"name": "password",
|
||||
"type": "P",
|
||||
"value": "bar"
|
||||
}
|
||||
],
|
||||
[...]
|
||||
},
|
||||
[...]
|
||||
"""
|
||||
data = json.loads(data_json)
|
||||
if section_title is None:
|
||||
# https://github.com/ansible-collections/community.general/pull/1610:
|
||||
# check the details dictionary for `field_name` and return it immediately if it exists
|
||||
# when the entry is a "password" instead of a "login" item, the password field is a key
|
||||
# in the `details` dictionary:
|
||||
if field_name in data['details']:
|
||||
return data['details'][field_name]
|
||||
|
||||
# when the field is not found above, iterate through the fields list in the object details
|
||||
for field_data in data['details'].get('fields', []):
|
||||
if field_data.get('name', '').lower() == field_name.lower():
|
||||
return field_data.get('value', '')
|
||||
|
||||
@@ -214,7 +214,7 @@ class LookupModule(LookupBase):
|
||||
name, value = line.split(':', 1)
|
||||
self.passdict[name.strip()] = value.strip()
|
||||
except (subprocess.CalledProcessError) as e:
|
||||
if e.returncode == 1 and 'not in the password store' in e.output:
|
||||
if e.returncode != 0 and 'not in the password store' in e.output:
|
||||
# if pass returns 1 and return string contains 'is not in the password store.'
|
||||
# We need to determine if this is valid or Error.
|
||||
if not self.paramvals['create']:
|
||||
|
||||
@@ -75,7 +75,13 @@ EXAMPLES = r"""
|
||||
vars:
|
||||
secret: "{{ lookup('community.general.tss', 1) }}"
|
||||
tasks:
|
||||
- ansible.builtin.debug: msg="the password is {{ (secret['items'] | items2dict(key_name='slug', value_name='itemValue'))['password'] }}"
|
||||
- ansible.builtin.debug:
|
||||
msg: >
|
||||
the password is {{
|
||||
(secret['items']
|
||||
| items2dict(key_name='slug',
|
||||
value_name='itemValue'))['password']
|
||||
}}
|
||||
"""
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleOptionsError
|
||||
|
||||
@@ -142,8 +142,8 @@ def aws_cvs_host_argument_spec():
|
||||
return dict(
|
||||
api_url=dict(required=True, type='str'),
|
||||
validate_certs=dict(required=False, type='bool', default=True),
|
||||
api_key=dict(required=True, type='str'),
|
||||
secret_key=dict(required=True, type='str')
|
||||
api_key=dict(required=True, type='str', no_log=True),
|
||||
secret_key=dict(required=True, type='str', no_log=True)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ def keycloak_argument_spec():
|
||||
auth_keycloak_url=dict(type='str', aliases=['url'], required=True),
|
||||
auth_client_id=dict(type='str', default='admin-cli'),
|
||||
auth_realm=dict(type='str', required=True),
|
||||
auth_client_secret=dict(type='str', default=None),
|
||||
auth_client_secret=dict(type='str', default=None, no_log=True),
|
||||
auth_username=dict(type='str', aliases=['username'], required=True),
|
||||
auth_password=dict(type='str', aliases=['password'], required=True, no_log=True),
|
||||
validate_certs=dict(type='bool', default=True)
|
||||
|
||||
@@ -469,7 +469,7 @@ class RedfishUtils(object):
|
||||
controller_results = []
|
||||
# Get these entries, but does not fail if not found
|
||||
properties = ['CacheSummary', 'FirmwareVersion', 'Identifiers',
|
||||
'Location', 'Manufacturer', 'Model', 'Name',
|
||||
'Location', 'Manufacturer', 'Model', 'Name', 'Id',
|
||||
'PartNumber', 'SerialNumber', 'SpeedGbps', 'Status']
|
||||
key = "StorageControllers"
|
||||
|
||||
@@ -1700,7 +1700,7 @@ class RedfishUtils(object):
|
||||
chassis_results = []
|
||||
|
||||
# Get these entries, but does not fail if not found
|
||||
properties = ['ChassisType', 'PartNumber', 'AssetTag',
|
||||
properties = ['Name', 'Id', 'ChassisType', 'PartNumber', 'AssetTag',
|
||||
'Manufacturer', 'IndicatorLED', 'SerialNumber', 'Model']
|
||||
|
||||
# Go through list
|
||||
@@ -1724,7 +1724,7 @@ class RedfishUtils(object):
|
||||
fan_results = []
|
||||
key = "Thermal"
|
||||
# Get these entries, but does not fail if not found
|
||||
properties = ['FanName', 'Reading', 'ReadingUnits', 'Status']
|
||||
properties = ['Name', 'FanName', 'Reading', 'ReadingUnits', 'Status']
|
||||
|
||||
# Go through list
|
||||
for chassis_uri in self.chassis_uris:
|
||||
@@ -1836,8 +1836,8 @@ class RedfishUtils(object):
|
||||
cpu_results = []
|
||||
key = "Processors"
|
||||
# Get these entries, but does not fail if not found
|
||||
properties = ['Id', 'Manufacturer', 'Model', 'MaxSpeedMHz', 'TotalCores',
|
||||
'TotalThreads', 'Status']
|
||||
properties = ['Id', 'Name', 'Manufacturer', 'Model', 'MaxSpeedMHz',
|
||||
'TotalCores', 'TotalThreads', 'Status']
|
||||
|
||||
# Search for 'key' entry and extract URI from it
|
||||
response = self.get_request(self.root_uri + systems_uri)
|
||||
@@ -1886,7 +1886,7 @@ class RedfishUtils(object):
|
||||
memory_results = []
|
||||
key = "Memory"
|
||||
# Get these entries, but does not fail if not found
|
||||
properties = ['SerialNumber', 'MemoryDeviceType', 'PartNumber',
|
||||
properties = ['Id', 'SerialNumber', 'MemoryDeviceType', 'PartNumber',
|
||||
'MemoryLocation', 'RankCount', 'CapacityMiB', 'OperatingMemoryModes', 'Status', 'Manufacturer', 'Name']
|
||||
|
||||
# Search for 'key' entry and extract URI from it
|
||||
@@ -1943,7 +1943,7 @@ class RedfishUtils(object):
|
||||
nic_results = []
|
||||
key = "EthernetInterfaces"
|
||||
# Get these entries, but does not fail if not found
|
||||
properties = ['Description', 'FQDN', 'IPv4Addresses', 'IPv6Addresses',
|
||||
properties = ['Name', 'Id', 'Description', 'FQDN', 'IPv4Addresses', 'IPv6Addresses',
|
||||
'NameServers', 'MACAddress', 'PermanentMACAddress',
|
||||
'SpeedMbps', 'MTUSize', 'AutoNeg', 'Status']
|
||||
|
||||
@@ -2368,7 +2368,7 @@ class RedfishUtils(object):
|
||||
properties = ['Status', 'HostName', 'PowerState', 'Model', 'Manufacturer',
|
||||
'PartNumber', 'SystemType', 'AssetTag', 'ServiceTag',
|
||||
'SerialNumber', 'SKU', 'BiosVersion', 'MemorySummary',
|
||||
'ProcessorSummary', 'TrustedModules']
|
||||
'ProcessorSummary', 'TrustedModules', 'Name', 'Id']
|
||||
|
||||
response = self.get_request(self.root_uri + systems_uri)
|
||||
if response['ret'] is False:
|
||||
|
||||
@@ -169,8 +169,14 @@ SCALEWAY_LOCATION = {
|
||||
'par1': {'name': 'Paris 1', 'country': 'FR', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/fr-par-1'},
|
||||
'EMEA-FR-PAR1': {'name': 'Paris 1', 'country': 'FR', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/fr-par-1'},
|
||||
|
||||
'par2': {'name': 'Paris 2', 'country': 'FR', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/fr-par-2'},
|
||||
'EMEA-FR-PAR2': {'name': 'Paris 2', 'country': 'FR', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/fr-par-2'},
|
||||
|
||||
'ams1': {'name': 'Amsterdam 1', 'country': 'NL', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/nl-ams-1'},
|
||||
'EMEA-NL-EVS': {'name': 'Amsterdam 1', 'country': 'NL', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/nl-ams-1'}
|
||||
'EMEA-NL-EVS': {'name': 'Amsterdam 1', 'country': 'NL', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/nl-ams-1'},
|
||||
|
||||
'waw1': {'name': 'Warsaw 1', 'country': 'PL', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/pl-waw-1'},
|
||||
'EMEA-PL-WAW1': {'name': 'Warsaw 1', 'country': 'PL', "api_endpoint": 'https://api.scaleway.com/instance/v1/zones/pl-waw-1'},
|
||||
}
|
||||
|
||||
SCALEWAY_ENDPOINT = "https://api.scaleway.com"
|
||||
@@ -178,9 +184,12 @@ SCALEWAY_ENDPOINT = "https://api.scaleway.com"
|
||||
SCALEWAY_REGIONS = [
|
||||
"fr-par",
|
||||
"nl-ams",
|
||||
"pl-waw",
|
||||
]
|
||||
|
||||
SCALEWAY_ZONES = [
|
||||
"fr-par-1",
|
||||
"fr-par-2",
|
||||
"nl-ams-1",
|
||||
"pl-waw-1",
|
||||
]
|
||||
|
||||
@@ -1721,7 +1721,7 @@ class TaskParameters(DockerBaseClass):
|
||||
elif p_len == 3:
|
||||
# We only allow IPv4 and IPv6 addresses for the bind address
|
||||
ipaddr = parts[0]
|
||||
if not re.match(r'^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$', parts[0]) and not re.match(r'^\[[0-9a-fA-F:]+\]$', ipaddr):
|
||||
if not re.match(r'^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$', parts[0]) and not re.match(r'^\[[0-9a-fA-F:]+(?:|%[^\]/]+)\]$', ipaddr):
|
||||
self.fail(('Bind addresses for published ports must be IPv4 or IPv6 addresses, not hostnames. '
|
||||
'Use the dig lookup to resolve hostnames. (Found hostname: {0})').format(ipaddr))
|
||||
if re.match(r'^\[[0-9a-fA-F:]+\]$', ipaddr):
|
||||
|
||||
@@ -776,15 +776,41 @@ class ImageManager(DockerBaseClass):
|
||||
'''
|
||||
# Load image(s) from file
|
||||
load_output = []
|
||||
has_output = False
|
||||
try:
|
||||
self.log("Opening image %s" % self.load_path)
|
||||
with open(self.load_path, 'rb') as image_tar:
|
||||
self.log("Loading image from %s" % self.load_path)
|
||||
for line in self.client.load_image(image_tar):
|
||||
self.log(line, pretty_print=True)
|
||||
if "stream" in line or "status" in line:
|
||||
load_line = line.get("stream") or line.get("status") or ''
|
||||
load_output.append(load_line)
|
||||
output = self.client.load_image(image_tar)
|
||||
if output is not None:
|
||||
# Old versions of Docker SDK of Python (before version 2.5.0) do not return anything.
|
||||
# (See https://github.com/docker/docker-py/commit/7139e2d8f1ea82340417add02090bfaf7794f159)
|
||||
# Note that before that commit, something else than None was returned, but that was also
|
||||
# only introduced in a commit that first appeared in 2.5.0 (see
|
||||
# https://github.com/docker/docker-py/commit/9e793806ff79559c3bc591d8c52a3bbe3cdb7350).
|
||||
# So the above check works for every released version of Docker SDK for Python.
|
||||
has_output = True
|
||||
for line in output:
|
||||
self.log(line, pretty_print=True)
|
||||
if "stream" in line or "status" in line:
|
||||
load_line = line.get("stream") or line.get("status") or ''
|
||||
load_output.append(load_line)
|
||||
else:
|
||||
if LooseVersion(docker_version) < LooseVersion('2.5.0'):
|
||||
self.client.module.warn(
|
||||
'The installed version of the Docker SDK for Python does not return the loading results'
|
||||
' from the Docker daemon. Therefore, we cannot verify whether the expected image was'
|
||||
' loaded, whether multiple images where loaded, or whether the load actually succeeded.'
|
||||
' If you are not stuck with Python 2.6, *please* upgrade to a version newer than 2.5.0'
|
||||
' (2.5.0 was released in August 2017).'
|
||||
)
|
||||
else:
|
||||
self.client.module.warn(
|
||||
'The API version of your Docker daemon is < 1.23, which does not return the image'
|
||||
' loading result from the Docker daemon. Therefore, we cannot verify whether the'
|
||||
' expected image was loaded, whether multiple images where loaded, or whether the load'
|
||||
' actually succeeded. You should consider upgrading your Docker daemon.'
|
||||
)
|
||||
except EnvironmentError as exc:
|
||||
if exc.errno == errno.ENOENT:
|
||||
self.client.fail("Error opening image %s - %s" % (self.load_path, str(exc)))
|
||||
@@ -793,26 +819,28 @@ class ImageManager(DockerBaseClass):
|
||||
self.client.fail("Error loading image %s - %s" % (self.name, str(exc)), stdout='\n'.join(load_output))
|
||||
|
||||
# Collect loaded images
|
||||
loaded_images = set()
|
||||
for line in load_output:
|
||||
if line.startswith('Loaded image:'):
|
||||
loaded_images.add(line[len('Loaded image:'):].strip())
|
||||
if has_output:
|
||||
# We can only do this when we actually got some output from Docker daemon
|
||||
loaded_images = set()
|
||||
for line in load_output:
|
||||
if line.startswith('Loaded image:'):
|
||||
loaded_images.add(line[len('Loaded image:'):].strip())
|
||||
|
||||
if not loaded_images:
|
||||
self.client.fail("Detected no loaded images. Archive potentially corrupt?", stdout='\n'.join(load_output))
|
||||
if not loaded_images:
|
||||
self.client.fail("Detected no loaded images. Archive potentially corrupt?", stdout='\n'.join(load_output))
|
||||
|
||||
expected_image = '%s:%s' % (self.name, self.tag)
|
||||
if expected_image not in loaded_images:
|
||||
self.client.fail(
|
||||
"The archive did not contain image '%s'. Instead, found %s." % (
|
||||
expected_image, ', '.join(["'%s'" % image for image in sorted(loaded_images)])),
|
||||
stdout='\n'.join(load_output))
|
||||
loaded_images.remove(expected_image)
|
||||
expected_image = '%s:%s' % (self.name, self.tag)
|
||||
if expected_image not in loaded_images:
|
||||
self.client.fail(
|
||||
"The archive did not contain image '%s'. Instead, found %s." % (
|
||||
expected_image, ', '.join(["'%s'" % image for image in sorted(loaded_images)])),
|
||||
stdout='\n'.join(load_output))
|
||||
loaded_images.remove(expected_image)
|
||||
|
||||
if loaded_images:
|
||||
self.client.module.warn(
|
||||
"The archive contained more images than specified: %s" % (
|
||||
', '.join(["'%s'" % image for image in sorted(loaded_images)]), ))
|
||||
if loaded_images:
|
||||
self.client.module.warn(
|
||||
"The archive contained more images than specified: %s" % (
|
||||
', '.join(["'%s'" % image for image in sorted(loaded_images)]), ))
|
||||
|
||||
return self.client.find_image(self.name, self.tag)
|
||||
|
||||
|
||||
@@ -616,7 +616,7 @@ def main():
|
||||
name=dict(type='str'),
|
||||
labels=dict(type='dict'),
|
||||
signing_ca_cert=dict(type='str'),
|
||||
signing_ca_key=dict(type='str'),
|
||||
signing_ca_key=dict(type='str', no_log=True),
|
||||
ca_force_rotate=dict(type='int'),
|
||||
autolock_managers=dict(type='bool'),
|
||||
node_id=dict(type='str'),
|
||||
|
||||
@@ -543,7 +543,7 @@ def build_module():
|
||||
snapshot_id=dict(type='str')
|
||||
)),
|
||||
vpc_id=dict(type='str', required=True),
|
||||
admin_pass=dict(type='str'),
|
||||
admin_pass=dict(type='str', no_log=True),
|
||||
data_volumes=dict(type='list', elements='dict', options=dict(
|
||||
volume_id=dict(type='str', required=True),
|
||||
device=dict(type='str')
|
||||
|
||||
@@ -405,8 +405,8 @@ def main():
|
||||
instance_gateway=dict(type='str', aliases=['gateway']),
|
||||
instance_domain=dict(type='str', aliases=['domain']),
|
||||
instance_dns=dict(type='str', aliases=['dns']),
|
||||
instance_rootpw=dict(type='str', aliases=['rootpw']),
|
||||
instance_key=dict(type='str', aliases=['key']),
|
||||
instance_rootpw=dict(type='str', aliases=['rootpw'], no_log=True),
|
||||
instance_key=dict(type='str', aliases=['key'], no_log=True),
|
||||
sdomain=dict(type='str'),
|
||||
region=dict(type='str'),
|
||||
),
|
||||
|
||||
@@ -194,9 +194,7 @@ def preflight_validation(bin_path, project_path, variables_args=None, plan_file=
|
||||
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, cwd=project_path, use_unsafe_shell=True)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to validate Terraform configuration files:\r\n{0}".format(err))
|
||||
rc, out, err = module.run_command([bin_path, 'validate'] + variables_args, check_rc=True, cwd=project_path, use_unsafe_shell=True)
|
||||
|
||||
|
||||
def _state_args(state_file):
|
||||
@@ -220,9 +218,7 @@ def init_plugins(bin_path, project_path, backend_config, backend_config_files, i
|
||||
command.extend(['-backend-config', f])
|
||||
if init_reconfigure:
|
||||
command.extend(['-reconfigure'])
|
||||
rc, out, err = module.run_command(command, cwd=project_path)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to initialize Terraform modules:\r\n{0}".format(err))
|
||||
rc, out, err = module.run_command(command, check_rc=True, cwd=project_path)
|
||||
|
||||
|
||||
def get_workspace_context(bin_path, project_path):
|
||||
@@ -244,9 +240,7 @@ def get_workspace_context(bin_path, project_path):
|
||||
|
||||
def _workspace_cmd(bin_path, project_path, action, workspace):
|
||||
command = [bin_path, 'workspace', action, workspace, '-no-color']
|
||||
rc, out, err = module.run_command(command, cwd=project_path)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to {0} workspace:\r\n{1}".format(action, err))
|
||||
rc, out, err = module.run_command(command, check_rc=True, cwd=project_path)
|
||||
return rc, out, err
|
||||
|
||||
|
||||
@@ -388,15 +382,10 @@ def main():
|
||||
command.append(plan_file)
|
||||
|
||||
if needs_application and not module.check_mode and not state == 'planned':
|
||||
rc, out, err = module.run_command(command, cwd=project_path)
|
||||
rc, out, err = module.run_command(command, check_rc=True, cwd=project_path)
|
||||
# checks out to decide if changes were made during execution
|
||||
if ' 0 added, 0 changed' not in out and not state == "absent" or ' 0 destroyed' not in out:
|
||||
changed = True
|
||||
if rc != 0:
|
||||
module.fail_json(
|
||||
msg="Failure when executing Terraform command. Exited {0}.\nstdout: {1}\nstderr: {2}".format(rc, out, err),
|
||||
command=' '.join(command)
|
||||
)
|
||||
|
||||
outputs_command = [command[0], 'output', '-no-color', '-json'] + _state_args(state_file)
|
||||
rc, outputs_text, outputs_err = module.run_command(outputs_command, cwd=project_path)
|
||||
|
||||
@@ -500,7 +500,7 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
auth_token=dict(
|
||||
type='str',
|
||||
type='str', no_log=True,
|
||||
default=os.environ.get('ONEANDONE_AUTH_TOKEN')),
|
||||
api_url=dict(
|
||||
type='str',
|
||||
|
||||
@@ -594,7 +594,7 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
auth_token=dict(
|
||||
type='str',
|
||||
type='str', no_log=True,
|
||||
default=os.environ.get('ONEANDONE_AUTH_TOKEN')),
|
||||
api_url=dict(
|
||||
type='str',
|
||||
|
||||
@@ -947,7 +947,7 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
auth_token=dict(
|
||||
type='str',
|
||||
type='str', no_log=True,
|
||||
default=os.environ.get('ONEANDONE_AUTH_TOKEN')),
|
||||
api_url=dict(
|
||||
type='str',
|
||||
|
||||
@@ -384,7 +384,7 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
auth_token=dict(
|
||||
type='str',
|
||||
type='str', no_log=True,
|
||||
default=os.environ.get('ONEANDONE_AUTH_TOKEN')),
|
||||
api_url=dict(
|
||||
type='str',
|
||||
|
||||
@@ -274,7 +274,7 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
auth_token=dict(
|
||||
type='str',
|
||||
type='str', no_log=True,
|
||||
default=os.environ.get('ONEANDONE_AUTH_TOKEN')),
|
||||
api_url=dict(
|
||||
type='str',
|
||||
|
||||
@@ -238,7 +238,7 @@ def main():
|
||||
loadbalancer=dict(required=True),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
enabled=dict(type='bool', default=True),
|
||||
private_key=dict(),
|
||||
private_key=dict(no_log=True),
|
||||
certificate=dict(),
|
||||
intermediate_certificate=dict(),
|
||||
secure_port=dict(type='int', default=443),
|
||||
|
||||
@@ -85,6 +85,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
|
||||
commercial_type:
|
||||
type: str
|
||||
|
||||
@@ -44,6 +44,7 @@ options:
|
||||
choices:
|
||||
- fr-par
|
||||
- nl-ams
|
||||
- pl-waw
|
||||
|
||||
id:
|
||||
description:
|
||||
|
||||
@@ -35,6 +35,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -32,6 +32,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -46,6 +46,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
|
||||
id:
|
||||
type: str
|
||||
|
||||
@@ -34,6 +34,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -30,6 +30,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -59,6 +59,7 @@ options:
|
||||
choices:
|
||||
- nl-ams
|
||||
- fr-par
|
||||
- pl-waw
|
||||
|
||||
tags:
|
||||
type: list
|
||||
|
||||
@@ -46,6 +46,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
|
||||
name:
|
||||
description:
|
||||
|
||||
@@ -31,6 +31,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
extends_documentation_fragment:
|
||||
- community.general.scaleway
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
extends_documentation_fragment:
|
||||
- community.general.scaleway
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
|
||||
protocol:
|
||||
type: str
|
||||
|
||||
@@ -34,6 +34,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -30,6 +30,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -34,6 +34,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -30,6 +30,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -48,6 +48,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
||||
@@ -41,6 +41,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
name:
|
||||
type: str
|
||||
description:
|
||||
|
||||
@@ -34,6 +34,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -30,6 +30,10 @@ options:
|
||||
- EMEA-NL-EVS
|
||||
- par1
|
||||
- EMEA-FR-PAR1
|
||||
- par2
|
||||
- EMEA-FR-PAR2
|
||||
- waw1
|
||||
- EMEA-PL-WAW1
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
||||
@@ -1459,7 +1459,7 @@ def main():
|
||||
min_size=dict(type='int', required=True),
|
||||
monitoring=dict(type='str'),
|
||||
multai_load_balancers=dict(type='list'),
|
||||
multai_token=dict(type='str'),
|
||||
multai_token=dict(type='str', no_log=True),
|
||||
name=dict(type='str', required=True),
|
||||
network_interfaces=dict(type='list'),
|
||||
on_demand_count=dict(type='int'),
|
||||
@@ -1483,7 +1483,7 @@ def main():
|
||||
target_group_arns=dict(type='list'),
|
||||
tenancy=dict(type='str'),
|
||||
terminate_at_end_of_billing_hour=dict(type='bool'),
|
||||
token=dict(type='str'),
|
||||
token=dict(type='str', no_log=True),
|
||||
unit=dict(type='str'),
|
||||
user_data=dict(type='str'),
|
||||
utilize_reserved_instances=dict(type='bool'),
|
||||
|
||||
@@ -707,7 +707,7 @@ def main():
|
||||
enabled=dict(type='bool'),
|
||||
client_authenticator_type=dict(type='str', choices=['client-secret', 'client-jwt'], aliases=['clientAuthenticatorType']),
|
||||
secret=dict(type='str', no_log=True),
|
||||
registration_access_token=dict(type='str', aliases=['registrationAccessToken']),
|
||||
registration_access_token=dict(type='str', aliases=['registrationAccessToken'], no_log=True),
|
||||
default_roles=dict(type='list', aliases=['defaultRoles']),
|
||||
redirect_uris=dict(type='list', aliases=['redirectUris']),
|
||||
web_origins=dict(type='list', aliases=['webOrigins']),
|
||||
|
||||
@@ -148,7 +148,7 @@ def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
user=dict(required=True),
|
||||
api_key=dict(required=True),
|
||||
api_key=dict(required=True, no_log=True),
|
||||
name=dict(required=False),
|
||||
title=dict(required=True),
|
||||
source=dict(required=False),
|
||||
|
||||
@@ -197,9 +197,9 @@ def main():
|
||||
argument_spec=dict(
|
||||
name=dict(required=False),
|
||||
service_id=dict(required=True),
|
||||
service_key=dict(required=False),
|
||||
integration_key=dict(required=False),
|
||||
api_key=dict(required=True),
|
||||
service_key=dict(required=False, no_log=True),
|
||||
integration_key=dict(required=False, no_log=True),
|
||||
api_key=dict(required=True, no_log=True),
|
||||
state=dict(required=True,
|
||||
choices=['triggered', 'acknowledged', 'resolved']),
|
||||
client=dict(required=False, default=None),
|
||||
|
||||
@@ -108,7 +108,7 @@ from datetime import datetime
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
integration_key=dict(required=True, type='str'),
|
||||
integration_key=dict(required=True, type='str', no_log=True),
|
||||
summary=dict(required=True, type='str'),
|
||||
source=dict(required=False, default='Ansible', type='str'),
|
||||
user=dict(required=False, type='str'),
|
||||
|
||||
@@ -112,7 +112,7 @@ def main():
|
||||
checkid=dict(required=True),
|
||||
uid=dict(required=True),
|
||||
passwd=dict(required=True, no_log=True),
|
||||
key=dict(required=True)
|
||||
key=dict(required=True, no_log=True),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
token=dict(required=True),
|
||||
token=dict(required=True, no_log=True),
|
||||
environment=dict(required=True),
|
||||
revision=dict(required=True),
|
||||
user=dict(required=False),
|
||||
|
||||
@@ -97,6 +97,7 @@ RETURN = '''
|
||||
|
||||
import json
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
@@ -129,7 +130,7 @@ def query(module, url, check, subscription):
|
||||
)
|
||||
|
||||
try:
|
||||
json_out = json.loads(response.read())
|
||||
json_out = json.loads(to_native(response.read()))
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
@@ -181,7 +182,7 @@ def clear(module, url, check, subscription):
|
||||
)
|
||||
|
||||
try:
|
||||
json_out = json.loads(response.read())
|
||||
json_out = json.loads(to_native(response.read()))
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
@@ -246,7 +247,7 @@ def create(
|
||||
)
|
||||
|
||||
try:
|
||||
json_out = json.loads(response.read())
|
||||
json_out = json.loads(to_native(response.read()))
|
||||
except Exception:
|
||||
json_out = ""
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict( # @TODO add types
|
||||
key=dict(required=True),
|
||||
key=dict(required=True, no_log=True),
|
||||
event=dict(required=True, choices=['deploy', 'annotation']),
|
||||
msg=dict(),
|
||||
revision_id=dict(),
|
||||
|
||||
@@ -467,6 +467,9 @@ class DME2(object):
|
||||
for result in self.all_records:
|
||||
if record_type == "MX":
|
||||
value = record_value.split(" ")[1]
|
||||
# Note that TXT records are surrounded by quotes in the API response.
|
||||
elif record_type == "TXT":
|
||||
value = '"{0}"'.format(record_value)
|
||||
elif record_type == "SRV":
|
||||
value = record_value.split(" ")[3]
|
||||
else:
|
||||
@@ -543,7 +546,7 @@ def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
account_key=dict(required=True),
|
||||
account_key=dict(required=True, no_log=True),
|
||||
account_secret=dict(required=True, no_log=True),
|
||||
domain=dict(required=True),
|
||||
sandbox=dict(default=False, type='bool'),
|
||||
@@ -651,7 +654,9 @@ def main():
|
||||
record_changed = False
|
||||
if current_record:
|
||||
for i in new_record:
|
||||
if str(current_record[i]) != str(new_record[i]):
|
||||
# Remove leading and trailing quote character from values because TXT records
|
||||
# are surrounded by quotes.
|
||||
if str(current_record[i]).strip('"') != str(new_record[i]):
|
||||
record_changed = True
|
||||
new_record['id'] = str(current_record['id'])
|
||||
|
||||
@@ -673,8 +678,11 @@ def main():
|
||||
# create record and monitor as the record does not exist
|
||||
if not current_record:
|
||||
record = DME.createRecord(DME.prepareRecord(new_record))
|
||||
monitor = DME.updateMonitor(record['id'], DME.prepareMonitor(new_monitor))
|
||||
module.exit_json(changed=True, result=dict(record=record, monitor=monitor))
|
||||
if new_monitor.get('monitor') and record_type == "A":
|
||||
monitor = DME.updateMonitor(record['id'], DME.prepareMonitor(new_monitor))
|
||||
module.exit_json(changed=True, result=dict(record=record, monitor=monitor))
|
||||
else:
|
||||
module.exit_json(changed=True, result=dict(record=record, monitor=current_monitor))
|
||||
|
||||
# update the record
|
||||
updated = False
|
||||
|
||||
@@ -41,7 +41,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def gather_lldp(module):
|
||||
cmd = ['lldpctl', '-f', 'keyvalue']
|
||||
cmd = [module.get_bin_path('lldpctl'), '-f', 'keyvalue']
|
||||
rc, output, err = module.run_command(cmd)
|
||||
if output:
|
||||
output_dict = {}
|
||||
|
||||
@@ -317,7 +317,7 @@ def main():
|
||||
address=dict(required=True, ib_req=True),
|
||||
name=dict(required=True, ib_req=True),
|
||||
stealth=dict(type='bool', default=False),
|
||||
tsig_key=dict(),
|
||||
tsig_key=dict(no_log=True),
|
||||
tsig_key_alg=dict(choices=['HMAC-MD5', 'HMAC-SHA256'], default='HMAC-MD5'),
|
||||
tsig_key_name=dict(required=True)
|
||||
)
|
||||
|
||||
@@ -73,7 +73,7 @@ def send_msg(module, token, msg, api, port):
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
token=dict(type='str', required=True),
|
||||
token=dict(type='str', required=True, no_log=True),
|
||||
msg=dict(type='str', required=True),
|
||||
api=dict(type='str', default="data.logentries.com"),
|
||||
port=dict(type='int', default=80)),
|
||||
|
||||
@@ -7,39 +7,39 @@ from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: npm
|
||||
short_description: Manage node.js packages with npm
|
||||
description:
|
||||
- Manage node.js packages with Node Package Manager (npm)
|
||||
- Manage node.js packages with Node Package Manager (npm).
|
||||
author: "Chris Hoffman (@chrishoffman)"
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- The name of a node.js library to install
|
||||
- The name of a node.js library to install.
|
||||
type: str
|
||||
required: false
|
||||
path:
|
||||
description:
|
||||
- The base path where to install the node.js libraries
|
||||
- The base path where to install the node.js libraries.
|
||||
type: path
|
||||
required: false
|
||||
version:
|
||||
description:
|
||||
- The version to be installed
|
||||
- The version to be installed.
|
||||
type: str
|
||||
required: false
|
||||
global:
|
||||
description:
|
||||
- Install the node.js library globally
|
||||
- Install the node.js library globally.
|
||||
required: false
|
||||
default: no
|
||||
type: bool
|
||||
executable:
|
||||
description:
|
||||
- The executable location for npm.
|
||||
- This is useful if you are using a version manager, such as nvm
|
||||
- This is useful if you are using a version manager, such as nvm.
|
||||
type: path
|
||||
required: false
|
||||
ignore_scripts:
|
||||
@@ -55,12 +55,12 @@ options:
|
||||
default: no
|
||||
ci:
|
||||
description:
|
||||
- Install packages based on package-lock file, same as running npm ci
|
||||
- Install packages based on package-lock file, same as running C(npm ci).
|
||||
type: bool
|
||||
default: no
|
||||
production:
|
||||
description:
|
||||
- Install dependencies in production mode, excluding devDependencies
|
||||
- Install dependencies in production mode, excluding devDependencies.
|
||||
required: false
|
||||
type: bool
|
||||
default: no
|
||||
@@ -71,7 +71,7 @@ options:
|
||||
type: str
|
||||
state:
|
||||
description:
|
||||
- The state of the node.js library
|
||||
- The state of the node.js library.
|
||||
required: false
|
||||
type: str
|
||||
default: present
|
||||
@@ -80,7 +80,7 @@ requirements:
|
||||
- npm installed in bin path (recommended /usr/local/bin)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r'''
|
||||
- name: Install "coffee-script" node.js package.
|
||||
community.general.npm:
|
||||
name: coffee-script
|
||||
@@ -124,12 +124,12 @@ EXAMPLES = '''
|
||||
state: present
|
||||
'''
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
import json
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class Npm(object):
|
||||
@@ -155,7 +155,7 @@ class Npm(object):
|
||||
else:
|
||||
self.name_version = self.name
|
||||
|
||||
def _exec(self, args, run_in_check_mode=False, check_rc=True):
|
||||
def _exec(self, args, run_in_check_mode=False, check_rc=True, add_package_name=True):
|
||||
if not self.module.check_mode or (self.module.check_mode and run_in_check_mode):
|
||||
cmd = self.executable + args
|
||||
|
||||
@@ -167,7 +167,7 @@ class Npm(object):
|
||||
cmd.append('--ignore-scripts')
|
||||
if self.unsafe_perm:
|
||||
cmd.append('--unsafe-perm')
|
||||
if self.name:
|
||||
if self.name and add_package_name:
|
||||
cmd.append(self.name_version)
|
||||
if self.registry:
|
||||
cmd.append('--registry')
|
||||
@@ -191,7 +191,11 @@ class Npm(object):
|
||||
|
||||
installed = list()
|
||||
missing = list()
|
||||
data = json.loads(self._exec(cmd, True, False))
|
||||
data = {}
|
||||
try:
|
||||
data = json.loads(self._exec(cmd, True, False, False) or '{}')
|
||||
except (getattr(json, 'JSONDecodeError', ValueError)) as e:
|
||||
self.module.fail_json(msg="Failed to parse NPM output with error %s" % to_native(e))
|
||||
if 'dependencies' in data:
|
||||
for dep in data['dependencies']:
|
||||
if 'missing' in data['dependencies'][dep] and data['dependencies'][dep]['missing']:
|
||||
|
||||
@@ -38,7 +38,7 @@ options:
|
||||
- "A ':' separated list of paths to search for 'brew' executable.
|
||||
Since a package (I(formula) in homebrew parlance) location is prefixed relative to the actual path of I(brew) command,
|
||||
providing an alternative I(brew) path enables managing different set of packages in an alternative location in the system."
|
||||
default: '/usr/local/bin'
|
||||
default: '/usr/local/bin:/opt/homebrew/bin'
|
||||
type: path
|
||||
state:
|
||||
description:
|
||||
@@ -76,7 +76,7 @@ notes:
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Install formula foo with 'brew' in default path (C(/usr/local/bin))
|
||||
# Install formula foo with 'brew' in default path
|
||||
- community.general.homebrew:
|
||||
name: foo
|
||||
state: present
|
||||
@@ -871,7 +871,7 @@ def main():
|
||||
elements='str',
|
||||
),
|
||||
path=dict(
|
||||
default="/usr/local/bin",
|
||||
default="/usr/local/bin:/opt/homebrew/bin",
|
||||
required=False,
|
||||
type='path',
|
||||
),
|
||||
|
||||
@@ -32,7 +32,7 @@ options:
|
||||
path:
|
||||
description:
|
||||
- "':' separated list of paths to search for 'brew' executable."
|
||||
default: '/usr/local/bin'
|
||||
default: '/usr/local/bin:/opt/homebrew/bin'
|
||||
type: path
|
||||
state:
|
||||
description:
|
||||
@@ -779,7 +779,7 @@ def main():
|
||||
elements='str',
|
||||
),
|
||||
path=dict(
|
||||
default="/usr/local/bin",
|
||||
default="/usr/local/bin:/opt/homebrew/bin",
|
||||
required=False,
|
||||
type='path',
|
||||
),
|
||||
|
||||
@@ -218,7 +218,7 @@ def main():
|
||||
brew_path = module.get_bin_path(
|
||||
'brew',
|
||||
required=True,
|
||||
opt_dirs=['/usr/local/bin']
|
||||
opt_dirs=['/usr/local/bin', '/opt/homebrew/bin']
|
||||
)
|
||||
|
||||
taps = module.params['name']
|
||||
|
||||
@@ -545,7 +545,7 @@ def main():
|
||||
deprecated_aliases=[dict(name='ca_cert', version='3.0.0',
|
||||
collection_name='community.general')]), # was Ansible 2.14
|
||||
feed_client_cert=dict(aliases=['importer_ssl_client_cert']),
|
||||
feed_client_key=dict(aliases=['importer_ssl_client_key']),
|
||||
feed_client_key=dict(aliases=['importer_ssl_client_key'], no_log=True),
|
||||
name=dict(required=True, aliases=['repo']),
|
||||
proxy_host=dict(),
|
||||
proxy_port=dict(),
|
||||
|
||||
@@ -572,7 +572,7 @@ def main():
|
||||
type='dict',
|
||||
options=dict(
|
||||
username=dict(),
|
||||
password=dict()
|
||||
password=dict(no_log=True)
|
||||
)
|
||||
),
|
||||
virtual_media=dict(
|
||||
|
||||
@@ -85,7 +85,7 @@ EXAMPLES = r'''
|
||||
|
||||
RETURN = r''' # '''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import AnsibleModule, _load_params
|
||||
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper
|
||||
|
||||
error_messages = {
|
||||
@@ -211,6 +211,14 @@ def delete_pipeline_variable(module, bitbucket, variable_uuid):
|
||||
))
|
||||
|
||||
|
||||
class BitBucketPipelineVariable(AnsibleModule):
|
||||
def __init__(self, *args, **kwargs):
|
||||
params = _load_params() or {}
|
||||
if params.get('secured'):
|
||||
kwargs['argument_spec']['value'].update({'no_log': True})
|
||||
super(BitBucketPipelineVariable, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = BitbucketHelper.bitbucket_argument_spec()
|
||||
argument_spec.update(
|
||||
@@ -221,7 +229,7 @@ def main():
|
||||
secured=dict(type='bool', default=False),
|
||||
state=dict(type='str', choices=['present', 'absent'], required=True),
|
||||
)
|
||||
module = AnsibleModule(
|
||||
module = BitBucketPipelineVariable(
|
||||
argument_spec=argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -284,7 +284,7 @@ def main():
|
||||
locked=dict(type='bool', default=False),
|
||||
access_level=dict(type='str', default='ref_protected', choices=["not_protected", "ref_protected"]),
|
||||
maximum_timeout=dict(type='int', default=3600),
|
||||
registration_token=dict(type='str', required=True),
|
||||
registration_token=dict(type='str', required=True, no_log=True),
|
||||
state=dict(type='str', default="present", choices=["absent", "present"]),
|
||||
))
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ class GitLabUser(object):
|
||||
'''
|
||||
def createOrUpdateUser(self, username, options):
|
||||
changed = False
|
||||
potentionally_changed = False
|
||||
|
||||
# Because we have already call userExists in main()
|
||||
if self.userObject is None:
|
||||
@@ -218,11 +219,36 @@ class GitLabUser(object):
|
||||
'external': options['external']})
|
||||
changed = True
|
||||
else:
|
||||
changed, user = self.updateUser(self.userObject, {
|
||||
'name': options['name'],
|
||||
'email': options['email'],
|
||||
'is_admin': options['isadmin'],
|
||||
'external': options['external']})
|
||||
changed, user = self.updateUser(
|
||||
self.userObject, {
|
||||
# add "normal" parameters here, put uncheckable
|
||||
# params in the dict below
|
||||
'name': {'value': options['name']},
|
||||
'email': {'value': options['email']},
|
||||
|
||||
# note: for some attributes like this one the key
|
||||
# from reading back from server is unfortunately
|
||||
# different to the one needed for pushing/writing,
|
||||
# in that case use the optional setter key
|
||||
'is_admin': {
|
||||
'value': options['isadmin'], 'setter': 'admin'
|
||||
},
|
||||
'external': {'value': options['external']},
|
||||
},
|
||||
{
|
||||
# put "uncheckable" params here, this means params
|
||||
# which the gitlab does accept for setting but does
|
||||
# not return any information about it
|
||||
'skip_reconfirmation': {'value': not options['confirm']},
|
||||
'password': {'value': options['password']},
|
||||
}
|
||||
)
|
||||
|
||||
# note: as we unfortunately have some uncheckable parameters
|
||||
# where it is not possible to determine if the update
|
||||
# changed something or not, we must assume here that a
|
||||
# changed happend and that an user object update is needed
|
||||
potentionally_changed = True
|
||||
|
||||
# Assign ssh keys
|
||||
if options['sshkey_name'] and options['sshkey_file']:
|
||||
@@ -237,14 +263,15 @@ class GitLabUser(object):
|
||||
changed = changed or group_changed
|
||||
|
||||
self.userObject = user
|
||||
if changed:
|
||||
if self._module.check_mode:
|
||||
self._module.exit_json(changed=True, msg="Successfully created or updated the user %s" % username)
|
||||
|
||||
if (changed or potentionally_changed) and not self._module.check_mode:
|
||||
try:
|
||||
user.save()
|
||||
except Exception as e:
|
||||
self._module.fail_json(msg="Failed to update user: %s " % to_native(e))
|
||||
|
||||
if changed:
|
||||
if self._module.check_mode:
|
||||
self._module.exit_json(changed=True, msg="Successfully created or updated the user %s" % username)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@@ -348,15 +375,23 @@ class GitLabUser(object):
|
||||
@param user User object
|
||||
@param arguments User attributes
|
||||
'''
|
||||
def updateUser(self, user, arguments):
|
||||
def updateUser(self, user, arguments, uncheckable_args):
|
||||
changed = False
|
||||
|
||||
for arg_key, arg_value in arguments.items():
|
||||
if arguments[arg_key] is not None:
|
||||
if getattr(user, arg_key) != arguments[arg_key]:
|
||||
setattr(user, arg_key, arguments[arg_key])
|
||||
av = arg_value['value']
|
||||
|
||||
if av is not None:
|
||||
if getattr(user, arg_key) != av:
|
||||
setattr(user, arg_value.get('setter', arg_key), av)
|
||||
changed = True
|
||||
|
||||
for arg_key, arg_value in uncheckable_args.items():
|
||||
av = arg_value['value']
|
||||
|
||||
if av is not None:
|
||||
setattr(user, arg_value.get('setter', arg_key), av)
|
||||
|
||||
return (changed, user)
|
||||
|
||||
'''
|
||||
|
||||
@@ -90,7 +90,7 @@ def main():
|
||||
cluster=dict(),
|
||||
domain=dict(),
|
||||
iscsi_chap_name=dict(),
|
||||
iscsi_chap_secret=dict()
|
||||
iscsi_chap_secret=dict(no_log=True),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -240,26 +240,35 @@ class XFS(Filesystem):
|
||||
GROW = 'xfs_growfs'
|
||||
|
||||
def get_fs_size(self, dev):
|
||||
cmd = self.module.get_bin_path('xfs_growfs', required=True)
|
||||
cmd = self.module.get_bin_path('xfs_info', required=True)
|
||||
|
||||
mountpoint = dev.get_mountpoint()
|
||||
if mountpoint:
|
||||
rc, out, err = self.module.run_command([cmd, str(mountpoint)], environ_update=self.LANG_ENV)
|
||||
else:
|
||||
# Recent GNU/Linux distros support access to unmounted XFS filesystems
|
||||
rc, out, err = self.module.run_command([cmd, str(dev)], environ_update=self.LANG_ENV)
|
||||
if rc != 0:
|
||||
self.module.fail_json(msg="Error while attempting to query size of XFS filesystem: %s" % err)
|
||||
|
||||
if not mountpoint:
|
||||
# xfs filesystem needs to be mounted
|
||||
self.module.fail_json(msg="%s needs to be mounted for xfs operations" % dev)
|
||||
|
||||
_, size, _ = self.module.run_command([cmd, '-n', str(mountpoint)], check_rc=True, environ_update=self.LANG_ENV)
|
||||
for line in size.splitlines():
|
||||
for line in out.splitlines():
|
||||
col = line.split('=')
|
||||
if col[0].strip() == 'data':
|
||||
if col[1].strip() != 'bsize':
|
||||
self.module.fail_json(msg='Unexpected output format from xfs_growfs (could not locate "bsize")')
|
||||
self.module.fail_json(msg='Unexpected output format from xfs_info (could not locate "bsize")')
|
||||
if col[2].split()[1] != 'blocks':
|
||||
self.module.fail_json(msg='Unexpected output format from xfs_growfs (could not locate "blocks")')
|
||||
self.module.fail_json(msg='Unexpected output format from xfs_info (could not locate "blocks")')
|
||||
block_size = int(col[2].split()[0])
|
||||
block_count = int(col[3].split(',')[0])
|
||||
return block_size * block_count
|
||||
|
||||
def grow_cmd(self, dev):
|
||||
# Check first if growing is needed, and then if it is doable or not.
|
||||
devsize_in_bytes = dev.size()
|
||||
fssize_in_bytes = self.get_fs_size(dev)
|
||||
if not fssize_in_bytes < devsize_in_bytes:
|
||||
self.module.exit_json(changed=False, msg="%s filesystem is using the whole device %s" % (self.fstype, dev))
|
||||
|
||||
mountpoint = dev.get_mountpoint()
|
||||
if not mountpoint:
|
||||
# xfs filesystem needs to be mounted
|
||||
|
||||
@@ -217,10 +217,11 @@ EXAMPLES = r'''
|
||||
|
||||
- name: Extend an existing partition to fill all available space
|
||||
community.general.parted:
|
||||
decice: /dev/sdb
|
||||
device: /dev/sdb
|
||||
number: "{{ sdb_info.partitions | length }}"
|
||||
part_end: "100%"
|
||||
resize: true
|
||||
state: present
|
||||
'''
|
||||
|
||||
|
||||
@@ -240,7 +241,7 @@ def parse_unit(size_str, unit=''):
|
||||
"""
|
||||
Parses a string containing a size or boundary information
|
||||
"""
|
||||
matches = re.search(r'^(-?[\d.]+)([\w%]+)?$', size_str)
|
||||
matches = re.search(r'^(-?[\d.]+) *([\w%]+)?$', size_str)
|
||||
if matches is None:
|
||||
# "<cylinder>,<head>,<sector>" format
|
||||
matches = re.search(r'^(\d+),(\d+),(\d+)$', size_str)
|
||||
@@ -499,6 +500,33 @@ def check_parted_label(device):
|
||||
return False
|
||||
|
||||
|
||||
def parse_parted_version(out):
|
||||
"""
|
||||
Returns version tuple from the output of "parted --version" command
|
||||
"""
|
||||
lines = [x for x in out.split('\n') if x.strip() != '']
|
||||
if len(lines) == 0:
|
||||
return None, None, None
|
||||
|
||||
# Sample parted versions (see as well test unit):
|
||||
# parted (GNU parted) 3.3
|
||||
# parted (GNU parted) 3.4.5
|
||||
# parted (GNU parted) 3.3.14-dfc61
|
||||
matches = re.search(r'^parted.+\s(\d+)\.(\d+)(?:\.(\d+))?', lines[0].strip())
|
||||
|
||||
if matches is None:
|
||||
return None, None, None
|
||||
|
||||
# Convert version to numbers
|
||||
major = int(matches.group(1))
|
||||
minor = int(matches.group(2))
|
||||
rev = 0
|
||||
if matches.group(3) is not None:
|
||||
rev = int(matches.group(3))
|
||||
|
||||
return major, minor, rev
|
||||
|
||||
|
||||
def parted_version():
|
||||
"""
|
||||
Returns the major and minor version of parted installed on the system.
|
||||
@@ -511,21 +539,10 @@ def parted_version():
|
||||
msg="Failed to get parted version.", rc=rc, out=out, err=err
|
||||
)
|
||||
|
||||
lines = [x for x in out.split('\n') if x.strip() != '']
|
||||
if len(lines) == 0:
|
||||
(major, minor, rev) = parse_parted_version(out)
|
||||
if major is None:
|
||||
module.fail_json(msg="Failed to get parted version.", rc=0, out=out)
|
||||
|
||||
matches = re.search(r'^parted.+(\d+)\.(\d+)(?:\.(\d+))?$', lines[0])
|
||||
if matches is None:
|
||||
module.fail_json(msg="Failed to get parted version.", rc=0, out=out)
|
||||
|
||||
# Convert version to numbers
|
||||
major = int(matches.group(1))
|
||||
minor = int(matches.group(2))
|
||||
rev = 0
|
||||
if matches.group(3) is not None:
|
||||
rev = int(matches.group(3))
|
||||
|
||||
return major, minor, rev
|
||||
|
||||
|
||||
|
||||
@@ -256,9 +256,6 @@ result:
|
||||
frontend_cookie:
|
||||
description: Frontend cookie name
|
||||
type: str
|
||||
frontend_cookie_secret:
|
||||
description: Frontend cookie secret
|
||||
type: str
|
||||
frontend_form:
|
||||
description: Frontend authentication form name
|
||||
type: str
|
||||
@@ -336,7 +333,7 @@ def main():
|
||||
backend_user_suffix=dict(type='str', required=False, default=""),
|
||||
comment=dict(type='str', required=False, default=""),
|
||||
frontend_cookie=dict(type='str', required=False),
|
||||
frontend_cookie_secret=dict(type='str', required=False),
|
||||
frontend_cookie_secret=dict(type='str', required=False, no_log=True),
|
||||
frontend_form=dict(type='str', required=False),
|
||||
frontend_form_template=dict(type='str', required=False, default=""),
|
||||
frontend_login=dict(type='str', required=False),
|
||||
|
||||
129
shippable.yml
129
shippable.yml
@@ -24,135 +24,6 @@ matrix:
|
||||
- env: T=2.9/sanity/3
|
||||
- env: T=2.9/sanity/4
|
||||
|
||||
- env: T=devel/units/2.6/1
|
||||
- env: T=devel/units/2.7/1
|
||||
- env: T=devel/units/3.5/1
|
||||
- env: T=devel/units/3.6/1
|
||||
- env: T=devel/units/3.7/1
|
||||
- env: T=devel/units/3.8/1
|
||||
- env: T=devel/units/3.9/1
|
||||
|
||||
- env: T=2.10/units/2.6/1
|
||||
- env: T=2.10/units/2.7/1
|
||||
- env: T=2.10/units/3.5/1
|
||||
- env: T=2.10/units/3.6/1
|
||||
- env: T=2.10/units/3.7/1
|
||||
- env: T=2.10/units/3.8/1
|
||||
- env: T=2.10/units/3.9/1
|
||||
|
||||
- env: T=2.9/units/2.6/1
|
||||
- env: T=2.9/units/2.7/1
|
||||
- env: T=2.9/units/3.5/1
|
||||
- env: T=2.9/units/3.6/1
|
||||
- env: T=2.9/units/3.7/1
|
||||
- env: T=2.9/units/3.8/1
|
||||
|
||||
#- env: T=devel/aix/7.2/1
|
||||
- env: T=devel/osx/10.11/1
|
||||
- env: T=devel/macos/10.15/1
|
||||
- env: T=devel/rhel/7.8/1
|
||||
- env: T=devel/rhel/8.2/1
|
||||
- env: T=devel/freebsd/11.1/1
|
||||
- env: T=devel/freebsd/12.1/1
|
||||
- env: T=devel/linux/centos6/1
|
||||
- env: T=devel/linux/centos7/1
|
||||
- env: T=devel/linux/centos8/1
|
||||
- env: T=devel/linux/fedora31/1
|
||||
- env: T=devel/linux/fedora32/1
|
||||
- env: T=devel/linux/opensuse15py2/1
|
||||
- env: T=devel/linux/opensuse15/1
|
||||
- env: T=devel/linux/ubuntu1604/1
|
||||
- env: T=devel/linux/ubuntu1804/1
|
||||
|
||||
#- env: T=devel/aix/7.2/2
|
||||
- env: T=devel/osx/10.11/2
|
||||
- env: T=devel/macos/10.15/2
|
||||
- env: T=devel/rhel/7.8/2
|
||||
- env: T=devel/rhel/8.2/2
|
||||
- env: T=devel/freebsd/11.1/2
|
||||
- env: T=devel/freebsd/12.1/2
|
||||
- env: T=devel/linux/centos6/2
|
||||
- env: T=devel/linux/centos7/2
|
||||
- env: T=devel/linux/centos8/2
|
||||
- env: T=devel/linux/fedora31/2
|
||||
- env: T=devel/linux/fedora32/2
|
||||
- env: T=devel/linux/opensuse15py2/2
|
||||
- env: T=devel/linux/opensuse15/2
|
||||
- env: T=devel/linux/ubuntu1604/2
|
||||
- env: T=devel/linux/ubuntu1804/2
|
||||
|
||||
#- env: T=devel/aix/7.2/3
|
||||
- env: T=devel/osx/10.11/3
|
||||
- env: T=devel/macos/10.15/3
|
||||
- env: T=devel/rhel/7.8/3
|
||||
- env: T=devel/rhel/8.2/3
|
||||
- env: T=devel/freebsd/11.1/3
|
||||
- env: T=devel/freebsd/12.1/3
|
||||
- env: T=devel/linux/centos6/3
|
||||
- env: T=devel/linux/centos7/3
|
||||
- env: T=devel/linux/centos8/3
|
||||
- env: T=devel/linux/fedora31/3
|
||||
- env: T=devel/linux/fedora32/3
|
||||
- env: T=devel/linux/opensuse15py2/3
|
||||
- env: T=devel/linux/opensuse15/3
|
||||
- env: T=devel/linux/ubuntu1604/3
|
||||
- env: T=devel/linux/ubuntu1804/3
|
||||
|
||||
#- env: T=devel/aix/7.2/4
|
||||
- env: T=devel/osx/10.11/4
|
||||
- env: T=devel/macos/10.15/4
|
||||
- env: T=devel/rhel/7.8/4
|
||||
- env: T=devel/rhel/8.2/4
|
||||
- env: T=devel/freebsd/11.1/4
|
||||
- env: T=devel/freebsd/12.1/4
|
||||
- env: T=devel/linux/centos6/4
|
||||
- env: T=devel/linux/centos7/4
|
||||
- env: T=devel/linux/centos8/4
|
||||
- env: T=devel/linux/fedora31/4
|
||||
- env: T=devel/linux/fedora32/4
|
||||
- env: T=devel/linux/opensuse15py2/4
|
||||
- env: T=devel/linux/opensuse15/4
|
||||
- env: T=devel/linux/ubuntu1604/4
|
||||
- env: T=devel/linux/ubuntu1804/4
|
||||
|
||||
#- env: T=devel/aix/7.2/5
|
||||
- env: T=devel/osx/10.11/5
|
||||
- env: T=devel/macos/10.15/5
|
||||
- env: T=devel/rhel/7.8/5
|
||||
- env: T=devel/rhel/8.2/5
|
||||
- env: T=devel/freebsd/11.1/5
|
||||
- env: T=devel/freebsd/12.1/5
|
||||
- env: T=devel/linux/centos6/5
|
||||
- env: T=devel/linux/centos7/5
|
||||
- env: T=devel/linux/centos8/5
|
||||
- env: T=devel/linux/fedora31/5
|
||||
- env: T=devel/linux/fedora32/5
|
||||
- env: T=devel/linux/opensuse15py2/5
|
||||
- env: T=devel/linux/opensuse15/5
|
||||
- env: T=devel/linux/ubuntu1604/5
|
||||
- env: T=devel/linux/ubuntu1804/5
|
||||
|
||||
- env: T=devel/cloud/2.7/1
|
||||
- env: T=devel/cloud/3.6/1
|
||||
|
||||
- env: T=2.10/osx/10.11/1
|
||||
- env: T=2.10/rhel/8.2/1
|
||||
- env: T=2.10/freebsd/12.1/2
|
||||
- env: T=2.10/linux/centos8/2
|
||||
- env: T=2.10/linux/fedora32/3
|
||||
- env: T=2.10/linux/opensuse15/3
|
||||
- env: T=2.10/linux/ubuntu1804/4
|
||||
- env: T=2.10/cloud/3.6/1
|
||||
|
||||
#- env: T=2.9/osx/10.11/1
|
||||
- env: T=2.9/rhel/8.2/1
|
||||
- env: T=2.9/freebsd/12.0/2
|
||||
- env: T=2.9/linux/centos8/2
|
||||
- env: T=2.9/linux/fedora31/3
|
||||
- env: T=2.9/linux/opensuse15/3
|
||||
- env: T=2.9/linux/ubuntu1804/4
|
||||
- env: T=2.9/cloud/3.6/1
|
||||
|
||||
branches:
|
||||
except:
|
||||
- "*-patch-*"
|
||||
|
||||
@@ -2914,9 +2914,22 @@ avoid such warnings, please quote the value.' in log_options_2.warnings"
|
||||
published_ports:
|
||||
- '127.0.0.1:9002:9002/tcp'
|
||||
- '[::1]:9003:9003/tcp'
|
||||
- '[fe80::1%test]:90:90/tcp'
|
||||
force_kill: yes
|
||||
register: published_ports_5
|
||||
|
||||
- name: published_ports (ports with IP addresses, idempotent)
|
||||
docker_container:
|
||||
image: "{{ docker_test_image_alpine }}"
|
||||
command: '/bin/sh -c "sleep 10m"'
|
||||
name: "{{ cname }}"
|
||||
state: started
|
||||
published_ports:
|
||||
- '127.0.0.1:9002:9002/tcp'
|
||||
- '[::1]:9003:9003/tcp'
|
||||
- '[fe80::1%test]:90:90/tcp'
|
||||
register: published_ports_6
|
||||
|
||||
- name: published_ports (no published ports)
|
||||
docker_container:
|
||||
image: "{{ docker_test_image_alpine }}"
|
||||
@@ -2927,7 +2940,7 @@ avoid such warnings, please quote the value.' in log_options_2.warnings"
|
||||
comparisons:
|
||||
published_ports: strict
|
||||
force_kill: yes
|
||||
register: published_ports_6
|
||||
register: published_ports_7
|
||||
|
||||
- name: cleanup
|
||||
docker_container:
|
||||
@@ -2943,7 +2956,8 @@ avoid such warnings, please quote the value.' in log_options_2.warnings"
|
||||
- published_ports_3 is not changed
|
||||
- published_ports_4 is changed
|
||||
- published_ports_5 is changed
|
||||
- published_ports_6 is changed
|
||||
- published_ports_6 is not changed
|
||||
- published_ports_7 is changed
|
||||
|
||||
####################################################################
|
||||
## pull ############################################################
|
||||
|
||||
@@ -230,6 +230,14 @@
|
||||
register: load_image_3
|
||||
ignore_errors: true
|
||||
|
||||
- name: load image (invalid image, old API version)
|
||||
docker_image:
|
||||
name: foo:bar
|
||||
load_path: "{{ output_dir }}/image-invalid.tar"
|
||||
source: load
|
||||
api_version: "1.22"
|
||||
register: load_image_4
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- load_image is changed
|
||||
@@ -240,6 +248,8 @@
|
||||
"The archive did not contain image 'foo:bar'. Instead, found '" ~ docker_test_image_hello_world ~ "'." == load_image_2.msg
|
||||
- load_image_3 is failed
|
||||
- '"Detected no loaded images. Archive potentially corrupt?" == load_image_3.msg'
|
||||
- load_image_4 is changed
|
||||
- "'The API version of your Docker daemon is < 1.23, which does not return the image loading result from the Docker daemon. Therefore, we cannot verify whether the expected image was loaded, whether multiple images where loaded, or whether the load actually succeeded. You should consider upgrading your Docker daemon.' in load_image_4.warnings"
|
||||
|
||||
####################################################################
|
||||
## path ############################################################
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
tested_filesystems:
|
||||
# key: fstype
|
||||
# fssize: size (Mo)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
dependencies:
|
||||
- setup_pkg_mgr
|
||||
- setup_remote_tmp_dir
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
- name: 'Create a "disk" file'
|
||||
command: 'dd if=/dev/zero of={{ image_file }} bs=1M count={{ fssize }}'
|
||||
|
||||
|
||||
@@ -43,40 +43,45 @@
|
||||
- 'fs3_result is success'
|
||||
- 'uuid.stdout != uuid3.stdout'
|
||||
|
||||
- name: increase fake device
|
||||
shell: 'dd if=/dev/zero bs=1M count=1 >> {{ image_file }}'
|
||||
|
||||
- when: fstype == 'lvm'
|
||||
block:
|
||||
- name: Resize loop device for LVM
|
||||
command: losetup -c {{ dev }}
|
||||
|
||||
- when: 'grow|bool and (fstype != "vfat" or resize_vfat)'
|
||||
block:
|
||||
- name: Expand filesystem
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs4_result
|
||||
- name: increase fake device
|
||||
shell: 'dd if=/dev/zero bs=1M count=1 >> {{ image_file }}'
|
||||
|
||||
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
|
||||
register: uuid4
|
||||
- name: Resize loop device for LVM
|
||||
command: losetup -c {{ dev }}
|
||||
when: fstype == 'lvm'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'fs4_result is changed'
|
||||
- 'fs4_result is success'
|
||||
- 'uuid3.stdout == uuid4.stdout' # unchanged
|
||||
- name: Expand filesystem
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs4_result
|
||||
|
||||
- name: Try to expand filesystem again
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs5_result
|
||||
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
|
||||
register: uuid4
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'not (fs5_result is changed)'
|
||||
- 'fs5_result is successful'
|
||||
- assert:
|
||||
that:
|
||||
- 'fs4_result is changed'
|
||||
- 'fs4_result is success'
|
||||
- 'uuid3.stdout == uuid4.stdout' # unchanged
|
||||
|
||||
- when:
|
||||
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
|
||||
(fstype == "xfs" and ansible_system == "Linux" and
|
||||
ansible_distribution not in ["CentOS", "Ubuntu"])
|
||||
block:
|
||||
- name: Check that resizefs does nothing if device size is not changed
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs5_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'fs5_result is not changed'
|
||||
- 'fs5_result is succeeded'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
- name: 'Recreate "disk" file'
|
||||
command: 'dd if=/dev/zero of={{ image_file }} bs=1M count={{ fssize }}'
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
- name: install filesystem tools
|
||||
package:
|
||||
name: '{{ item }}'
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
|
||||
- name: Clean up gitlab user
|
||||
gitlab_user:
|
||||
server_url: "{{ gitlab_host }}"
|
||||
api_url: "{{ gitlab_host }}"
|
||||
name: ansible_test_user
|
||||
username: ansible_test_user
|
||||
password: Secr3tPassw00rd
|
||||
email: root@localhost
|
||||
validate_certs: false
|
||||
login_token: "{{ gitlab_login_token }}"
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: absent
|
||||
|
||||
|
||||
- name: Create gitlab user
|
||||
gitlab_user:
|
||||
server_url: "{{ gitlab_host }}"
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
password: "{{ gitlab_user_pass }}"
|
||||
validate_certs: False
|
||||
login_token: "{{ gitlab_login_token }}"
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
@@ -39,13 +39,13 @@
|
||||
|
||||
- name: Create gitlab user again
|
||||
gitlab_user:
|
||||
server_url: "{{ gitlab_host }}"
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: root@localhost
|
||||
name: ansible_test_user
|
||||
username: ansible_test_user
|
||||
password: Secr3tPassw00rd
|
||||
validate_certs: False
|
||||
login_token: "{{ gitlab_login_token }}"
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state_again
|
||||
|
||||
@@ -53,3 +53,198 @@
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state_again is not changed
|
||||
- gitlab_user_state_again.user.is_admin == False
|
||||
|
||||
|
||||
- name: Update User Test => Make User Admin
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
isadmin: true
|
||||
validate_certs: False
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check if user is admin now
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is changed
|
||||
- gitlab_user_state.user.is_admin == True
|
||||
|
||||
- name: Update User Test => Make User Admin (Again)
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
isadmin: true
|
||||
validate_certs: False
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check state is not changed
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is not changed
|
||||
- gitlab_user_state.user.is_admin == True
|
||||
|
||||
- name: Update User Test => Remove Admin Rights
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
isadmin: false
|
||||
validate_certs: False
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check if user is not admin anymore
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is changed
|
||||
- gitlab_user_state.user.is_admin == False
|
||||
|
||||
|
||||
- name: Update User Test => Try Changing Mail without Confirmation Skipping
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: foo@bar.baz
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
confirm: True
|
||||
validate_certs: False
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check that eMail is unchanged (Only works with confirmation skipping)
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is changed
|
||||
- gitlab_user_state.user.email == gitlab_user_email
|
||||
|
||||
- name: Update User Test => Change Mail with Confirmation Skip
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: foo@bar.baz
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
confirm: false
|
||||
validate_certs: False
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check that mail has changed now
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is changed
|
||||
- gitlab_user_state.user.email == 'foo@bar.baz'
|
||||
|
||||
- name: Update User Test => Change Mail with Confirmation Skip (Again)
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: foo@bar.baz
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
confirm: false
|
||||
validate_certs: False
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check state is not changed
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is not changed
|
||||
- gitlab_user_state.user.email == 'foo@bar.baz'
|
||||
|
||||
- name: Update User Test => Revert to original Mail Address
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
confirm: false
|
||||
validate_certs: False
|
||||
api_token: "{{ gitlab_login_token }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check that reverting mail back to original has worked
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is changed
|
||||
- gitlab_user_state.user.email == gitlab_user_email
|
||||
|
||||
|
||||
- name: Update User Test => Change User Password
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
validate_certs: False
|
||||
|
||||
# note: the only way to check if a password really is what it is expected
|
||||
# to be is to use it for login, so we use it here instead of the
|
||||
# default token assuming that a user can always change its own password
|
||||
api_username: "{{ gitlab_user }}"
|
||||
api_password: "{{ gitlab_user_pass }}"
|
||||
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
password: new-super-password
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check PW setting return state
|
||||
assert:
|
||||
that:
|
||||
# note: there is no way to determine if a password has changed or
|
||||
# not, so it can only be always yellow or always green, we
|
||||
# decided for always green for now
|
||||
- gitlab_user_state is not changed
|
||||
|
||||
- name: Update User Test => Reset User Password
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
validate_certs: False
|
||||
|
||||
api_username: "{{ gitlab_user }}"
|
||||
api_password: new-super-password
|
||||
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
password: "{{ gitlab_user_pass }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check PW setting return state (Again)
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is not changed
|
||||
|
||||
- name: Update User Test => Check that password was reset
|
||||
gitlab_user:
|
||||
api_url: "{{ gitlab_host }}"
|
||||
validate_certs: False
|
||||
|
||||
api_username: "{{ gitlab_user }}"
|
||||
api_password: "{{ gitlab_user_pass }}"
|
||||
|
||||
email: "{{ gitlab_user_email }}"
|
||||
name: "{{ gitlab_user }}"
|
||||
username: "{{ gitlab_user }}"
|
||||
state: present
|
||||
register: gitlab_user_state
|
||||
|
||||
- name: Check PW setting return state (Reset)
|
||||
assert:
|
||||
that:
|
||||
- gitlab_user_state is not changed
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
name: mercurial
|
||||
when: ansible_facts.pkg_mgr in ['pkgng', 'community.general.pkgng']
|
||||
|
||||
- name: install mercurial (zypper)
|
||||
package:
|
||||
name: mercurial
|
||||
when: ansible_facts.pkg_mgr in ['zypper', 'community.general.zypper']
|
||||
|
||||
- name: preserve the updated python
|
||||
command: cp -av "{{ which_python.stdout }}" "{{ which_python.stdout }}.updated"
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
autoremove: yes
|
||||
when: ansible_facts.pkg_mgr in ['pkgng', 'community.general.pkgng']
|
||||
|
||||
- name: uninstall packages which were not originally installed (zypper)
|
||||
package:
|
||||
name: mercurial
|
||||
state: absent
|
||||
when: ansible_facts.pkg_mgr in ['zypper', 'community.general.zypper']
|
||||
|
||||
- name: restore the default python
|
||||
raw: mv "{{ which_python.stdout }}.default" "{{ which_python.stdout }}"
|
||||
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
unsupported
|
||||
destructive
|
||||
shippable/posix/group3
|
||||
skip/aix
|
||||
skip/osx
|
||||
skip/macos
|
||||
skip/freebsd
|
||||
needs/root
|
||||
|
||||
2
tests/integration/targets/java_cert/meta/main.yml
Normal file
2
tests/integration/targets/java_cert/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- setup_java_keytool
|
||||
@@ -3,56 +3,58 @@
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
- when: has_java_keytool
|
||||
block:
|
||||
|
||||
- name: prep pkcs12 file
|
||||
copy: src="{{ test_pkcs12_path }}" dest="{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
- name: prep pkcs12 file
|
||||
copy: src="{{ test_pkcs12_path }}" dest="{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
|
||||
- name: import pkcs12
|
||||
java_cert:
|
||||
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
pkcs12_password: changeit
|
||||
pkcs12_alias: default
|
||||
cert_alias: default
|
||||
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
|
||||
keystore_pass: changeme_keystore
|
||||
keystore_create: yes
|
||||
state: present
|
||||
register: result_success
|
||||
- name: verify success
|
||||
assert:
|
||||
that:
|
||||
- result_success is successful
|
||||
- name: import pkcs12
|
||||
java_cert:
|
||||
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
pkcs12_password: changeit
|
||||
pkcs12_alias: default
|
||||
cert_alias: default
|
||||
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
|
||||
keystore_pass: changeme_keystore
|
||||
keystore_create: yes
|
||||
state: present
|
||||
register: result_success
|
||||
- name: verify success
|
||||
assert:
|
||||
that:
|
||||
- result_success is successful
|
||||
|
||||
- name: import pkcs12 with wrong password
|
||||
java_cert:
|
||||
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
pkcs12_password: wrong_pass
|
||||
pkcs12_alias: default
|
||||
cert_alias: default_new
|
||||
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
|
||||
keystore_pass: changeme_keystore
|
||||
keystore_create: yes
|
||||
state: present
|
||||
ignore_errors: true
|
||||
register: result_wrong_pass
|
||||
- name: import pkcs12 with wrong password
|
||||
java_cert:
|
||||
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
pkcs12_password: wrong_pass
|
||||
pkcs12_alias: default
|
||||
cert_alias: default_new
|
||||
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
|
||||
keystore_pass: changeme_keystore
|
||||
keystore_create: yes
|
||||
state: present
|
||||
ignore_errors: true
|
||||
register: result_wrong_pass
|
||||
|
||||
- name: verify fail with wrong import password
|
||||
assert:
|
||||
that:
|
||||
- result_wrong_pass is failed
|
||||
- name: verify fail with wrong import password
|
||||
assert:
|
||||
that:
|
||||
- result_wrong_pass is failed
|
||||
|
||||
- name: test fail on mutually exclusive params
|
||||
java_cert:
|
||||
cert_path: ca.crt
|
||||
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
cert_alias: default
|
||||
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
|
||||
keystore_pass: changeme_keystore
|
||||
keystore_create: yes
|
||||
state: present
|
||||
ignore_errors: true
|
||||
register: result_excl_params
|
||||
- name: verify failed exclusive params
|
||||
assert:
|
||||
that:
|
||||
- result_excl_params is failed
|
||||
- name: test fail on mutually exclusive params
|
||||
java_cert:
|
||||
cert_path: ca.crt
|
||||
pkcs12_path: "{{output_dir}}/{{ test_pkcs12_path }}"
|
||||
cert_alias: default
|
||||
keystore_path: "{{output_dir}}/{{ test_keystore_path }}"
|
||||
keystore_pass: changeme_keystore
|
||||
keystore_create: yes
|
||||
state: present
|
||||
ignore_errors: true
|
||||
register: result_excl_params
|
||||
- name: verify failed exclusive params
|
||||
assert:
|
||||
that:
|
||||
- result_excl_params is failed
|
||||
|
||||
7
tests/integration/targets/java_keystore/aliases
Normal file
7
tests/integration/targets/java_keystore/aliases
Normal file
@@ -0,0 +1,7 @@
|
||||
destructive
|
||||
shippable/posix/group3
|
||||
skip/aix
|
||||
skip/osx
|
||||
skip/macos
|
||||
skip/freebsd
|
||||
needs/root
|
||||
3
tests/integration/targets/java_keystore/meta/main.yml
Normal file
3
tests/integration/targets/java_keystore/meta/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
dependencies:
|
||||
- setup_java_keytool
|
||||
- setup_openssl
|
||||
137
tests/integration/targets/java_keystore/tasks/main.yml
Normal file
137
tests/integration/targets/java_keystore/tasks/main.yml
Normal file
@@ -0,0 +1,137 @@
|
||||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
- when: has_java_keytool
|
||||
block:
|
||||
- name: Create private keys
|
||||
community.crypto.openssl_privatekey:
|
||||
path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
||||
size: 2048 # this should work everywhere
|
||||
# The following is more efficient, but might not work everywhere:
|
||||
# type: ECC
|
||||
# curve: secp384r1
|
||||
cipher: "{{ 'auto' if item.passphrase is defined else omit }}"
|
||||
passphrase: "{{ item.passphrase | default(omit) }}"
|
||||
loop:
|
||||
- name: cert
|
||||
- name: cert-pw
|
||||
passphrase: hunter2
|
||||
|
||||
- name: Create CSRs
|
||||
community.crypto.openssl_csr:
|
||||
path: "{{ output_dir ~ '/' ~ item.name ~ '.csr' }}"
|
||||
privatekey_path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
||||
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
|
||||
commonName: "{{ item.commonName }}"
|
||||
loop:
|
||||
- name: cert
|
||||
commonName: example.com
|
||||
- name: cert-pw
|
||||
passphrase: hunter2
|
||||
commonName: example.com
|
||||
- name: cert2
|
||||
keyname: cert
|
||||
commonName: example.org
|
||||
- name: cert2-pw
|
||||
keyname: cert-pw
|
||||
passphrase: hunter2
|
||||
commonName: example.org
|
||||
|
||||
- name: Create certificates
|
||||
community.crypto.x509_certificate:
|
||||
path: "{{ output_dir ~ '/' ~ item.name ~ '.pem' }}"
|
||||
csr_path: "{{ output_dir ~ '/' ~ item.name ~ '.csr' }}"
|
||||
privatekey_path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
||||
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
|
||||
provider: selfsigned
|
||||
loop:
|
||||
- name: cert
|
||||
commonName: example.com
|
||||
- name: cert-pw
|
||||
passphrase: hunter2
|
||||
commonName: example.com
|
||||
- name: cert2
|
||||
keyname: cert
|
||||
commonName: example.org
|
||||
- name: cert2-pw
|
||||
keyname: cert-pw
|
||||
passphrase: hunter2
|
||||
commonName: example.org
|
||||
|
||||
- name: Create a Java key store for the given certificates (check mode)
|
||||
community.general.java_keystore: &create_key_store_data
|
||||
name: example
|
||||
certificate: "{{lookup('file', output_dir ~ '/' ~ item.name ~ '.pem') }}"
|
||||
private_key: "{{lookup('file', output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key') }}"
|
||||
private_key_passphrase: "{{ item.passphrase | default(omit) }}"
|
||||
password: changeit
|
||||
dest: "{{ output_dir ~ '/' ~ item.name ~ '.jks' }}"
|
||||
loop: &create_key_store_loop
|
||||
- name: cert
|
||||
- name: cert-pw
|
||||
passphrase: hunter2
|
||||
check_mode: yes
|
||||
register: result_check
|
||||
|
||||
- name: Create a Java key store for the given certificates
|
||||
community.general.java_keystore: *create_key_store_data
|
||||
loop: *create_key_store_loop
|
||||
register: result
|
||||
|
||||
- name: Create a Java key store for the given certificates (idempotency, check mode)
|
||||
community.general.java_keystore: *create_key_store_data
|
||||
loop: *create_key_store_loop
|
||||
check_mode: yes
|
||||
register: result_idem_check
|
||||
|
||||
- name: Create a Java key store for the given certificates (idempotency)
|
||||
community.general.java_keystore: *create_key_store_data
|
||||
loop: *create_key_store_loop
|
||||
register: result_idem
|
||||
|
||||
- name: Create a Java key store for the given certificates (certificate changed, check mode)
|
||||
community.general.java_keystore: *create_key_store_data
|
||||
loop: &create_key_store_loop_new_certs
|
||||
- name: cert2
|
||||
keyname: cert
|
||||
- name: cert2-pw
|
||||
keyname: cert-pw
|
||||
passphrase: hunter2
|
||||
check_mode: yes
|
||||
register: result_change_check
|
||||
|
||||
- name: Create a Java key store for the given certificates (certificate changed)
|
||||
community.general.java_keystore: *create_key_store_data
|
||||
loop: *create_key_store_loop_new_certs
|
||||
register: result_change
|
||||
|
||||
- name: Create a Java key store for the given certificates (password changed, check mode)
|
||||
community.general.java_keystore:
|
||||
<<: *create_key_store_data
|
||||
password: hunter2
|
||||
loop: *create_key_store_loop_new_certs
|
||||
check_mode: yes
|
||||
register: result_pw_change_check
|
||||
when: false # FIXME: module currently crashes
|
||||
|
||||
- name: Create a Java key store for the given certificates (password changed)
|
||||
community.general.java_keystore:
|
||||
<<: *create_key_store_data
|
||||
password: hunter2
|
||||
loop: *create_key_store_loop_new_certs
|
||||
register: result_pw_change
|
||||
when: false # FIXME: module currently crashes
|
||||
|
||||
- name: Validate results
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result_check is changed
|
||||
- result_idem is not changed
|
||||
- result_idem_check is not changed
|
||||
- result_change is changed
|
||||
- result_change_check is changed
|
||||
# - result_pw_change is changed # FIXME: module currently crashes
|
||||
# - result_pw_change_check is changed # FIXME: module currently crashes
|
||||
@@ -0,0 +1,3 @@
|
||||
dependencies:
|
||||
- setup_remote_constraints
|
||||
- setup_pkg_mgr
|
||||
21
tests/integration/targets/setup_java_keytool/tasks/main.yml
Normal file
21
tests/integration/targets/setup_java_keytool/tasks/main.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
- set_fact:
|
||||
has_java_keytool: >-
|
||||
{{
|
||||
ansible_os_family not in ['Darwin', 'FreeBSD']
|
||||
and not (ansible_distribution == "CentOS" and ansible_distribution_version is version("7.0", "<"))
|
||||
}}
|
||||
|
||||
- name: Include OS-specific variables
|
||||
include_vars: '{{ ansible_os_family }}.yml'
|
||||
when: has_java_keytool
|
||||
|
||||
- name: Install keytool
|
||||
package:
|
||||
name: '{{ keytool_package_name }}'
|
||||
become: true
|
||||
when: has_java_keytool
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
keytool_package_name: ca-certificates-java
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
keytool_package_name: java-11-openjdk-headless
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
keytool_package_name: java-11-openjdk-headless
|
||||
70
tests/unit/plugins/modules/packaging/language/test_npm.py
Normal file
70
tests/unit/plugins/modules/packaging/language/test_npm.py
Normal file
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# Copyright: (c) 2021, Abhijeet Kasurde <akasurde@redhat.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import call, patch
|
||||
from ansible_collections.community.general.plugins.modules.packaging.language import npm
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import (
|
||||
AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args)
|
||||
|
||||
|
||||
class NPMModuleTestCase(ModuleTestCase):
|
||||
module = npm
|
||||
|
||||
def setUp(self):
|
||||
super(NPMModuleTestCase, self).setUp()
|
||||
ansible_module_path = "ansible_collections.community.general.plugins.modules.packaging.language.npm.AnsibleModule"
|
||||
self.mock_run_command = patch('%s.run_command' % ansible_module_path)
|
||||
self.module_main_command = self.mock_run_command.start()
|
||||
self.mock_get_bin_path = patch('%s.get_bin_path' % ansible_module_path)
|
||||
self.get_bin_path = self.mock_get_bin_path.start()
|
||||
self.get_bin_path.return_value = '/testbin/npm'
|
||||
|
||||
def tearDown(self):
|
||||
self.mock_run_command.stop()
|
||||
self.mock_get_bin_path.stop()
|
||||
super(NPMModuleTestCase, self).tearDown()
|
||||
|
||||
def module_main(self, exit_exc):
|
||||
with self.assertRaises(exit_exc) as exc:
|
||||
self.module.main()
|
||||
return exc.exception.args[0]
|
||||
|
||||
def test_present(self):
|
||||
set_module_args({
|
||||
'name': 'coffee-script',
|
||||
'global': 'true',
|
||||
'state': 'present'
|
||||
})
|
||||
self.module_main_command.side_effect = [
|
||||
(0, '{}', ''),
|
||||
(0, '{}', ''),
|
||||
]
|
||||
|
||||
result = self.module_main(AnsibleExitJson)
|
||||
|
||||
self.assertTrue(result['changed'])
|
||||
self.module_main_command.assert_has_calls([
|
||||
call(['/testbin/npm', 'list', '--json', '--long', '--global'], check_rc=False, cwd=None),
|
||||
])
|
||||
|
||||
def test_absent(self):
|
||||
set_module_args({
|
||||
'name': 'coffee-script',
|
||||
'global': 'true',
|
||||
'state': 'absent'
|
||||
})
|
||||
self.module_main_command.side_effect = [
|
||||
(0, '{"dependencies": {"coffee-script": {}}}', ''),
|
||||
(0, '{}', ''),
|
||||
]
|
||||
|
||||
result = self.module_main(AnsibleExitJson)
|
||||
|
||||
self.assertTrue(result['changed'])
|
||||
self.module_main_command.assert_has_calls([
|
||||
call(['/testbin/npm', 'uninstall', '--global', 'coffee-script'], check_rc=True, cwd=None),
|
||||
])
|
||||
@@ -88,16 +88,33 @@ class TestGitlabUser(GitlabModuleTestCase):
|
||||
@with_httmock(resp_get_user)
|
||||
def test_update_user(self):
|
||||
user = self.gitlab_instance.users.get(1)
|
||||
changed, newUser = self.moduleUtil.updateUser(user, {'name': "Jack Smith", "is_admin": "true"})
|
||||
|
||||
changed, newUser = self.moduleUtil.updateUser(
|
||||
user,
|
||||
{'name': {'value': "Jack Smith"}, "is_admin": {'value': "true", 'setter': 'admin'}}, {}
|
||||
)
|
||||
|
||||
self.assertEqual(changed, True)
|
||||
self.assertEqual(newUser.name, "Jack Smith")
|
||||
self.assertEqual(newUser.is_admin, "true")
|
||||
self.assertEqual(newUser.admin, "true")
|
||||
|
||||
changed, newUser = self.moduleUtil.updateUser(user, {'name': "Jack Smith"})
|
||||
changed, newUser = self.moduleUtil.updateUser(user, {'name': {'value': "Jack Smith"}}, {})
|
||||
|
||||
self.assertEqual(changed, False)
|
||||
|
||||
changed, newUser = self.moduleUtil.updateUser(
|
||||
user,
|
||||
{}, {
|
||||
'skip_reconfirmation': {'value': True},
|
||||
'password': {'value': 'super_secret-super_secret'},
|
||||
}
|
||||
)
|
||||
|
||||
# note: uncheckable parameters dont set changed state
|
||||
self.assertEqual(changed, False)
|
||||
self.assertEqual(newUser.skip_reconfirmation, True)
|
||||
self.assertEqual(newUser.password, 'super_secret-super_secret')
|
||||
|
||||
@with_httmock(resp_find_user)
|
||||
@with_httmock(resp_delete_user)
|
||||
def test_delete_user(self):
|
||||
|
||||
@@ -6,6 +6,7 @@ __metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch, call
|
||||
from ansible_collections.community.general.plugins.modules.system import parted as parted_module
|
||||
from ansible_collections.community.general.plugins.modules.system.parted import parse_parted_version
|
||||
from ansible_collections.community.general.plugins.modules.system.parted import parse_partition_info
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
|
||||
|
||||
@@ -17,6 +18,32 @@ BYT;
|
||||
2:106MB:368MB:262MB:ext2::;
|
||||
3:368MB:256061MB:255692MB:::;"""
|
||||
|
||||
parted_version_info = {"""
|
||||
parted (GNU parted) 3.3
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
Written by <http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>.
|
||||
""": (3, 3, 0), """
|
||||
parted (GNU parted) 3.4.5
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
Written by <http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>.
|
||||
""": (3, 4, 5), """
|
||||
parted (GNU parted) 3.3.14-dfc61
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
Written by <http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>.
|
||||
""": (3, 3, 14)}
|
||||
|
||||
# corresponding dictionary after parsing by parse_partition_info
|
||||
parted_dict1 = {
|
||||
"generic": {
|
||||
@@ -311,3 +338,8 @@ class TestParted(ModuleTestCase):
|
||||
})
|
||||
with patch('ansible_collections.community.general.plugins.modules.system.parted.get_device_info', return_value=parted_dict3):
|
||||
self.execute_module(changed=True)
|
||||
|
||||
def test_version_info(self):
|
||||
"""Test that the parse_parted_version returns the expected tuple"""
|
||||
for key, value in parted_version_info.items():
|
||||
self.assertEqual(parse_parted_version(key), value)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
coverage >= 4.2, < 5.0.0, != 4.3.2 ; python_version <= '3.7' # features in 4.2+ required, avoid known bug in 4.3.2 on python 2.6, coverage 5.0+ incompatible
|
||||
coverage >= 4.5.4, < 5.0.0 ; python_version > '3.7' # coverage had a bug in < 4.5.4 that would cause unit tests to hang in Python 3.8, coverage 5.0+ incompatible
|
||||
cryptography < 2.2 ; python_version < '2.7' # cryptography 2.2 drops support for python 2.6
|
||||
cryptography >= 3.0, < 3.4 ; python_version < '3.6' # cryptography 3.4 drops support for python 2.7
|
||||
cryptography >= 3.3, < 3.4 # FIXME: the upper limit is needed for RHEL8.2, CentOS 8, Ubuntu 18.04, and OpenSuSE 15
|
||||
deepdiff < 4.0.0 ; python_version < '3' # deepdiff 4.0.0 and later require python 3
|
||||
jinja2 < 2.11 ; python_version < '2.7' # jinja2 2.11 and later require python 2.7 or later
|
||||
urllib3 < 1.24 ; python_version < '2.7' # urllib3 1.24 and later require python 2.7 or later
|
||||
|
||||
Reference in New Issue
Block a user