mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-06-10 18:46:12 +00:00
Refreshed modules
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from ansible.module_utils.k8s_common import OpenShiftAnsibleModule, OpenShiftAnsibleException
|
||||
from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException
|
||||
|
||||
DOCUMENTATION = '''
|
||||
module: k8s_v1_persistent_volume_claim
|
||||
@@ -148,10 +148,19 @@ options:
|
||||
- Whether or not to verify the API server's SSL certificates.
|
||||
type: bool
|
||||
requirements:
|
||||
- openshift == 1.0.0-snapshot
|
||||
- kubernetes == 1.0.0
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Create persitent volume claim
|
||||
k8s_v1_persistent_volume_claim.yml:
|
||||
name: mypvc
|
||||
namespace: demo_project
|
||||
state: present
|
||||
access_modes:
|
||||
- ReadWriteOnce
|
||||
resources_requests:
|
||||
storage: 1Gi
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
@@ -420,17 +429,16 @@ persistent_volume_claim:
|
||||
|
||||
def main():
|
||||
try:
|
||||
module = OpenShiftAnsibleModule('persistent_volume_claim', 'V1')
|
||||
except OpenShiftAnsibleException as exc:
|
||||
module = KubernetesAnsibleModule('persistent_volume_claim', 'V1')
|
||||
except KubernetesAnsibleException as exc:
|
||||
# The helper failed to init, so there is no module object. All we can do is raise the error.
|
||||
raise Exception(exc.message)
|
||||
|
||||
try:
|
||||
module.execute_module()
|
||||
except OpenShiftAnsibleException as exc:
|
||||
except KubernetesAnsibleException as exc:
|
||||
module.fail_json(msg="Module failed!", error=str(exc))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user