diff --git a/plugins/doc_fragments/k8s_name_options.py b/plugins/doc_fragments/k8s_name_options.py index 088a5637..58840d55 100644 --- a/plugins/doc_fragments/k8s_name_options.py +++ b/plugins/doc_fragments/k8s_name_options.py @@ -42,7 +42,7 @@ class ModuleDocFragment(object): description: - Use to specify an object namespace. Useful when creating, deleting, or discovering an object without providing a full resource definition. Use in conjunction with I(api_version), I(kind), and I(name) - to identify a specfic object. If I(resource definition) is provided, the I(metadata.namespace) value + to identify a specific object. If I(resource definition) is provided, the I(metadata.namespace) value from the I(resource_definition) will override this option. type: str ''' diff --git a/plugins/modules/helm.py b/plugins/modules/helm.py index 379f5141..5872735d 100644 --- a/plugins/modules/helm.py +++ b/plugins/modules/helm.py @@ -7,7 +7,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: helm @@ -120,9 +120,9 @@ type: str ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create helm namespace as HELM 3 doesn't create it automatically - k8s: + community.kubernetes.k8s: api_version: v1 kind: Namespace name: "monitoring" @@ -130,12 +130,12 @@ # From repository - name: Add stable chart repo - helm_repository: + community.kubernetes.helm_repository: name: stable repo_url: "https://kubernetes-charts.storage.googleapis.com" - name: Deploy latest version of Grafana chart inside monitoring namespace with values - helm: + community.kubernetes.helm: name: test chart_ref: stable/grafana release_namespace: monitoring @@ -143,39 +143,39 @@ replicas: 2 - name: Deploy Grafana chart on 5.0.12 with values loaded from template - helm: + community.kubernetes.helm: name: test chart_ref: stable/grafana chart_version: 5.0.12 values: "{{ lookup('template', 'somefile.yaml') | from_yaml }}" - name: Remove test release and waiting suppression ending - helm: + community.kubernetes.helm: name: test state: absent wait: true # From git - name: Git clone stable repo on HEAD - git: + ansible.builtin.git: repo: "http://github.com/helm/charts.git" dest: /tmp/helm_repo - name: Deploy Grafana chart from local path - helm: + community.kubernetes.helm: name: test chart_ref: /tmp/helm_repo/stable/grafana release_namespace: monitoring # From url - name: Deploy Grafana chart on 5.0.12 from url - helm: + community.kubernetes.helm: name: test chart_ref: "https://kubernetes-charts.storage.googleapis.com/grafana-5.0.12.tgz" release_namespace: monitoring ''' -RETURN = """ +RETURN = r""" status: type: complex description: A dictionary of status output diff --git a/plugins/modules/helm_info.py b/plugins/modules/helm_info.py index cccbf250..a38271c8 100644 --- a/plugins/modules/helm_info.py +++ b/plugins/modules/helm_info.py @@ -7,11 +7,11 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: helm_info -short_description: Get informations from Helm package deployed inside the cluster +short_description: Get information from Helm package deployed inside the cluster version_added: "0.11.0" @@ -23,7 +23,7 @@ - "yaml (https://pypi.org/project/PyYAML/)" description: - - Get informations (values, states, ...) from Helm package deployed inside the cluster + - Get information (values, states, ...) from Helm package deployed inside the cluster options: binary_path: @@ -56,14 +56,14 @@ aliases: [ kubeconfig ] ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Deploy latest version of Grafana chart inside monitoring namespace - helm_info: + community.kubernetes.helm_info: name: test release_namespace: monitoring ''' -RETURN = """ +RETURN = r""" status: type: complex description: A dictionary of status output diff --git a/plugins/modules/helm_repository.py b/plugins/modules/helm_repository.py index e097b133..fd8a80c1 100644 --- a/plugins/modules/helm_repository.py +++ b/plugins/modules/helm_repository.py @@ -7,7 +7,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: helm_repository @@ -59,21 +59,21 @@ repo_state: choices: ['present', 'absent'] description: - - Desirated state of repositoriy. + - Desirated state of repository. required: false default: present aliases: [ state ] type: str ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Add default repository - helm_repository: + community.kubernetes.helm_repository: name: stable repo_url: https://kubernetes-charts.storage.googleapis.com ''' -RETURN = ''' # ''' +RETURN = r''' # ''' import traceback diff --git a/plugins/modules/k8s.py b/plugins/modules/k8s.py index b7581f4d..a02d3a8f 100644 --- a/plugins/modules/k8s.py +++ b/plugins/modules/k8s.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: k8s @@ -147,16 +147,16 @@ - "PyYAML >= 3.11" ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create a k8s namespace - k8s: + community.kubernetes.k8s: name: testing api_version: v1 kind: Namespace state: present - name: Create a Service object from an inline definition - k8s: + community.kubernetes.k8s: state: present definition: apiVersion: v1 @@ -178,7 +178,7 @@ port: 8000 - name: Remove an existing Service object - k8s: + community.kubernetes.k8s: state: absent api_version: v1 kind: Service @@ -188,31 +188,31 @@ # Passing the object definition from a file - name: Create a Deployment by reading the definition from a local file - k8s: + community.kubernetes.k8s: state: present src: /testing/deployment.yml - name: >- Read definition file from the Ansible controller file system. If the definition file has been encrypted with Ansible Vault it will automatically be decrypted. - k8s: + community.kubernetes.k8s: state: present definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}" - name: Read definition file from the Ansible controller file system after Jinja templating - k8s: + community.kubernetes.k8s: state: present definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}" - name: fail on validation errors - k8s: + community.kubernetes.k8s: state: present definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}" validate: fail_on_error: yes - name: warn on validation errors, check for unexpected properties - k8s: + community.kubernetes.k8s: state: present definition: "{{ lookup('template', '/testing/deployment.yml') | from_yaml }}" validate: @@ -220,7 +220,7 @@ strict: yes ''' -RETURN = ''' +RETURN = r''' result: description: - The created, patched, or otherwise present object. Will be empty in the case of a deletion. diff --git a/plugins/modules/k8s_auth.py b/plugins/modules/k8s_auth.py index a02a5257..d225132c 100644 --- a/plugins/modules/k8s_auth.py +++ b/plugins/modules/k8s_auth.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: k8s_auth @@ -75,7 +75,7 @@ - requests-oauthlib ''' -EXAMPLES = ''' +EXAMPLES = r''' - hosts: localhost module_defaults: group/k8s: @@ -88,7 +88,7 @@ - include_vars: k8s_passwords.yml - name: Log in (obtain access token) - k8s_auth: + community.kubernetes.k8s_auth: username: admin password: "{{ k8s_admin_password }}" register: k8s_auth_results @@ -96,7 +96,7 @@ # 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_info: + community.kubernetes.k8s_info: api_key: "{{ k8s_auth_results.k8s_auth.api_key }}" kind: Pod register: pod_list @@ -104,7 +104,7 @@ always: - name: If login succeeded, try to log out (revoke access token) when: k8s_auth_results.k8s_auth.api_key is defined - k8s_auth: + community.kubernetes.k8s_auth: state: absent api_key: "{{ k8s_auth_results.k8s_auth.api_key }}" ''' @@ -112,7 +112,7 @@ # Returned value names need to match k8s modules parameter names, to make it # easy to pass returned values of k8s_auth to other k8s modules. # Discussion: https://github.com/ansible/ansible/pull/50807#discussion_r248827899 -RETURN = ''' +RETURN = r''' k8s_auth: description: Kubernetes authentication facts. returned: success diff --git a/plugins/modules/k8s_exec.py b/plugins/modules/k8s_exec.py index fe710e9c..8c7b29d6 100644 --- a/plugins/modules/k8s_exec.py +++ b/plugins/modules/k8s_exec.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: k8s_exec @@ -58,15 +58,15 @@ required: yes ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Execute a command - k8s_exec: + community.kubernetes.k8s_exec: namespace: myproject pod: zuul-scheduler command: zuul-scheduler full-reconfigure ''' -RETURN = ''' +RETURN = r''' result: description: - The command object diff --git a/plugins/modules/k8s_info.py b/plugins/modules/k8s_info.py index af394d49..a4b2715b 100644 --- a/plugins/modules/k8s_info.py +++ b/plugins/modules/k8s_info.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: k8s_info short_description: Describe Kubernetes (K8s) objects @@ -68,7 +68,7 @@ - "PyYAML >= 3.11" ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Get an existing Service object k8s_info: api_version: v1 @@ -103,7 +103,7 @@ - status.phase=Running ''' -RETURN = ''' +RETURN = r''' resources: description: - The object(s) that exists diff --git a/plugins/modules/k8s_log.py b/plugins/modules/k8s_log.py index 6f8d5b46..bdf2037a 100644 --- a/plugins/modules/k8s_log.py +++ b/plugins/modules/k8s_log.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: k8s_log short_description: Fetch logs from Kubernetes resources @@ -48,7 +48,7 @@ namespace: description: - Use to specify an object namespace. Use in conjunction with I(api_version), I(kind), and I(name) - to identify a specfic object. + to identify a specific object. type: str name: description: @@ -76,16 +76,16 @@ - "PyYAML >= 3.11" ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Get a log from a Pod - k8s_log: + community.kubernetes.k8s_log: name: example-1 namespace: testing register: log # This will get the log from the first Pod found matching the selector - name: Log a Pod matching a label selector - k8s_log: + community.kubernetes.k8s_log: namespace: testing label_selectors: - app=example @@ -93,7 +93,7 @@ # This will get the log from a single Pod managed by this Deployment - name: Get a log from a Deployment - k8s_log: + community.kubernetes.k8s_log: api_version: apps/v1 kind: Deployment namespace: testing @@ -102,7 +102,7 @@ # This will get the log from a single Pod managed by this DeploymentConfig - name: Get a log from a DeploymentConfig - k8s_log: + community.kubernetes.k8s_log: api_version: apps.openshift.io/v1 kind: DeploymentConfig namespace: testing @@ -110,7 +110,7 @@ register: log ''' -RETURN = ''' +RETURN = r''' log: type: str description: diff --git a/plugins/modules/k8s_scale.py b/plugins/modules/k8s_scale.py index cf3a0c39..9e63366a 100644 --- a/plugins/modules/k8s_scale.py +++ b/plugins/modules/k8s_scale.py @@ -10,7 +10,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: k8s_scale @@ -36,9 +36,9 @@ - "PyYAML >= 3.11" ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Scale deployment up, and extend timeout - k8s_scale: + community.kubernetes.k8s_scale: api_version: v1 kind: Deployment name: elastic @@ -47,7 +47,7 @@ wait_timeout: 60 - name: Scale deployment down when current replicas match - k8s_scale: + community.kubernetes.k8s_scale: api_version: v1 kind: Deployment name: elastic @@ -56,7 +56,7 @@ replicas: 2 - name: Increase job parallelism - k8s_scale: + community.kubernetes.k8s_scale: api_version: batch/v1 kind: job name: pi-with-timeout @@ -66,25 +66,25 @@ # Match object using local file or inline definition - name: Scale deployment based on a file from the local filesystem - k8s_scale: + community.kubernetes.k8s_scale: src: /myproject/elastic_deployment.yml replicas: 3 wait: no - name: Scale deployment based on a template output - k8s_scale: + community.kubernetes.k8s_scale: resource_definition: "{{ lookup('template', '/myproject/elastic_deployment.yml') | from_yaml }}" replicas: 3 wait: no - name: Scale deployment based on a file from the Ansible controller filesystem - k8s_scale: + community.kubernetes.k8s_scale: resource_definition: "{{ lookup('file', '/myproject/elastic_deployment.yml') | from_yaml }}" replicas: 3 wait: no ''' -RETURN = ''' +RETURN = r''' result: description: - If a change was made, will return the patched object, otherwise returns the existing object. diff --git a/plugins/modules/k8s_service.py b/plugins/modules/k8s_service.py index 1366caef..dcfd714b 100644 --- a/plugins/modules/k8s_service.py +++ b/plugins/modules/k8s_service.py @@ -9,7 +9,7 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: k8s_service @@ -121,9 +121,9 @@ - openshift >= 0.6.2 ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Expose https port with ClusterIP - k8s_service: + community.kubernetes.k8s_service: state: present name: test-https namespace: default @@ -134,7 +134,7 @@ key: special - name: Expose https port with ClusterIP using spec - k8s_service: + community.kubernetes.k8s_service: state: present name: test-https namespace: default @@ -147,7 +147,7 @@ key: special ''' -RETURN = ''' +RETURN = r''' result: description: - The created, patched, or otherwise present Service object. Will be empty in the case of a deletion.