Skip to content

Commit

Permalink
Merge branch 'main' into bluikko-1193-sefcontext
Browse files Browse the repository at this point in the history
  • Loading branch information
bluikko committed Feb 21, 2023
2 parents a460c0b + 867aee6 commit e6b138b
Show file tree
Hide file tree
Showing 573 changed files with 3,428 additions and 1,379 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ stages:
targets:
- name: Debian Bullseye
test: debian-bullseye/3.9
- name: ArchLinux
test: archlinux/3.10
#- name: ArchLinux
# test: archlinux/3.10
- name: CentOS Stream 8
test: centos-stream8/3.9
groups:
Expand Down
4 changes: 2 additions & 2 deletions .github/BOTMETA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ files:
labels: datadog_event
maintainers: n0ts
$modules/datadog_monitor.py:
maintainers: skornehl
ignore: skornehl
$modules/dconf.py:
maintainers: azaghal
$modules/deploy_helper.py:
Expand Down Expand Up @@ -1037,7 +1037,7 @@ files:
maintainers: dagwieers
$modules/redfish_:
ignore: jose-delarosa
maintainers: $team_redfish
maintainers: $team_redfish TSKushal
$modules/redhat_subscription.py:
labels: redhat_subscription
maintainers: barnabycourt alikins kahowell
Expand Down
2 changes: 1 addition & 1 deletion changelogs/fragments/5811-clarify-bitwarden-error.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
minor_changes:
bugfixes:
- bitwarden lookup plugin - clarify what to do, if the bitwarden vault is not unlocked (https://github.com/ansible-collections/community.general/pull/5811).
2 changes: 2 additions & 0 deletions changelogs/fragments/5812-implement-updateconf-api-call.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- one_vm - add a new ``updateconf`` option which implements the ``one.vm.updateconf`` API call (https://github.com/ansible-collections/community.general/pull/5812).
4 changes: 4 additions & 0 deletions changelogs/fragments/5829-fix-yarn-global.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bugfixes:
- yarn - fix ``state=latest`` not working with ``global=true`` (https://github.com/ansible-collections/community.general/issues/5712).
- yarn - fix ``global=true`` to check for the configured global folder instead of assuming the default (https://github.com/ansible-collections/community.general/pull/5829)
- yarn - fix ``state=absent`` not working with ``global=true`` when the package does not include a binary (https://github.com/ansible-collections/community.general/pull/5829)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- bitwarden lookup plugin - implement filtering results by ``collection_id`` parameter (https://github.com/ansible-collections/community.general/issues/5849).
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- sudoers - add ``setenv`` parameters to support passing environment variables via sudo. (https://github.com/ansible-collections/community.general/pull/5883)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- redfish_utils - removed basic auth HTTP header when performing a GET on the service root resource and when performing a POST to the session collection (https://github.com/ansible-collections/community.general/issues/5886).
2 changes: 2 additions & 0 deletions changelogs/fragments/5888-update-key-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- gitlab_deploy_key - also update ``title`` and not just ``can_push`` (https://github.com/ansible-collections/community.general/pull/5888).
2 changes: 2 additions & 0 deletions changelogs/fragments/5897-ipa_group-add-external-users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ipa_group - allow to add and remove external users with the ``external_user`` option (https://github.com/ansible-collections/community.general/pull/5897).
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- redfish_command - adding ``EnableSecureBoot`` functionality (https://github.com/ansible-collections/community.general/pull/5899).
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- redfish_command - adding ``VerifyBiosAttributes`` functionality (https://github.com/ansible-collections/community.general/pull/5900).
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- gitlab_runner - add new boolean option ``access_level_on_creation``. It controls, whether the value of ``access_level`` is used for runner registration or not. The option ``access_level`` has been ignored on registration so far and was only used on updates (https://github.com/ansible-collections/community.general/issues/5907, https://github.com/ansible-collections/community.general/pull/5908).
deprecated_features:
- gitlab_runner - the default of the new option ``access_level_on_creation`` will change from ``false`` to ``true`` in community.general 7.0.0. This will cause ``access_level`` to be used during runner registration as well, and not only during updates (https://github.com/ansible-collections/community.general/pull/5908).
2 changes: 2 additions & 0 deletions changelogs/fragments/5913-dig-caa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "dig lookup plugin - support CAA record type (https://github.com/ansible-collections/community.general/pull/5913)."
2 changes: 2 additions & 0 deletions changelogs/fragments/5914-dig-dnskey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "dig lookup plugin - correctly handle DNSKEY record type's ``algorithm`` field (https://github.com/ansible-collections/community.general/pull/5914)."
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- proxmox - suppress urllib3 ``InsecureRequestWarnings`` when ``validate_certs`` option is ``false`` (https://github.com/ansible-collections/community.general/pull/5931).
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecated_features:
- gitlab_runner - the option ``access_level`` will lose its default value in community.general 8.0.0. From that version on, you have set this option to ``ref_protected`` explicitly, if you want to have a protected runner (https://github.com/ansible-collections/community.general/issues/5925).
2 changes: 2 additions & 0 deletions changelogs/fragments/5927-set-user-agent-dnsimple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "dnsimple - set custom User-Agent for API requests to DNSimple (https://github.com/ansible-collections/community.general/pull/5927)."
2 changes: 2 additions & 0 deletions changelogs/fragments/5928-fix-favicon-url.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- mattermost, rocketchat, slack - replace missing default favicon with docs.ansible.com favicon (https://github.com/ansible-collections/community.general/pull/5928).
2 changes: 2 additions & 0 deletions changelogs/fragments/5933-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "terraform and timezone - slight refactoring to avoid linter reporting potentially undefined variables (https://github.com/ansible-collections/community.general/pull/5933)."
2 changes: 2 additions & 0 deletions changelogs/fragments/remove-unneeded-imports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "various plugins and modules - remove unnecessary imports (https://github.com/ansible-collections/community.general/pull/5940)."
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace: community
name: general
version: 6.3.0
version: 6.4.0
readme: README.md
authors:
- Ansible (https://github.com/ansible)
Expand Down
2 changes: 0 additions & 2 deletions plugins/cache/memcached.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@
from multiprocessing import Lock
from itertools import chain

from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils.common._collections_compat import MutableSet
from ansible.plugins.cache import BaseCacheModule
from ansible.release import __version__ as ansible_base_version
from ansible.utils.display import Display

try:
Expand Down
2 changes: 0 additions & 2 deletions plugins/cache/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@
import time
import json

from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils.common.text.converters import to_native
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
from ansible.plugins.cache import BaseCacheModule
from ansible.release import __version__ as ansible_base_version
from ansible.utils.display import Display

try:
Expand Down
1 change: 0 additions & 1 deletion plugins/callback/counter_enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from ansible import constants as C
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
from ansible.template import Templar
from ansible.playbook.task_include import TaskInclude


Expand Down
4 changes: 0 additions & 4 deletions plugins/callback/diy.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,6 @@

import sys
from contextlib import contextmanager
from ansible import constants as C
from ansible.playbook.task_include import TaskInclude
from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor
from ansible.template import Templar
from ansible.vars.manager import VariableManager
from ansible.plugins.callback.default import CallbackModule as Default
Expand Down
1 change: 0 additions & 1 deletion plugins/callback/loganalytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import hashlib
import hmac
import base64
import logging
import json
import uuid
import socket
Expand Down
1 change: 0 additions & 1 deletion plugins/callback/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
import email.utils
import smtplib

from ansible.module_utils.six import string_types
from ansible.module_utils.common.text.converters import to_bytes
from ansible.parsing.ajson import AnsibleJSONEncoder
from ansible.plugins.callback import CallbackBase
Expand Down
3 changes: 0 additions & 3 deletions plugins/callback/nrdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@
type: string
'''

import os
import json

from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible.module_utils.common.text.converters import to_bytes
from ansible.module_utils.urls import open_url
Expand Down
3 changes: 0 additions & 3 deletions plugins/callback/syslog_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@
version_added: 4.5.0
'''

import os
import json

import logging
import logging.handlers

Expand Down
6 changes: 2 additions & 4 deletions plugins/callback/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
import json
import re
import string
import sys

from ansible.module_utils.common.text.converters import to_bytes, to_text
from ansible.module_utils.six import string_types
from ansible.module_utils.common.text.converters import to_text
from ansible.parsing.yaml.dumper import AnsibleDumper
from ansible.plugins.callback import CallbackBase, strip_internal_keys, module_response_deepcopy
from ansible.plugins.callback import strip_internal_keys, module_response_deepcopy
from ansible.plugins.callback.default import CallbackModule as Default


Expand Down
2 changes: 2 additions & 0 deletions plugins/doc_fragments/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ModuleDocFragment(object):
'''

PLATFORM = r'''
options: {}
attributes:
platform:
description: Target OS/families that can be operated against.
support: N/A
Expand Down
3 changes: 1 addition & 2 deletions plugins/doc_fragments/hpe3par.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class ModuleDocFragment(object):
required: true
requirements:
- hpe3par_sdk >= 1.0.2. Install using 'pip install hpe3par_sdk'
- hpe3par_sdk >= 1.0.2. Install using C(pip install hpe3par_sdk).
- WSAPI service should be enabled on the 3PAR storage array.
notes:
- check_mode not supported
'''
6 changes: 3 additions & 3 deletions plugins/filter/jc.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
import importlib

try:
import jc
import jc # noqa: F401, pylint: disable=unused-import
HAS_LIB = True
except ImportError:
HAS_LIB = False


def jc(data, parser, quiet=True, raw=False):
def jc_filter(data, parser, quiet=True, raw=False):
"""Convert returned command output to JSON using the JC library
Arguments:
Expand Down Expand Up @@ -150,5 +150,5 @@ class FilterModule(object):

def filters(self):
return {
'jc': jc
'jc': jc_filter,
}
2 changes: 0 additions & 2 deletions plugins/filter/lists_mergeby.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@
from ansible.module_utils.six import string_types
from ansible.module_utils.common._collections_compat import Mapping, Sequence
from ansible.utils.vars import merge_hash
from ansible.release import __version__ as ansible_version
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion

from collections import defaultdict
from operator import itemgetter
Expand Down
5 changes: 1 addition & 4 deletions plugins/inventory/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@
ansible_host: "ipv4 | community.general.json_query('[?public==`false`].address') | first"
'''

import os

from ansible.errors import AnsibleError, AnsibleParserError
from ansible.module_utils.six import string_types
from ansible.errors import AnsibleError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable


Expand Down
2 changes: 0 additions & 2 deletions plugins/inventory/lxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,10 @@
attribute: internals
'''

import binascii
import json
import re
import time
import os
import socket
from ansible.plugins.inventory import BaseInventoryPlugin
from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.common.dict_transformations import dict_merge
Expand Down
2 changes: 1 addition & 1 deletion plugins/inventory/online.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from ansible.errors import AnsibleError
from ansible.module_utils.urls import open_url
from ansible.plugins.inventory import BaseInventoryPlugin
from ansible.module_utils.common.text.converters import to_native, to_text
from ansible.module_utils.common.text.converters import to_text
from ansible.module_utils.ansible_release import __version__ as ansible_version
from ansible.module_utils.six.moves.urllib.parse import urljoin

Expand Down
5 changes: 5 additions & 0 deletions plugins/inventory/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ def _get_auth(self):
credentials = urlencode({'username': self.proxmox_user, 'password': self.proxmox_password, })

a = self._get_session()

if a.verify is False:
from requests.packages.urllib3 import disable_warnings
disable_warnings()

ret = a.post('%s/api2/json/access/ticket' % self.proxmox_url, data=credentials)

json = ret.json()
Expand Down
32 changes: 25 additions & 7 deletions plugins/lookup/bitwarden.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
default: name
version_added: 5.7.0
field:
description: Field to fetch; leave unset to fetch whole response.
description: Field to fetch. Leave unset to fetch whole response.
type: str
collection_id:
description: Collection ID to filter results by collection. Leave unset to skip filtering.
type: str
version_added: 6.3.0
"""

EXAMPLES = """
Expand All @@ -43,6 +47,11 @@
msg: >-
{{ lookup('community.general.bitwarden', 'bafba515-af11-47e6-abe3-af1200cd18b2', search='id', field='password') }}
- name: "Get 'password' from Bitwarden record named 'a_test' from collection"
ansible.builtin.debug:
msg: >-
{{ lookup('community.general.bitwarden', 'a_test', field='password', collection_id='bafba515-af11-47e6-abe3-af1200cd18b2') }}
- name: "Get full Bitwarden record named 'a_test'"
ansible.builtin.debug:
msg: >-
Expand Down Expand Up @@ -96,23 +105,31 @@ def _run(self, args, stdin=None, expected_rc=0):
raise BitwardenException(err)
return to_text(out, errors='surrogate_or_strict'), to_text(err, errors='surrogate_or_strict')

def _get_matches(self, search_value, search_field):
def _get_matches(self, search_value, search_field, collection_id):
"""Return matching records whose search_field is equal to key.
"""
out, err = self._run(['list', 'items', '--search', search_value])

# Prepare set of params for Bitwarden CLI
params = ['list', 'items', '--search', search_value]

if collection_id:
params.extend(['--collectionid', collection_id])

out, err = self._run(params)

# This includes things that matched in different fields.
initial_matches = AnsibleJSONDecoder().raw_decode(out)[0]

# Filter to only include results from the right field.
return [item for item in initial_matches if item[search_field] == search_value]

def get_field(self, field, search_value, search_field="name"):
"""Return a list of the specified field for records whose search_field match search_value.
def get_field(self, field, search_value, search_field="name", collection_id=None):
"""Return a list of the specified field for records whose search_field match search_value
and filtered by collection if collection has been provided.
If field is None, return the whole record for each match.
"""
matches = self._get_matches(search_value, search_field)
matches = self._get_matches(search_value, search_field, collection_id)

if field in ['autofillOnPageLoad', 'password', 'passwordRevisionDate', 'totp', 'uris', 'username']:
return [match['login'][field] for match in matches]
Expand All @@ -135,10 +152,11 @@ def run(self, terms, variables=None, **kwargs):
self.set_options(var_options=variables, direct=kwargs)
field = self.get_option('field')
search_field = self.get_option('search')
collection_id = self.get_option('collection_id')
if not _bitwarden.unlocked:
raise AnsibleError("Bitwarden Vault locked. Run 'bw unlock'.")

return [_bitwarden.get_field(field, term, search_field) for term in terms]
return [_bitwarden.get_field(field, term, search_field, collection_id) for term in terms]


_bitwarden = Bitwarden()
1 change: 0 additions & 1 deletion plugins/lookup/consul_kv.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
type: dict
"""

import os
from ansible.module_utils.six.moves.urllib.parse import urlparse
from ansible.errors import AnsibleError, AnsibleAssertionError
from ansible.plugins.lookup import LookupBase
Expand Down
2 changes: 0 additions & 2 deletions plugins/lookup/credstash.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@
type: str
"""

import os

from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase

Expand Down
1 change: 0 additions & 1 deletion plugins/lookup/cyberarkpassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@

from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
from ansible.parsing.splitter import parse_kv
from ansible.module_utils.common.text.converters import to_bytes, to_text, to_native
from ansible.utils.display import Display

Expand Down
Loading

0 comments on commit e6b138b

Please sign in to comment.