First batch _facts -> _info rename. (#56822)
This commit is contained in:
parent
4f8abde081
commit
7a0af34ba9
19 changed files with 91 additions and 65 deletions
5
changelogs/fragments/56822-facts-info-rename.yaml
Normal file
5
changelogs/fragments/56822-facts-info-rename.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
minor_changes:
|
||||
- The ``python_requirements_facts`` module has been renamed to ``python_requirements_info``.
|
||||
- The ``zabbix_group_facts`` module has been renamed to ``zabbix_group_info``.
|
||||
- The ``zabbix_host_facts`` module has been renamed to ``zabbix_host_info``.
|
||||
- The ``k8s_facts`` module has been renamed to ``k8s_info``.
|
|
@ -69,6 +69,11 @@ Noteworthy module changes
|
|||
* `vmware_dvswitch <vmware_dvswitch_module>` accepts `folder` parameter to place dvswitch in user defined folder. This option makes `datacenter` as an optional parameter.
|
||||
* `vmware_datastore_cluster <vmware_datastore_cluster_module>` accepts `folder` parameter to place datastore cluster in user defined folder. This option makes `datacenter` as an optional parameter.
|
||||
|
||||
* The ``python_requirements_facts`` module was renamed to :ref:`python_requirements_info <python_requirements_info_module>`.
|
||||
* The ``zabbix_group_facts`` module was renamed to :ref:`zabbix_group_info <zabbix_group_info_module>`.
|
||||
* The ``zabbix_host_facts`` module was renamed to :ref:`zabbix_host_info <zabbix_host_info_module>`.
|
||||
* The ``k8s_facts`` module was renamed to :ref:`k8s_info <k8s_info_module>`.
|
||||
|
||||
|
||||
Plugins
|
||||
=======
|
||||
|
|
1
lib/ansible/modules/clustering/k8s/_k8s_facts.py
Symbolic link
1
lib/ansible/modules/clustering/k8s/_k8s_facts.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
k8s_info.py
|
|
@ -30,7 +30,7 @@ description:
|
|||
- Pass the object definition from a source file or inline. See examples for reading
|
||||
files and using Jinja templates or vault-encrypted files.
|
||||
- Access to the full range of K8s APIs.
|
||||
- Use the M(k8s_facts) module to obtain a list of items about an object of type C(kind)
|
||||
- Use the M(k8s_info) module to obtain a list of items about an object of type C(kind)
|
||||
- Authenticate using either a config file, certificates, password or token.
|
||||
- Supports check mode.
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ EXAMPLES = '''
|
|||
# Previous task provides the token/api_key, while all other parameters
|
||||
# are taken from module_defaults
|
||||
- name: Get a list of all pods from any namespace
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_key: "{{ k8s_auth_results.k8s_auth.api_key }}"
|
||||
kind: Pod
|
||||
register: pod_list
|
||||
|
|
|
@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
'supported_by': 'community'}
|
||||
|
||||
DOCUMENTATION = '''
|
||||
module: k8s_facts
|
||||
module: k8s_info
|
||||
|
||||
short_description: Describe Kubernetes (K8s) objects
|
||||
|
||||
|
@ -28,6 +28,7 @@ description:
|
|||
- Access to the full range of K8s APIs.
|
||||
- Authenticate using either a config file, certificates, password or token.
|
||||
- Supports check mode.
|
||||
- This module was called C(k8s_facts) before Ansible 2.9. The usage did not change.
|
||||
|
||||
options:
|
||||
api_version:
|
||||
|
@ -67,7 +68,7 @@ requirements:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get an existing Service object
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Service
|
||||
name: web
|
||||
|
@ -75,26 +76,26 @@ EXAMPLES = '''
|
|||
register: web_service
|
||||
|
||||
- name: Get a list of all service objects
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Service
|
||||
namespace: testing
|
||||
register: service_list
|
||||
|
||||
- name: Get a list of all pods from any namespace
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
kind: Pod
|
||||
register: pod_list
|
||||
|
||||
- name: Search for all Pods labelled app=web
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
kind: Pod
|
||||
label_selectors:
|
||||
- app = web
|
||||
- tier in (dev, test)
|
||||
|
||||
- name: Search for all running pods
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
kind: Pod
|
||||
field_selectors:
|
||||
- status.phase=Running
|
||||
|
@ -134,12 +135,14 @@ from ansible.module_utils.k8s.common import KubernetesAnsibleModule, AUTH_ARG_SP
|
|||
import copy
|
||||
|
||||
|
||||
class KubernetesFactsModule(KubernetesAnsibleModule):
|
||||
class KubernetesInfoModule(KubernetesAnsibleModule):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
KubernetesAnsibleModule.__init__(self, *args,
|
||||
supports_check_mode=True,
|
||||
**kwargs)
|
||||
if self._name == 'k8s_facts':
|
||||
self.deprecate("The 'k8s_facts' module has been renamed to 'k8s_info'", version='2.13')
|
||||
|
||||
def execute_module(self):
|
||||
self.client = self.get_api_client()
|
||||
|
@ -169,7 +172,7 @@ class KubernetesFactsModule(KubernetesAnsibleModule):
|
|||
|
||||
|
||||
def main():
|
||||
KubernetesFactsModule().execute_module()
|
||||
KubernetesInfoModule().execute_module()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
1
lib/ansible/modules/monitoring/zabbix/_zabbix_group_facts.py
Symbolic link
1
lib/ansible/modules/monitoring/zabbix/_zabbix_group_facts.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
zabbix_group_info.py
|
1
lib/ansible/modules/monitoring/zabbix/_zabbix_host_facts.py
Symbolic link
1
lib/ansible/modules/monitoring/zabbix/_zabbix_host_facts.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
zabbix_host_info.py
|
|
@ -23,10 +23,11 @@ host_groups:
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: zabbix_group_facts
|
||||
short_description: Gather facts about Zabbix hostgroup
|
||||
module: zabbix_group_info
|
||||
short_description: Gather information about Zabbix hostgroup
|
||||
description:
|
||||
- This module allows you to search for Zabbix hostgroup entries.
|
||||
- This module was called C(zabbix_group_facts) before Ansible 2.9. The usage did not change.
|
||||
version_added: "2.6"
|
||||
author:
|
||||
- "Michael Miko (@RedWhiteMiko)"
|
||||
|
@ -46,7 +47,7 @@ extends_documentation_fragment:
|
|||
EXAMPLES = '''
|
||||
- name: Get hostgroup info
|
||||
local_action:
|
||||
module: zabbix_group_facts
|
||||
module: zabbix_group_info
|
||||
server_url: http://monitor.example.com
|
||||
login_user: username
|
||||
login_password: password
|
||||
|
@ -102,6 +103,8 @@ def main():
|
|||
),
|
||||
supports_check_mode=True
|
||||
)
|
||||
if module._name == 'zabbix_group_facts':
|
||||
module.deprecate("The 'zabbix_group_facts' module has been renamed to 'zabbix_group_info'", version='2.13')
|
||||
|
||||
if not HAS_ZABBIX_API:
|
||||
module.fail_json(msg="Missing required zabbix-api module (check docs or install with: pip install zabbix-api)")
|
|
@ -24,10 +24,11 @@ hosts:
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: zabbix_host_facts
|
||||
short_description: Gather facts about Zabbix host
|
||||
module: zabbix_host_info
|
||||
short_description: Gather information about Zabbix host
|
||||
description:
|
||||
- This module allows you to search for Zabbix host entries.
|
||||
- This module was called C(zabbix_host_facts) before Ansible 2.9. The usage did not change.
|
||||
version_added: "2.7"
|
||||
author:
|
||||
- "Michael Miko (@RedWhiteMiko)"
|
||||
|
@ -68,7 +69,7 @@ extends_documentation_fragment:
|
|||
EXAMPLES = '''
|
||||
- name: Get host info
|
||||
local_action:
|
||||
module: zabbix_host_facts
|
||||
module: zabbix_host_info
|
||||
server_url: http://monitor.example.com
|
||||
login_user: username
|
||||
login_password: password
|
||||
|
@ -80,7 +81,7 @@ EXAMPLES = '''
|
|||
|
||||
- name: Reduce host inventory information to provided keys
|
||||
local_action:
|
||||
module: zabbix_host_facts
|
||||
module: zabbix_host_info
|
||||
server_url: http://monitor.example.com
|
||||
login_user: username
|
||||
login_password: password
|
||||
|
@ -185,6 +186,8 @@ def main():
|
|||
),
|
||||
supports_check_mode=True
|
||||
)
|
||||
if module._name == 'zabbix_host_facts':
|
||||
module.deprecate("The 'zabbix_host_facts' module has been renamed to 'zabbix_host_info'", version='2.13')
|
||||
|
||||
if not HAS_ZABBIX_API:
|
||||
module.fail_json(msg="Missing required zabbix-api module (check docs or install with: pip install zabbix-api)")
|
1
lib/ansible/modules/system/_python_requirements_facts.py
Symbolic link
1
lib/ansible/modules/system/_python_requirements_facts.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
python_requirements_info.py
|
|
@ -12,10 +12,11 @@ ANSIBLE_METADATA = {
|
|||
}
|
||||
|
||||
DOCUMENTATION = '''
|
||||
module: python_requirements_facts
|
||||
module: python_requirements_info
|
||||
short_description: Show python path and assert dependency versions
|
||||
description:
|
||||
- Get info about available Python requirements on the target host, including listing required libraries and gathering versions.
|
||||
- This module was called C(python_requirements_facts) before Ansible 2.9. The usage did not change.
|
||||
version_added: "2.7"
|
||||
options:
|
||||
dependencies:
|
||||
|
@ -31,9 +32,9 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: show python lib/site paths
|
||||
python_requirements_facts:
|
||||
python_requirements_info:
|
||||
- name: check for modern boto3 and botocore versions
|
||||
python_requirements_facts:
|
||||
python_requirements_info:
|
||||
dependencies:
|
||||
- boto3>1.6
|
||||
- botocore<2
|
||||
|
@ -116,6 +117,8 @@ def main():
|
|||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
if module._name == 'python_requirements_facts':
|
||||
module.deprecate("The 'python_requirements_facts' module has been renamed to 'python_requirements_info'", version='2.13')
|
||||
if not HAS_DISTUTILS:
|
||||
module.fail_json(
|
||||
msg='Could not import "distutils" and "pkg_resources" libraries to introspect python environment.',
|
|
@ -17,18 +17,18 @@
|
|||
debug:
|
||||
var: output
|
||||
|
||||
- name: k8s_facts works with empty resources
|
||||
k8s_facts:
|
||||
- name: k8s_info works with empty resources
|
||||
k8s_info:
|
||||
kind: Deployment
|
||||
namespace: testing
|
||||
api_version: extensions/v1beta1
|
||||
register: k8s_facts
|
||||
register: k8s_info
|
||||
|
||||
- name: assert that k8s_facts is in correct format
|
||||
- name: assert that k8s_info is in correct format
|
||||
assert:
|
||||
that:
|
||||
- "'resources' in k8s_facts"
|
||||
- not k8s_facts.resources
|
||||
- "'resources' in k8s_info"
|
||||
- not k8s_info.resources
|
||||
|
||||
- name: Create a service
|
||||
k8s:
|
||||
|
@ -162,12 +162,12 @@
|
|||
name: testing1
|
||||
|
||||
- name: Namespace should exist
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
kind: Namespace
|
||||
api_version: v1
|
||||
name: testing1
|
||||
register: k8s_facts_testing1
|
||||
failed_when: not k8s_facts_testing1.resources or k8s_facts_testing1.resources[0].status.phase != "Active"
|
||||
register: k8s_info_testing1
|
||||
failed_when: not k8s_info_testing1.resources or k8s_info_testing1.resources[0].status.phase != "Active"
|
||||
|
||||
- name: Create resources from a multidocument yaml string
|
||||
k8s:
|
||||
|
@ -184,7 +184,7 @@
|
|||
name: testing3
|
||||
|
||||
- name: Lookup namespaces
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
name: "{{ item }}"
|
||||
|
@ -214,7 +214,7 @@
|
|||
name: testing3
|
||||
|
||||
- name: Lookup namespaces
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
name: "{{ item }}"
|
||||
|
@ -242,7 +242,7 @@
|
|||
name: testing5
|
||||
|
||||
- name: Lookup namespaces
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
name: "{{ item }}"
|
||||
|
@ -269,20 +269,20 @@
|
|||
metadata:
|
||||
name: testing5
|
||||
|
||||
- k8s_facts:
|
||||
- k8s_info:
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
name: "{{ item }}"
|
||||
loop:
|
||||
- testing4
|
||||
- testing5
|
||||
register: k8s_facts
|
||||
register: k8s_info
|
||||
|
||||
|
||||
- name: Resources are terminating if still in results
|
||||
assert:
|
||||
that: not item.resources or item.resources[0].status.phase == "Terminating"
|
||||
loop: "{{ k8s_facts.results }}"
|
||||
loop: "{{ k8s_info.results }}"
|
||||
|
||||
- include_tasks: crd.yml
|
||||
- include_tasks: lists.yml
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
items: '{{ configmaps }}'
|
||||
|
||||
- name: Get ConfigMaps
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: ConfigMap
|
||||
namespace: testing1
|
||||
|
@ -39,7 +39,7 @@
|
|||
items: '{{ configmaps }}'
|
||||
|
||||
- name: Get ConfigMaps
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: ConfigMap
|
||||
namespace: testing1
|
||||
|
@ -82,7 +82,7 @@
|
|||
items: '{{ resources }}'
|
||||
|
||||
- name: Get the created resources
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: '{{ item.apiVersion }}'
|
||||
kind: '{{ item.kind }}'
|
||||
namespace: testing1
|
||||
|
@ -105,7 +105,7 @@
|
|||
items: '{{ resources }}'
|
||||
|
||||
- name: Get the resources
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: '{{ item.apiVersion }}'
|
||||
kind: '{{ item.kind }}'
|
||||
namespace: testing1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- python_requirements_facts:
|
||||
- python_requirements_info:
|
||||
dependencies:
|
||||
- openshift==0.6.0
|
||||
- kubernetes==6.0.0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: ensure that there are actually some nodes
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
kind: Node
|
||||
register: nodes
|
||||
|
||||
|
@ -113,7 +113,7 @@
|
|||
register: ds
|
||||
|
||||
- name: get updated pods
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Pod
|
||||
namespace: "{{ wait_namespace }}"
|
||||
|
@ -228,7 +228,7 @@
|
|||
register: update_deploy
|
||||
|
||||
- name: get updated pods
|
||||
k8s_facts:
|
||||
k8s_info:
|
||||
api_version: v1
|
||||
kind: Pod
|
||||
namespace: "{{ wait_namespace }}"
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
- name: run python_requirements_facts module
|
||||
python_requirements_facts:
|
||||
register: basic_facts
|
||||
|
||||
- name: ensure python_requirements_facts returns desired info
|
||||
assert:
|
||||
that:
|
||||
- "'python' in basic_facts"
|
||||
- "'python_version' in basic_facts"
|
||||
|
||||
- name: run python_requirements_facts module
|
||||
python_requirements_facts:
|
||||
dependencies:
|
||||
- notreal<1
|
||||
- ansible>2
|
||||
register: dep_facts
|
||||
|
||||
- name: ensure python_requirements_facts returns desired info
|
||||
assert:
|
||||
that:
|
||||
- "'installed' in dep_facts.valid.ansible"
|
||||
- "'notreal' in dep_facts.not_found"
|
|
@ -0,0 +1,22 @@
|
|||
- name: run python_requirements_info module
|
||||
python_requirements_info:
|
||||
register: basic_info
|
||||
|
||||
- name: ensure python_requirements_info returns desired info
|
||||
assert:
|
||||
that:
|
||||
- "'python' in basic_info"
|
||||
- "'python_version' in basic_info"
|
||||
|
||||
- name: run python_requirements_info module
|
||||
python_requirements_info:
|
||||
dependencies:
|
||||
- notreal<1
|
||||
- ansible>2
|
||||
register: dep_info
|
||||
|
||||
- name: ensure python_requirements_info returns desired info
|
||||
assert:
|
||||
that:
|
||||
- "'installed' in dep_info.valid.ansible"
|
||||
- "'notreal' in dep_info.not_found"
|
Loading…
Reference in a new issue