├── .gitignore ├── .tito ├── packages │ ├── ansible-kubernetes-modules │ └── .readme ├── tito.props └── releasers.conf ├── tests ├── inventory ├── ansible.cfg ├── test.yml └── roles │ ├── hello-templates │ ├── files │ │ └── deployment.yml │ └── tasks │ │ └── main.yml │ └── hello-world │ └── tasks │ └── main.yml ├── defaults └── main.yml ├── requirements.txt ├── tasks └── main.yml ├── module_utils ├── README.md └── openshift_common.py ├── .travis.yml ├── meta └── main.yml ├── ansible-kubernetes-modules.spec ├── README.md └── library ├── openshift_v1_self_subject_rules_review.py ├── openshift_v1_subject_rules_review.py ├── openshift_v1_applied_cluster_resource_quota_list.py ├── k8s_v1_scale.py ├── k8s_v1beta2_scale.py ├── k8s_apps_v1beta1_scale.py ├── k8s_extensions_v1beta1_scale.py ├── k8s_v1_token_review.py ├── k8s_v1beta1_token_review.py ├── k8s_v1_self_subject_rules_review.py ├── k8s_v1beta1_self_subject_rules_review.py ├── k8s_v1_component_status_list.py ├── k8s_v1alpha1_pod_preset_list.py ├── k8s_v1_component_status.py ├── k8s_v1_limit_range_list.py ├── openshift_v1_group_list.py ├── k8s_v1_pod_template_list.py ├── k8s_v1_network_policy_list.py ├── k8s_v1beta1_network_policy_list.py ├── k8s_v1beta1_pod_security_policy_list.py ├── k8s_v1_job_list.py ├── k8s_v1beta1_api_service_list.py ├── k8s_v1_config_map_list.py ├── openshift_v1_role_binding_restriction_list.py ├── k8s_v1_node_list.py ├── openshift_v1_egress_network_policy_list.py ├── openshift_v1_route_list.py ├── openshift_v1_broker_template_instance_list.py ├── openshift_v1_build_list.py ├── k8s_v1beta1_pod_disruption_budget_list.py ├── k8s_v1beta1_ingress_list.py ├── k8s_v1beta1_stateful_set_list.py ├── k8s_v1beta2_stateful_set_list.py ├── openshift_v1_stateful_set_list.py ├── k8s_v1beta1_certificate_signing_request_list.py └── openshift_v1_project_list.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.retry 2 | .idea 3 | *.log 4 | -------------------------------------------------------------------------------- /.tito/packages/ansible-kubernetes-modules: -------------------------------------------------------------------------------- 1 | 0.4.0-8 ./ 2 | -------------------------------------------------------------------------------- /tests/inventory: -------------------------------------------------------------------------------- 1 | localhost ansible_connection=local 2 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | install_python_requirements: no 3 | virtualenv: 4 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | https://github.com/openshift/openshift-restclient-python/archive/master.tar.gz#egg=openshift 2 | -------------------------------------------------------------------------------- /tests/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | command_warnings = False 3 | system_warnings = False 4 | deprecation_warnings = False 5 | -------------------------------------------------------------------------------- /.tito/tito.props: -------------------------------------------------------------------------------- 1 | [buildconfig] 2 | builder = tito.builder.Builder 3 | tagger = tito.tagger.ReleaseTagger 4 | changelog_do_not_remove_cherrypick = 0 5 | changelog_format = %s (%ae) 6 | -------------------------------------------------------------------------------- /.tito/packages/.readme: -------------------------------------------------------------------------------- 1 | the .tito/packages directory contains metadata files 2 | named after their packages. Each file has the latest tagged 3 | version and the project's relative directory. 4 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | # tasks/main.yml 2 | --- 3 | 4 | - name: Install latest openshift client 5 | pip: 6 | name: https://github.com/openshift/openshift-restclient-python/archive/master.tar.gz 7 | state: latest 8 | virtualenv: "{{ virtualenv }}" 9 | when: install_python_requirements 10 | 11 | -------------------------------------------------------------------------------- /tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Load the modules 3 | hosts: all 4 | gather_facts: no 5 | vars: 6 | os_kubeconfig: konfig.json 7 | os_host: localhost:8443 8 | os_verify_ssl: False 9 | roles: 10 | - role: ansible-kubernetes-modules 11 | - role: hello-world 12 | - role: hello-templates 13 | -------------------------------------------------------------------------------- /module_utils/README.md: -------------------------------------------------------------------------------- 1 | The `k8_common.py` and `openshift_common.py` modules are not currently available in an official release of Ansible. They are part of Ansible, as you'll find them in the `devel` branch. At some point they will make it into an official release. Until then, they're included here for convenience. 2 | 3 | If you have uncovered a problem, or would like to make a change, please open an issue and submit pull requess at the [Ansible repo](https://github.com/ansible/ansible). 4 | -------------------------------------------------------------------------------- /.tito/releasers.conf: -------------------------------------------------------------------------------- 1 | [asb-copr] 2 | releaser = tito.release.CoprReleaser 3 | project_name = @ansible-service-broker/ansible-service-broker-latest 4 | upload_command = scp -4 %(srpm)s $fas_username@fedorapeople.org:/srv/repos/asb 5 | remote_location = http://repos.fedorapeople.org/asb/ 6 | copr_options = --timeout 600 7 | 8 | [asb-copr-test] 9 | releaser = tito.release.CoprReleaser 10 | project_name = @ansible-service-broker/ansible-service-broker-nightly 11 | upload_command = scp -4 %(srpm)s $fas_username@fedorapeople.org:/srv/repos/asb 12 | remote_location = http://repos.fedorapeople.org/asb/ 13 | copr_options = --timeout 600 14 | builder.test = 1 15 | 16 | [asb-brew-36] 17 | releaser = tito.release.DistGitReleaser 18 | branches = rhaos-3.6-asb-rhel-7 19 | 20 | [asb-brew-37] 21 | releaser = tito.release.DistGitReleaser 22 | branches = rhaos-3.7-asb-rhel-7 23 | 24 | [asb-brew-38] 25 | releaser = tito.release.DistGitReleaser 26 | branches = rhaos-3.8-asb-rhel-7 27 | 28 | [asb-brew-39] 29 | releaser = tito.release.DistGitReleaser 30 | branches = rhaos-3.9-asb-rhel-7 31 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: python 3 | python: "2.7" 4 | 5 | # Use the new container infrastructure 6 | sudo: false 7 | 8 | # Install ansible 9 | addons: 10 | apt: 11 | packages: 12 | - python-pip 13 | 14 | install: 15 | # Install prereqs 16 | - pip install https://github.com/ansible/ansible/archive/devel.tar.gz 17 | - pip install openshift 18 | - pip list | grep openshift 19 | 20 | # Start OpenShift 21 | - docker run --publish 8443:8443 -d --name openshift openshift/origin:v3.7.1 start master --listen https://0.0.0.0:8443 22 | - sleep 15 23 | 24 | # Fetch a copy of the kube config file 25 | - docker exec -it openshift cat /var/lib/origin/openshift.local.config/master/admin.kubeconfig >tests/konfig.json 26 | 27 | - printf '[defaults]\nroles_path=../' >ansible.cfg 28 | - echo "localhost ansible_connection=local ansible_python_interpreter=$(which python)">tests/inventory 29 | 30 | script: 31 | - ansible-playbook -i tests/inventory -vvv tests/test.yml 32 | 33 | notifications: 34 | webhooks: https://galaxy.ansible.com/api/v1/notifications/ 35 | -------------------------------------------------------------------------------- /tests/roles/hello-templates/files/deployment.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: DeploymentConfig 3 | metadata: 4 | name: hello-depoy 5 | namespace: hello 6 | labels: 7 | app: hello 8 | spec: 9 | strategy: 10 | type: Rolling 11 | rollingParams: 12 | updatePeriodSeconds: 1 13 | intervalSeconds: 1 14 | timeoutSeconds: 600 15 | maxUnavailable: 25% 16 | maxSurge: 25% 17 | resources: {} 18 | triggers: 19 | - type: ConfigChange 20 | replicas: 1 21 | test: false 22 | selector: 23 | app: hello 24 | template: 25 | metadata: 26 | name: hello-pod 27 | labels: 28 | app: hello 29 | spec: 30 | containers: 31 | - name: hello 32 | image: openshift/busybox-http-app 33 | ports: 34 | - name: web-8100-tcp 35 | containerPort: 8080 36 | protocol: TCP 37 | resources: {} 38 | terminationMessagePath: /dev/termination-log 39 | imagePullPolicy: Always 40 | restartPolicy: Always 41 | terminationGracePeriodSeconds: 30 42 | dnsPolicy: ClusterFirst 43 | securityContext: {} 44 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Ansible 3 | description: Pre-release Kubernetes modules 4 | company: Ansible by Red Hat 5 | 6 | # If the issue tracker for your role is not on github, uncomment the 7 | # next line and provide a value 8 | issue_tracker_url: https://github.com/openshift/openshift-restclient-python/issues 9 | 10 | # Some suggested licenses: 11 | # - BSD (default) 12 | # - MIT 13 | # - GPLv2 14 | # - GPLv3 15 | # - Apache 16 | # - CC-BY 17 | license: Apache V2 18 | 19 | min_ansible_version: 2.3 20 | 21 | # Optionally specify the branch Galaxy will use when accessing the GitHub 22 | # repo for this role. During role install, if no tags are available, 23 | # Galaxy will use this branch. During import Galaxy will access files on 24 | # this branch. If travis integration is cofigured, only notification for this 25 | # branch will be accepted. Otherwise, in all cases, the repo's default branch 26 | # (usually master) will be used. 27 | #github_branch: 28 | 29 | # 30 | # Below are all platforms currently available. Just uncomment 31 | # the ones that apply to your role. If you don't see your 32 | # platform on this list, let us know and we'll get it added! 33 | # 34 | platforms: 35 | - name: Fedora 36 | versions: 37 | - all 38 | - name: Ubuntu 39 | versions: 40 | - all 41 | - name: EL 42 | versions: 43 | - all 44 | 45 | galaxy_tags: 46 | - k8s 47 | - kubernetes 48 | - openshift 49 | - modules 50 | - api 51 | 52 | dependencies: [] 53 | -------------------------------------------------------------------------------- /tests/roles/hello-templates/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Create project 2 | openshift_v1_project: 3 | name: test-resource-defn 4 | display_name: Resource Defn 5 | description: Load resources 6 | debug: no 7 | kubeconfig: '{{ os_kubeconfig }}' 8 | host: '{{ os_host }}' 9 | verify_ssl: '{{ os_verify_ssl }}' 10 | register: create_project 11 | 12 | - debug: var=create_project 13 | 14 | # Create service from unaltered YAML copied from console 15 | - name: Create service from resource definition 16 | k8s_v1_service: 17 | state: present 18 | debug: yes 19 | resource_definition: 20 | apiVersion: v1 21 | kind: Service 22 | metadata: 23 | name: hello-service 24 | namespace: test-resource-defn 25 | selfLink: /api/v1/namespaces/hello/services/hello-service 26 | uid: fd228ddb-0f38-11e7-840c-a2a3304da08d 27 | resourceVersion: '42303' 28 | creationTimestamp: '2017-03-22T19:51:49Z' 29 | labels: 30 | app: hello 31 | spec: 32 | ports: 33 | - name: web-tcp 34 | protocol: TCP 35 | port: 8080 36 | targetPort: 8080 37 | selector: 38 | app: hello 39 | type: ClusterIP 40 | sessionAffinity: None 41 | status: 42 | loadBalancer: {} 43 | kubeconfig: '{{ os_kubeconfig }}' 44 | host: '{{ os_host }}' 45 | verify_ssl: '{{ os_verify_ssl }}' 46 | register: create_service 47 | 48 | - debug: var=create_service 49 | 50 | - name: Create deployment from resource file 51 | openshift_v1_deployment_config: 52 | state: present 53 | debug: yes 54 | src: "{{ role_path }}/files/deployment.yml" 55 | kubeconfig: '{{ os_kubeconfig }}' 56 | host: '{{ os_host }}' 57 | verify_ssl: '{{ os_verify_ssl }}' 58 | register: deployment_create 59 | 60 | - debug: var=deployment_create 61 | -------------------------------------------------------------------------------- /tests/roles/hello-world/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - name: Delete project 2 | openshift_v1_project: 3 | name: hello 4 | state: absent 5 | debug: yes 6 | kubeconfig: '{{ os_kubeconfig }}' 7 | host: '{{ os_host }}' 8 | verify_ssl: '{{ os_verify_ssl }}' 9 | register: delete_project 10 | 11 | - debug: var=delete_project 12 | 13 | - name: Create project 14 | openshift_v1_project: 15 | name: hello 16 | state: present 17 | display_name: Hello World 18 | description: Hello. 19 | debug: yes 20 | kubeconfig: '{{ os_kubeconfig }}' 21 | host: '{{ os_host }}' 22 | verify_ssl: '{{ os_verify_ssl }}' 23 | register: create_project 24 | 25 | - debug: var=create_project 26 | 27 | - name: Create service 28 | k8s_v1_service: 29 | name: hello-service 30 | namespace: hello 31 | state: present 32 | ports: 33 | - port: 8080 34 | target_port: 8080 35 | name: web-tcp 36 | selector: 37 | app: hello 38 | labels: 39 | app: hello 40 | debug: yes 41 | kubeconfig: '{{ os_kubeconfig }}' 42 | host: '{{ os_host }}' 43 | verify_ssl: '{{ os_verify_ssl }}' 44 | register: create_service 45 | 46 | - debug: var=create_service 47 | 48 | - name: Create deployment config 49 | openshift_v1_deployment_config: 50 | name: hello-deploy 51 | namespace: hello 52 | state: present 53 | debug: yes 54 | labels: 55 | app: hello 56 | spec_template_metadata_name: hello-pod 57 | spec_template_metadata_labels: 58 | app: hello 59 | containers: 60 | - name: hello 61 | image: openshift/busybox-http-app 62 | ports: 63 | - container_port: 8080 64 | protocol: TCP 65 | name: web-8080-tcp 66 | - container_port: 8100 67 | protocol: TCP 68 | name: web-8100-tcp 69 | replicas: 1 70 | selector: 71 | app: hello 72 | strategy_type: Rolling 73 | kubeconfig: '{{ os_kubeconfig }}' 74 | host: '{{ os_host }}' 75 | verify_ssl: '{{ os_verify_ssl }}' 76 | register: create_deployment 77 | 78 | - debug: var=create_deployment 79 | 80 | - name: Create route 81 | openshift_v1_route: 82 | name: hello-route 83 | namespace: hello 84 | state: present 85 | to_kind: Service 86 | to_name: hello-service 87 | to_weight: 100 88 | port_target_port: web-tcp 89 | tls_termination: edge 90 | kubeconfig: '{{ os_kubeconfig }}' 91 | host: '{{ os_host }}' 92 | verify_ssl: '{{ os_verify_ssl }}' 93 | register: create_route 94 | 95 | - debug: var=create_route 96 | 97 | -------------------------------------------------------------------------------- /ansible-kubernetes-modules.spec: -------------------------------------------------------------------------------- 1 | Name: ansible-kubernetes-modules 2 | Version: 0.4.0 3 | Release: 8%{?dist} 4 | Summary: Ansible role containing pre-release K8s modules 5 | License: ASL 2.0 6 | URL: https://github.com/ansible/%{name} 7 | Source0: https://github.com/ansible/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz 8 | 9 | BuildArch: noarch 10 | 11 | Requires: ansible >= 2.3.0.0 12 | Requires: python-openshift >= 0.4 13 | 14 | %description 15 | %{summary} 16 | 17 | %prep 18 | %autosetup -p1 19 | 20 | %build 21 | 22 | %install 23 | mkdir -p %{buildroot}%{_sysconfdir}/ansible/roles/ansible.kubernetes-modules 24 | mv * %{buildroot}%{_sysconfdir}/ansible/roles/ansible.kubernetes-modules 25 | 26 | %check 27 | 28 | %files 29 | %{_sysconfdir}/ansible/roles/ansible.kubernetes-modules 30 | 31 | %changelog 32 | * Fri Jan 19 2018 David Zager 0.4.0-8 33 | - when in checkmode _create returns None and cannot have to_dict() called (#27) 34 | (trbs@users.noreply.github.com) 35 | - Show openshift version (chousekn@redhat.com) 36 | - Unpin openshift (chousekn@redhat.com) 37 | - regen modules (fabian@fabianism.us) 38 | - Pin openshift. Trying Origin 3.6.7. (chousekn@redhat.com) 39 | 40 | * Wed Jan 17 2018 David Zager 0.4.0-7 41 | - Bump package version for 4.x (david.j.zager@gmail.com) 42 | - Update releasers (david.j.zager@gmail.com) 43 | - update generated modules (#26) (fabian@fabianism.us) 44 | 45 | * Mon Oct 16 2017 Jason Montleon 0.3.1-6 46 | - Update to latest k8s_common (chousekn@redhat.com) 47 | 48 | * Fri Oct 13 2017 Jason Montleon 0.3.1-5 49 | - increment release 50 | 51 | * Fri Oct 13 2017 Jason Montleon 0.3.1-4 52 | - Bump version 53 | 54 | * Fri Oct 13 2017 Jason Montleon 0.3.1-3 55 | - add python-openshift rpm dependency (jmontleo@redhat.com) 56 | - Travis file cleanup (#13) (chousekn@redhat.com) 57 | - Removes -i inventory (chousekn@redhat.com) 58 | - Removes ansible-galaxy install (chousekn@redhat.com) 59 | - Regen modules. Add tests. (chousekn@redhat.com) 60 | - Add Travis button (chousekn@redhat.com) 61 | - Add simple module test (chousekn@redhat.com) 62 | - Adds latest generated modules (chousekn@redhat.com) 63 | 64 | * Fri Oct 06 2017 Jason Montleon 0.3.1-2 65 | - new package built with tito 66 | 67 | * Fri Oct 06 2017 Jason Montleon 68 | - new package built with tito 69 | 70 | * Fri May 12 2017 Jason Montleon - 0.0.1-1 71 | - initial package 72 | -------------------------------------------------------------------------------- /module_utils/openshift_common.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2017 Red Hat | Ansible 3 | # 4 | # This file is part of Ansible 5 | # 6 | # Ansible is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Ansible is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with Ansible. If not, see . 18 | 19 | from ansible.module_utils.k8s_common import KubernetesAnsibleException, KubernetesAnsibleModule 20 | 21 | try: 22 | from openshift.helper.ansible import OpenShiftAnsibleModuleHelper, ARG_ATTRIBUTES_BLACKLIST 23 | from openshift.helper.exceptions import KubernetesException, OpenShiftException 24 | HAS_OPENSHIFT_HELPER = True 25 | except ImportError as exc: 26 | HAS_OPENSHIFT_HELPER = False 27 | 28 | 29 | class OpenShiftAnsibleException(KubernetesAnsibleException): 30 | pass 31 | 32 | 33 | class OpenShiftAnsibleModule(KubernetesAnsibleModule): 34 | def __init__(self, kind, api_version): 35 | if not HAS_OPENSHIFT_HELPER: 36 | raise OpenShiftAnsibleException( 37 | "This module requires the OpenShift Python client. Try `pip install openshift`" 38 | ) 39 | 40 | try: 41 | super(OpenShiftAnsibleModule, self).__init__(kind, api_version) 42 | except KubernetesAnsibleException as exc: 43 | raise OpenShiftAnsibleException(exc.args) 44 | 45 | @staticmethod 46 | def get_helper(api_version, kind): 47 | return OpenShiftAnsibleModuleHelper(api_version, kind) 48 | 49 | def _create(self, namespace): 50 | if self.kind.lower() == 'project': 51 | return self._create_project() 52 | else: 53 | return super(OpenShiftAnsibleModule, self)._create(namespace) 54 | 55 | def _create_project(self): 56 | new_obj = None 57 | k8s_obj = None 58 | try: 59 | new_obj = self.helper.object_from_params(self.params) 60 | except KubernetesException as exc: 61 | self.fail_json(msg="Failed to create object: {}".format(exc.message)) 62 | try: 63 | k8s_obj = self.helper.create_project(metadata=new_obj.metadata, 64 | display_name=self.params.get('display_name'), 65 | description=self.params.get('description')) 66 | except KubernetesException as exc: 67 | self.fail_json(msg='Failed to retrieve requested object', 68 | error=exc.value.get('status')) 69 | return k8s_obj 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | These modules have been deprecated in favor of the k8s_raw and openshift_raw modules that were added to Ansible 2.5. 3 | 4 | 5 | [![Build Status](https://travis-ci.org/ansible/ansible-kubernetes-modules.svg?branch=master)](https://travis-ci.org/ansible/ansible-kubernetes-modules) 6 | 7 | # ansible-kubernetes-modules 8 | 9 | Provides access to the latest release of the K8s modules. 10 | 11 | Include this role in a playbook, and any other plays, roles, and includes will have access to the modules. 12 | 13 | The modules are found in the [library folder](./library). Each has full documentation for parameters and the returned data structure. However, not all modules will include examples, only those where [test data](https://github.com/openshift/openshift-restclient-python/tree/master/openshift/ansiblegen/examples) has been created. 14 | 15 | If you find an issue with a particular module, or have suggestions, please file an issue at the [OpenShift Rest Client repo](https://github.com/openshift/openshift-restclient-python/issues). 16 | 17 | For convenience, the `k8s_common.py` and `openshift_common.py` modules are included under [module_utils](./module_utils). It is not currenlty part of an official Ansible release, but it is part of Ansible, and lives in the `devel` branch. In the meantime, if you happen to find a bug, or would like to make a change, please open issues and submit pull requests at the [Ansible repo](https://github.com/ansible/ansible). 18 | 19 | ## Requirements 20 | 21 | - Ansible 22 | - [OpenShift Rest Client](https://github.com/openshift/openshift-restclient-python) installed on the host where the modules will execute. 23 | 24 | ## Installation and use 25 | 26 | Use the Galaxy client to install the role: 27 | 28 | ``` 29 | $ ansible-galaxy install ansible.kubernetes-modules 30 | ``` 31 | 32 | Once installed, add it to a playbook: 33 | 34 | ``` 35 | --- 36 | - hosts: localhost 37 | remote_user: root 38 | roles: 39 | - role: ansible.kubernetes-modules 40 | install_python_requirements: no 41 | - role: hello-world 42 | ``` 43 | 44 | Because the role is referenced, the `hello-world` role is able to deploy an applicatoin using the K8s modules. To see contents of the actual role, check in the [tests/roles](./tests/roles) folder. 45 | 46 | ## Authenticating with the API 47 | 48 | The modules interact directly with the Kubernetes or OpenShift API. It is not required that you have the `kubectl` or `oc` CLI tool installed. 49 | 50 | ### Module parameters 51 | 52 | The OpenShift rest client requires a Kubernetes config file. Use the following options to control where it looks for the file, and the context it uses to authenticate with the API: 53 | 54 | kubeconfig 55 | > The default path to the config file is `~/.kube/config`. Use to pass an alternate file path. 56 | 57 | context 58 | > Name of the configuration context to use for authentication. If not specified, the current, active contexts is used. 59 | 60 | Use the following parameters to ovrride the settings found in the config file: 61 | 62 | host 63 | > Provide the URL to the API server. 64 | 65 | ssl_ca_cert 66 | > Path to the Certificate Authority certificate file. 67 | 68 | cert_file 69 | > Path to the server certificate file. 70 | 71 | key_file 72 | > Path to the private key file. 73 | 74 | api_key 75 | > API token. 76 | 77 | verify_ssl 78 | > Set to *true* or *false*. If *false*, SSL verification will not be enforced. 79 | 80 | ### Environment Variables 81 | 82 | Rather than pass the authentication settings as parameters to individual modules, you can pass the information using environment variables. The name of the environment variables is *K8S_AUTH_* followed by the variable name in uppercase. For example, *key_file* would be *K8S_AUTH_KEY_FILE* 83 | 84 | ## Role Variables 85 | 86 | install_python_requirements 87 | > Set to true, if you want the OpenShift Rest Client installed. Defaults to false. Will install via `pip`. 88 | 89 | virtualenv 90 | > Provide the name of a virtualenv to use when installing `pip` packages. 91 | 92 | ## License 93 | 94 | Apache V2 95 | -------------------------------------------------------------------------------- /library/openshift_v1_self_subject_rules_review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_self_subject_rules_review 8 | short_description: OpenShift SelfSubjectRulesReview 9 | description: 10 | - Manage the lifecycle of a self_subject_rules_review object. Supports check mode, 11 | and attempts to to be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | api_key: 16 | description: 17 | - Token used to connect to the API. 18 | cert_file: 19 | description: 20 | - Path to a certificate used to authenticate with the API. 21 | type: path 22 | context: 23 | description: 24 | - The name of a context found in the Kubernetes config file. 25 | debug: 26 | description: 27 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 28 | default: false 29 | type: bool 30 | force: 31 | description: 32 | - If set to C(True), and I(state) is C(present), an existing object will updated, 33 | and lists will be replaced, rather than merged. 34 | default: false 35 | type: bool 36 | host: 37 | description: 38 | - Provide a URL for acessing the Kubernetes API. 39 | key_file: 40 | description: 41 | - Path to a key file used to authenticate with the API. 42 | type: path 43 | kubeconfig: 44 | description: 45 | - Path to an existing Kubernetes config file. If not provided, and no other connection 46 | options are provided, the openshift client will attempt to load the default 47 | configuration file from I(~/.kube/config.json). 48 | type: path 49 | password: 50 | description: 51 | - Provide a password for connecting to the API. Use in conjunction with I(username). 52 | spec_scopes: 53 | description: 54 | - Scopes to use for the evaluation. Empty means "use the unscoped (full) permissions 55 | of the user/groups". Nil means "use the scopes on this request". 56 | aliases: 57 | - scopes 58 | type: list 59 | ssl_ca_cert: 60 | description: 61 | - Path to a CA certificate used to authenticate with the API. 62 | type: path 63 | username: 64 | description: 65 | - Provide a username for connecting to the API. 66 | verify_ssl: 67 | description: 68 | - Whether or not to verify the API server's SSL certificates. 69 | type: bool 70 | requirements: 71 | - openshift == 0.4.0.a1 72 | ''' 73 | 74 | EXAMPLES = ''' 75 | ''' 76 | 77 | RETURN = ''' 78 | api_version: 79 | description: Requested API version 80 | type: string 81 | self_subject_rules_review: 82 | type: complex 83 | returned: on success 84 | contains: 85 | api_version: 86 | description: 87 | - APIVersion defines the versioned schema of this representation of an object. 88 | Servers should convert recognized schemas to the latest internal value, and 89 | may reject unrecognized values. 90 | type: str 91 | kind: 92 | description: 93 | - Kind is a string value representing the REST resource this object represents. 94 | Servers may infer this from the endpoint the client submits requests to. Cannot 95 | be updated. In CamelCase. 96 | type: str 97 | spec: 98 | description: 99 | - Spec adds information about how to conduct the check 100 | type: complex 101 | status: 102 | description: 103 | - Status is completed by the server to tell which permissions you have 104 | type: complex 105 | ''' 106 | 107 | 108 | def main(): 109 | try: 110 | module = OpenShiftAnsibleModule('self_subject_rules_review', 'v1') 111 | except OpenShiftAnsibleException as exc: 112 | # The helper failed to init, so there is no module object. All we can do is raise the error. 113 | raise Exception(exc.message) 114 | 115 | try: 116 | module.execute_module() 117 | except OpenShiftAnsibleException as exc: 118 | module.fail_json(msg="Module failed!", error=str(exc)) 119 | 120 | 121 | if __name__ == '__main__': 122 | main() 123 | -------------------------------------------------------------------------------- /library/openshift_v1_subject_rules_review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_subject_rules_review 8 | short_description: OpenShift SubjectRulesReview 9 | description: 10 | - Manage the lifecycle of a subject_rules_review object. Supports check mode, and 11 | attempts to to be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | api_key: 16 | description: 17 | - Token used to connect to the API. 18 | cert_file: 19 | description: 20 | - Path to a certificate used to authenticate with the API. 21 | type: path 22 | context: 23 | description: 24 | - The name of a context found in the Kubernetes config file. 25 | debug: 26 | description: 27 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 28 | default: false 29 | type: bool 30 | force: 31 | description: 32 | - If set to C(True), and I(state) is C(present), an existing object will updated, 33 | and lists will be replaced, rather than merged. 34 | default: false 35 | type: bool 36 | host: 37 | description: 38 | - Provide a URL for acessing the Kubernetes API. 39 | key_file: 40 | description: 41 | - Path to a key file used to authenticate with the API. 42 | type: path 43 | kubeconfig: 44 | description: 45 | - Path to an existing Kubernetes config file. If not provided, and no other connection 46 | options are provided, the openshift client will attempt to load the default 47 | configuration file from I(~/.kube/config.json). 48 | type: path 49 | password: 50 | description: 51 | - Provide a password for connecting to the API. Use in conjunction with I(username). 52 | spec_groups: 53 | description: 54 | - Groups is optional. Groups is the list of groups to which the User belongs. 55 | At least one of User and Groups must be specified. 56 | aliases: 57 | - groups 58 | type: list 59 | spec_scopes: 60 | description: 61 | - Scopes to use for the evaluation. Empty means "use the unscoped (full) permissions 62 | of the user/groups". 63 | aliases: 64 | - scopes 65 | type: list 66 | spec_user: 67 | description: 68 | - User is optional. At least one of User and Groups must be specified. 69 | aliases: 70 | - user 71 | ssl_ca_cert: 72 | description: 73 | - Path to a CA certificate used to authenticate with the API. 74 | type: path 75 | username: 76 | description: 77 | - Provide a username for connecting to the API. 78 | verify_ssl: 79 | description: 80 | - Whether or not to verify the API server's SSL certificates. 81 | type: bool 82 | requirements: 83 | - openshift == 0.4.0.a1 84 | ''' 85 | 86 | EXAMPLES = ''' 87 | ''' 88 | 89 | RETURN = ''' 90 | api_version: 91 | description: Requested API version 92 | type: string 93 | subject_rules_review: 94 | type: complex 95 | returned: on success 96 | contains: 97 | api_version: 98 | description: 99 | - APIVersion defines the versioned schema of this representation of an object. 100 | Servers should convert recognized schemas to the latest internal value, and 101 | may reject unrecognized values. 102 | type: str 103 | kind: 104 | description: 105 | - Kind is a string value representing the REST resource this object represents. 106 | Servers may infer this from the endpoint the client submits requests to. Cannot 107 | be updated. In CamelCase. 108 | type: str 109 | spec: 110 | description: 111 | - Spec adds information about how to conduct the check 112 | type: complex 113 | status: 114 | description: 115 | - Status is completed by the server to tell which permissions you have 116 | type: complex 117 | ''' 118 | 119 | 120 | def main(): 121 | try: 122 | module = OpenShiftAnsibleModule('subject_rules_review', 'v1') 123 | except OpenShiftAnsibleException as exc: 124 | # The helper failed to init, so there is no module object. All we can do is raise the error. 125 | raise Exception(exc.message) 126 | 127 | try: 128 | module.execute_module() 129 | except OpenShiftAnsibleException as exc: 130 | module.fail_json(msg="Module failed!", error=str(exc)) 131 | 132 | 133 | if __name__ == '__main__': 134 | main() 135 | -------------------------------------------------------------------------------- /library/openshift_v1_applied_cluster_resource_quota_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_applied_cluster_resource_quota_list 8 | short_description: OpenShift AppliedClusterResourceQuotaList 9 | description: 10 | - Retrieve a list of applied_cluster_resource_quotas. List operations provide a snapshot 11 | read of the underlying objects, returning a resource_version representing a consistent 12 | version of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | ssl_ca_cert: 54 | description: 55 | - Path to a CA certificate used to authenticate with the API. 56 | type: path 57 | username: 58 | description: 59 | - Provide a username for connecting to the API. 60 | verify_ssl: 61 | description: 62 | - Whether or not to verify the API server's SSL certificates. 63 | type: bool 64 | requirements: 65 | - openshift == 0.4.0.a1 66 | ''' 67 | 68 | EXAMPLES = ''' 69 | ''' 70 | 71 | RETURN = ''' 72 | api_version: 73 | description: Requested API version 74 | type: string 75 | applied_cluster_resource_quota_list: 76 | type: complex 77 | returned: on success 78 | contains: 79 | api_version: 80 | description: 81 | - APIVersion defines the versioned schema of this representation of an object. 82 | Servers should convert recognized schemas to the latest internal value, and 83 | may reject unrecognized values. 84 | type: str 85 | items: 86 | description: 87 | - Items is a list of AppliedClusterResourceQuota 88 | type: list 89 | contains: 90 | api_version: 91 | description: 92 | - APIVersion defines the versioned schema of this representation of an object. 93 | Servers should convert recognized schemas to the latest internal value, 94 | and may reject unrecognized values. 95 | type: str 96 | kind: 97 | description: 98 | - Kind is a string value representing the REST resource this object represents. 99 | Servers may infer this from the endpoint the client submits requests to. 100 | Cannot be updated. In CamelCase. 101 | type: str 102 | metadata: 103 | description: 104 | - Standard object's metadata. 105 | type: complex 106 | spec: 107 | description: 108 | - Spec defines the desired quota 109 | type: complex 110 | status: 111 | description: 112 | - Status defines the actual enforced quota and its current usage 113 | type: complex 114 | kind: 115 | description: 116 | - Kind is a string value representing the REST resource this object represents. 117 | Servers may infer this from the endpoint the client submits requests to. Cannot 118 | be updated. In CamelCase. 119 | type: str 120 | metadata: 121 | description: 122 | - Standard object's metadata. 123 | type: complex 124 | ''' 125 | 126 | 127 | def main(): 128 | try: 129 | module = OpenShiftAnsibleModule('applied_cluster_resource_quota_list', 'v1') 130 | except OpenShiftAnsibleException as exc: 131 | # The helper failed to init, so there is no module object. All we can do is raise the error. 132 | raise Exception(exc.message) 133 | 134 | try: 135 | module.execute_module() 136 | except OpenShiftAnsibleException as exc: 137 | module.fail_json(msg="Module failed!", error=str(exc)) 138 | 139 | 140 | if __name__ == '__main__': 141 | main() 142 | -------------------------------------------------------------------------------- /library/k8s_v1_scale.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_scale 8 | short_description: Kubernetes Scale 9 | description: 10 | - Manage the lifecycle of a scale object. Supports check mode, and attempts to to 11 | be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_replicas: 76 | description: 77 | - desired number of instances for the scaled object. 78 | aliases: 79 | - replicas 80 | type: int 81 | ssl_ca_cert: 82 | description: 83 | - Path to a CA certificate used to authenticate with the API. 84 | type: path 85 | username: 86 | description: 87 | - Provide a username for connecting to the API. 88 | verify_ssl: 89 | description: 90 | - Whether or not to verify the API server's SSL certificates. 91 | type: bool 92 | requirements: 93 | - kubernetes == 4.0.0 94 | ''' 95 | 96 | EXAMPLES = ''' 97 | ''' 98 | 99 | RETURN = ''' 100 | api_version: 101 | description: Requested API version 102 | type: string 103 | scale: 104 | type: complex 105 | returned: on success 106 | contains: 107 | api_version: 108 | description: 109 | - APIVersion defines the versioned schema of this representation of an object. 110 | Servers should convert recognized schemas to the latest internal value, and 111 | may reject unrecognized values. 112 | type: str 113 | kind: 114 | description: 115 | - Kind is a string value representing the REST resource this object represents. 116 | Servers may infer this from the endpoint the client submits requests to. Cannot 117 | be updated. In CamelCase. 118 | type: str 119 | metadata: 120 | description: 121 | - Standard object metadata; 122 | type: complex 123 | spec: 124 | description: 125 | - defines the behavior of the scale. 126 | type: complex 127 | status: 128 | description: 129 | - current status of the scale. 130 | type: complex 131 | ''' 132 | 133 | 134 | def main(): 135 | try: 136 | module = KubernetesAnsibleModule('scale', 'v1') 137 | except KubernetesAnsibleException as exc: 138 | # The helper failed to init, so there is no module object. All we can do is raise the error. 139 | raise Exception(exc.message) 140 | 141 | try: 142 | module.execute_module() 143 | except KubernetesAnsibleException as exc: 144 | module.fail_json(msg="Module failed!", error=str(exc)) 145 | 146 | 147 | if __name__ == '__main__': 148 | main() 149 | -------------------------------------------------------------------------------- /library/k8s_v1beta2_scale.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta2_scale 8 | short_description: Kubernetes Scale 9 | description: 10 | - Manage the lifecycle of a scale object. Supports check mode, and attempts to to 11 | be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_replicas: 76 | description: 77 | - desired number of instances for the scaled object. 78 | aliases: 79 | - replicas 80 | type: int 81 | ssl_ca_cert: 82 | description: 83 | - Path to a CA certificate used to authenticate with the API. 84 | type: path 85 | username: 86 | description: 87 | - Provide a username for connecting to the API. 88 | verify_ssl: 89 | description: 90 | - Whether or not to verify the API server's SSL certificates. 91 | type: bool 92 | requirements: 93 | - kubernetes == 4.0.0 94 | ''' 95 | 96 | EXAMPLES = ''' 97 | ''' 98 | 99 | RETURN = ''' 100 | api_version: 101 | description: Requested API version 102 | type: string 103 | scale: 104 | type: complex 105 | returned: on success 106 | contains: 107 | api_version: 108 | description: 109 | - APIVersion defines the versioned schema of this representation of an object. 110 | Servers should convert recognized schemas to the latest internal value, and 111 | may reject unrecognized values. 112 | type: str 113 | kind: 114 | description: 115 | - Kind is a string value representing the REST resource this object represents. 116 | Servers may infer this from the endpoint the client submits requests to. Cannot 117 | be updated. In CamelCase. 118 | type: str 119 | metadata: 120 | description: 121 | - Standard object metadata; 122 | type: complex 123 | spec: 124 | description: 125 | - defines the behavior of the scale. 126 | type: complex 127 | status: 128 | description: 129 | - current status of the scale. 130 | type: complex 131 | ''' 132 | 133 | 134 | def main(): 135 | try: 136 | module = KubernetesAnsibleModule('scale', 'v1beta2') 137 | except KubernetesAnsibleException as exc: 138 | # The helper failed to init, so there is no module object. All we can do is raise the error. 139 | raise Exception(exc.message) 140 | 141 | try: 142 | module.execute_module() 143 | except KubernetesAnsibleException as exc: 144 | module.fail_json(msg="Module failed!", error=str(exc)) 145 | 146 | 147 | if __name__ == '__main__': 148 | main() 149 | -------------------------------------------------------------------------------- /library/k8s_apps_v1beta1_scale.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_apps_v1beta1_scale 8 | short_description: Kubernetes Scale 9 | description: 10 | - Manage the lifecycle of a scale object. Supports check mode, and attempts to to 11 | be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_replicas: 76 | description: 77 | - desired number of instances for the scaled object. 78 | aliases: 79 | - replicas 80 | type: int 81 | ssl_ca_cert: 82 | description: 83 | - Path to a CA certificate used to authenticate with the API. 84 | type: path 85 | username: 86 | description: 87 | - Provide a username for connecting to the API. 88 | verify_ssl: 89 | description: 90 | - Whether or not to verify the API server's SSL certificates. 91 | type: bool 92 | requirements: 93 | - kubernetes == 4.0.0 94 | ''' 95 | 96 | EXAMPLES = ''' 97 | ''' 98 | 99 | RETURN = ''' 100 | api_version: 101 | description: Requested API version 102 | type: string 103 | scale: 104 | type: complex 105 | returned: on success 106 | contains: 107 | api_version: 108 | description: 109 | - APIVersion defines the versioned schema of this representation of an object. 110 | Servers should convert recognized schemas to the latest internal value, and 111 | may reject unrecognized values. 112 | type: str 113 | kind: 114 | description: 115 | - Kind is a string value representing the REST resource this object represents. 116 | Servers may infer this from the endpoint the client submits requests to. Cannot 117 | be updated. In CamelCase. 118 | type: str 119 | metadata: 120 | description: 121 | - Standard object metadata; 122 | type: complex 123 | spec: 124 | description: 125 | - defines the behavior of the scale. 126 | type: complex 127 | status: 128 | description: 129 | - current status of the scale. 130 | type: complex 131 | ''' 132 | 133 | 134 | def main(): 135 | try: 136 | module = KubernetesAnsibleModule('scale', 'apps_v1beta1') 137 | except KubernetesAnsibleException as exc: 138 | # The helper failed to init, so there is no module object. All we can do is raise the error. 139 | raise Exception(exc.message) 140 | 141 | try: 142 | module.execute_module() 143 | except KubernetesAnsibleException as exc: 144 | module.fail_json(msg="Module failed!", error=str(exc)) 145 | 146 | 147 | if __name__ == '__main__': 148 | main() 149 | -------------------------------------------------------------------------------- /library/k8s_extensions_v1beta1_scale.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_extensions_v1beta1_scale 8 | short_description: Kubernetes Scale 9 | description: 10 | - Manage the lifecycle of a scale object. Supports check mode, and attempts to to 11 | be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_replicas: 76 | description: 77 | - desired number of instances for the scaled object. 78 | aliases: 79 | - replicas 80 | type: int 81 | ssl_ca_cert: 82 | description: 83 | - Path to a CA certificate used to authenticate with the API. 84 | type: path 85 | username: 86 | description: 87 | - Provide a username for connecting to the API. 88 | verify_ssl: 89 | description: 90 | - Whether or not to verify the API server's SSL certificates. 91 | type: bool 92 | requirements: 93 | - kubernetes == 4.0.0 94 | ''' 95 | 96 | EXAMPLES = ''' 97 | ''' 98 | 99 | RETURN = ''' 100 | api_version: 101 | description: Requested API version 102 | type: string 103 | scale: 104 | type: complex 105 | returned: on success 106 | contains: 107 | api_version: 108 | description: 109 | - APIVersion defines the versioned schema of this representation of an object. 110 | Servers should convert recognized schemas to the latest internal value, and 111 | may reject unrecognized values. 112 | type: str 113 | kind: 114 | description: 115 | - Kind is a string value representing the REST resource this object represents. 116 | Servers may infer this from the endpoint the client submits requests to. Cannot 117 | be updated. In CamelCase. 118 | type: str 119 | metadata: 120 | description: 121 | - Standard object metadata; 122 | type: complex 123 | spec: 124 | description: 125 | - defines the behavior of the scale. 126 | type: complex 127 | status: 128 | description: 129 | - current status of the scale. 130 | type: complex 131 | ''' 132 | 133 | 134 | def main(): 135 | try: 136 | module = KubernetesAnsibleModule('scale', 'extensions_v1beta1') 137 | except KubernetesAnsibleException as exc: 138 | # The helper failed to init, so there is no module object. All we can do is raise the error. 139 | raise Exception(exc.message) 140 | 141 | try: 142 | module.execute_module() 143 | except KubernetesAnsibleException as exc: 144 | module.fail_json(msg="Module failed!", error=str(exc)) 145 | 146 | 147 | if __name__ == '__main__': 148 | main() 149 | -------------------------------------------------------------------------------- /library/k8s_v1_token_review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_token_review 8 | short_description: Kubernetes TokenReview 9 | description: 10 | - Manage the lifecycle of a token_review object. Supports check mode, and attempts 11 | to to be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_token: 76 | description: 77 | - Token is the opaque bearer token. 78 | aliases: 79 | - token 80 | ssl_ca_cert: 81 | description: 82 | - Path to a CA certificate used to authenticate with the API. 83 | type: path 84 | username: 85 | description: 86 | - Provide a username for connecting to the API. 87 | verify_ssl: 88 | description: 89 | - Whether or not to verify the API server's SSL certificates. 90 | type: bool 91 | requirements: 92 | - kubernetes == 4.0.0 93 | ''' 94 | 95 | EXAMPLES = ''' 96 | ''' 97 | 98 | RETURN = ''' 99 | api_version: 100 | description: Requested API version 101 | type: string 102 | token_review: 103 | type: complex 104 | returned: on success 105 | contains: 106 | api_version: 107 | description: 108 | - APIVersion defines the versioned schema of this representation of an object. 109 | Servers should convert recognized schemas to the latest internal value, and 110 | may reject unrecognized values. 111 | type: str 112 | kind: 113 | description: 114 | - Kind is a string value representing the REST resource this object represents. 115 | Servers may infer this from the endpoint the client submits requests to. Cannot 116 | be updated. In CamelCase. 117 | type: str 118 | metadata: 119 | description: [] 120 | type: complex 121 | spec: 122 | description: 123 | - Spec holds information about the request being evaluated 124 | type: complex 125 | status: 126 | description: 127 | - Status is filled in by the server and indicates whether the request can be 128 | authenticated. 129 | type: complex 130 | ''' 131 | 132 | 133 | def main(): 134 | try: 135 | module = KubernetesAnsibleModule('token_review', 'v1') 136 | except KubernetesAnsibleException as exc: 137 | # The helper failed to init, so there is no module object. All we can do is raise the error. 138 | raise Exception(exc.message) 139 | 140 | try: 141 | module.execute_module() 142 | except KubernetesAnsibleException as exc: 143 | module.fail_json(msg="Module failed!", error=str(exc)) 144 | 145 | 146 | if __name__ == '__main__': 147 | main() 148 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_token_review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_token_review 8 | short_description: Kubernetes TokenReview 9 | description: 10 | - Manage the lifecycle of a token_review object. Supports check mode, and attempts 11 | to to be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_token: 76 | description: 77 | - Token is the opaque bearer token. 78 | aliases: 79 | - token 80 | ssl_ca_cert: 81 | description: 82 | - Path to a CA certificate used to authenticate with the API. 83 | type: path 84 | username: 85 | description: 86 | - Provide a username for connecting to the API. 87 | verify_ssl: 88 | description: 89 | - Whether or not to verify the API server's SSL certificates. 90 | type: bool 91 | requirements: 92 | - kubernetes == 4.0.0 93 | ''' 94 | 95 | EXAMPLES = ''' 96 | ''' 97 | 98 | RETURN = ''' 99 | api_version: 100 | description: Requested API version 101 | type: string 102 | token_review: 103 | type: complex 104 | returned: on success 105 | contains: 106 | api_version: 107 | description: 108 | - APIVersion defines the versioned schema of this representation of an object. 109 | Servers should convert recognized schemas to the latest internal value, and 110 | may reject unrecognized values. 111 | type: str 112 | kind: 113 | description: 114 | - Kind is a string value representing the REST resource this object represents. 115 | Servers may infer this from the endpoint the client submits requests to. Cannot 116 | be updated. In CamelCase. 117 | type: str 118 | metadata: 119 | description: [] 120 | type: complex 121 | spec: 122 | description: 123 | - Spec holds information about the request being evaluated 124 | type: complex 125 | status: 126 | description: 127 | - Status is filled in by the server and indicates whether the request can be 128 | authenticated. 129 | type: complex 130 | ''' 131 | 132 | 133 | def main(): 134 | try: 135 | module = KubernetesAnsibleModule('token_review', 'v1beta1') 136 | except KubernetesAnsibleException as exc: 137 | # The helper failed to init, so there is no module object. All we can do is raise the error. 138 | raise Exception(exc.message) 139 | 140 | try: 141 | module.execute_module() 142 | except KubernetesAnsibleException as exc: 143 | module.fail_json(msg="Module failed!", error=str(exc)) 144 | 145 | 146 | if __name__ == '__main__': 147 | main() 148 | -------------------------------------------------------------------------------- /library/k8s_v1_self_subject_rules_review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_self_subject_rules_review 8 | short_description: Kubernetes SelfSubjectRulesReview 9 | description: 10 | - Manage the lifecycle of a self_subject_rules_review object. Supports check mode, 11 | and attempts to to be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_namespace: 76 | description: 77 | - Namespace to evaluate rules for. Required. 78 | ssl_ca_cert: 79 | description: 80 | - Path to a CA certificate used to authenticate with the API. 81 | type: path 82 | username: 83 | description: 84 | - Provide a username for connecting to the API. 85 | verify_ssl: 86 | description: 87 | - Whether or not to verify the API server's SSL certificates. 88 | type: bool 89 | requirements: 90 | - kubernetes == 4.0.0 91 | ''' 92 | 93 | EXAMPLES = ''' 94 | ''' 95 | 96 | RETURN = ''' 97 | api_version: 98 | description: Requested API version 99 | type: string 100 | self_subject_rules_review: 101 | type: complex 102 | returned: on success 103 | contains: 104 | api_version: 105 | description: 106 | - APIVersion defines the versioned schema of this representation of an object. 107 | Servers should convert recognized schemas to the latest internal value, and 108 | may reject unrecognized values. 109 | type: str 110 | kind: 111 | description: 112 | - Kind is a string value representing the REST resource this object represents. 113 | Servers may infer this from the endpoint the client submits requests to. Cannot 114 | be updated. In CamelCase. 115 | type: str 116 | metadata: 117 | description: [] 118 | type: complex 119 | spec: 120 | description: 121 | - Spec holds information about the request being evaluated. 122 | type: complex 123 | status: 124 | description: 125 | - Status is filled in by the server and indicates the set of actions a user 126 | can perform. 127 | type: complex 128 | ''' 129 | 130 | 131 | def main(): 132 | try: 133 | module = KubernetesAnsibleModule('self_subject_rules_review', 'v1') 134 | except KubernetesAnsibleException as exc: 135 | # The helper failed to init, so there is no module object. All we can do is raise the error. 136 | raise Exception(exc.message) 137 | 138 | try: 139 | module.execute_module() 140 | except KubernetesAnsibleException as exc: 141 | module.fail_json(msg="Module failed!", error=str(exc)) 142 | 143 | 144 | if __name__ == '__main__': 145 | main() 146 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_self_subject_rules_review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_self_subject_rules_review 8 | short_description: Kubernetes SelfSubjectRulesReview 9 | description: 10 | - Manage the lifecycle of a self_subject_rules_review object. Supports check mode, 11 | and attempts to to be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | context: 29 | description: 30 | - The name of a context found in the Kubernetes config file. 31 | debug: 32 | description: 33 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 34 | default: false 35 | type: bool 36 | force: 37 | description: 38 | - If set to C(True), and I(state) is C(present), an existing object will updated, 39 | and lists will be replaced, rather than merged. 40 | default: false 41 | type: bool 42 | host: 43 | description: 44 | - Provide a URL for acessing the Kubernetes API. 45 | key_file: 46 | description: 47 | - Path to a key file used to authenticate with the API. 48 | type: path 49 | kubeconfig: 50 | description: 51 | - Path to an existing Kubernetes config file. If not provided, and no other connection 52 | options are provided, the openshift client will attempt to load the default 53 | configuration file from I(~/.kube/config.json). 54 | type: path 55 | labels: 56 | description: 57 | - Map of string keys and values that can be used to organize and categorize (scope 58 | and select) objects. May match selectors of replication controllers and services. 59 | type: dict 60 | name: 61 | description: 62 | - Name must be unique within a namespace. Is required when creating resources, 63 | although some resources may allow a client to request the generation of an appropriate 64 | name automatically. Name is primarily intended for creation idempotence and 65 | configuration definition. Cannot be updated. 66 | namespace: 67 | description: 68 | - Namespace defines the space within each name must be unique. An empty namespace 69 | is equivalent to the "default" namespace, but "default" is the canonical representation. 70 | Not all objects are required to be scoped to a namespace - the value of this 71 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 72 | password: 73 | description: 74 | - Provide a password for connecting to the API. Use in conjunction with I(username). 75 | spec_namespace: 76 | description: 77 | - Namespace to evaluate rules for. Required. 78 | ssl_ca_cert: 79 | description: 80 | - Path to a CA certificate used to authenticate with the API. 81 | type: path 82 | username: 83 | description: 84 | - Provide a username for connecting to the API. 85 | verify_ssl: 86 | description: 87 | - Whether or not to verify the API server's SSL certificates. 88 | type: bool 89 | requirements: 90 | - kubernetes == 4.0.0 91 | ''' 92 | 93 | EXAMPLES = ''' 94 | ''' 95 | 96 | RETURN = ''' 97 | api_version: 98 | description: Requested API version 99 | type: string 100 | self_subject_rules_review: 101 | type: complex 102 | returned: on success 103 | contains: 104 | api_version: 105 | description: 106 | - APIVersion defines the versioned schema of this representation of an object. 107 | Servers should convert recognized schemas to the latest internal value, and 108 | may reject unrecognized values. 109 | type: str 110 | kind: 111 | description: 112 | - Kind is a string value representing the REST resource this object represents. 113 | Servers may infer this from the endpoint the client submits requests to. Cannot 114 | be updated. In CamelCase. 115 | type: str 116 | metadata: 117 | description: [] 118 | type: complex 119 | spec: 120 | description: 121 | - Spec holds information about the request being evaluated. 122 | type: complex 123 | status: 124 | description: 125 | - Status is filled in by the server and indicates the set of actions a user 126 | can perform. 127 | type: complex 128 | ''' 129 | 130 | 131 | def main(): 132 | try: 133 | module = KubernetesAnsibleModule('self_subject_rules_review', 'v1beta1') 134 | except KubernetesAnsibleException as exc: 135 | # The helper failed to init, so there is no module object. All we can do is raise the error. 136 | raise Exception(exc.message) 137 | 138 | try: 139 | module.execute_module() 140 | except KubernetesAnsibleException as exc: 141 | module.fail_json(msg="Module failed!", error=str(exc)) 142 | 143 | 144 | if __name__ == '__main__': 145 | main() 146 | -------------------------------------------------------------------------------- /library/k8s_v1_component_status_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_component_status_list 8 | short_description: Kubernetes ComponentStatusList 9 | description: 10 | - Retrieve a list of component_status. List operations provide a snapshot read of 11 | the underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | ssl_ca_cert: 54 | description: 55 | - Path to a CA certificate used to authenticate with the API. 56 | type: path 57 | username: 58 | description: 59 | - Provide a username for connecting to the API. 60 | verify_ssl: 61 | description: 62 | - Whether or not to verify the API server's SSL certificates. 63 | type: bool 64 | requirements: 65 | - kubernetes == 4.0.0 66 | ''' 67 | 68 | EXAMPLES = ''' 69 | ''' 70 | 71 | RETURN = ''' 72 | api_version: 73 | description: Requested API version 74 | type: string 75 | component_status_list: 76 | type: complex 77 | returned: on success 78 | contains: 79 | api_version: 80 | description: 81 | - APIVersion defines the versioned schema of this representation of an object. 82 | Servers should convert recognized schemas to the latest internal value, and 83 | may reject unrecognized values. 84 | type: str 85 | items: 86 | description: 87 | - List of ComponentStatus objects. 88 | type: list 89 | contains: 90 | api_version: 91 | description: 92 | - APIVersion defines the versioned schema of this representation of an object. 93 | Servers should convert recognized schemas to the latest internal value, 94 | and may reject unrecognized values. 95 | type: str 96 | conditions: 97 | description: 98 | - List of component conditions observed 99 | type: list 100 | contains: 101 | error: 102 | description: 103 | - Condition error code for a component. For example, a health check 104 | error code. 105 | type: str 106 | message: 107 | description: 108 | - Message about the condition for a component. For example, information 109 | about a health check. 110 | type: str 111 | status: 112 | description: 113 | - 'Status of the condition for a component. Valid values for "Healthy": 114 | "True", "False", or "Unknown".' 115 | type: str 116 | type: 117 | description: 118 | - 'Type of condition for a component. Valid value: "Healthy"' 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | kind: 131 | description: 132 | - Kind is a string value representing the REST resource this object represents. 133 | Servers may infer this from the endpoint the client submits requests to. Cannot 134 | be updated. In CamelCase. 135 | type: str 136 | metadata: 137 | description: 138 | - Standard list metadata. 139 | type: complex 140 | ''' 141 | 142 | 143 | def main(): 144 | try: 145 | module = KubernetesAnsibleModule('component_status_list', 'v1') 146 | except KubernetesAnsibleException as exc: 147 | # The helper failed to init, so there is no module object. All we can do is raise the error. 148 | raise Exception(exc.message) 149 | 150 | try: 151 | module.execute_module() 152 | except KubernetesAnsibleException as exc: 153 | module.fail_json(msg="Module failed!", error=str(exc)) 154 | 155 | 156 | if __name__ == '__main__': 157 | main() 158 | -------------------------------------------------------------------------------- /library/k8s_v1alpha1_pod_preset_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1alpha1_pod_preset_list 8 | short_description: Kubernetes PodPresetList 9 | description: 10 | - Retrieve a list of pod_presets. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | pod_preset_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is a list of schema objects. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: [] 128 | type: complex 129 | spec: 130 | description: [] 131 | type: complex 132 | kind: 133 | description: 134 | - Kind is a string value representing the REST resource this object represents. 135 | Servers may infer this from the endpoint the client submits requests to. Cannot 136 | be updated. In CamelCase. 137 | type: str 138 | metadata: 139 | description: 140 | - Standard list metadata. 141 | type: complex 142 | ''' 143 | 144 | 145 | def main(): 146 | try: 147 | module = KubernetesAnsibleModule('pod_preset_list', 'v1alpha1') 148 | except KubernetesAnsibleException as exc: 149 | # The helper failed to init, so there is no module object. All we can do is raise the error. 150 | raise Exception(exc.message) 151 | 152 | try: 153 | module.execute_module() 154 | except KubernetesAnsibleException as exc: 155 | module.fail_json(msg="Module failed!", error=str(exc)) 156 | 157 | 158 | if __name__ == '__main__': 159 | main() 160 | -------------------------------------------------------------------------------- /library/k8s_v1_component_status.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_component_status 8 | short_description: Kubernetes ComponentStatus 9 | description: 10 | - Manage the lifecycle of a component_status object. Supports check mode, and attempts 11 | to to be idempotent. 12 | version_added: 2.3.0 13 | author: OpenShift (@openshift) 14 | options: 15 | annotations: 16 | description: 17 | - Annotations is an unstructured key value map stored with a resource that may 18 | be set by external tools to store and retrieve arbitrary metadata. They are 19 | not queryable and should be preserved when modifying objects. 20 | type: dict 21 | api_key: 22 | description: 23 | - Token used to connect to the API. 24 | cert_file: 25 | description: 26 | - Path to a certificate used to authenticate with the API. 27 | type: path 28 | conditions: 29 | description: 30 | - List of component conditions observed 31 | type: list 32 | context: 33 | description: 34 | - The name of a context found in the Kubernetes config file. 35 | debug: 36 | description: 37 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 38 | default: false 39 | type: bool 40 | force: 41 | description: 42 | - If set to C(True), and I(state) is C(present), an existing object will updated, 43 | and lists will be replaced, rather than merged. 44 | default: false 45 | type: bool 46 | host: 47 | description: 48 | - Provide a URL for acessing the Kubernetes API. 49 | key_file: 50 | description: 51 | - Path to a key file used to authenticate with the API. 52 | type: path 53 | kubeconfig: 54 | description: 55 | - Path to an existing Kubernetes config file. If not provided, and no other connection 56 | options are provided, the openshift client will attempt to load the default 57 | configuration file from I(~/.kube/config.json). 58 | type: path 59 | labels: 60 | description: 61 | - Map of string keys and values that can be used to organize and categorize (scope 62 | and select) objects. May match selectors of replication controllers and services. 63 | type: dict 64 | name: 65 | description: 66 | - Name must be unique within a namespace. Is required when creating resources, 67 | although some resources may allow a client to request the generation of an appropriate 68 | name automatically. Name is primarily intended for creation idempotence and 69 | configuration definition. Cannot be updated. 70 | namespace: 71 | description: 72 | - Namespace defines the space within each name must be unique. An empty namespace 73 | is equivalent to the "default" namespace, but "default" is the canonical representation. 74 | Not all objects are required to be scoped to a namespace - the value of this 75 | field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. 76 | password: 77 | description: 78 | - Provide a password for connecting to the API. Use in conjunction with I(username). 79 | ssl_ca_cert: 80 | description: 81 | - Path to a CA certificate used to authenticate with the API. 82 | type: path 83 | username: 84 | description: 85 | - Provide a username for connecting to the API. 86 | verify_ssl: 87 | description: 88 | - Whether or not to verify the API server's SSL certificates. 89 | type: bool 90 | requirements: 91 | - kubernetes == 4.0.0 92 | ''' 93 | 94 | EXAMPLES = ''' 95 | ''' 96 | 97 | RETURN = ''' 98 | api_version: 99 | description: Requested API version 100 | type: string 101 | component_status: 102 | type: complex 103 | returned: on success 104 | contains: 105 | api_version: 106 | description: 107 | - APIVersion defines the versioned schema of this representation of an object. 108 | Servers should convert recognized schemas to the latest internal value, and 109 | may reject unrecognized values. 110 | type: str 111 | conditions: 112 | description: 113 | - List of component conditions observed 114 | type: list 115 | contains: 116 | error: 117 | description: 118 | - Condition error code for a component. For example, a health check error 119 | code. 120 | type: str 121 | message: 122 | description: 123 | - Message about the condition for a component. For example, information 124 | about a health check. 125 | type: str 126 | status: 127 | description: 128 | - 'Status of the condition for a component. Valid values for "Healthy": 129 | "True", "False", or "Unknown".' 130 | type: str 131 | type: 132 | description: 133 | - 'Type of condition for a component. Valid value: "Healthy"' 134 | type: str 135 | kind: 136 | description: 137 | - Kind is a string value representing the REST resource this object represents. 138 | Servers may infer this from the endpoint the client submits requests to. Cannot 139 | be updated. In CamelCase. 140 | type: str 141 | metadata: 142 | description: 143 | - Standard object's metadata. 144 | type: complex 145 | ''' 146 | 147 | 148 | def main(): 149 | try: 150 | module = KubernetesAnsibleModule('component_status', 'v1') 151 | except KubernetesAnsibleException as exc: 152 | # The helper failed to init, so there is no module object. All we can do is raise the error. 153 | raise Exception(exc.message) 154 | 155 | try: 156 | module.execute_module() 157 | except KubernetesAnsibleException as exc: 158 | module.fail_json(msg="Module failed!", error=str(exc)) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/k8s_v1_limit_range_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_limit_range_list 8 | short_description: Kubernetes LimitRangeList 9 | description: 10 | - Retrieve a list of limit_ranges. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | limit_range_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is a list of LimitRange objects. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Spec defines the limits enforced. 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - Standard list metadata. 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = KubernetesAnsibleModule('limit_range_list', 'v1') 150 | except KubernetesAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except KubernetesAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/openshift_v1_group_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_group_list 8 | short_description: OpenShift GroupList 9 | description: 10 | - Retrieve a list of groups. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | group_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is the list of groups 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | users: 131 | description: 132 | - Users is the list of users in this group. 133 | type: list 134 | contains: str 135 | kind: 136 | description: 137 | - Kind is a string value representing the REST resource this object represents. 138 | Servers may infer this from the endpoint the client submits requests to. Cannot 139 | be updated. In CamelCase. 140 | type: str 141 | metadata: 142 | description: 143 | - Standard object's metadata. 144 | type: complex 145 | ''' 146 | 147 | 148 | def main(): 149 | try: 150 | module = OpenShiftAnsibleModule('group_list', 'v1') 151 | except OpenShiftAnsibleException as exc: 152 | # The helper failed to init, so there is no module object. All we can do is raise the error. 153 | raise Exception(exc.message) 154 | 155 | try: 156 | module.execute_module() 157 | except OpenShiftAnsibleException as exc: 158 | module.fail_json(msg="Module failed!", error=str(exc)) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/k8s_v1_pod_template_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_pod_template_list 8 | short_description: Kubernetes PodTemplateList 9 | description: 10 | - Retrieve a list of pod_templates. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | pod_template_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - List of pod templates 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | template: 131 | description: 132 | - Template defines the pods that will be created from this pod template. 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - Standard list metadata. 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = KubernetesAnsibleModule('pod_template_list', 'v1') 150 | except KubernetesAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except KubernetesAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/k8s_v1_network_policy_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_network_policy_list 8 | short_description: Kubernetes NetworkPolicyList 9 | description: 10 | - Retrieve a list of network_policys. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | network_policy_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is a list of schema objects. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Specification of the desired behavior for this NetworkPolicy. 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - Standard list metadata. 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = KubernetesAnsibleModule('network_policy_list', 'v1') 150 | except KubernetesAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except KubernetesAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_network_policy_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_network_policy_list 8 | short_description: Kubernetes NetworkPolicyList 9 | description: 10 | - Retrieve a list of network_policys. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | network_policy_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is a list of schema objects. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Specification of the desired behavior for this NetworkPolicy. 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - Standard list metadata. 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = KubernetesAnsibleModule('network_policy_list', 'v1beta1') 150 | except KubernetesAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except KubernetesAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_pod_security_policy_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_pod_security_policy_list 8 | short_description: Kubernetes PodSecurityPolicyList 9 | description: 10 | - Retrieve a list of pod_security_policys. List operations provide a snapshot read 11 | of the underlying objects, returning a resource_version representing a consistent 12 | version of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | pod_security_policy_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is a list of schema objects. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - spec defines the policy enforced. 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - Standard list metadata. 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = KubernetesAnsibleModule('pod_security_policy_list', 'v1beta1') 150 | except KubernetesAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except KubernetesAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/k8s_v1_job_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_job_list 8 | short_description: Kubernetes JobList 9 | description: 10 | - Retrieve a list of jobs. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | job_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - items is the list of Jobs. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Specification of the desired behavior of a job. 133 | type: complex 134 | status: 135 | description: 136 | - Current status of a job. 137 | type: complex 138 | kind: 139 | description: 140 | - Kind is a string value representing the REST resource this object represents. 141 | Servers may infer this from the endpoint the client submits requests to. Cannot 142 | be updated. In CamelCase. 143 | type: str 144 | metadata: 145 | description: 146 | - Standard list metadata. 147 | type: complex 148 | ''' 149 | 150 | 151 | def main(): 152 | try: 153 | module = KubernetesAnsibleModule('job_list', 'v1') 154 | except KubernetesAnsibleException as exc: 155 | # The helper failed to init, so there is no module object. All we can do is raise the error. 156 | raise Exception(exc.message) 157 | 158 | try: 159 | module.execute_module() 160 | except KubernetesAnsibleException as exc: 161 | module.fail_json(msg="Module failed!", error=str(exc)) 162 | 163 | 164 | if __name__ == '__main__': 165 | main() 166 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_api_service_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_api_service_list 8 | short_description: Kubernetes APIServiceList 9 | description: 10 | - Retrieve a list of api_services. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | api_service_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: [] 111 | type: list 112 | contains: 113 | api_version: 114 | description: 115 | - APIVersion defines the versioned schema of this representation of an object. 116 | Servers should convert recognized schemas to the latest internal value, 117 | and may reject unrecognized values. 118 | type: str 119 | kind: 120 | description: 121 | - Kind is a string value representing the REST resource this object represents. 122 | Servers may infer this from the endpoint the client submits requests to. 123 | Cannot be updated. In CamelCase. 124 | type: str 125 | metadata: 126 | description: [] 127 | type: complex 128 | spec: 129 | description: 130 | - Spec contains information for locating and communicating with a server 131 | type: complex 132 | status: 133 | description: 134 | - Status contains derived information about an API server 135 | type: complex 136 | kind: 137 | description: 138 | - Kind is a string value representing the REST resource this object represents. 139 | Servers may infer this from the endpoint the client submits requests to. Cannot 140 | be updated. In CamelCase. 141 | type: str 142 | metadata: 143 | description: [] 144 | type: complex 145 | ''' 146 | 147 | 148 | def main(): 149 | try: 150 | module = KubernetesAnsibleModule('api_service_list', 'v1beta1') 151 | except KubernetesAnsibleException as exc: 152 | # The helper failed to init, so there is no module object. All we can do is raise the error. 153 | raise Exception(exc.message) 154 | 155 | try: 156 | module.execute_module() 157 | except KubernetesAnsibleException as exc: 158 | module.fail_json(msg="Module failed!", error=str(exc)) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/k8s_v1_config_map_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_config_map_list 8 | short_description: Kubernetes ConfigMapList 9 | description: 10 | - Retrieve a list of config_maps. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | config_map_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is the list of ConfigMaps. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | data: 121 | description: 122 | - Data contains the configuration data. Each key must consist of alphanumeric 123 | characters, '-', '_' or '.'. 124 | type: complex 125 | contains: str, str 126 | kind: 127 | description: 128 | - Kind is a string value representing the REST resource this object represents. 129 | Servers may infer this from the endpoint the client submits requests to. 130 | Cannot be updated. In CamelCase. 131 | type: str 132 | metadata: 133 | description: 134 | - Standard object's metadata. 135 | type: complex 136 | kind: 137 | description: 138 | - Kind is a string value representing the REST resource this object represents. 139 | Servers may infer this from the endpoint the client submits requests to. Cannot 140 | be updated. In CamelCase. 141 | type: str 142 | metadata: 143 | description: 144 | - '' 145 | type: complex 146 | ''' 147 | 148 | 149 | def main(): 150 | try: 151 | module = KubernetesAnsibleModule('config_map_list', 'v1') 152 | except KubernetesAnsibleException as exc: 153 | # The helper failed to init, so there is no module object. All we can do is raise the error. 154 | raise Exception(exc.message) 155 | 156 | try: 157 | module.execute_module() 158 | except KubernetesAnsibleException as exc: 159 | module.fail_json(msg="Module failed!", error=str(exc)) 160 | 161 | 162 | if __name__ == '__main__': 163 | main() 164 | -------------------------------------------------------------------------------- /library/openshift_v1_role_binding_restriction_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_role_binding_restriction_list 8 | short_description: OpenShift RoleBindingRestrictionList 9 | description: 10 | - Retrieve a list of role_binding_restrictions. List operations provide a snapshot 11 | read of the underlying objects, returning a resource_version representing a consistent 12 | version of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | role_binding_restriction_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is a list of RoleBindingRestriction objects. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Spec defines the matcher. 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - Standard object's metadata. 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = OpenShiftAnsibleModule('role_binding_restriction_list', 'v1') 150 | except OpenShiftAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except OpenShiftAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/k8s_v1_node_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1_node_list 8 | short_description: Kubernetes NodeList 9 | description: 10 | - Retrieve a list of nodes. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | node_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - List of nodes 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Spec defines the behavior of a node. 133 | type: complex 134 | status: 135 | description: 136 | - Most recently observed status of the node. Populated by the system. Read-only. 137 | type: complex 138 | kind: 139 | description: 140 | - Kind is a string value representing the REST resource this object represents. 141 | Servers may infer this from the endpoint the client submits requests to. Cannot 142 | be updated. In CamelCase. 143 | type: str 144 | metadata: 145 | description: 146 | - Standard list metadata. 147 | type: complex 148 | ''' 149 | 150 | 151 | def main(): 152 | try: 153 | module = KubernetesAnsibleModule('node_list', 'v1') 154 | except KubernetesAnsibleException as exc: 155 | # The helper failed to init, so there is no module object. All we can do is raise the error. 156 | raise Exception(exc.message) 157 | 158 | try: 159 | module.execute_module() 160 | except KubernetesAnsibleException as exc: 161 | module.fail_json(msg="Module failed!", error=str(exc)) 162 | 163 | 164 | if __name__ == '__main__': 165 | main() 166 | -------------------------------------------------------------------------------- /library/openshift_v1_egress_network_policy_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_egress_network_policy_list 8 | short_description: OpenShift EgressNetworkPolicyList 9 | description: 10 | - Retrieve a list of egress_network_policys. List operations provide a snapshot read 11 | of the underlying objects, returning a resource_version representing a consistent 12 | version of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | egress_network_policy_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - items is the list of policies 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - metadata for EgressNetworkPolicy 129 | type: complex 130 | spec: 131 | description: 132 | - spec is the specification of the current egress network policy 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - metadata for EgressNetworkPolicyList 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = OpenShiftAnsibleModule('egress_network_policy_list', 'v1') 150 | except OpenShiftAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except OpenShiftAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/openshift_v1_route_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_route_list 8 | short_description: OpenShift RouteList 9 | description: 10 | - Retrieve a list of routes. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | route_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - items is a list of routes 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - spec is the desired state of the route 133 | type: complex 134 | status: 135 | description: 136 | - status is the current state of the route 137 | type: complex 138 | kind: 139 | description: 140 | - Kind is a string value representing the REST resource this object represents. 141 | Servers may infer this from the endpoint the client submits requests to. Cannot 142 | be updated. In CamelCase. 143 | type: str 144 | metadata: 145 | description: 146 | - Standard object metadata. 147 | type: complex 148 | ''' 149 | 150 | 151 | def main(): 152 | try: 153 | module = OpenShiftAnsibleModule('route_list', 'v1') 154 | except OpenShiftAnsibleException as exc: 155 | # The helper failed to init, so there is no module object. All we can do is raise the error. 156 | raise Exception(exc.message) 157 | 158 | try: 159 | module.execute_module() 160 | except OpenShiftAnsibleException as exc: 161 | module.fail_json(msg="Module failed!", error=str(exc)) 162 | 163 | 164 | if __name__ == '__main__': 165 | main() 166 | -------------------------------------------------------------------------------- /library/openshift_v1_broker_template_instance_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_broker_template_instance_list 8 | short_description: OpenShift BrokerTemplateInstanceList 9 | description: 10 | - Retrieve a list of broker_template_instances. List operations provide a snapshot 11 | read of the underlying objects, returning a resource_version representing a consistent 12 | version of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | broker_template_instance_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - items is a list of BrokerTemplateInstances 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - spec describes the state of this BrokerTemplateInstance. 133 | type: complex 134 | kind: 135 | description: 136 | - Kind is a string value representing the REST resource this object represents. 137 | Servers may infer this from the endpoint the client submits requests to. Cannot 138 | be updated. In CamelCase. 139 | type: str 140 | metadata: 141 | description: 142 | - Standard object metadata. 143 | type: complex 144 | ''' 145 | 146 | 147 | def main(): 148 | try: 149 | module = OpenShiftAnsibleModule('broker_template_instance_list', 'v1') 150 | except OpenShiftAnsibleException as exc: 151 | # The helper failed to init, so there is no module object. All we can do is raise the error. 152 | raise Exception(exc.message) 153 | 154 | try: 155 | module.execute_module() 156 | except OpenShiftAnsibleException as exc: 157 | module.fail_json(msg="Module failed!", error=str(exc)) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/openshift_v1_build_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_build_list 8 | short_description: OpenShift BuildList 9 | description: 10 | - Retrieve a list of builds. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | build_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - items is a list of builds 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - spec is all the inputs used to execute the build. 133 | type: complex 134 | status: 135 | description: 136 | - status is the current status of the build. 137 | type: complex 138 | kind: 139 | description: 140 | - Kind is a string value representing the REST resource this object represents. 141 | Servers may infer this from the endpoint the client submits requests to. Cannot 142 | be updated. In CamelCase. 143 | type: str 144 | metadata: 145 | description: 146 | - metadata for BuildList. 147 | type: complex 148 | ''' 149 | 150 | 151 | def main(): 152 | try: 153 | module = OpenShiftAnsibleModule('build_list', 'v1') 154 | except OpenShiftAnsibleException as exc: 155 | # The helper failed to init, so there is no module object. All we can do is raise the error. 156 | raise Exception(exc.message) 157 | 158 | try: 159 | module.execute_module() 160 | except OpenShiftAnsibleException as exc: 161 | module.fail_json(msg="Module failed!", error=str(exc)) 162 | 163 | 164 | if __name__ == '__main__': 165 | main() 166 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_pod_disruption_budget_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_pod_disruption_budget_list 8 | short_description: Kubernetes PodDisruptionBudgetList 9 | description: 10 | - Retrieve a list of pod_disruption_budgets. List operations provide a snapshot read 11 | of the underlying objects, returning a resource_version representing a consistent 12 | version of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | pod_disruption_budget_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: [] 111 | type: list 112 | contains: 113 | api_version: 114 | description: 115 | - APIVersion defines the versioned schema of this representation of an object. 116 | Servers should convert recognized schemas to the latest internal value, 117 | and may reject unrecognized values. 118 | type: str 119 | kind: 120 | description: 121 | - Kind is a string value representing the REST resource this object represents. 122 | Servers may infer this from the endpoint the client submits requests to. 123 | Cannot be updated. In CamelCase. 124 | type: str 125 | metadata: 126 | description: [] 127 | type: complex 128 | spec: 129 | description: 130 | - Specification of the desired behavior of the PodDisruptionBudget. 131 | type: complex 132 | status: 133 | description: 134 | - Most recently observed status of the PodDisruptionBudget. 135 | type: complex 136 | kind: 137 | description: 138 | - Kind is a string value representing the REST resource this object represents. 139 | Servers may infer this from the endpoint the client submits requests to. Cannot 140 | be updated. In CamelCase. 141 | type: str 142 | metadata: 143 | description: [] 144 | type: complex 145 | ''' 146 | 147 | 148 | def main(): 149 | try: 150 | module = KubernetesAnsibleModule('pod_disruption_budget_list', 'v1beta1') 151 | except KubernetesAnsibleException as exc: 152 | # The helper failed to init, so there is no module object. All we can do is raise the error. 153 | raise Exception(exc.message) 154 | 155 | try: 156 | module.execute_module() 157 | except KubernetesAnsibleException as exc: 158 | module.fail_json(msg="Module failed!", error=str(exc)) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_ingress_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_ingress_list 8 | short_description: Kubernetes IngressList 9 | description: 10 | - Retrieve a list of ingress. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | ingress_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is the list of Ingress. 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Spec is the desired state of the Ingress. 133 | type: complex 134 | status: 135 | description: 136 | - Status is the current state of the Ingress. 137 | type: complex 138 | kind: 139 | description: 140 | - Kind is a string value representing the REST resource this object represents. 141 | Servers may infer this from the endpoint the client submits requests to. Cannot 142 | be updated. In CamelCase. 143 | type: str 144 | metadata: 145 | description: 146 | - Standard object's metadata. 147 | type: complex 148 | ''' 149 | 150 | 151 | def main(): 152 | try: 153 | module = KubernetesAnsibleModule('ingress_list', 'v1beta1') 154 | except KubernetesAnsibleException as exc: 155 | # The helper failed to init, so there is no module object. All we can do is raise the error. 156 | raise Exception(exc.message) 157 | 158 | try: 159 | module.execute_module() 160 | except KubernetesAnsibleException as exc: 161 | module.fail_json(msg="Module failed!", error=str(exc)) 162 | 163 | 164 | if __name__ == '__main__': 165 | main() 166 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_stateful_set_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_stateful_set_list 8 | short_description: Kubernetes StatefulSetList 9 | description: 10 | - Retrieve a list of stateful_sets. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | stateful_set_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: [] 111 | type: list 112 | contains: 113 | api_version: 114 | description: 115 | - APIVersion defines the versioned schema of this representation of an object. 116 | Servers should convert recognized schemas to the latest internal value, 117 | and may reject unrecognized values. 118 | type: str 119 | kind: 120 | description: 121 | - Kind is a string value representing the REST resource this object represents. 122 | Servers may infer this from the endpoint the client submits requests to. 123 | Cannot be updated. In CamelCase. 124 | type: str 125 | metadata: 126 | description: [] 127 | type: complex 128 | spec: 129 | description: 130 | - Spec defines the desired identities of pods in this set. 131 | type: complex 132 | status: 133 | description: 134 | - Status is the current status of Pods in this StatefulSet. This data may 135 | be out of date by some window of time. 136 | type: complex 137 | kind: 138 | description: 139 | - Kind is a string value representing the REST resource this object represents. 140 | Servers may infer this from the endpoint the client submits requests to. Cannot 141 | be updated. In CamelCase. 142 | type: str 143 | metadata: 144 | description: [] 145 | type: complex 146 | ''' 147 | 148 | 149 | def main(): 150 | try: 151 | module = KubernetesAnsibleModule('stateful_set_list', 'v1beta1') 152 | except KubernetesAnsibleException as exc: 153 | # The helper failed to init, so there is no module object. All we can do is raise the error. 154 | raise Exception(exc.message) 155 | 156 | try: 157 | module.execute_module() 158 | except KubernetesAnsibleException as exc: 159 | module.fail_json(msg="Module failed!", error=str(exc)) 160 | 161 | 162 | if __name__ == '__main__': 163 | main() 164 | -------------------------------------------------------------------------------- /library/k8s_v1beta2_stateful_set_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta2_stateful_set_list 8 | short_description: Kubernetes StatefulSetList 9 | description: 10 | - Retrieve a list of stateful_sets. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | stateful_set_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: [] 111 | type: list 112 | contains: 113 | api_version: 114 | description: 115 | - APIVersion defines the versioned schema of this representation of an object. 116 | Servers should convert recognized schemas to the latest internal value, 117 | and may reject unrecognized values. 118 | type: str 119 | kind: 120 | description: 121 | - Kind is a string value representing the REST resource this object represents. 122 | Servers may infer this from the endpoint the client submits requests to. 123 | Cannot be updated. In CamelCase. 124 | type: str 125 | metadata: 126 | description: [] 127 | type: complex 128 | spec: 129 | description: 130 | - Spec defines the desired identities of pods in this set. 131 | type: complex 132 | status: 133 | description: 134 | - Status is the current status of Pods in this StatefulSet. This data may 135 | be out of date by some window of time. 136 | type: complex 137 | kind: 138 | description: 139 | - Kind is a string value representing the REST resource this object represents. 140 | Servers may infer this from the endpoint the client submits requests to. Cannot 141 | be updated. In CamelCase. 142 | type: str 143 | metadata: 144 | description: [] 145 | type: complex 146 | ''' 147 | 148 | 149 | def main(): 150 | try: 151 | module = KubernetesAnsibleModule('stateful_set_list', 'v1beta2') 152 | except KubernetesAnsibleException as exc: 153 | # The helper failed to init, so there is no module object. All we can do is raise the error. 154 | raise Exception(exc.message) 155 | 156 | try: 157 | module.execute_module() 158 | except KubernetesAnsibleException as exc: 159 | module.fail_json(msg="Module failed!", error=str(exc)) 160 | 161 | 162 | if __name__ == '__main__': 163 | main() 164 | -------------------------------------------------------------------------------- /library/openshift_v1_stateful_set_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_stateful_set_list 8 | short_description: OpenShift StatefulSetList 9 | description: 10 | - Retrieve a list of stateful_sets. List operations provide a snapshot read of the 11 | underlying objects, returning a resource_version representing a consistent version 12 | of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | stateful_set_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: [] 111 | type: list 112 | contains: 113 | api_version: 114 | description: 115 | - APIVersion defines the versioned schema of this representation of an object. 116 | Servers should convert recognized schemas to the latest internal value, 117 | and may reject unrecognized values. 118 | type: str 119 | kind: 120 | description: 121 | - Kind is a string value representing the REST resource this object represents. 122 | Servers may infer this from the endpoint the client submits requests to. 123 | Cannot be updated. In CamelCase. 124 | type: str 125 | metadata: 126 | description: [] 127 | type: complex 128 | spec: 129 | description: 130 | - Spec defines the desired identities of pods in this set. 131 | type: complex 132 | status: 133 | description: 134 | - Status is the current status of Pods in this StatefulSet. This data may 135 | be out of date by some window of time. 136 | type: complex 137 | kind: 138 | description: 139 | - Kind is a string value representing the REST resource this object represents. 140 | Servers may infer this from the endpoint the client submits requests to. Cannot 141 | be updated. In CamelCase. 142 | type: str 143 | metadata: 144 | description: [] 145 | type: complex 146 | ''' 147 | 148 | 149 | def main(): 150 | try: 151 | module = OpenShiftAnsibleModule('stateful_set_list', 'v1') 152 | except OpenShiftAnsibleException as exc: 153 | # The helper failed to init, so there is no module object. All we can do is raise the error. 154 | raise Exception(exc.message) 155 | 156 | try: 157 | module.execute_module() 158 | except OpenShiftAnsibleException as exc: 159 | module.fail_json(msg="Module failed!", error=str(exc)) 160 | 161 | 162 | if __name__ == '__main__': 163 | main() 164 | -------------------------------------------------------------------------------- /library/k8s_v1beta1_certificate_signing_request_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: k8s_v1beta1_certificate_signing_request_list 8 | short_description: Kubernetes CertificateSigningRequestList 9 | description: 10 | - Retrieve a list of certificate_signing_requests. List operations provide a snapshot 11 | read of the underlying objects, returning a resource_version representing a consistent 12 | version of the listed objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - kubernetes == 4.0.0 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | certificate_signing_request_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: [] 111 | type: list 112 | contains: 113 | api_version: 114 | description: 115 | - APIVersion defines the versioned schema of this representation of an object. 116 | Servers should convert recognized schemas to the latest internal value, 117 | and may reject unrecognized values. 118 | type: str 119 | kind: 120 | description: 121 | - Kind is a string value representing the REST resource this object represents. 122 | Servers may infer this from the endpoint the client submits requests to. 123 | Cannot be updated. In CamelCase. 124 | type: str 125 | metadata: 126 | description: [] 127 | type: complex 128 | spec: 129 | description: 130 | - The certificate request itself and any additional information. 131 | type: complex 132 | status: 133 | description: 134 | - Derived information about the request. 135 | type: complex 136 | kind: 137 | description: 138 | - Kind is a string value representing the REST resource this object represents. 139 | Servers may infer this from the endpoint the client submits requests to. Cannot 140 | be updated. In CamelCase. 141 | type: str 142 | metadata: 143 | description: [] 144 | type: complex 145 | ''' 146 | 147 | 148 | def main(): 149 | try: 150 | module = KubernetesAnsibleModule('certificate_signing_request_list', 'v1beta1') 151 | except KubernetesAnsibleException as exc: 152 | # The helper failed to init, so there is no module object. All we can do is raise the error. 153 | raise Exception(exc.message) 154 | 155 | try: 156 | module.execute_module() 157 | except KubernetesAnsibleException as exc: 158 | module.fail_json(msg="Module failed!", error=str(exc)) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/openshift_v1_project_list.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException 5 | 6 | DOCUMENTATION = ''' 7 | module: openshift_v1_project_list 8 | short_description: OpenShift ProjectList 9 | description: 10 | - Retrieve a list of projects. List operations provide a snapshot read of the underlying 11 | objects, returning a resource_version representing a consistent version of the listed 12 | objects. 13 | version_added: 2.3.0 14 | author: OpenShift (@openshift) 15 | options: 16 | api_key: 17 | description: 18 | - Token used to connect to the API. 19 | cert_file: 20 | description: 21 | - Path to a certificate used to authenticate with the API. 22 | type: path 23 | context: 24 | description: 25 | - The name of a context found in the Kubernetes config file. 26 | debug: 27 | description: 28 | - Enable debug output from the OpenShift helper. Logging info is written to KubeObjHelper.log 29 | default: false 30 | type: bool 31 | force: 32 | description: 33 | - If set to C(True), and I(state) is C(present), an existing object will updated, 34 | and lists will be replaced, rather than merged. 35 | default: false 36 | type: bool 37 | host: 38 | description: 39 | - Provide a URL for acessing the Kubernetes API. 40 | key_file: 41 | description: 42 | - Path to a key file used to authenticate with the API. 43 | type: path 44 | kubeconfig: 45 | description: 46 | - Path to an existing Kubernetes config file. If not provided, and no other connection 47 | options are provided, the openshift client will attempt to load the default 48 | configuration file from I(~/.kube/config.json). 49 | type: path 50 | password: 51 | description: 52 | - Provide a password for connecting to the API. Use in conjunction with I(username). 53 | resource_definition: 54 | description: 55 | - Provide the YAML definition for the object, bypassing any modules parameters 56 | intended to define object attributes. 57 | type: dict 58 | src: 59 | description: 60 | - Provide a path to a file containing the YAML definition of the object. Mutually 61 | exclusive with I(resource_definition). 62 | type: path 63 | ssl_ca_cert: 64 | description: 65 | - Path to a CA certificate used to authenticate with the API. 66 | type: path 67 | state: 68 | description: 69 | - Determines if an object should be created, patched, or deleted. When set to 70 | C(present), the object will be created, if it does not exist, or patched, if 71 | parameter values differ from the existing object's attributes, and deleted, 72 | if set to C(absent). A patch operation results in merging lists and updating 73 | dictionaries, with lists being merged into a unique set of values. If a list 74 | contains a dictionary with a I(name) or I(type) attribute, a strategic merge 75 | is performed, where individual elements with a matching I(name_) or I(type) 76 | are merged. To force the replacement of lists, set the I(force) option to C(True). 77 | default: present 78 | choices: 79 | - present 80 | - absent 81 | username: 82 | description: 83 | - Provide a username for connecting to the API. 84 | verify_ssl: 85 | description: 86 | - Whether or not to verify the API server's SSL certificates. 87 | type: bool 88 | requirements: 89 | - openshift == 0.4.0.a1 90 | ''' 91 | 92 | EXAMPLES = ''' 93 | ''' 94 | 95 | RETURN = ''' 96 | api_version: 97 | description: Requested API version 98 | type: string 99 | project_list: 100 | type: complex 101 | returned: when I(state) = C(present) 102 | contains: 103 | api_version: 104 | description: 105 | - APIVersion defines the versioned schema of this representation of an object. 106 | Servers should convert recognized schemas to the latest internal value, and 107 | may reject unrecognized values. 108 | type: str 109 | items: 110 | description: 111 | - Items is the list of projects 112 | type: list 113 | contains: 114 | api_version: 115 | description: 116 | - APIVersion defines the versioned schema of this representation of an object. 117 | Servers should convert recognized schemas to the latest internal value, 118 | and may reject unrecognized values. 119 | type: str 120 | kind: 121 | description: 122 | - Kind is a string value representing the REST resource this object represents. 123 | Servers may infer this from the endpoint the client submits requests to. 124 | Cannot be updated. In CamelCase. 125 | type: str 126 | metadata: 127 | description: 128 | - Standard object's metadata. 129 | type: complex 130 | spec: 131 | description: 132 | - Spec defines the behavior of the Namespace. 133 | type: complex 134 | status: 135 | description: 136 | - Status describes the current status of a Namespace 137 | type: complex 138 | kind: 139 | description: 140 | - Kind is a string value representing the REST resource this object represents. 141 | Servers may infer this from the endpoint the client submits requests to. Cannot 142 | be updated. In CamelCase. 143 | type: str 144 | metadata: 145 | description: 146 | - Standard object's metadata. 147 | type: complex 148 | ''' 149 | 150 | 151 | def main(): 152 | try: 153 | module = OpenShiftAnsibleModule('project_list', 'v1') 154 | except OpenShiftAnsibleException as exc: 155 | # The helper failed to init, so there is no module object. All we can do is raise the error. 156 | raise Exception(exc.message) 157 | 158 | try: 159 | module.execute_module() 160 | except OpenShiftAnsibleException as exc: 161 | module.fail_json(msg="Module failed!", error=str(exc)) 162 | 163 | 164 | if __name__ == '__main__': 165 | main() 166 | --------------------------------------------------------------------------------