mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Remove deprecated modules scheduled for removal in 3.0.0 (#1924)
* Remove deprecated modules scheduled for removal in 3.0.0. * Update BOTMETA. * Update ignore-2.12.txt. * Next release will be 3.0.0.
This commit is contained in:
parent
98af8161b2
commit
081c534d40
161 changed files with 167 additions and 10434 deletions
21
.github/BOTMETA.yml
vendored
21
.github/BOTMETA.yml
vendored
|
@ -186,8 +186,6 @@ files:
|
||||||
maintainers: glitchcrab
|
maintainers: glitchcrab
|
||||||
$modules/cloud/misc/cloud_init_data_facts.py:
|
$modules/cloud/misc/cloud_init_data_facts.py:
|
||||||
maintainers: resmo
|
maintainers: resmo
|
||||||
$modules/cloud/misc/helm.py:
|
|
||||||
maintainers: flaper87
|
|
||||||
$modules/cloud/misc/proxmox.py:
|
$modules/cloud/misc/proxmox.py:
|
||||||
maintainers: $team_virt UnderGreen
|
maintainers: $team_virt UnderGreen
|
||||||
labels: proxmox virt
|
labels: proxmox virt
|
||||||
|
@ -348,8 +346,6 @@ files:
|
||||||
maintainers: dagwieers magnus919 tbielawa cmprescott sm4rk0
|
maintainers: dagwieers magnus919 tbielawa cmprescott sm4rk0
|
||||||
labels: m:xml xml
|
labels: m:xml xml
|
||||||
ignore: magnus919
|
ignore: magnus919
|
||||||
$modules/identity/onepassword_facts.py:
|
|
||||||
maintainers: Rylon
|
|
||||||
$modules/identity/ipa/:
|
$modules/identity/ipa/:
|
||||||
maintainers: $team_ipa
|
maintainers: $team_ipa
|
||||||
$modules/identity/ipa/ipa_pwpolicy.py:
|
$modules/identity/ipa/ipa_pwpolicy.py:
|
||||||
|
@ -452,8 +448,6 @@ files:
|
||||||
maintainers: akostyuk
|
maintainers: akostyuk
|
||||||
$modules/net_tools/ipwcli_dns.py:
|
$modules/net_tools/ipwcli_dns.py:
|
||||||
maintainers: cwollinger
|
maintainers: cwollinger
|
||||||
$modules/net_tools/ldap/ldap_attr.py:
|
|
||||||
maintainers: jtyr
|
|
||||||
$modules/net_tools/ldap/ldap_attrs.py:
|
$modules/net_tools/ldap/ldap_attrs.py:
|
||||||
maintainers: drybjed jtyr noles
|
maintainers: drybjed jtyr noles
|
||||||
$modules/net_tools/ldap/ldap_entry.py:
|
$modules/net_tools/ldap/ldap_entry.py:
|
||||||
|
@ -718,8 +712,6 @@ files:
|
||||||
maintainers: evertmulder
|
maintainers: evertmulder
|
||||||
$modules/remote_management/manageiq/manageiq_tenant.py:
|
$modules/remote_management/manageiq/manageiq_tenant.py:
|
||||||
maintainers: evertmulder
|
maintainers: evertmulder
|
||||||
$modules/remote_management/oneview/oneview_datacenter_facts.py:
|
|
||||||
maintainers: aalexmonteiro madhav-bharadwaj ricardogpsf soodpr
|
|
||||||
$modules/remote_management/oneview/:
|
$modules/remote_management/oneview/:
|
||||||
maintainers: adriane-cardozo fgbulsoni tmiotto
|
maintainers: adriane-cardozo fgbulsoni tmiotto
|
||||||
$modules/remote_management/oneview/oneview_datacenter_info.py:
|
$modules/remote_management/oneview/oneview_datacenter_info.py:
|
||||||
|
@ -766,12 +758,6 @@ files:
|
||||||
maintainers: yeukhon
|
maintainers: yeukhon
|
||||||
$modules/storage/emc/emc_vnx_sg_member.py:
|
$modules/storage/emc/emc_vnx_sg_member.py:
|
||||||
maintainers: remixtj
|
maintainers: remixtj
|
||||||
$modules/storage/glusterfs/:
|
|
||||||
maintainers: devyanikota
|
|
||||||
$modules/storage/glusterfs/gluster_peer.py:
|
|
||||||
maintainers: sac
|
|
||||||
$modules/storage/glusterfs/gluster_volume.py:
|
|
||||||
maintainers: rosmo
|
|
||||||
$modules/storage/hpe3par/ss_3par_cpg.py:
|
$modules/storage/hpe3par/ss_3par_cpg.py:
|
||||||
maintainers: farhan7500 gautamphegde
|
maintainers: farhan7500 gautamphegde
|
||||||
$modules/storage/ibm/:
|
$modules/storage/ibm/:
|
||||||
|
@ -793,9 +779,6 @@ files:
|
||||||
maintainers: johanwiren
|
maintainers: johanwiren
|
||||||
$modules/storage/zfs/zfs_delegate_admin.py:
|
$modules/storage/zfs/zfs_delegate_admin.py:
|
||||||
maintainers: natefoo
|
maintainers: natefoo
|
||||||
$modules/system/python_requirements_facts.py:
|
|
||||||
maintainers: willthames
|
|
||||||
ignore: ryansb
|
|
||||||
$modules/system/aix:
|
$modules/system/aix:
|
||||||
maintainers: $team_aix
|
maintainers: $team_aix
|
||||||
labels: aix
|
labels: aix
|
||||||
|
@ -926,10 +909,6 @@ files:
|
||||||
labels: xfconf
|
labels: xfconf
|
||||||
$modules/system/xfs_quota.py:
|
$modules/system/xfs_quota.py:
|
||||||
maintainers: bushvin
|
maintainers: bushvin
|
||||||
$modules/web_infrastructure/jenkins_job_facts.py:
|
|
||||||
maintainers: stpierre
|
|
||||||
$modules/web_infrastructure/nginx_status_facts.py:
|
|
||||||
maintainers: resmo
|
|
||||||
$modules/web_infrastructure/apache2_mod_proxy.py:
|
$modules/web_infrastructure/apache2_mod_proxy.py:
|
||||||
maintainers: oboukili
|
maintainers: oboukili
|
||||||
$modules/web_infrastructure/apache2_module.py:
|
$modules/web_infrastructure/apache2_module.py:
|
||||||
|
|
66
changelogs/fragments/remove-deprecated-modules.yml
Normal file
66
changelogs/fragments/remove-deprecated-modules.yml
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
removed_features:
|
||||||
|
- "The deprecated ali_instance_facts module has been removed. Use ali_instance_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated hpilo_facts module has been removed. Use hpilo_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated idrac_redfish_facts module has been removed. Use idrac_redfish_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated jenkins_job_facts module has been removed. Use jenkins_job_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated memset_memstore_facts module has been removed. Use memset_memstore_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated memset_server_facts module has been removed. Use memset_server_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated na_ontap_gather_facts module has been removed. Use netapp.ontap.na_ontap_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated nginx_status_facts module has been removed. Use nginx_status_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated one_image_facts module has been removed. Use one_image_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated onepassword_facts module has been removed. Use onepassword_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_datacenter_facts module has been removed. Use oneview_datacenter_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_enclosure_facts module has been removed. Use oneview_enclosure_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_ethernet_network_facts module has been removed. Use oneview_ethernet_network_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_fc_network_facts module has been removed. Use oneview_fc_network_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_fcoe_network_facts module has been removed. Use oneview_fcoe_network_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_logical_interconnect_group_facts module has been removed. Use oneview_logical_interconnect_group_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_network_set_facts module has been removed. Use oneview_network_set_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated oneview_san_manager_facts module has been removed. Use oneview_san_manager_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated online_server_facts module has been removed. Use online_server_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated online_user_facts module has been removed. Use online_user_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated purefa_facts module has been removed. Use purestorage.flasharray.purefa_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated purefb_facts module has been removed. Use purestorage.flasharray.purefb_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated python_requirements_facts module has been removed. Use python_requirements_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated redfish_facts module has been removed. Use redfish_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated scaleway_image_facts module has been removed. Use scaleway_image_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated scaleway_ip_facts module has been removed. Use scaleway_ip_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated scaleway_organization_facts module has been removed. Use scaleway_organization_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated scaleway_security_group_facts module has been removed. Use scaleway_security_group_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated scaleway_server_facts module has been removed. Use scaleway_server_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated scaleway_snapshot_facts module has been removed. Use scaleway_snapshot_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated scaleway_volume_facts module has been removed. Use scaleway_volume_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated smartos_image_facts module has been removed. Use smartos_image_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated vertica_facts module has been removed. Use vertica_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated xenserver_guest_facts module has been removed. Use xenserver_guest_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt module has been removed. Use ovirt.ovirt.ovirt_vm instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_affinity_label_facts module has been removed. Use ovirt.ovirt.ovirt_affinity_label_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_api_facts module has been removed. Use ovirt.ovirt.ovirt_api_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_cluster_facts module has been removed. Use ovirt.ovirt.ovirt_cluster_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_datacenter_facts module has been removed. Use ovirt.ovirt.ovirt_datacenter_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_disk_facts module has been removed. Use ovirt.ovirt.ovirt_disk_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_event_facts module has been removed. Use ovirt.ovirt.ovirt_event_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_external_provider_facts module has been removed. Use ovirt.ovirt.ovirt_external_provider_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_group_facts module has been removed. Use ovirt.ovirt.ovirt_group_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_host_facts module has been removed. Use ovirt.ovirt.ovirt_host_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_host_storage_facts module has been removed. Use ovirt.ovirt.ovirt_host_storage_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_network_facts module has been removed. Use ovirt.ovirt.ovirt_network_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_nic_facts module has been removed. Use ovirt.ovirt.ovirt_nic_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_permission_facts module has been removed. Use ovirt.ovirt.ovirt_permission_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_quota_facts module has been removed. Use ovirt.ovirt.ovirt_quota_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_scheduling_policy_facts module has been removed. Use ovirt.ovirt.ovirt_scheduling_policy_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_snapshot_facts module has been removed. Use ovirt.ovirt.ovirt_snapshot_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_storage_domain_facts module has been removed. Use ovirt.ovirt.ovirt_storage_domain_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_storage_template_facts module has been removed. Use ovirt.ovirt.ovirt_storage_template_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_storage_vm_facts module has been removed. Use ovirt.ovirt.ovirt_storage_vm_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_tag_facts module has been removed. Use ovirt.ovirt.ovirt_tag_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_template_facts module has been removed. Use ovirt.ovirt.ovirt_template_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_user_facts module has been removed. Use ovirt.ovirt.ovirt_user_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_vm_facts module has been removed. Use ovirt.ovirt.ovirt_vm_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ovirt_vmpool_facts module has been removed. Use ovirt.ovirt.ovirt_vmpool_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The ovirt_facts docs fragment has been removed (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated gluster_heal_info module has been removed. Use gluster.gluster.gluster_heal_info instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated gluster_peer module has been removed. Use gluster.gluster.gluster_peer instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated gluster_volume module has been removed. Use gluster.gluster.gluster_volume instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated helm module has been removed. Use community.kubernetes.helm instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
||||||
|
- "The deprecated ldap_attr module has been removed. Use ldap_attrs instead (https://github.com/ansible-collections/community.general/pull/1924)."
|
|
@ -1,6 +1,6 @@
|
||||||
namespace: community
|
namespace: community
|
||||||
name: general
|
name: general
|
||||||
version: 2.5.0
|
version: 3.0.0
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- Ansible (https://github.com/ansible)
|
- Ansible (https://github.com/ansible)
|
||||||
|
|
156
meta/runtime.yml
156
meta/runtime.yml
|
@ -39,7 +39,7 @@ plugin_routing:
|
||||||
redirect: community.hashi_vault.hashi_vault
|
redirect: community.hashi_vault.hashi_vault
|
||||||
modules:
|
modules:
|
||||||
ali_instance_facts:
|
ali_instance_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.ali_instance_info instead.
|
warning_text: Use community.general.ali_instance_info instead.
|
||||||
docker_compose:
|
docker_compose:
|
||||||
|
@ -159,8 +159,7 @@ plugin_routing:
|
||||||
gcpubsub_info:
|
gcpubsub_info:
|
||||||
redirect: community.google.gcpubsub_info
|
redirect: community.google.gcpubsub_info
|
||||||
gcpubsub_facts:
|
gcpubsub_facts:
|
||||||
redirect: community.google.gcpubsub_info
|
tombstone:
|
||||||
deprecation:
|
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.google.gcpubsub_info instead.
|
warning_text: Use community.google.gcpubsub_info instead.
|
||||||
gcspanner:
|
gcspanner:
|
||||||
|
@ -171,22 +170,23 @@ plugin_routing:
|
||||||
tombstone:
|
tombstone:
|
||||||
removal_version: 2.0.0
|
removal_version: 2.0.0
|
||||||
warning_text: Use community.general.github_webhook and community.general.github_webhook_info instead.
|
warning_text: Use community.general.github_webhook and community.general.github_webhook_info instead.
|
||||||
gluster_heal_info:
|
# Adding tombstones burns the old name, so we simply remove the entries:
|
||||||
deprecation:
|
# gluster_heal_info:
|
||||||
removal_version: 3.0.0
|
# tombstone:
|
||||||
warning_text: The gluster modules have migrated to the gluster.gluster collection. Use gluster.gluster.gluster_heal_info instead.
|
# removal_version: 3.0.0
|
||||||
gluster_peer:
|
# warning_text: The gluster modules have migrated to the gluster.gluster collection. Use gluster.gluster.gluster_heal_info instead.
|
||||||
deprecation:
|
# gluster_peer:
|
||||||
removal_version: 3.0.0
|
# tombstone:
|
||||||
warning_text: The gluster modules have migrated to the gluster.gluster collection. Use gluster.gluster.gluster_peer instead.
|
# removal_version: 3.0.0
|
||||||
gluster_volume:
|
# warning_text: The gluster modules have migrated to the gluster.gluster collection. Use gluster.gluster.gluster_peer instead.
|
||||||
deprecation:
|
# gluster_volume:
|
||||||
removal_version: 3.0.0
|
# tombstone:
|
||||||
warning_text: The gluster modules have migrated to the gluster.gluster collection. Use gluster.gluster.gluster_volume instead.
|
# removal_version: 3.0.0
|
||||||
helm:
|
# warning_text: The gluster modules have migrated to the gluster.gluster collection. Use gluster.gluster.gluster_volume instead.
|
||||||
deprecation:
|
# helm:
|
||||||
removal_version: 3.0.0
|
# tombstone:
|
||||||
warning_text: The helm module in community.general has been deprecated. Use community.kubernetes.helm instead.
|
# removal_version: 3.0.0
|
||||||
|
# warning_text: Use community.kubernetes.helm instead.
|
||||||
hetzner_failover_ip:
|
hetzner_failover_ip:
|
||||||
redirect: community.hrobot.failover_ip
|
redirect: community.hrobot.failover_ip
|
||||||
hetzner_failover_ip_info:
|
hetzner_failover_ip_info:
|
||||||
|
@ -196,19 +196,19 @@ plugin_routing:
|
||||||
hetzner_firewall_info:
|
hetzner_firewall_info:
|
||||||
redirect: community.hrobot.firewall_info
|
redirect: community.hrobot.firewall_info
|
||||||
hpilo_facts:
|
hpilo_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.hpilo_info instead.
|
warning_text: Use community.general.hpilo_info instead.
|
||||||
idrac_firmware:
|
idrac_firmware:
|
||||||
redirect: dellemc.openmanage.idrac_firmware
|
redirect: dellemc.openmanage.idrac_firmware
|
||||||
idrac_redfish_facts:
|
idrac_redfish_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.idrac_redfish_info instead.
|
warning_text: Use community.general.idrac_redfish_info instead.
|
||||||
idrac_server_config_profile:
|
idrac_server_config_profile:
|
||||||
redirect: dellemc.openmanage.idrac_server_config_profile
|
redirect: dellemc.openmanage.idrac_server_config_profile
|
||||||
jenkins_job_facts:
|
jenkins_job_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.jenkins_job_info instead.
|
warning_text: Use community.general.jenkins_job_info instead.
|
||||||
katello:
|
katello:
|
||||||
|
@ -228,7 +228,7 @@ plugin_routing:
|
||||||
kubevirt_vm:
|
kubevirt_vm:
|
||||||
redirect: community.kubevirt.kubevirt_vm
|
redirect: community.kubevirt.kubevirt_vm
|
||||||
ldap_attr:
|
ldap_attr:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.ldap_attrs instead.
|
warning_text: Use community.general.ldap_attrs instead.
|
||||||
logicmonitor:
|
logicmonitor:
|
||||||
|
@ -240,11 +240,11 @@ plugin_routing:
|
||||||
removal_version: 1.0.0
|
removal_version: 1.0.0
|
||||||
warning_text: The logicmonitor_facts module is no longer maintained and the API used has been disabled in 2017.
|
warning_text: The logicmonitor_facts module is no longer maintained and the API used has been disabled in 2017.
|
||||||
memset_memstore_facts:
|
memset_memstore_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.memset_memstore_info instead.
|
warning_text: Use community.general.memset_memstore_info instead.
|
||||||
memset_server_facts:
|
memset_server_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.memset_server_info instead.
|
warning_text: Use community.general.memset_server_info instead.
|
||||||
na_cdot_aggregate:
|
na_cdot_aggregate:
|
||||||
|
@ -280,161 +280,161 @@ plugin_routing:
|
||||||
removal_version: 2.0.0
|
removal_version: 2.0.0
|
||||||
warning_text: Use netapp.ontap.na_ontap_volume instead.
|
warning_text: Use netapp.ontap.na_ontap_volume instead.
|
||||||
na_ontap_gather_facts:
|
na_ontap_gather_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use netapp.ontap.na_ontap_info instead.
|
warning_text: Use netapp.ontap.na_ontap_info instead.
|
||||||
nginx_status_facts:
|
nginx_status_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.nginx_status_info instead.
|
warning_text: Use community.general.nginx_status_info instead.
|
||||||
ome_device_info:
|
ome_device_info:
|
||||||
redirect: dellemc.openmanage.ome_device_info
|
redirect: dellemc.openmanage.ome_device_info
|
||||||
one_image_facts:
|
one_image_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.one_image_info instead.
|
warning_text: Use community.general.one_image_info instead.
|
||||||
onepassword_facts:
|
onepassword_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.onepassword_info instead.
|
warning_text: Use community.general.onepassword_info instead.
|
||||||
oneview_datacenter_facts:
|
oneview_datacenter_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_datacenter_info instead.
|
warning_text: Use community.general.oneview_datacenter_info instead.
|
||||||
oneview_enclosure_facts:
|
oneview_enclosure_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_enclosure_info instead.
|
warning_text: Use community.general.oneview_enclosure_info instead.
|
||||||
oneview_ethernet_network_facts:
|
oneview_ethernet_network_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_ethernet_network_info instead.
|
warning_text: Use community.general.oneview_ethernet_network_info instead.
|
||||||
oneview_fc_network_facts:
|
oneview_fc_network_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_fc_network_info instead.
|
warning_text: Use community.general.oneview_fc_network_info instead.
|
||||||
oneview_fcoe_network_facts:
|
oneview_fcoe_network_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_fcoe_network_info instead.
|
warning_text: Use community.general.oneview_fcoe_network_info instead.
|
||||||
oneview_logical_interconnect_group_facts:
|
oneview_logical_interconnect_group_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_logical_interconnect_group_info instead.
|
warning_text: Use community.general.oneview_logical_interconnect_group_info instead.
|
||||||
oneview_network_set_facts:
|
oneview_network_set_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_network_set_info instead.
|
warning_text: Use community.general.oneview_network_set_info instead.
|
||||||
oneview_san_manager_facts:
|
oneview_san_manager_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.oneview_san_manager_info instead.
|
warning_text: Use community.general.oneview_san_manager_info instead.
|
||||||
online_server_facts:
|
online_server_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.online_server_info instead.
|
warning_text: Use community.general.online_server_info instead.
|
||||||
online_user_facts:
|
online_user_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.online_user_info instead.
|
warning_text: Use community.general.online_user_info instead.
|
||||||
ovirt:
|
ovirt:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_vm instead.
|
warning_text: Use ovirt.ovirt.ovirt_vm instead.
|
||||||
ovirt_affinity_label_facts:
|
ovirt_affinity_label_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_affinity_label_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_affinity_label_info instead.
|
||||||
ovirt_api_facts:
|
ovirt_api_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_api_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_api_info instead.
|
||||||
ovirt_cluster_facts:
|
ovirt_cluster_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_cluster_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_cluster_info instead.
|
||||||
ovirt_datacenter_facts:
|
ovirt_datacenter_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_datacenter_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_datacenter_info instead.
|
||||||
ovirt_disk_facts:
|
ovirt_disk_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_disk_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_disk_info instead.
|
||||||
ovirt_event_facts:
|
ovirt_event_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_event_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_event_info instead.
|
||||||
ovirt_external_provider_facts:
|
ovirt_external_provider_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_external_provider_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_external_provider_info instead.
|
||||||
ovirt_group_facts:
|
ovirt_group_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_group_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_group_info instead.
|
||||||
ovirt_host_facts:
|
ovirt_host_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_host_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_host_info instead.
|
||||||
ovirt_host_storage_facts:
|
ovirt_host_storage_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_host_storage_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_host_storage_info instead.
|
||||||
ovirt_network_facts:
|
ovirt_network_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_network_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_network_info instead.
|
||||||
ovirt_nic_facts:
|
ovirt_nic_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_nic_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_nic_info instead.
|
||||||
ovirt_permission_facts:
|
ovirt_permission_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_permission_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_permission_info instead.
|
||||||
ovirt_quota_facts:
|
ovirt_quota_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_quota_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_quota_info instead.
|
||||||
ovirt_scheduling_policy_facts:
|
ovirt_scheduling_policy_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_scheduling_policy_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_scheduling_policy_info instead.
|
||||||
ovirt_snapshot_facts:
|
ovirt_snapshot_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_snapshot_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_snapshot_info instead.
|
||||||
ovirt_storage_domain_facts:
|
ovirt_storage_domain_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_storage_domain_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_storage_domain_info instead.
|
||||||
ovirt_storage_template_facts:
|
ovirt_storage_template_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_storage_template_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_storage_template_info instead.
|
||||||
ovirt_storage_vm_facts:
|
ovirt_storage_vm_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_storage_vm_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_storage_vm_info instead.
|
||||||
ovirt_tag_facts:
|
ovirt_tag_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_tag_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_tag_info instead.
|
||||||
ovirt_template_facts:
|
ovirt_template_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_template_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_template_info instead.
|
||||||
ovirt_user_facts:
|
ovirt_user_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_user_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_user_info instead.
|
||||||
ovirt_vm_facts:
|
ovirt_vm_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_vm_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_vm_info instead.
|
||||||
ovirt_vmpool_facts:
|
ovirt_vmpool_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use ovirt.ovirt.ovirt_vmpool_info instead.
|
warning_text: Use ovirt.ovirt.ovirt_vmpool_info instead.
|
||||||
postgresql_copy:
|
postgresql_copy:
|
||||||
|
@ -482,47 +482,47 @@ plugin_routing:
|
||||||
postgresql_user:
|
postgresql_user:
|
||||||
redirect: community.postgresql.postgresql_user
|
redirect: community.postgresql.postgresql_user
|
||||||
purefa_facts:
|
purefa_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use purestorage.flasharray.purefa_info instead.
|
warning_text: Use purestorage.flasharray.purefa_info instead.
|
||||||
purefb_facts:
|
purefb_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use purestorage.flashblade.purefb_info instead.
|
warning_text: Use purestorage.flashblade.purefb_info instead.
|
||||||
python_requirements_facts:
|
python_requirements_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.python_requirements_info instead.
|
warning_text: Use community.general.python_requirements_info instead.
|
||||||
redfish_facts:
|
redfish_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.redfish_info instead.
|
warning_text: Use community.general.redfish_info instead.
|
||||||
scaleway_image_facts:
|
scaleway_image_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.scaleway_image_info instead.
|
warning_text: Use community.general.scaleway_image_info instead.
|
||||||
scaleway_ip_facts:
|
scaleway_ip_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.scaleway_ip_info instead.
|
warning_text: Use community.general.scaleway_ip_info instead.
|
||||||
scaleway_organization_facts:
|
scaleway_organization_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.scaleway_organization_info instead.
|
warning_text: Use community.general.scaleway_organization_info instead.
|
||||||
scaleway_security_group_facts:
|
scaleway_security_group_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.scaleway_security_group_info instead.
|
warning_text: Use community.general.scaleway_security_group_info instead.
|
||||||
scaleway_server_facts:
|
scaleway_server_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.scaleway_server_info instead.
|
warning_text: Use community.general.scaleway_server_info instead.
|
||||||
scaleway_snapshot_facts:
|
scaleway_snapshot_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.scaleway_snapshot_info instead.
|
warning_text: Use community.general.scaleway_snapshot_info instead.
|
||||||
scaleway_volume_facts:
|
scaleway_volume_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.scaleway_volume_info instead.
|
warning_text: Use community.general.scaleway_volume_info instead.
|
||||||
sf_account_manager:
|
sf_account_manager:
|
||||||
|
@ -546,15 +546,15 @@ plugin_routing:
|
||||||
removal_version: 2.0.0
|
removal_version: 2.0.0
|
||||||
warning_text: Use netapp.elementsw.na_elementsw_volume instead.
|
warning_text: Use netapp.elementsw.na_elementsw_volume instead.
|
||||||
smartos_image_facts:
|
smartos_image_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.smartos_image_info instead.
|
warning_text: Use community.general.smartos_image_info instead.
|
||||||
vertica_facts:
|
vertica_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.vertica_info instead.
|
warning_text: Use community.general.vertica_info instead.
|
||||||
xenserver_guest_facts:
|
xenserver_guest_facts:
|
||||||
deprecation:
|
tombstone:
|
||||||
removal_version: 3.0.0
|
removal_version: 3.0.0
|
||||||
warning_text: Use community.general.xenserver_guest_info instead.
|
warning_text: Use community.general.xenserver_guest_info instead.
|
||||||
doc_fragments:
|
doc_fragments:
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Copyright: (c) 2016, Red Hat, Inc.
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
|
||||||
|
|
||||||
# info standard oVirt documentation fragment
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
options:
|
|
||||||
fetch_nested:
|
|
||||||
description:
|
|
||||||
- If I(yes) the module will fetch additional data from the API.
|
|
||||||
- It will fetch only IDs of nested entity. It doesn't fetch multiple levels of nested attributes.
|
|
||||||
Only the attributes of the current entity. User can configure to fetch other
|
|
||||||
attributes of the nested entities by specifying C(nested_attributes).
|
|
||||||
type: bool
|
|
||||||
default: false
|
|
||||||
nested_attributes:
|
|
||||||
description:
|
|
||||||
- Specifies list of the attributes which should be fetched from the API.
|
|
||||||
- This parameter apply only when C(fetch_nested) is I(true).
|
|
||||||
type: list
|
|
||||||
auth:
|
|
||||||
description:
|
|
||||||
- "Dictionary with values needed to create HTTP/HTTPS connection to oVirt:"
|
|
||||||
- C(username)[I(required)] - The name of the user, something like I(admin@internal).
|
|
||||||
Default value is set by I(OVIRT_USERNAME) environment variable.
|
|
||||||
- "C(password)[I(required)] - The password of the user. Default value is set by I(OVIRT_PASSWORD) environment variable."
|
|
||||||
- "C(url)- A string containing the API URL of the server, usually
|
|
||||||
something like `I(https://server.example.com/ovirt-engine/api)`. Default value is set by I(OVIRT_URL) environment variable.
|
|
||||||
Either C(url) or C(hostname) is required."
|
|
||||||
- "C(hostname) - A string containing the hostname of the server, usually
|
|
||||||
something like `I(server.example.com)`. Default value is set by I(OVIRT_HOSTNAME) environment variable.
|
|
||||||
Either C(url) or C(hostname) is required."
|
|
||||||
- "C(token) - Token to be used instead of login with username/password. Default value is set by I(OVIRT_TOKEN) environment variable."
|
|
||||||
- "C(insecure) - A boolean flag that indicates if the server TLS
|
|
||||||
certificate and host name should be checked."
|
|
||||||
- "C(ca_file) - A PEM file containing the trusted CA certificates. The
|
|
||||||
certificate presented by the server will be verified using these CA
|
|
||||||
certificates. If `C(ca_file)` parameter is not set, system wide
|
|
||||||
CA certificate store is used. Default value is set by I(OVIRT_CAFILE) environment variable."
|
|
||||||
- "C(kerberos) - A boolean flag indicating if Kerberos authentication
|
|
||||||
should be used instead of the default basic authentication."
|
|
||||||
- "C(headers) - Dictionary of HTTP headers to be added to each API call."
|
|
||||||
type: dict
|
|
||||||
required: true
|
|
||||||
requirements:
|
|
||||||
- python >= 2.7
|
|
||||||
- ovirt-engine-sdk-python >= 4.3.0
|
|
||||||
notes:
|
|
||||||
- "In order to use this module you have to install oVirt Python SDK.
|
|
||||||
To ensure it's installed with correct version you can create the following task:
|
|
||||||
ansible.builtin.pip: name=ovirt-engine-sdk-python version=4.3.0"
|
|
||||||
'''
|
|
|
@ -1,871 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
import inspect
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
|
|
||||||
from abc import ABCMeta, abstractmethod
|
|
||||||
from datetime import datetime
|
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.cloud import CloudRetry
|
|
||||||
from ansible.module_utils.common._collections_compat import Mapping
|
|
||||||
|
|
||||||
try:
|
|
||||||
from enum import Enum # enum is a ovirtsdk4 requirement
|
|
||||||
import ovirtsdk4 as sdk
|
|
||||||
import ovirtsdk4.version as sdk_version
|
|
||||||
import ovirtsdk4.types as otypes
|
|
||||||
HAS_SDK = LooseVersion(sdk_version.VERSION) >= LooseVersion('4.3.0')
|
|
||||||
except ImportError:
|
|
||||||
HAS_SDK = False
|
|
||||||
|
|
||||||
|
|
||||||
BYTES_MAP = {
|
|
||||||
'kib': 2**10,
|
|
||||||
'mib': 2**20,
|
|
||||||
'gib': 2**30,
|
|
||||||
'tib': 2**40,
|
|
||||||
'pib': 2**50,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def check_sdk(module):
|
|
||||||
if not HAS_SDK:
|
|
||||||
module.fail_json(
|
|
||||||
msg='ovirtsdk4 version 4.3.0 or higher is required for this module'
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_dict_of_struct(struct, connection=None, fetch_nested=False, attributes=None):
|
|
||||||
"""
|
|
||||||
Convert SDK Struct type into dictionary.
|
|
||||||
"""
|
|
||||||
res = {}
|
|
||||||
|
|
||||||
def resolve_href(value):
|
|
||||||
# Fetch nested values of struct:
|
|
||||||
try:
|
|
||||||
value = connection.follow_link(value)
|
|
||||||
except sdk.Error:
|
|
||||||
value = None
|
|
||||||
nested_obj = dict(
|
|
||||||
(attr, convert_value(getattr(value, attr)))
|
|
||||||
for attr in attributes if getattr(value, attr, None) is not None
|
|
||||||
)
|
|
||||||
nested_obj['id'] = getattr(value, 'id', None)
|
|
||||||
nested_obj['href'] = getattr(value, 'href', None)
|
|
||||||
return nested_obj
|
|
||||||
|
|
||||||
def remove_underscore(val):
|
|
||||||
if val.startswith('_'):
|
|
||||||
val = val[1:]
|
|
||||||
remove_underscore(val)
|
|
||||||
return val
|
|
||||||
|
|
||||||
def convert_value(value):
|
|
||||||
nested = False
|
|
||||||
|
|
||||||
if isinstance(value, sdk.Struct):
|
|
||||||
if not fetch_nested or not value.href:
|
|
||||||
return get_dict_of_struct(value)
|
|
||||||
return resolve_href(value)
|
|
||||||
|
|
||||||
elif isinstance(value, Enum) or isinstance(value, datetime):
|
|
||||||
return str(value)
|
|
||||||
elif isinstance(value, list) or isinstance(value, sdk.List):
|
|
||||||
if isinstance(value, sdk.List) and fetch_nested and value.href:
|
|
||||||
try:
|
|
||||||
value = connection.follow_link(value)
|
|
||||||
nested = True
|
|
||||||
except sdk.Error:
|
|
||||||
value = []
|
|
||||||
|
|
||||||
ret = []
|
|
||||||
for i in value:
|
|
||||||
if isinstance(i, sdk.Struct):
|
|
||||||
if not nested and fetch_nested and i.href:
|
|
||||||
ret.append(resolve_href(i))
|
|
||||||
elif not nested:
|
|
||||||
ret.append(get_dict_of_struct(i))
|
|
||||||
else:
|
|
||||||
nested_obj = dict(
|
|
||||||
(attr, convert_value(getattr(i, attr)))
|
|
||||||
for attr in attributes if getattr(i, attr, None)
|
|
||||||
)
|
|
||||||
nested_obj['id'] = getattr(i, 'id', None)
|
|
||||||
ret.append(nested_obj)
|
|
||||||
elif isinstance(i, Enum):
|
|
||||||
ret.append(str(i))
|
|
||||||
else:
|
|
||||||
ret.append(i)
|
|
||||||
return ret
|
|
||||||
else:
|
|
||||||
return value
|
|
||||||
|
|
||||||
if struct is not None:
|
|
||||||
for key, value in struct.__dict__.items():
|
|
||||||
if value is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
key = remove_underscore(key)
|
|
||||||
res[key] = convert_value(value)
|
|
||||||
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
def engine_version(connection):
|
|
||||||
"""
|
|
||||||
Return string representation of oVirt engine version.
|
|
||||||
"""
|
|
||||||
engine_api = connection.system_service().get()
|
|
||||||
engine_version = engine_api.product_info.version
|
|
||||||
return '%s.%s' % (engine_version.major, engine_version.minor)
|
|
||||||
|
|
||||||
|
|
||||||
def create_connection(auth):
|
|
||||||
"""
|
|
||||||
Create a connection to Python SDK, from task `auth` parameter.
|
|
||||||
If user doesnt't have SSO token the `auth` dictionary has following parameters mandatory:
|
|
||||||
url, username, password
|
|
||||||
|
|
||||||
If user has SSO token the `auth` dictionary has following parameters mandatory:
|
|
||||||
url, token
|
|
||||||
|
|
||||||
The `ca_file` parameter is mandatory in case user want to use secure connection,
|
|
||||||
in case user want to use insecure connection, it's mandatory to send insecure=True.
|
|
||||||
|
|
||||||
:param auth: dictionary which contains needed values for connection creation
|
|
||||||
:return: Python SDK connection
|
|
||||||
"""
|
|
||||||
|
|
||||||
url = auth.get('url')
|
|
||||||
if url is None and auth.get('hostname') is not None:
|
|
||||||
url = 'https://{0}/ovirt-engine/api'.format(auth.get('hostname'))
|
|
||||||
|
|
||||||
return sdk.Connection(
|
|
||||||
url=url,
|
|
||||||
username=auth.get('username'),
|
|
||||||
password=auth.get('password'),
|
|
||||||
ca_file=auth.get('ca_file', None),
|
|
||||||
insecure=auth.get('insecure', False),
|
|
||||||
token=auth.get('token', None),
|
|
||||||
kerberos=auth.get('kerberos', None),
|
|
||||||
headers=auth.get('headers', None),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def convert_to_bytes(param):
|
|
||||||
"""
|
|
||||||
This method convert units to bytes, which follow IEC standard.
|
|
||||||
|
|
||||||
:param param: value to be converted
|
|
||||||
"""
|
|
||||||
if param is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Get rid of whitespaces:
|
|
||||||
param = ''.join(param.split())
|
|
||||||
|
|
||||||
# Convert to bytes:
|
|
||||||
if len(param) > 3 and param[-3].lower() in ['k', 'm', 'g', 't', 'p']:
|
|
||||||
return int(param[:-3]) * BYTES_MAP.get(param[-3:].lower(), 1)
|
|
||||||
elif param.isdigit():
|
|
||||||
return int(param) * 2**10
|
|
||||||
else:
|
|
||||||
raise ValueError(
|
|
||||||
"Unsupported value(IEC supported): '{value}'".format(value=param)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def follow_link(connection, link):
|
|
||||||
"""
|
|
||||||
This method returns the entity of the element which link points to.
|
|
||||||
|
|
||||||
:param connection: connection to the Python SDK
|
|
||||||
:param link: link of the entity
|
|
||||||
:return: entity which link points to
|
|
||||||
"""
|
|
||||||
|
|
||||||
if link:
|
|
||||||
return connection.follow_link(link)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def get_link_name(connection, link):
|
|
||||||
"""
|
|
||||||
This method returns the name of the element which link points to.
|
|
||||||
|
|
||||||
:param connection: connection to the Python SDK
|
|
||||||
:param link: link of the entity
|
|
||||||
:return: name of the entity, which link points to
|
|
||||||
"""
|
|
||||||
|
|
||||||
if link:
|
|
||||||
return connection.follow_link(link).name
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def equal(param1, param2, ignore_case=False):
|
|
||||||
"""
|
|
||||||
Compare two parameters and return if they are equal.
|
|
||||||
This parameter doesn't run equal operation if first parameter is None.
|
|
||||||
With this approach we don't run equal operation in case user don't
|
|
||||||
specify parameter in their task.
|
|
||||||
|
|
||||||
:param param1: user inputted parameter
|
|
||||||
:param param2: value of entity parameter
|
|
||||||
:return: True if parameters are equal or first parameter is None, otherwise False
|
|
||||||
"""
|
|
||||||
if param1 is not None:
|
|
||||||
if ignore_case:
|
|
||||||
return param1.lower() == param2.lower()
|
|
||||||
return param1 == param2
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def search_by_attributes(service, list_params=None, **kwargs):
|
|
||||||
"""
|
|
||||||
Search for the entity by attributes. Nested entities don't support search
|
|
||||||
via REST, so in case using search for nested entity we return all entities
|
|
||||||
and filter them by specified attributes.
|
|
||||||
"""
|
|
||||||
list_params = list_params or {}
|
|
||||||
# Check if 'list' method support search(look for search parameter):
|
|
||||||
if 'search' in inspect.getargspec(service.list)[0]:
|
|
||||||
res = service.list(
|
|
||||||
# There must be double quotes around name, because some oVirt resources it's possible to create then with space in name.
|
|
||||||
search=' and '.join('{0}="{1}"'.format(k, v) for k, v in kwargs.items()),
|
|
||||||
**list_params
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
res = [
|
|
||||||
e for e in service.list(**list_params) if len([
|
|
||||||
k for k, v in kwargs.items() if getattr(e, k, None) == v
|
|
||||||
]) == len(kwargs)
|
|
||||||
]
|
|
||||||
|
|
||||||
res = res or [None]
|
|
||||||
return res[0]
|
|
||||||
|
|
||||||
|
|
||||||
def search_by_name(service, name, **kwargs):
|
|
||||||
"""
|
|
||||||
Search for the entity by its name. Nested entities don't support search
|
|
||||||
via REST, so in case using search for nested entity we return all entities
|
|
||||||
and filter them by name.
|
|
||||||
|
|
||||||
:param service: service of the entity
|
|
||||||
:param name: name of the entity
|
|
||||||
:return: Entity object returned by Python SDK
|
|
||||||
"""
|
|
||||||
# Check if 'list' method support search(look for search parameter):
|
|
||||||
if 'search' in inspect.getargspec(service.list)[0]:
|
|
||||||
res = service.list(
|
|
||||||
# There must be double quotes around name, because some oVirt resources it's possible to create then with space in name.
|
|
||||||
search='name="{name}"'.format(name=name)
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
res = [e for e in service.list() if e.name == name]
|
|
||||||
|
|
||||||
if kwargs:
|
|
||||||
res = [
|
|
||||||
e for e in service.list() if len([
|
|
||||||
k for k, v in kwargs.items() if getattr(e, k, None) == v
|
|
||||||
]) == len(kwargs)
|
|
||||||
]
|
|
||||||
|
|
||||||
res = res or [None]
|
|
||||||
return res[0]
|
|
||||||
|
|
||||||
|
|
||||||
def get_entity(service, get_params=None):
|
|
||||||
"""
|
|
||||||
Ignore SDK Error in case of getting an entity from service.
|
|
||||||
"""
|
|
||||||
entity = None
|
|
||||||
try:
|
|
||||||
if get_params is not None:
|
|
||||||
entity = service.get(**get_params)
|
|
||||||
else:
|
|
||||||
entity = service.get()
|
|
||||||
except sdk.Error:
|
|
||||||
# We can get here 404, we should ignore it, in case
|
|
||||||
# of removing entity for example.
|
|
||||||
pass
|
|
||||||
return entity
|
|
||||||
|
|
||||||
|
|
||||||
def get_id_by_name(service, name, raise_error=True, ignore_case=False):
|
|
||||||
"""
|
|
||||||
Search an entity ID by it's name.
|
|
||||||
"""
|
|
||||||
entity = search_by_name(service, name)
|
|
||||||
|
|
||||||
if entity is not None:
|
|
||||||
return entity.id
|
|
||||||
|
|
||||||
if raise_error:
|
|
||||||
raise Exception("Entity '%s' was not found." % name)
|
|
||||||
|
|
||||||
|
|
||||||
def wait(
|
|
||||||
service,
|
|
||||||
condition,
|
|
||||||
fail_condition=lambda e: False,
|
|
||||||
timeout=180,
|
|
||||||
wait=True,
|
|
||||||
poll_interval=3,
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Wait until entity fulfill expected condition.
|
|
||||||
|
|
||||||
:param service: service of the entity
|
|
||||||
:param condition: condition to be fulfilled
|
|
||||||
:param fail_condition: if this condition is true, raise Exception
|
|
||||||
:param timeout: max time to wait in seconds
|
|
||||||
:param wait: if True wait for condition, if False don't wait
|
|
||||||
:param poll_interval: Number of seconds we should wait until next condition check
|
|
||||||
"""
|
|
||||||
# Wait until the desired state of the entity:
|
|
||||||
if wait:
|
|
||||||
start = time.time()
|
|
||||||
while time.time() < start + timeout:
|
|
||||||
# Exit if the condition of entity is valid:
|
|
||||||
entity = get_entity(service)
|
|
||||||
if condition(entity):
|
|
||||||
return
|
|
||||||
elif fail_condition(entity):
|
|
||||||
raise Exception("Error while waiting on result state of the entity.")
|
|
||||||
|
|
||||||
# Sleep for `poll_interval` seconds if none of the conditions apply:
|
|
||||||
time.sleep(float(poll_interval))
|
|
||||||
|
|
||||||
raise Exception("Timeout exceed while waiting on result state of the entity.")
|
|
||||||
|
|
||||||
|
|
||||||
def __get_auth_dict():
|
|
||||||
OVIRT_URL = os.environ.get('OVIRT_URL')
|
|
||||||
OVIRT_HOSTNAME = os.environ.get('OVIRT_HOSTNAME')
|
|
||||||
OVIRT_USERNAME = os.environ.get('OVIRT_USERNAME')
|
|
||||||
OVIRT_PASSWORD = os.environ.get('OVIRT_PASSWORD')
|
|
||||||
OVIRT_TOKEN = os.environ.get('OVIRT_TOKEN')
|
|
||||||
OVIRT_CAFILE = os.environ.get('OVIRT_CAFILE')
|
|
||||||
OVIRT_INSECURE = OVIRT_CAFILE is None
|
|
||||||
|
|
||||||
env_vars = None
|
|
||||||
if OVIRT_URL is None and OVIRT_HOSTNAME is not None:
|
|
||||||
OVIRT_URL = 'https://{0}/ovirt-engine/api'.format(OVIRT_HOSTNAME)
|
|
||||||
if OVIRT_URL and ((OVIRT_USERNAME and OVIRT_PASSWORD) or OVIRT_TOKEN):
|
|
||||||
env_vars = {
|
|
||||||
'url': OVIRT_URL,
|
|
||||||
'username': OVIRT_USERNAME,
|
|
||||||
'password': OVIRT_PASSWORD,
|
|
||||||
'insecure': OVIRT_INSECURE,
|
|
||||||
'token': OVIRT_TOKEN,
|
|
||||||
'ca_file': OVIRT_CAFILE,
|
|
||||||
}
|
|
||||||
if env_vars is not None:
|
|
||||||
auth = dict(default=env_vars, type='dict')
|
|
||||||
else:
|
|
||||||
auth = dict(required=True, type='dict')
|
|
||||||
|
|
||||||
return auth
|
|
||||||
|
|
||||||
|
|
||||||
def ovirt_info_full_argument_spec(**kwargs):
|
|
||||||
"""
|
|
||||||
Extend parameters of info module with parameters which are common to all
|
|
||||||
oVirt info modules.
|
|
||||||
|
|
||||||
:param kwargs: kwargs to be extended
|
|
||||||
:return: extended dictionary with common parameters
|
|
||||||
"""
|
|
||||||
spec = dict(
|
|
||||||
auth=__get_auth_dict(),
|
|
||||||
fetch_nested=dict(default=False, type='bool'),
|
|
||||||
nested_attributes=dict(type='list', default=list()),
|
|
||||||
)
|
|
||||||
spec.update(kwargs)
|
|
||||||
return spec
|
|
||||||
|
|
||||||
|
|
||||||
# Left for third-party module compatibility
|
|
||||||
def ovirt_facts_full_argument_spec(**kwargs):
|
|
||||||
"""
|
|
||||||
This is deprecated. Please use ovirt_info_full_argument_spec instead!
|
|
||||||
|
|
||||||
:param kwargs: kwargs to be extended
|
|
||||||
:return: extended dictionary with common parameters
|
|
||||||
"""
|
|
||||||
return ovirt_info_full_argument_spec(**kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def ovirt_full_argument_spec(**kwargs):
|
|
||||||
"""
|
|
||||||
Extend parameters of module with parameters which are common to all oVirt modules.
|
|
||||||
|
|
||||||
:param kwargs: kwargs to be extended
|
|
||||||
:return: extended dictionary with common parameters
|
|
||||||
"""
|
|
||||||
spec = dict(
|
|
||||||
auth=__get_auth_dict(),
|
|
||||||
timeout=dict(default=180, type='int'),
|
|
||||||
wait=dict(default=True, type='bool'),
|
|
||||||
poll_interval=dict(default=3, type='int'),
|
|
||||||
fetch_nested=dict(default=False, type='bool'),
|
|
||||||
nested_attributes=dict(type='list', default=list()),
|
|
||||||
)
|
|
||||||
spec.update(kwargs)
|
|
||||||
return spec
|
|
||||||
|
|
||||||
|
|
||||||
def check_params(module):
|
|
||||||
"""
|
|
||||||
Most modules must have either `name` or `id` specified.
|
|
||||||
"""
|
|
||||||
if module.params.get('name') is None and module.params.get('id') is None:
|
|
||||||
module.fail_json(msg='"name" or "id" is required')
|
|
||||||
|
|
||||||
|
|
||||||
def engine_supported(connection, version):
|
|
||||||
return LooseVersion(engine_version(connection)) >= LooseVersion(version)
|
|
||||||
|
|
||||||
|
|
||||||
def check_support(version, connection, module, params):
|
|
||||||
"""
|
|
||||||
Check if parameters used by user are supported by oVirt Python SDK
|
|
||||||
and oVirt engine.
|
|
||||||
"""
|
|
||||||
api_version = LooseVersion(engine_version(connection))
|
|
||||||
version = LooseVersion(version)
|
|
||||||
for param in params:
|
|
||||||
if module.params.get(param) is not None:
|
|
||||||
return LooseVersion(sdk_version.VERSION) >= version and api_version >= version
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class BaseModule(object):
|
|
||||||
"""
|
|
||||||
This is base class for oVirt modules. oVirt modules should inherit this
|
|
||||||
class and override method to customize specific needs of the module.
|
|
||||||
The only abstract method of this class is `build_entity`, which must
|
|
||||||
to be implemented in child class.
|
|
||||||
"""
|
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, connection, module, service, changed=False):
|
|
||||||
self._connection = connection
|
|
||||||
self._module = module
|
|
||||||
self._service = service
|
|
||||||
self._changed = changed
|
|
||||||
self._diff = {'after': dict(), 'before': dict()}
|
|
||||||
|
|
||||||
@property
|
|
||||||
def changed(self):
|
|
||||||
return self._changed
|
|
||||||
|
|
||||||
@changed.setter
|
|
||||||
def changed(self, changed):
|
|
||||||
if not self._changed:
|
|
||||||
self._changed = changed
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def build_entity(self):
|
|
||||||
"""
|
|
||||||
This method should return oVirt Python SDK type, which we want to
|
|
||||||
create or update, initialized by values passed by Ansible module.
|
|
||||||
|
|
||||||
For example if we want to create VM, we will return following:
|
|
||||||
types.Vm(name=self._module.params['vm_name'])
|
|
||||||
|
|
||||||
:return: Specific instance of sdk.Struct.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def param(self, name, default=None):
|
|
||||||
"""
|
|
||||||
Return a module parameter specified by it's name.
|
|
||||||
"""
|
|
||||||
return self._module.params.get(name, default)
|
|
||||||
|
|
||||||
def update_check(self, entity):
|
|
||||||
"""
|
|
||||||
This method handle checks whether the entity values are same as values
|
|
||||||
passed to ansible module. By default we don't compare any values.
|
|
||||||
|
|
||||||
:param entity: Entity we want to compare with Ansible module values.
|
|
||||||
:return: True if values are same, so we don't need to update the entity.
|
|
||||||
"""
|
|
||||||
return True
|
|
||||||
|
|
||||||
def pre_create(self, entity):
|
|
||||||
"""
|
|
||||||
This method is called right before entity is created.
|
|
||||||
|
|
||||||
:param entity: Entity to be created or updated.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def post_create(self, entity):
|
|
||||||
"""
|
|
||||||
This method is called right after entity is created.
|
|
||||||
|
|
||||||
:param entity: Entity which was created.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def post_update(self, entity):
|
|
||||||
"""
|
|
||||||
This method is called right after entity is updated.
|
|
||||||
|
|
||||||
:param entity: Entity which was updated.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def diff_update(self, after, update):
|
|
||||||
for k, v in update.items():
|
|
||||||
if isinstance(v, Mapping):
|
|
||||||
after[k] = self.diff_update(after.get(k, dict()), v)
|
|
||||||
else:
|
|
||||||
after[k] = update[k]
|
|
||||||
return after
|
|
||||||
|
|
||||||
def create(
|
|
||||||
self,
|
|
||||||
entity=None,
|
|
||||||
result_state=None,
|
|
||||||
fail_condition=lambda e: False,
|
|
||||||
search_params=None,
|
|
||||||
update_params=None,
|
|
||||||
_wait=None,
|
|
||||||
force_create=False,
|
|
||||||
**kwargs
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Method which is called when state of the entity is 'present'. If user
|
|
||||||
don't provide `entity` parameter the entity is searched using
|
|
||||||
`search_params` parameter. If entity is found it's updated, whether
|
|
||||||
the entity should be updated is checked by `update_check` method.
|
|
||||||
The corresponding updated entity is build by `build_entity` method.
|
|
||||||
|
|
||||||
Function executed after entity is created can optionally be specified
|
|
||||||
in `post_create` parameter. Function executed after entity is updated
|
|
||||||
can optionally be specified in `post_update` parameter.
|
|
||||||
|
|
||||||
:param entity: Entity we want to update, if exists.
|
|
||||||
:param result_state: State which should entity has in order to finish task.
|
|
||||||
:param fail_condition: Function which checks incorrect state of entity, if it returns `True` Exception is raised.
|
|
||||||
:param search_params: Dictionary of parameters to be used for search.
|
|
||||||
:param update_params: The params which should be passed to update method.
|
|
||||||
:param kwargs: Additional parameters passed when creating entity.
|
|
||||||
:return: Dictionary with values returned by Ansible module.
|
|
||||||
"""
|
|
||||||
if entity is None and not force_create:
|
|
||||||
entity = self.search_entity(search_params)
|
|
||||||
|
|
||||||
self.pre_create(entity)
|
|
||||||
|
|
||||||
if entity:
|
|
||||||
# Entity exists, so update it:
|
|
||||||
entity_service = self._service.service(entity.id)
|
|
||||||
if not self.update_check(entity):
|
|
||||||
new_entity = self.build_entity()
|
|
||||||
if not self._module.check_mode:
|
|
||||||
update_params = update_params or {}
|
|
||||||
updated_entity = entity_service.update(
|
|
||||||
new_entity,
|
|
||||||
**update_params
|
|
||||||
)
|
|
||||||
self.post_update(entity)
|
|
||||||
|
|
||||||
# Update diffs only if user specified --diff parameter,
|
|
||||||
# so we don't useless overload API:
|
|
||||||
if self._module._diff:
|
|
||||||
before = get_dict_of_struct(
|
|
||||||
entity,
|
|
||||||
self._connection,
|
|
||||||
fetch_nested=True,
|
|
||||||
attributes=['name'],
|
|
||||||
)
|
|
||||||
after = before.copy()
|
|
||||||
self.diff_update(after, get_dict_of_struct(new_entity))
|
|
||||||
self._diff['before'] = before
|
|
||||||
self._diff['after'] = after
|
|
||||||
|
|
||||||
self.changed = True
|
|
||||||
else:
|
|
||||||
# Entity don't exists, so create it:
|
|
||||||
if not self._module.check_mode:
|
|
||||||
entity = self._service.add(
|
|
||||||
self.build_entity(),
|
|
||||||
**kwargs
|
|
||||||
)
|
|
||||||
self.post_create(entity)
|
|
||||||
self.changed = True
|
|
||||||
|
|
||||||
if not self._module.check_mode:
|
|
||||||
# Wait for the entity to be created and to be in the defined state:
|
|
||||||
entity_service = self._service.service(entity.id)
|
|
||||||
|
|
||||||
def state_condition(entity):
|
|
||||||
return entity
|
|
||||||
|
|
||||||
if result_state:
|
|
||||||
|
|
||||||
def state_condition(entity):
|
|
||||||
return entity and entity.status == result_state
|
|
||||||
|
|
||||||
wait(
|
|
||||||
service=entity_service,
|
|
||||||
condition=state_condition,
|
|
||||||
fail_condition=fail_condition,
|
|
||||||
wait=_wait if _wait is not None else self._module.params['wait'],
|
|
||||||
timeout=self._module.params['timeout'],
|
|
||||||
poll_interval=self._module.params['poll_interval'],
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
|
||||||
'changed': self.changed,
|
|
||||||
'id': getattr(entity, 'id', None),
|
|
||||||
type(entity).__name__.lower(): get_dict_of_struct(
|
|
||||||
struct=entity,
|
|
||||||
connection=self._connection,
|
|
||||||
fetch_nested=self._module.params.get('fetch_nested'),
|
|
||||||
attributes=self._module.params.get('nested_attributes'),
|
|
||||||
),
|
|
||||||
'diff': self._diff,
|
|
||||||
}
|
|
||||||
|
|
||||||
def pre_remove(self, entity):
|
|
||||||
"""
|
|
||||||
This method is called right before entity is removed.
|
|
||||||
|
|
||||||
:param entity: Entity which we want to remove.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def entity_name(self, entity):
|
|
||||||
return "{e_type} '{e_name}'".format(
|
|
||||||
e_type=type(entity).__name__.lower(),
|
|
||||||
e_name=getattr(entity, 'name', None),
|
|
||||||
)
|
|
||||||
|
|
||||||
def remove(self, entity=None, search_params=None, **kwargs):
|
|
||||||
"""
|
|
||||||
Method which is called when state of the entity is 'absent'. If user
|
|
||||||
don't provide `entity` parameter the entity is searched using
|
|
||||||
`search_params` parameter. If entity is found it's removed.
|
|
||||||
|
|
||||||
Function executed before remove is executed can optionally be specified
|
|
||||||
in `pre_remove` parameter.
|
|
||||||
|
|
||||||
:param entity: Entity we want to remove.
|
|
||||||
:param search_params: Dictionary of parameters to be used for search.
|
|
||||||
:param kwargs: Additional parameters passed when removing entity.
|
|
||||||
:return: Dictionary with values returned by Ansible module.
|
|
||||||
"""
|
|
||||||
if entity is None:
|
|
||||||
entity = self.search_entity(search_params)
|
|
||||||
|
|
||||||
if entity is None:
|
|
||||||
return {
|
|
||||||
'changed': self.changed,
|
|
||||||
'msg': "Entity wasn't found."
|
|
||||||
}
|
|
||||||
|
|
||||||
self.pre_remove(entity)
|
|
||||||
|
|
||||||
entity_service = self._service.service(entity.id)
|
|
||||||
if not self._module.check_mode:
|
|
||||||
entity_service.remove(**kwargs)
|
|
||||||
wait(
|
|
||||||
service=entity_service,
|
|
||||||
condition=lambda entity: not entity,
|
|
||||||
wait=self._module.params['wait'],
|
|
||||||
timeout=self._module.params['timeout'],
|
|
||||||
poll_interval=self._module.params['poll_interval'],
|
|
||||||
)
|
|
||||||
self.changed = True
|
|
||||||
|
|
||||||
return {
|
|
||||||
'changed': self.changed,
|
|
||||||
'id': entity.id,
|
|
||||||
type(entity).__name__.lower(): get_dict_of_struct(
|
|
||||||
struct=entity,
|
|
||||||
connection=self._connection,
|
|
||||||
fetch_nested=self._module.params.get('fetch_nested'),
|
|
||||||
attributes=self._module.params.get('nested_attributes'),
|
|
||||||
),
|
|
||||||
}
|
|
||||||
|
|
||||||
def action(
|
|
||||||
self,
|
|
||||||
action,
|
|
||||||
entity=None,
|
|
||||||
action_condition=lambda e: e,
|
|
||||||
wait_condition=lambda e: e,
|
|
||||||
fail_condition=lambda e: False,
|
|
||||||
pre_action=lambda e: e,
|
|
||||||
post_action=lambda e: None,
|
|
||||||
search_params=None,
|
|
||||||
**kwargs
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
This method is executed when we want to change the state of some oVirt
|
|
||||||
entity. The action to be executed on oVirt service is specified by
|
|
||||||
`action` parameter. Whether the action should be executed can be
|
|
||||||
specified by passing `action_condition` parameter. State which the
|
|
||||||
entity should be in after execution of the action can be specified
|
|
||||||
by `wait_condition` parameter.
|
|
||||||
|
|
||||||
Function executed before an action on entity can optionally be specified
|
|
||||||
in `pre_action` parameter. Function executed after an action on entity can
|
|
||||||
optionally be specified in `post_action` parameter.
|
|
||||||
|
|
||||||
:param action: Action which should be executed by service on entity.
|
|
||||||
:param entity: Entity we want to run action on.
|
|
||||||
:param action_condition: Function which is executed when checking if action should be executed.
|
|
||||||
:param fail_condition: Function which checks incorrect state of entity, if it returns `True` Exception is raised.
|
|
||||||
:param wait_condition: Function which is executed when waiting on result state.
|
|
||||||
:param pre_action: Function which is executed before running the action.
|
|
||||||
:param post_action: Function which is executed after running the action.
|
|
||||||
:param search_params: Dictionary of parameters to be used for search.
|
|
||||||
:param kwargs: Additional parameters passed to action.
|
|
||||||
:return: Dictionary with values returned by Ansible module.
|
|
||||||
"""
|
|
||||||
if entity is None:
|
|
||||||
entity = self.search_entity(search_params)
|
|
||||||
|
|
||||||
entity = pre_action(entity)
|
|
||||||
|
|
||||||
if entity is None:
|
|
||||||
self._module.fail_json(
|
|
||||||
msg="Entity not found, can't run action '{0}'.".format(
|
|
||||||
action
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
entity_service = self._service.service(entity.id)
|
|
||||||
entity = entity_service.get()
|
|
||||||
if action_condition(entity):
|
|
||||||
if not self._module.check_mode:
|
|
||||||
getattr(entity_service, action)(**kwargs)
|
|
||||||
self.changed = True
|
|
||||||
|
|
||||||
post_action(entity)
|
|
||||||
|
|
||||||
wait(
|
|
||||||
service=self._service.service(entity.id),
|
|
||||||
condition=wait_condition,
|
|
||||||
fail_condition=fail_condition,
|
|
||||||
wait=self._module.params['wait'],
|
|
||||||
timeout=self._module.params['timeout'],
|
|
||||||
poll_interval=self._module.params['poll_interval'],
|
|
||||||
)
|
|
||||||
return {
|
|
||||||
'changed': self.changed,
|
|
||||||
'id': entity.id,
|
|
||||||
type(entity).__name__.lower(): get_dict_of_struct(
|
|
||||||
struct=entity,
|
|
||||||
connection=self._connection,
|
|
||||||
fetch_nested=self._module.params.get('fetch_nested'),
|
|
||||||
attributes=self._module.params.get('nested_attributes'),
|
|
||||||
),
|
|
||||||
'diff': self._diff,
|
|
||||||
}
|
|
||||||
|
|
||||||
def wait_for_import(self, condition=lambda e: True):
|
|
||||||
if self._module.params['wait']:
|
|
||||||
start = time.time()
|
|
||||||
timeout = self._module.params['timeout']
|
|
||||||
poll_interval = self._module.params['poll_interval']
|
|
||||||
while time.time() < start + timeout:
|
|
||||||
entity = self.search_entity()
|
|
||||||
if entity and condition(entity):
|
|
||||||
return entity
|
|
||||||
time.sleep(poll_interval)
|
|
||||||
|
|
||||||
def search_entity(self, search_params=None, list_params=None):
|
|
||||||
"""
|
|
||||||
Always first try to search by `ID`, if ID isn't specified,
|
|
||||||
check if user constructed special search in `search_params`,
|
|
||||||
if not search by `name`.
|
|
||||||
"""
|
|
||||||
entity = None
|
|
||||||
|
|
||||||
if 'id' in self._module.params and self._module.params['id'] is not None:
|
|
||||||
entity = get_entity(self._service.service(self._module.params['id']), get_params=list_params)
|
|
||||||
elif search_params is not None:
|
|
||||||
entity = search_by_attributes(self._service, list_params=list_params, **search_params)
|
|
||||||
elif self._module.params.get('name') is not None:
|
|
||||||
entity = search_by_attributes(self._service, list_params=list_params, name=self._module.params['name'])
|
|
||||||
|
|
||||||
return entity
|
|
||||||
|
|
||||||
def _get_major(self, full_version):
|
|
||||||
if full_version is None or full_version == "":
|
|
||||||
return None
|
|
||||||
if isinstance(full_version, otypes.Version):
|
|
||||||
return int(full_version.major)
|
|
||||||
return int(full_version.split('.')[0])
|
|
||||||
|
|
||||||
def _get_minor(self, full_version):
|
|
||||||
if full_version is None or full_version == "":
|
|
||||||
return None
|
|
||||||
if isinstance(full_version, otypes.Version):
|
|
||||||
return int(full_version.minor)
|
|
||||||
return int(full_version.split('.')[1])
|
|
||||||
|
|
||||||
|
|
||||||
def _sdk4_error_maybe():
|
|
||||||
"""
|
|
||||||
Allow for ovirtsdk4 not being installed.
|
|
||||||
"""
|
|
||||||
if HAS_SDK:
|
|
||||||
return sdk.Error
|
|
||||||
return type(None)
|
|
||||||
|
|
||||||
|
|
||||||
class OvirtRetry(CloudRetry):
|
|
||||||
base_class = _sdk4_error_maybe()
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def status_code_from_exception(error):
|
|
||||||
return error.code
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def found(response_code, catch_extra_error_codes=None):
|
|
||||||
# This is a list of error codes to retry.
|
|
||||||
retry_on = [
|
|
||||||
# HTTP status: Conflict
|
|
||||||
409,
|
|
||||||
]
|
|
||||||
if catch_extra_error_codes:
|
|
||||||
retry_on.extend(catch_extra_error_codes)
|
|
||||||
|
|
||||||
return response_code in retry_on
|
|
|
@ -1 +0,0 @@
|
||||||
cloud/alicloud/ali_instance_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
ali_instance_info.py
|
|
|
@ -383,9 +383,6 @@ def main():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
if module._name in ('ali_instance_facts', 'community.general.ali_instance_facts'):
|
|
||||||
module.deprecate("The 'ali_instance_facts' module has been renamed to 'ali_instance_info'",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
if HAS_FOOTMARK is False:
|
if HAS_FOOTMARK is False:
|
||||||
module.fail_json(msg=missing_required_lib('footmark'), exception=FOOTMARK_IMP_ERR)
|
module.fail_json(msg=missing_required_lib('footmark'), exception=FOOTMARK_IMP_ERR)
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
memset_memstore_info.py
|
|
|
@ -151,9 +151,6 @@ def main():
|
||||||
),
|
),
|
||||||
supports_check_mode=False
|
supports_check_mode=False
|
||||||
)
|
)
|
||||||
if module._name in ('memset_memstore_facts', 'community.general.memset_memstore_facts'):
|
|
||||||
module.deprecate("The 'memset_memstore_facts' module has been renamed to 'memset_memstore_info'",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
# populate the dict with the user-provided vars.
|
# populate the dict with the user-provided vars.
|
||||||
args = dict()
|
args = dict()
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
memset_server_info.py
|
|
|
@ -276,9 +276,6 @@ def main():
|
||||||
),
|
),
|
||||||
supports_check_mode=False
|
supports_check_mode=False
|
||||||
)
|
)
|
||||||
if module._name in ('memset_server_facts', 'community.general.memset_server_facts'):
|
|
||||||
module.deprecate("The 'memset_server_facts' module has been renamed to 'memset_server_info'",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
# populate the dict with the user-provided vars.
|
# populate the dict with the user-provided vars.
|
||||||
args = dict()
|
args = dict()
|
||||||
|
|
|
@ -1,216 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# (c) 2016, Flavio Percoco <flavio@redhat.com>
|
|
||||||
#
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.14
|
|
||||||
why: For more details https://github.com/ansible/ansible/issues/61546.
|
|
||||||
alternative: Use M(community.kubernetes.helm) instead.
|
|
||||||
module: helm
|
|
||||||
short_description: Manages Kubernetes packages with the Helm package manager
|
|
||||||
author: "Flavio Percoco (@flaper87)"
|
|
||||||
description:
|
|
||||||
- Install, upgrade, delete and list packages with the Helm package manager.
|
|
||||||
requirements:
|
|
||||||
- "pyhelm"
|
|
||||||
- "grpcio"
|
|
||||||
options:
|
|
||||||
host:
|
|
||||||
description:
|
|
||||||
- Tiller's server host.
|
|
||||||
type: str
|
|
||||||
default: "localhost"
|
|
||||||
port:
|
|
||||||
description:
|
|
||||||
- Tiller's server port.
|
|
||||||
type: int
|
|
||||||
default: 44134
|
|
||||||
namespace:
|
|
||||||
description:
|
|
||||||
- Kubernetes namespace where the chart should be installed.
|
|
||||||
type: str
|
|
||||||
default: "default"
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- Release name to manage.
|
|
||||||
type: str
|
|
||||||
state:
|
|
||||||
description:
|
|
||||||
- Whether to install C(present), remove C(absent), or purge C(purged) a package.
|
|
||||||
choices: ['absent', 'purged', 'present']
|
|
||||||
type: str
|
|
||||||
default: "present"
|
|
||||||
chart:
|
|
||||||
description:
|
|
||||||
- A map describing the chart to install. See examples for available options.
|
|
||||||
type: dict
|
|
||||||
default: {}
|
|
||||||
values:
|
|
||||||
description:
|
|
||||||
- A map of value options for the chart.
|
|
||||||
type: dict
|
|
||||||
default: {}
|
|
||||||
disable_hooks:
|
|
||||||
description:
|
|
||||||
- Whether to disable hooks during the uninstall process.
|
|
||||||
type: bool
|
|
||||||
default: 'no'
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = ''' # '''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
- name: Install helm chart
|
|
||||||
community.general.helm:
|
|
||||||
host: localhost
|
|
||||||
chart:
|
|
||||||
name: memcached
|
|
||||||
version: 0.4.0
|
|
||||||
source:
|
|
||||||
type: repo
|
|
||||||
location: https://kubernetes-charts.storage.googleapis.com
|
|
||||||
state: present
|
|
||||||
name: my-memcached
|
|
||||||
namespace: default
|
|
||||||
|
|
||||||
- name: Uninstall helm chart
|
|
||||||
community.general.helm:
|
|
||||||
host: localhost
|
|
||||||
state: absent
|
|
||||||
name: my-memcached
|
|
||||||
|
|
||||||
- name: Install helm chart from a git repo
|
|
||||||
community.general.helm:
|
|
||||||
host: localhost
|
|
||||||
chart:
|
|
||||||
source:
|
|
||||||
type: git
|
|
||||||
location: https://github.com/user/helm-chart.git
|
|
||||||
state: present
|
|
||||||
name: my-example
|
|
||||||
namespace: default
|
|
||||||
values:
|
|
||||||
foo: "bar"
|
|
||||||
|
|
||||||
- name: Install helm chart from a git repo specifying path
|
|
||||||
community.general.helm:
|
|
||||||
host: localhost
|
|
||||||
chart:
|
|
||||||
source:
|
|
||||||
type: git
|
|
||||||
location: https://github.com/helm/charts.git
|
|
||||||
path: stable/memcached
|
|
||||||
state: present
|
|
||||||
name: my-memcached
|
|
||||||
namespace: default
|
|
||||||
values: "{{ lookup('file', '/path/to/file/values.yaml') | from_yaml }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
HELM_IMPORT_ERR = None
|
|
||||||
try:
|
|
||||||
import grpc
|
|
||||||
from pyhelm import tiller
|
|
||||||
from pyhelm import chartbuilder
|
|
||||||
except ImportError:
|
|
||||||
HELM_IMPORT_ERR = traceback.format_exc()
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
|
||||||
|
|
||||||
|
|
||||||
def install(module, tserver):
|
|
||||||
changed = False
|
|
||||||
params = module.params
|
|
||||||
name = params['name']
|
|
||||||
values = params['values']
|
|
||||||
chart = module.params['chart']
|
|
||||||
namespace = module.params['namespace']
|
|
||||||
|
|
||||||
chartb = chartbuilder.ChartBuilder(chart)
|
|
||||||
r_matches = (x for x in tserver.list_releases()
|
|
||||||
if x.name == name and x.namespace == namespace)
|
|
||||||
installed_release = next(r_matches, None)
|
|
||||||
if installed_release:
|
|
||||||
if installed_release.chart.metadata.version != chart['version']:
|
|
||||||
tserver.update_release(chartb.get_helm_chart(), False,
|
|
||||||
namespace, name=name, values=values)
|
|
||||||
changed = True
|
|
||||||
else:
|
|
||||||
tserver.install_release(chartb.get_helm_chart(), namespace,
|
|
||||||
dry_run=False, name=name,
|
|
||||||
values=values)
|
|
||||||
changed = True
|
|
||||||
|
|
||||||
return dict(changed=changed)
|
|
||||||
|
|
||||||
|
|
||||||
def delete(module, tserver, purge=False):
|
|
||||||
changed = False
|
|
||||||
params = module.params
|
|
||||||
|
|
||||||
if not module.params['name']:
|
|
||||||
module.fail_json(msg='Missing required field name')
|
|
||||||
|
|
||||||
name = module.params['name']
|
|
||||||
disable_hooks = params['disable_hooks']
|
|
||||||
|
|
||||||
try:
|
|
||||||
tserver.uninstall_release(name, disable_hooks, purge)
|
|
||||||
changed = True
|
|
||||||
except grpc._channel._Rendezvous as exc:
|
|
||||||
if 'not found' not in str(exc):
|
|
||||||
raise exc
|
|
||||||
|
|
||||||
return dict(changed=changed)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""The main function."""
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=dict(
|
|
||||||
host=dict(type='str', default='localhost'),
|
|
||||||
port=dict(type='int', default=44134),
|
|
||||||
name=dict(type='str', default=''),
|
|
||||||
chart=dict(type='dict'),
|
|
||||||
state=dict(
|
|
||||||
choices=['absent', 'purged', 'present'],
|
|
||||||
default='present'
|
|
||||||
),
|
|
||||||
# Install options
|
|
||||||
values=dict(type='dict'),
|
|
||||||
namespace=dict(type='str', default='default'),
|
|
||||||
|
|
||||||
# Uninstall options
|
|
||||||
disable_hooks=dict(type='bool', default=False),
|
|
||||||
),
|
|
||||||
supports_check_mode=True)
|
|
||||||
|
|
||||||
if HELM_IMPORT_ERR:
|
|
||||||
module.fail_json(msg=missing_required_lib('pyhelm'), exception=HELM_IMPORT_ERR)
|
|
||||||
|
|
||||||
host = module.params['host']
|
|
||||||
port = module.params['port']
|
|
||||||
state = module.params['state']
|
|
||||||
tserver = tiller.Tiller(host, port)
|
|
||||||
|
|
||||||
if state == 'present':
|
|
||||||
rst = install(module, tserver)
|
|
||||||
|
|
||||||
if state in 'absent':
|
|
||||||
rst = delete(module, tserver)
|
|
||||||
|
|
||||||
if state in 'purged':
|
|
||||||
rst = delete(module, tserver, True)
|
|
||||||
|
|
||||||
module.exit_json(**rst)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,503 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
# Copyright: (c) 2013, Vincent Van der Kussen <vincent at vanderkussen.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt
|
|
||||||
author:
|
|
||||||
- Vincent Van der Kussen (@vincentvdk)
|
|
||||||
short_description: oVirt/RHEV platform management
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.14
|
|
||||||
why: This module is for deprecated version of ovirt.
|
|
||||||
alternative: Use C(ovirt_vm) from the C(ovirt.ovirt) collection instead
|
|
||||||
description:
|
|
||||||
- This module only supports oVirt/RHEV version 3. A newer module M(ovirt.ovirt.ovirt_vm) supports oVirt/RHV version 4.
|
|
||||||
- Allows you to create new instances, either from scratch or an image, in addition to deleting or stopping instances on the oVirt/RHEV platform.
|
|
||||||
options:
|
|
||||||
user:
|
|
||||||
description:
|
|
||||||
- The user to authenticate with.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
url:
|
|
||||||
description:
|
|
||||||
- The url of the oVirt instance.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
instance_name:
|
|
||||||
description:
|
|
||||||
- The name of the instance to use.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
aliases: [ vmname ]
|
|
||||||
password:
|
|
||||||
description:
|
|
||||||
- Password of the user to authenticate with.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
image:
|
|
||||||
description:
|
|
||||||
- The template to use for the instance.
|
|
||||||
type: str
|
|
||||||
resource_type:
|
|
||||||
description:
|
|
||||||
- Whether you want to deploy an image or create an instance from scratch.
|
|
||||||
type: str
|
|
||||||
choices: [ new, template ]
|
|
||||||
zone:
|
|
||||||
description:
|
|
||||||
- Deploy the image to this oVirt cluster.
|
|
||||||
type: str
|
|
||||||
instance_disksize:
|
|
||||||
description:
|
|
||||||
- Size of the instance's disk in GB.
|
|
||||||
type: str
|
|
||||||
aliases: [ vm_disksize]
|
|
||||||
instance_cpus:
|
|
||||||
description:
|
|
||||||
- The instance's number of CPUs.
|
|
||||||
type: str
|
|
||||||
default: 1
|
|
||||||
aliases: [ vmcpus ]
|
|
||||||
instance_nic:
|
|
||||||
description:
|
|
||||||
- The name of the network interface in oVirt/RHEV.
|
|
||||||
type: str
|
|
||||||
aliases: [ vmnic ]
|
|
||||||
instance_network:
|
|
||||||
description:
|
|
||||||
- The logical network the machine should belong to.
|
|
||||||
type: str
|
|
||||||
default: rhevm
|
|
||||||
aliases: [ vmnetwork ]
|
|
||||||
instance_mem:
|
|
||||||
description:
|
|
||||||
- The instance's amount of memory in MB.
|
|
||||||
type: str
|
|
||||||
aliases: [ vmmem ]
|
|
||||||
instance_type:
|
|
||||||
description:
|
|
||||||
- Define whether the instance is a server, desktop or high_performance.
|
|
||||||
- I(high_performance) is supported since Ansible 2.5 and oVirt/RHV 4.2.
|
|
||||||
type: str
|
|
||||||
choices: [ desktop, server, high_performance ]
|
|
||||||
default: server
|
|
||||||
aliases: [ vmtype ]
|
|
||||||
disk_alloc:
|
|
||||||
description:
|
|
||||||
- Define whether disk is thin or preallocated.
|
|
||||||
type: str
|
|
||||||
choices: [ preallocated, thin ]
|
|
||||||
default: thin
|
|
||||||
disk_int:
|
|
||||||
description:
|
|
||||||
- Interface type of the disk.
|
|
||||||
type: str
|
|
||||||
choices: [ ide, virtio ]
|
|
||||||
default: virtio
|
|
||||||
instance_os:
|
|
||||||
description:
|
|
||||||
- Type of Operating System.
|
|
||||||
type: str
|
|
||||||
aliases: [ vmos ]
|
|
||||||
instance_cores:
|
|
||||||
description:
|
|
||||||
- Define the instance's number of cores.
|
|
||||||
type: str
|
|
||||||
default: 1
|
|
||||||
aliases: [ vmcores ]
|
|
||||||
sdomain:
|
|
||||||
description:
|
|
||||||
- The Storage Domain where you want to create the instance's disk on.
|
|
||||||
type: str
|
|
||||||
region:
|
|
||||||
description:
|
|
||||||
- The oVirt/RHEV datacenter where you want to deploy to.
|
|
||||||
type: str
|
|
||||||
instance_dns:
|
|
||||||
description:
|
|
||||||
- Define the instance's Primary DNS server.
|
|
||||||
type: str
|
|
||||||
aliases: [ dns ]
|
|
||||||
instance_domain:
|
|
||||||
description:
|
|
||||||
- Define the instance's Domain.
|
|
||||||
type: str
|
|
||||||
aliases: [ domain ]
|
|
||||||
instance_hostname:
|
|
||||||
description:
|
|
||||||
- Define the instance's Hostname.
|
|
||||||
type: str
|
|
||||||
aliases: [ hostname ]
|
|
||||||
instance_ip:
|
|
||||||
description:
|
|
||||||
- Define the instance's IP.
|
|
||||||
type: str
|
|
||||||
aliases: [ ip ]
|
|
||||||
instance_netmask:
|
|
||||||
description:
|
|
||||||
- Define the instance's Netmask.
|
|
||||||
type: str
|
|
||||||
aliases: [ netmask ]
|
|
||||||
instance_gateway:
|
|
||||||
description:
|
|
||||||
- Define the instance's Gateway.
|
|
||||||
type: str
|
|
||||||
aliases: [ gateway ]
|
|
||||||
instance_rootpw:
|
|
||||||
description:
|
|
||||||
- Define the instance's Root password.
|
|
||||||
type: str
|
|
||||||
aliases: [ rootpw ]
|
|
||||||
instance_key:
|
|
||||||
description:
|
|
||||||
- Define the instance's Authorized key.
|
|
||||||
type: str
|
|
||||||
aliases: [ key ]
|
|
||||||
state:
|
|
||||||
description:
|
|
||||||
- Create, terminate or remove instances.
|
|
||||||
type: str
|
|
||||||
choices: [ absent, present, restart, shutdown, started ]
|
|
||||||
default: present
|
|
||||||
requirements:
|
|
||||||
- ovirt-engine-sdk-python
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
- name: Basic example to provision from image
|
|
||||||
community.general.ovirt:
|
|
||||||
user: admin@internal
|
|
||||||
url: https://ovirt.example.com
|
|
||||||
instance_name: ansiblevm04
|
|
||||||
password: secret
|
|
||||||
image: centos_64
|
|
||||||
zone: cluster01
|
|
||||||
resource_type: template
|
|
||||||
|
|
||||||
- name: Full example to create new instance from scratch
|
|
||||||
community.general.ovirt:
|
|
||||||
instance_name: testansible
|
|
||||||
resource_type: new
|
|
||||||
instance_type: server
|
|
||||||
user: admin@internal
|
|
||||||
password: secret
|
|
||||||
url: https://ovirt.example.com
|
|
||||||
instance_disksize: 10
|
|
||||||
zone: cluster01
|
|
||||||
region: datacenter1
|
|
||||||
instance_cpus: 1
|
|
||||||
instance_nic: nic1
|
|
||||||
instance_network: rhevm
|
|
||||||
instance_mem: 1000
|
|
||||||
disk_alloc: thin
|
|
||||||
sdomain: FIBER01
|
|
||||||
instance_cores: 1
|
|
||||||
instance_os: rhel_6x64
|
|
||||||
disk_int: virtio
|
|
||||||
|
|
||||||
- name: Stopping an existing instance
|
|
||||||
community.general.ovirt:
|
|
||||||
instance_name: testansible
|
|
||||||
state: stopped
|
|
||||||
user: admin@internal
|
|
||||||
password: secret
|
|
||||||
url: https://ovirt.example.com
|
|
||||||
|
|
||||||
- name: Start an existing instance
|
|
||||||
community.general.ovirt:
|
|
||||||
instance_name: testansible
|
|
||||||
state: started
|
|
||||||
user: admin@internal
|
|
||||||
password: secret
|
|
||||||
url: https://ovirt.example.com
|
|
||||||
|
|
||||||
- name: Start an instance with cloud init information
|
|
||||||
community.general.ovirt:
|
|
||||||
instance_name: testansible
|
|
||||||
state: started
|
|
||||||
user: admin@internal
|
|
||||||
password: secret
|
|
||||||
url: https://ovirt.example.com
|
|
||||||
hostname: testansible
|
|
||||||
domain: ansible.local
|
|
||||||
ip: 192.0.2.100
|
|
||||||
netmask: 255.255.255.0
|
|
||||||
gateway: 192.0.2.1
|
|
||||||
rootpw: bigsecret
|
|
||||||
'''
|
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
try:
|
|
||||||
from ovirtsdk.api import API
|
|
||||||
from ovirtsdk.xml import params
|
|
||||||
HAS_OVIRTSDK = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_OVIRTSDK = False
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------- #
|
|
||||||
# create connection with API
|
|
||||||
#
|
|
||||||
def conn(url, user, password):
|
|
||||||
api = API(url=url, username=user, password=password, insecure=True)
|
|
||||||
try:
|
|
||||||
value = api.test()
|
|
||||||
except Exception:
|
|
||||||
raise Exception("error connecting to the oVirt API")
|
|
||||||
return api
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------- #
|
|
||||||
# Create VM from scratch
|
|
||||||
def create_vm(conn, vmtype, vmname, zone, vmdisk_size, vmcpus, vmnic, vmnetwork, vmmem, vmdisk_alloc, sdomain, vmcores, vmos, vmdisk_int):
|
|
||||||
if vmdisk_alloc == 'thin':
|
|
||||||
# define VM params
|
|
||||||
vmparams = params.VM(name=vmname, cluster=conn.clusters.get(name=zone), os=params.OperatingSystem(type_=vmos),
|
|
||||||
template=conn.templates.get(name="Blank"), memory=1024 * 1024 * int(vmmem),
|
|
||||||
cpu=params.CPU(topology=params.CpuTopology(cores=int(vmcores), sockets=vmcpus)), type_=vmtype)
|
|
||||||
# define disk params
|
|
||||||
vmdisk = params.Disk(size=1024 * 1024 * 1024 * int(vmdisk_size), wipe_after_delete=True, sparse=True, interface=vmdisk_int, type_="System",
|
|
||||||
format='cow',
|
|
||||||
storage_domains=params.StorageDomains(storage_domain=[conn.storagedomains.get(name=sdomain)]))
|
|
||||||
# define network parameters
|
|
||||||
network_net = params.Network(name=vmnetwork)
|
|
||||||
nic_net1 = params.NIC(name='nic1', network=network_net, interface='virtio')
|
|
||||||
elif vmdisk_alloc == 'preallocated':
|
|
||||||
# define VM params
|
|
||||||
vmparams = params.VM(name=vmname, cluster=conn.clusters.get(name=zone), os=params.OperatingSystem(type_=vmos),
|
|
||||||
template=conn.templates.get(name="Blank"), memory=1024 * 1024 * int(vmmem),
|
|
||||||
cpu=params.CPU(topology=params.CpuTopology(cores=int(vmcores), sockets=vmcpus)), type_=vmtype)
|
|
||||||
# define disk params
|
|
||||||
vmdisk = params.Disk(size=1024 * 1024 * 1024 * int(vmdisk_size), wipe_after_delete=True, sparse=False, interface=vmdisk_int, type_="System",
|
|
||||||
format='raw', storage_domains=params.StorageDomains(storage_domain=[conn.storagedomains.get(name=sdomain)]))
|
|
||||||
# define network parameters
|
|
||||||
network_net = params.Network(name=vmnetwork)
|
|
||||||
nic_net1 = params.NIC(name=vmnic, network=network_net, interface='virtio')
|
|
||||||
|
|
||||||
try:
|
|
||||||
conn.vms.add(vmparams)
|
|
||||||
except Exception:
|
|
||||||
raise Exception("Error creating VM with specified parameters")
|
|
||||||
vm = conn.vms.get(name=vmname)
|
|
||||||
try:
|
|
||||||
vm.disks.add(vmdisk)
|
|
||||||
except Exception:
|
|
||||||
raise Exception("Error attaching disk")
|
|
||||||
try:
|
|
||||||
vm.nics.add(nic_net1)
|
|
||||||
except Exception:
|
|
||||||
raise Exception("Error adding nic")
|
|
||||||
|
|
||||||
|
|
||||||
# create an instance from a template
|
|
||||||
def create_vm_template(conn, vmname, image, zone):
|
|
||||||
vmparams = params.VM(name=vmname, cluster=conn.clusters.get(name=zone), template=conn.templates.get(name=image), disks=params.Disks(clone=True))
|
|
||||||
try:
|
|
||||||
conn.vms.add(vmparams)
|
|
||||||
except Exception:
|
|
||||||
raise Exception('error adding template %s' % image)
|
|
||||||
|
|
||||||
|
|
||||||
# start instance
|
|
||||||
def vm_start(conn, vmname, hostname=None, ip=None, netmask=None, gateway=None,
|
|
||||||
domain=None, dns=None, rootpw=None, key=None):
|
|
||||||
vm = conn.vms.get(name=vmname)
|
|
||||||
use_cloud_init = False
|
|
||||||
nics = None
|
|
||||||
nic = None
|
|
||||||
if hostname or ip or netmask or gateway or domain or dns or rootpw or key:
|
|
||||||
use_cloud_init = True
|
|
||||||
if ip and netmask and gateway:
|
|
||||||
ipinfo = params.IP(address=ip, netmask=netmask, gateway=gateway)
|
|
||||||
nic = params.GuestNicConfiguration(name='eth0', boot_protocol='STATIC', ip=ipinfo, on_boot=True)
|
|
||||||
nics = params.Nics()
|
|
||||||
nics = params.GuestNicsConfiguration(nic_configuration=[nic])
|
|
||||||
initialization = params.Initialization(regenerate_ssh_keys=True, host_name=hostname, domain=domain, user_name='root',
|
|
||||||
root_password=rootpw, nic_configurations=nics, dns_servers=dns,
|
|
||||||
authorized_ssh_keys=key)
|
|
||||||
action = params.Action(use_cloud_init=use_cloud_init, vm=params.VM(initialization=initialization))
|
|
||||||
vm.start(action=action)
|
|
||||||
|
|
||||||
|
|
||||||
# Stop instance
|
|
||||||
def vm_stop(conn, vmname):
|
|
||||||
vm = conn.vms.get(name=vmname)
|
|
||||||
vm.stop()
|
|
||||||
|
|
||||||
|
|
||||||
# restart instance
|
|
||||||
def vm_restart(conn, vmname):
|
|
||||||
state = vm_status(conn, vmname)
|
|
||||||
vm = conn.vms.get(name=vmname)
|
|
||||||
vm.stop()
|
|
||||||
while conn.vms.get(vmname).get_status().get_state() != 'down':
|
|
||||||
time.sleep(5)
|
|
||||||
vm.start()
|
|
||||||
|
|
||||||
|
|
||||||
# remove an instance
|
|
||||||
def vm_remove(conn, vmname):
|
|
||||||
vm = conn.vms.get(name=vmname)
|
|
||||||
vm.delete()
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------- #
|
|
||||||
# VM statuses
|
|
||||||
#
|
|
||||||
# Get the VMs status
|
|
||||||
def vm_status(conn, vmname):
|
|
||||||
status = conn.vms.get(name=vmname).status.state
|
|
||||||
return status
|
|
||||||
|
|
||||||
|
|
||||||
# Get VM object and return it's name if object exists
|
|
||||||
def get_vm(conn, vmname):
|
|
||||||
vm = conn.vms.get(name=vmname)
|
|
||||||
if vm is None:
|
|
||||||
name = "empty"
|
|
||||||
else:
|
|
||||||
name = vm.get_name()
|
|
||||||
return name
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------- #
|
|
||||||
# Hypervisor operations
|
|
||||||
#
|
|
||||||
# not available yet
|
|
||||||
# ------------------------------------------------------------------- #
|
|
||||||
# Main
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=dict(
|
|
||||||
state=dict(type='str', default='present', choices=['absent', 'present', 'restart', 'shutdown', 'started']),
|
|
||||||
user=dict(type='str', required=True),
|
|
||||||
url=dict(type='str', required=True),
|
|
||||||
instance_name=dict(type='str', required=True, aliases=['vmname']),
|
|
||||||
password=dict(type='str', required=True, no_log=True),
|
|
||||||
image=dict(type='str'),
|
|
||||||
resource_type=dict(type='str', choices=['new', 'template']),
|
|
||||||
zone=dict(type='str'),
|
|
||||||
instance_disksize=dict(type='str', aliases=['vm_disksize']),
|
|
||||||
instance_cpus=dict(type='str', default=1, aliases=['vmcpus']),
|
|
||||||
instance_nic=dict(type='str', aliases=['vmnic']),
|
|
||||||
instance_network=dict(type='str', default='rhevm', aliases=['vmnetwork']),
|
|
||||||
instance_mem=dict(type='str', aliases=['vmmem']),
|
|
||||||
instance_type=dict(type='str', default='server', aliases=['vmtype'], choices=['desktop', 'server', 'high_performance']),
|
|
||||||
disk_alloc=dict(type='str', default='thin', choices=['preallocated', 'thin']),
|
|
||||||
disk_int=dict(type='str', default='virtio', choices=['ide', 'virtio']),
|
|
||||||
instance_os=dict(type='str', aliases=['vmos']),
|
|
||||||
instance_cores=dict(type='str', default=1, aliases=['vmcores']),
|
|
||||||
instance_hostname=dict(type='str', aliases=['hostname']),
|
|
||||||
instance_ip=dict(type='str', aliases=['ip']),
|
|
||||||
instance_netmask=dict(type='str', aliases=['netmask']),
|
|
||||||
instance_gateway=dict(type='str', aliases=['gateway']),
|
|
||||||
instance_domain=dict(type='str', aliases=['domain']),
|
|
||||||
instance_dns=dict(type='str', aliases=['dns']),
|
|
||||||
instance_rootpw=dict(type='str', aliases=['rootpw'], no_log=True),
|
|
||||||
instance_key=dict(type='str', aliases=['key'], no_log=True),
|
|
||||||
sdomain=dict(type='str'),
|
|
||||||
region=dict(type='str'),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
if not HAS_OVIRTSDK:
|
|
||||||
module.fail_json(msg='ovirtsdk required for this module')
|
|
||||||
|
|
||||||
state = module.params['state']
|
|
||||||
user = module.params['user']
|
|
||||||
url = module.params['url']
|
|
||||||
vmname = module.params['instance_name']
|
|
||||||
password = module.params['password']
|
|
||||||
image = module.params['image'] # name of the image to deploy
|
|
||||||
resource_type = module.params['resource_type'] # template or from scratch
|
|
||||||
zone = module.params['zone'] # oVirt cluster
|
|
||||||
vmdisk_size = module.params['instance_disksize'] # disksize
|
|
||||||
vmcpus = module.params['instance_cpus'] # number of cpu
|
|
||||||
vmnic = module.params['instance_nic'] # network interface
|
|
||||||
vmnetwork = module.params['instance_network'] # logical network
|
|
||||||
vmmem = module.params['instance_mem'] # mem size
|
|
||||||
vmdisk_alloc = module.params['disk_alloc'] # thin, preallocated
|
|
||||||
vmdisk_int = module.params['disk_int'] # disk interface virtio or ide
|
|
||||||
vmos = module.params['instance_os'] # Operating System
|
|
||||||
vmtype = module.params['instance_type'] # server, desktop or high_performance
|
|
||||||
vmcores = module.params['instance_cores'] # number of cores
|
|
||||||
sdomain = module.params['sdomain'] # storage domain to store disk on
|
|
||||||
region = module.params['region'] # oVirt Datacenter
|
|
||||||
hostname = module.params['instance_hostname']
|
|
||||||
ip = module.params['instance_ip']
|
|
||||||
netmask = module.params['instance_netmask']
|
|
||||||
gateway = module.params['instance_gateway']
|
|
||||||
domain = module.params['instance_domain']
|
|
||||||
dns = module.params['instance_dns']
|
|
||||||
rootpw = module.params['instance_rootpw']
|
|
||||||
key = module.params['instance_key']
|
|
||||||
# initialize connection
|
|
||||||
try:
|
|
||||||
c = conn(url + "/api", user, password)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg='%s' % e)
|
|
||||||
|
|
||||||
if state == 'present':
|
|
||||||
if get_vm(c, vmname) == "empty":
|
|
||||||
if resource_type == 'template':
|
|
||||||
try:
|
|
||||||
create_vm_template(c, vmname, image, zone)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg='%s' % e)
|
|
||||||
module.exit_json(changed=True, msg="deployed VM %s from template %s" % (vmname, image))
|
|
||||||
elif resource_type == 'new':
|
|
||||||
# FIXME: refactor, use keyword args.
|
|
||||||
try:
|
|
||||||
create_vm(c, vmtype, vmname, zone, vmdisk_size, vmcpus, vmnic, vmnetwork, vmmem, vmdisk_alloc, sdomain, vmcores, vmos, vmdisk_int)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg='%s' % e)
|
|
||||||
module.exit_json(changed=True, msg="deployed VM %s from scratch" % vmname)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, msg="You did not specify a resource type")
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, msg="VM %s already exists" % vmname)
|
|
||||||
|
|
||||||
if state == 'started':
|
|
||||||
if vm_status(c, vmname) == 'up':
|
|
||||||
module.exit_json(changed=False, msg="VM %s is already running" % vmname)
|
|
||||||
else:
|
|
||||||
# vm_start(c, vmname)
|
|
||||||
vm_start(c, vmname, hostname, ip, netmask, gateway, domain, dns, rootpw, key)
|
|
||||||
module.exit_json(changed=True, msg="VM %s started" % vmname)
|
|
||||||
|
|
||||||
if state == 'shutdown':
|
|
||||||
if vm_status(c, vmname) == 'down':
|
|
||||||
module.exit_json(changed=False, msg="VM %s is already shutdown" % vmname)
|
|
||||||
else:
|
|
||||||
vm_stop(c, vmname)
|
|
||||||
module.exit_json(changed=True, msg="VM %s is shutting down" % vmname)
|
|
||||||
|
|
||||||
if state == 'restart':
|
|
||||||
if vm_status(c, vmname) == 'up':
|
|
||||||
vm_restart(c, vmname)
|
|
||||||
module.exit_json(changed=True, msg="VM %s is restarted" % vmname)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, msg="VM %s is not running" % vmname)
|
|
||||||
|
|
||||||
if state == 'absent':
|
|
||||||
if get_vm(c, vmname) == "empty":
|
|
||||||
module.exit_json(changed=False, msg="VM %s does not exist" % vmname)
|
|
||||||
else:
|
|
||||||
vm_remove(c, vmname)
|
|
||||||
module.exit_json(changed=True, msg="VM %s removed" % vmname)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,175 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: online_server_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.online_server_info) instead.
|
|
||||||
short_description: Gather facts about Online servers.
|
|
||||||
description:
|
|
||||||
- Gather facts about the servers.
|
|
||||||
- U(https://www.online.net/en/dedicated-server)
|
|
||||||
author:
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.online
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Online server facts
|
|
||||||
community.general.online_server_facts:
|
|
||||||
api_token: '0d1627e8-bbf0-44c5-a46f-5c4d3aef033f'
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
online_server_facts:
|
|
||||||
description: Response from Online API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"online_server_facts": [
|
|
||||||
{
|
|
||||||
"abuse": "abuse@example.com",
|
|
||||||
"anti_ddos": false,
|
|
||||||
"bmc": {
|
|
||||||
"session_key": null
|
|
||||||
},
|
|
||||||
"boot_mode": "normal",
|
|
||||||
"contacts": {
|
|
||||||
"owner": "foobar",
|
|
||||||
"tech": "foobar"
|
|
||||||
},
|
|
||||||
"disks": [
|
|
||||||
{
|
|
||||||
"$ref": "/api/v1/server/hardware/disk/68452"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "/api/v1/server/hardware/disk/68453"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"drive_arrays": [
|
|
||||||
{
|
|
||||||
"disks": [
|
|
||||||
{
|
|
||||||
"$ref": "/api/v1/server/hardware/disk/68452"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "/api/v1/server/hardware/disk/68453"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"raid_controller": {
|
|
||||||
"$ref": "/api/v1/server/hardware/raidController/9910"
|
|
||||||
},
|
|
||||||
"raid_level": "RAID1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"hardware_watch": true,
|
|
||||||
"hostname": "sd-42",
|
|
||||||
"id": 42,
|
|
||||||
"ip": [
|
|
||||||
{
|
|
||||||
"address": "195.154.172.149",
|
|
||||||
"mac": "28:92:4a:33:5e:c6",
|
|
||||||
"reverse": "195-154-172-149.rev.poneytelecom.eu.",
|
|
||||||
"switch_port_state": "up",
|
|
||||||
"type": "public"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "10.90.53.212",
|
|
||||||
"mac": "28:92:4a:33:5e:c7",
|
|
||||||
"reverse": null,
|
|
||||||
"switch_port_state": "up",
|
|
||||||
"type": "private"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"last_reboot": "2018-08-23T08:32:03.000Z",
|
|
||||||
"location": {
|
|
||||||
"block": "A",
|
|
||||||
"datacenter": "DC3",
|
|
||||||
"position": 19,
|
|
||||||
"rack": "A23",
|
|
||||||
"room": "4 4-4"
|
|
||||||
},
|
|
||||||
"network": {
|
|
||||||
"ip": [
|
|
||||||
"195.154.172.149"
|
|
||||||
],
|
|
||||||
"ipfo": [],
|
|
||||||
"private": [
|
|
||||||
"10.90.53.212"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"offer": "Pro-1-S-SATA",
|
|
||||||
"os": {
|
|
||||||
"name": "FreeBSD",
|
|
||||||
"version": "11.1-RELEASE"
|
|
||||||
},
|
|
||||||
"power": "ON",
|
|
||||||
"proactive_monitoring": false,
|
|
||||||
"raid_controllers": [
|
|
||||||
{
|
|
||||||
"$ref": "/api/v1/server/hardware/raidController/9910"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"support": "Basic service level"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.online import (
|
|
||||||
Online, OnlineException, online_argument_spec
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class OnlineServerFacts(Online):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(OnlineServerFacts, self).__init__(module)
|
|
||||||
self.name = 'api/v1/server'
|
|
||||||
|
|
||||||
def _get_server_detail(self, server_path):
|
|
||||||
try:
|
|
||||||
return self.get(path=server_path).json
|
|
||||||
except OnlineException as exc:
|
|
||||||
self.module.fail_json(msg="A problem occurred while fetching: %s (%s)" % (server_path, exc))
|
|
||||||
|
|
||||||
def all_detailed_servers(self):
|
|
||||||
servers_api_path = self.get_resources()
|
|
||||||
|
|
||||||
server_data = (
|
|
||||||
self._get_server_detail(server_api_path)
|
|
||||||
for server_api_path in servers_api_path
|
|
||||||
)
|
|
||||||
|
|
||||||
return [s for s in server_data if s is not None]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=online_argument_spec(),
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
servers_facts = OnlineServerFacts(module).all_detailed_servers()
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'online_server_facts': servers_facts}
|
|
||||||
)
|
|
||||||
except OnlineException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,76 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: online_user_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.online_user_info) instead.
|
|
||||||
short_description: Gather facts about Online user.
|
|
||||||
description:
|
|
||||||
- Gather facts about the user.
|
|
||||||
author:
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.online
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Online user facts
|
|
||||||
community.general.online_user_facts:
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
online_user_facts:
|
|
||||||
description: Response from Online API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"online_user_facts": {
|
|
||||||
"company": "foobar LLC",
|
|
||||||
"email": "foobar@example.com",
|
|
||||||
"first_name": "foo",
|
|
||||||
"id": 42,
|
|
||||||
"last_name": "bar",
|
|
||||||
"login": "foobar"
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.online import (
|
|
||||||
Online, OnlineException, online_argument_spec
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class OnlineUserFacts(Online):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(OnlineUserFacts, self).__init__(module)
|
|
||||||
self.name = 'api/v1/user'
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=online_argument_spec(),
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'online_user_facts': OnlineUserFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except OnlineException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1 +0,0 @@
|
||||||
one_image_info.py
|
|
|
@ -261,9 +261,6 @@ def main():
|
||||||
module = AnsibleModule(argument_spec=fields,
|
module = AnsibleModule(argument_spec=fields,
|
||||||
mutually_exclusive=[['ids', 'name']],
|
mutually_exclusive=[['ids', 'name']],
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
if module._name in ('one_image_facts', 'community.general.one_image_facts'):
|
|
||||||
module.deprecate("The 'one_image_facts' module has been renamed to 'one_image_info'",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
if not HAS_PYONE:
|
if not HAS_PYONE:
|
||||||
module.fail_json(msg='This module requires pyone to work!')
|
module.fail_json(msg='This module requires pyone to work!')
|
||||||
|
|
|
@ -1,196 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_affinity_label_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV affinity labels
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_affinity_label_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV affinity labels."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_affinity_labels), which
|
|
||||||
contains a list of affinity labels. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- "Name of the affinity labels which should be listed."
|
|
||||||
vm:
|
|
||||||
description:
|
|
||||||
- "Name of the VM, which affinity labels should be listed."
|
|
||||||
host:
|
|
||||||
description:
|
|
||||||
- "Name of the host, which affinity labels should be listed."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all affinity labels, which names start with label
|
|
||||||
ovirt_affinity_label_info:
|
|
||||||
name: label*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_affinity_labels }}"
|
|
||||||
|
|
||||||
- name: >
|
|
||||||
Gather information about all affinity labels, which are assigned to VMs
|
|
||||||
which names start with postgres
|
|
||||||
ovirt_affinity_label_info:
|
|
||||||
vm: postgres*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_affinity_labels }}"
|
|
||||||
|
|
||||||
- name: >
|
|
||||||
Gather information about all affinity labels, which are assigned to hosts
|
|
||||||
which names start with west
|
|
||||||
ovirt_affinity_label_info:
|
|
||||||
host: west*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_affinity_labels }}"
|
|
||||||
|
|
||||||
- name: >
|
|
||||||
Gather information about all affinity labels, which are assigned to hosts
|
|
||||||
which names start with west or VMs which names start with postgres
|
|
||||||
ovirt_affinity_label_info:
|
|
||||||
host: west*
|
|
||||||
vm: postgres*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_affinity_labels }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_affinity_labels:
|
|
||||||
description: "List of dictionaries describing the affinity labels. Affinity labels attributes are mapped to dictionary keys,
|
|
||||||
all affinity labels attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/affinity_label."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
search_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
name=dict(default=None),
|
|
||||||
host=dict(default=None),
|
|
||||||
vm=dict(default=None),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_affinity_label_facts', 'community.general.ovirt_affinity_label_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_affinity_label_facts' module has been renamed to 'ovirt_affinity_label_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
affinity_labels_service = connection.system_service().affinity_labels_service()
|
|
||||||
labels = []
|
|
||||||
all_labels = affinity_labels_service.list()
|
|
||||||
if module.params['name']:
|
|
||||||
labels.extend([
|
|
||||||
l for l in all_labels
|
|
||||||
if fnmatch.fnmatch(l.name, module.params['name'])
|
|
||||||
])
|
|
||||||
if module.params['host']:
|
|
||||||
hosts_service = connection.system_service().hosts_service()
|
|
||||||
if search_by_name(hosts_service, module.params['host']) is None:
|
|
||||||
raise Exception("Host '%s' was not found." % module.params['host'])
|
|
||||||
labels.extend([
|
|
||||||
label
|
|
||||||
for label in all_labels
|
|
||||||
for host in connection.follow_link(label.hosts)
|
|
||||||
if fnmatch.fnmatch(hosts_service.service(host.id).get().name, module.params['host'])
|
|
||||||
])
|
|
||||||
if module.params['vm']:
|
|
||||||
vms_service = connection.system_service().vms_service()
|
|
||||||
if search_by_name(vms_service, module.params['vm']) is None:
|
|
||||||
raise Exception("Vm '%s' was not found." % module.params['vm'])
|
|
||||||
labels.extend([
|
|
||||||
label
|
|
||||||
for label in all_labels
|
|
||||||
for vm in connection.follow_link(label.vms)
|
|
||||||
if fnmatch.fnmatch(vms_service.service(vm.id).get().name, module.params['vm'])
|
|
||||||
])
|
|
||||||
|
|
||||||
if not (module.params['vm'] or module.params['host'] or module.params['name']):
|
|
||||||
labels = all_labels
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_affinity_labels=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=l,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for l in labels
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,98 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright (c) 2017 Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_api_facts
|
|
||||||
short_description: Retrieve information about the oVirt/RHV API
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_api_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about the oVirt/RHV API."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_api),
|
|
||||||
which contains a information about oVirt/RHV API. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information oVirt API
|
|
||||||
ovirt_api_info:
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_api }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_api:
|
|
||||||
description: "Dictionary describing the oVirt API information.
|
|
||||||
Api attributes are mapped to dictionary keys,
|
|
||||||
all API attributes can be found at following
|
|
||||||
url: https://ovirt.example.com/ovirt-engine/api/model#types/api."
|
|
||||||
returned: On success.
|
|
||||||
type: dict
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec()
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_api_facts', 'community.general.ovirt_api_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_api_facts' module has been renamed to 'ovirt_api_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
api = connection.system_service().get()
|
|
||||||
result = dict(
|
|
||||||
ovirt_api=get_dict_of_struct(
|
|
||||||
struct=api,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,125 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_cluster_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV clusters
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_cluster_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV clusters."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_clusters), which
|
|
||||||
contains a list of clusters. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search cluster X from datacenter Y use following pattern:
|
|
||||||
name=X and datacenter=Y"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all clusters which names start with production
|
|
||||||
ovirt_cluster_info:
|
|
||||||
pattern:
|
|
||||||
name: 'production*'
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_clusters }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_clusters:
|
|
||||||
description: "List of dictionaries describing the clusters. Cluster attributes are mapped to dictionary keys,
|
|
||||||
all clusters attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/cluster."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_cluster_facts', 'community.general.ovirt_cluster_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_cluster_facts' module has been renamed to 'ovirt_cluster_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
clusters_service = connection.system_service().clusters_service()
|
|
||||||
clusters = clusters_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_clusters=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in clusters
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,108 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_datacenter_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV datacenters
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_datacenter_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV datacenters."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_datacenters), which
|
|
||||||
contains a list of datacenters. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search datacenter I(X) use following pattern: I(name=X)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all data centers which names start with production
|
|
||||||
ovirt_datacenter_info:
|
|
||||||
pattern: name=production*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_datacenters }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_datacenters:
|
|
||||||
description: "List of dictionaries describing the datacenters. Datacenter attributes are mapped to dictionary keys,
|
|
||||||
all datacenters attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/data_center."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_datacenter_facts', 'community.general.ovirt_datacenter_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_datacenter_facts' module has been renamed to 'ovirt_datacenter_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
datacenters_service = connection.system_service().data_centers_service()
|
|
||||||
datacenters = datacenters_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_datacenters=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=d,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for d in datacenters
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,125 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2017 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_disk_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV disks
|
|
||||||
author: "Katerina Koukiou (@KKoukiou)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_disk_info) instead
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV disks."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_disks), which
|
|
||||||
contains a list of disks. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search Disk X from storage Y use following pattern:
|
|
||||||
name=X and storage.name=Y"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all Disks which names start with centos
|
|
||||||
ovirt_disk_info:
|
|
||||||
pattern: name=centos*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_disks }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_disks:
|
|
||||||
description: "List of dictionaries describing the Disks. Disk attributes are mapped to dictionary keys,
|
|
||||||
all Disks attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/disk."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_disk_facts', 'community.general.ovirt_disk_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_disk_facts' module has been renamed to 'ovirt_disk_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
disks_service = connection.system_service().disks_service()
|
|
||||||
disks = disks_service.list(
|
|
||||||
search=module.params['pattern'],
|
|
||||||
)
|
|
||||||
result = dict(
|
|
||||||
ovirt_disks=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in disks
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,170 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright: (c) 2019, Ansible Project
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_event_facts
|
|
||||||
short_description: This module can be used to retrieve information about one or more oVirt/RHV events
|
|
||||||
author: "Chris Keller (@nasx)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_event_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV events."
|
|
||||||
options:
|
|
||||||
case_sensitive:
|
|
||||||
description:
|
|
||||||
- "Indicates if the search performed using the search parameter should be performed taking case
|
|
||||||
into account. The default value is true, which means that case is taken into account. If you
|
|
||||||
want to search ignoring case set it to false."
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: bool
|
|
||||||
|
|
||||||
from_:
|
|
||||||
description:
|
|
||||||
- "Indicates the event index after which events should be returned. The indexes of events are
|
|
||||||
strictly increasing, so when this parameter is used only the events with greater indexes
|
|
||||||
will be returned."
|
|
||||||
required: false
|
|
||||||
type: int
|
|
||||||
|
|
||||||
max:
|
|
||||||
description:
|
|
||||||
- "Sets the maximum number of events to return. If not specified all the events are returned."
|
|
||||||
required: false
|
|
||||||
type: int
|
|
||||||
|
|
||||||
search:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by the oVirt/RHV API."
|
|
||||||
- "For example to search for events of severity alert use the following pattern: severity=alert"
|
|
||||||
required: false
|
|
||||||
type: str
|
|
||||||
|
|
||||||
headers:
|
|
||||||
description:
|
|
||||||
- "Additional HTTP headers."
|
|
||||||
required: false
|
|
||||||
type: str
|
|
||||||
|
|
||||||
query:
|
|
||||||
description:
|
|
||||||
- "Additional URL query parameters."
|
|
||||||
required: false
|
|
||||||
type: str
|
|
||||||
|
|
||||||
wait:
|
|
||||||
description:
|
|
||||||
- "If True wait for the response."
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
type: bool
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain the auth parameter for simplicity,
|
|
||||||
# look at the ovirt_auth module to see how to reuse authentication.
|
|
||||||
|
|
||||||
- name: Return all events
|
|
||||||
ovirt_event_info:
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Return the last 10 events
|
|
||||||
ovirt_event_info:
|
|
||||||
max: 10
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Return all events of type alert
|
|
||||||
ovirt_event_info:
|
|
||||||
search: "severity=alert"
|
|
||||||
register: result
|
|
||||||
- ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_events }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_events:
|
|
||||||
description: "List of dictionaries describing the events. Event attributes are mapped to dictionary keys.
|
|
||||||
All event attributes can be found at the following url:
|
|
||||||
http://ovirt.github.io/ovirt-engine-api-model/master/#types/event"
|
|
||||||
returned: On success."
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
case_sensitive=dict(default=True, type='bool', required=False),
|
|
||||||
from_=dict(default=None, type='int', required=False),
|
|
||||||
max=dict(default=None, type='int', required=False),
|
|
||||||
search=dict(default='', required=False),
|
|
||||||
headers=dict(default='', required=False),
|
|
||||||
query=dict(default='', required=False),
|
|
||||||
wait=dict(default=True, type='bool', required=False)
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_event_facts', 'community.general.ovirt_event_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_event_facts' module has been renamed to 'ovirt_event_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
events_service = connection.system_service().events_service()
|
|
||||||
events = events_service.list(
|
|
||||||
case_sensitive=module.params['case_sensitive'],
|
|
||||||
from_=module.params['from_'],
|
|
||||||
max=module.params['max'],
|
|
||||||
search=module.params['search'],
|
|
||||||
headers=module.params['headers'],
|
|
||||||
query=module.params['query'],
|
|
||||||
wait=module.params['wait']
|
|
||||||
)
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_events=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in events
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,165 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_external_provider_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV external providers
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_external_provider_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV external providers."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_external_providers), which
|
|
||||||
contains a list of external_providers. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
type:
|
|
||||||
description:
|
|
||||||
- "Type of the external provider."
|
|
||||||
choices: ['os_image', 'os_network', 'os_volume', 'foreman']
|
|
||||||
required: true
|
|
||||||
type: str
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- "Name of the external provider, can be used as glob expression."
|
|
||||||
type: str
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all image external providers named glance
|
|
||||||
ovirt_external_provider_info:
|
|
||||||
type: os_image
|
|
||||||
name: glance
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_external_providers }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_external_providers:
|
|
||||||
description:
|
|
||||||
- "List of dictionaries. Content depends on I(type)."
|
|
||||||
- "For type C(foreman), attributes appearing in the dictionary can be found on your oVirt/RHV instance
|
|
||||||
at the following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/external_host_provider."
|
|
||||||
- "For type C(os_image), attributes appearing in the dictionary can be found on your oVirt/RHV instance
|
|
||||||
at the following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/openstack_image_provider."
|
|
||||||
- "For type C(os_volume), attributes appearing in the dictionary can be found on your oVirt/RHV instance
|
|
||||||
at the following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/openstack_volume_provider."
|
|
||||||
- "For type C(os_network), attributes appearing in the dictionary can be found on your oVirt/RHV instance
|
|
||||||
at the following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/openstack_network_provider."
|
|
||||||
returned: On success
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _external_provider_service(provider_type, system_service):
|
|
||||||
if provider_type == 'os_image':
|
|
||||||
return system_service.openstack_image_providers_service()
|
|
||||||
elif provider_type == 'os_network':
|
|
||||||
return system_service.openstack_network_providers_service()
|
|
||||||
elif provider_type == 'os_volume':
|
|
||||||
return system_service.openstack_volume_providers_service()
|
|
||||||
elif provider_type == 'foreman':
|
|
||||||
return system_service.external_host_providers_service()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
name=dict(default=None, required=False),
|
|
||||||
type=dict(
|
|
||||||
required=True,
|
|
||||||
choices=['os_image', 'os_network', 'os_volume', 'foreman'],
|
|
||||||
aliases=['provider'],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_external_provider_facts', 'community.general.ovirt_external_provider_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_external_provider_facts' module has been renamed to 'ovirt_external_provider_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
external_providers_service = _external_provider_service(
|
|
||||||
provider_type=module.params.pop('type'),
|
|
||||||
system_service=connection.system_service(),
|
|
||||||
)
|
|
||||||
if module.params['name']:
|
|
||||||
external_providers = [
|
|
||||||
e for e in external_providers_service.list()
|
|
||||||
if fnmatch.fnmatch(e.name, module.params['name'])
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
external_providers = external_providers_service.list()
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_external_providers=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in external_providers
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,123 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_group_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV groups
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_group_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV groups."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_groups), which
|
|
||||||
contains a list of groups. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search group X use following pattern: name=X"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all groups which names start with admin
|
|
||||||
ovirt_group_info:
|
|
||||||
pattern: name=admin*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_groups }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_groups:
|
|
||||||
description: "List of dictionaries describing the groups. Group attributes are mapped to dictionary keys,
|
|
||||||
all groups attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/group."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_group_facts', 'community.general.ovirt_group_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_group_facts' module has been renamed to 'ovirt_group_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
groups_service = connection.system_service().groups_service()
|
|
||||||
groups = groups_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_groups=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in groups
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,149 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_host_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV hosts
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_host_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV hosts."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_hosts), which
|
|
||||||
contains a list of hosts. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search host X from datacenter Y use following pattern:
|
|
||||||
name=X and datacenter=Y"
|
|
||||||
all_content:
|
|
||||||
description:
|
|
||||||
- "If I(true) all the attributes of the hosts should be
|
|
||||||
included in the response."
|
|
||||||
default: False
|
|
||||||
type: bool
|
|
||||||
cluster_version:
|
|
||||||
description:
|
|
||||||
- "Filter the hosts based on the cluster version."
|
|
||||||
type: str
|
|
||||||
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all hosts which names start with host and belong to data center west
|
|
||||||
ovirt_host_info:
|
|
||||||
pattern: name=host* and datacenter=west
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_hosts }}"
|
|
||||||
|
|
||||||
- name: Gather information about all hosts with cluster version 4.2
|
|
||||||
ovirt_host_info:
|
|
||||||
pattern: name=host*
|
|
||||||
cluster_version: "4.2"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_hosts }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_hosts:
|
|
||||||
description: "List of dictionaries describing the hosts. Host attributes are mapped to dictionary keys,
|
|
||||||
all hosts attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/host."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_filtered_hosts(cluster_version, hosts, connection):
|
|
||||||
# Filtering by cluster version returns only those which have same cluster version as input
|
|
||||||
filtered_hosts = []
|
|
||||||
for host in hosts:
|
|
||||||
cluster = connection.follow_link(host.cluster)
|
|
||||||
cluster_version_host = str(cluster.version.major) + '.' + str(cluster.version.minor)
|
|
||||||
if cluster_version_host == cluster_version:
|
|
||||||
filtered_hosts.append(host)
|
|
||||||
return filtered_hosts
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
all_content=dict(default=False, type='bool'),
|
|
||||||
cluster_version=dict(default=None, type='str'),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_host_facts', 'community.general.ovirt_host_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_host_facts' module has been renamed to 'ovirt_host_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
hosts_service = connection.system_service().hosts_service()
|
|
||||||
hosts = hosts_service.list(
|
|
||||||
search=module.params['pattern'],
|
|
||||||
all_content=module.params['all_content']
|
|
||||||
)
|
|
||||||
cluster_version = module.params.get('cluster_version')
|
|
||||||
if cluster_version is not None:
|
|
||||||
hosts = get_filtered_hosts(cluster_version, hosts, connection)
|
|
||||||
result = dict(
|
|
||||||
ovirt_hosts=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in hosts
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,187 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2017 Red Hat, Inc.
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_host_storage_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV HostStorages (applicable only for block storage)
|
|
||||||
author: "Daniel Erez (@derez)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_host_storage_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV HostStorages (applicable only for block storage)."
|
|
||||||
options:
|
|
||||||
host:
|
|
||||||
description:
|
|
||||||
- "Host to get device list from."
|
|
||||||
required: true
|
|
||||||
iscsi:
|
|
||||||
description:
|
|
||||||
- "Dictionary with values for iSCSI storage type:"
|
|
||||||
suboptions:
|
|
||||||
address:
|
|
||||||
description:
|
|
||||||
- "Address of the iSCSI storage server."
|
|
||||||
target:
|
|
||||||
description:
|
|
||||||
- "The target IQN for the storage device."
|
|
||||||
username:
|
|
||||||
description:
|
|
||||||
- "A CHAP user name for logging into a target."
|
|
||||||
password:
|
|
||||||
description:
|
|
||||||
- "A CHAP password for logging into a target."
|
|
||||||
portal:
|
|
||||||
description:
|
|
||||||
- "The portal being used to connect with iscsi."
|
|
||||||
fcp:
|
|
||||||
description:
|
|
||||||
- "Dictionary with values for fibre channel storage type:"
|
|
||||||
suboptions:
|
|
||||||
address:
|
|
||||||
description:
|
|
||||||
- "Address of the fibre channel storage server."
|
|
||||||
port:
|
|
||||||
description:
|
|
||||||
- "Port of the fibre channel storage server."
|
|
||||||
lun_id:
|
|
||||||
description:
|
|
||||||
- "LUN id."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about HostStorages with specified target and address
|
|
||||||
ovirt_host_storage_info:
|
|
||||||
host: myhost
|
|
||||||
iscsi:
|
|
||||||
target: iqn.2016-08-09.domain-01:nickname
|
|
||||||
address: 10.34.63.204
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_host_storages }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_host_storages:
|
|
||||||
description: "List of dictionaries describing the HostStorage. HostStorage attributes are mapped to dictionary keys,
|
|
||||||
all HostStorage attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/host_storage."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
try:
|
|
||||||
import ovirtsdk4.types as otypes
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
get_id_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _login(host_service, iscsi):
|
|
||||||
host_service.iscsi_login(
|
|
||||||
iscsi=otypes.IscsiDetails(
|
|
||||||
username=iscsi.get('username'),
|
|
||||||
password=iscsi.get('password'),
|
|
||||||
address=iscsi.get('address'),
|
|
||||||
target=iscsi.get('target'),
|
|
||||||
portal=iscsi.get('portal')
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _get_storage_type(params):
|
|
||||||
for sd_type in ['iscsi', 'fcp']:
|
|
||||||
if params.get(sd_type) is not None:
|
|
||||||
return sd_type
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
host=dict(required=True),
|
|
||||||
iscsi=dict(default=None, type='dict'),
|
|
||||||
fcp=dict(default=None, type='dict'),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_host_storage_facts', 'community.general.ovirt_host_storage_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_host_storage_facts' module has been renamed to 'ovirt_host_storage_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
|
|
||||||
# Get Host
|
|
||||||
hosts_service = connection.system_service().hosts_service()
|
|
||||||
host_id = get_id_by_name(hosts_service, module.params['host'])
|
|
||||||
storage_type = _get_storage_type(module.params)
|
|
||||||
host_service = hosts_service.host_service(host_id)
|
|
||||||
|
|
||||||
if storage_type == 'iscsi':
|
|
||||||
# Login
|
|
||||||
iscsi = module.params.get('iscsi')
|
|
||||||
_login(host_service, iscsi)
|
|
||||||
|
|
||||||
# Get LUNs exposed from the specified target
|
|
||||||
host_storages = host_service.storage_service().list()
|
|
||||||
|
|
||||||
if storage_type == 'iscsi':
|
|
||||||
filterred_host_storages = [host_storage for host_storage in host_storages
|
|
||||||
if host_storage.type == otypes.StorageType.ISCSI]
|
|
||||||
if 'target' in iscsi:
|
|
||||||
filterred_host_storages = [host_storage for host_storage in filterred_host_storages
|
|
||||||
if iscsi.get('target') == host_storage.logical_units[0].target]
|
|
||||||
elif storage_type == 'fcp':
|
|
||||||
filterred_host_storages = [host_storage for host_storage in host_storages
|
|
||||||
if host_storage.type == otypes.StorageType.FCP]
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_host_storages=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in filterred_host_storages
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,125 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_network_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV networks
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_network_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV networks."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_networks), which
|
|
||||||
contains a list of networks. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search network starting with string vlan1 use: name=vlan1*"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all networks which names start with vlan1
|
|
||||||
ovirt_network_info:
|
|
||||||
pattern: name=vlan1*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_networks }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_networks:
|
|
||||||
description: "List of dictionaries describing the networks. Network attributes are mapped to dictionary keys,
|
|
||||||
all networks attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/network."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_network_facts', 'community.general.ovirt_network_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_network_facts' module has been renamed to 'ovirt_network_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
networks_service = connection.system_service().networks_service()
|
|
||||||
networks = networks_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_networks=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in networks
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,143 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_nic_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV virtual machine network interfaces
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_nic_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV virtual machine network interfaces."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_nics), which
|
|
||||||
contains a list of NICs. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
vm:
|
|
||||||
description:
|
|
||||||
- "Name of the VM where NIC is attached."
|
|
||||||
required: true
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- "Name of the NIC, can be used as glob expression."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all NICs which names start with eth for VM named centos7
|
|
||||||
ovirt_nic_info:
|
|
||||||
vm: centos7
|
|
||||||
name: eth*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_nics }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_nics:
|
|
||||||
description: "List of dictionaries describing the network interfaces. NIC attributes are mapped to dictionary keys,
|
|
||||||
all NICs attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/nic."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
search_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
vm=dict(required=True),
|
|
||||||
name=dict(default=None),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_nic_facts', 'community.general.ovirt_nic_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_nic_facts' module has been renamed to 'ovirt_nic_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
vms_service = connection.system_service().vms_service()
|
|
||||||
vm_name = module.params['vm']
|
|
||||||
vm = search_by_name(vms_service, vm_name)
|
|
||||||
if vm is None:
|
|
||||||
raise Exception("VM '%s' was not found." % vm_name)
|
|
||||||
|
|
||||||
nics_service = vms_service.service(vm.id).nics_service()
|
|
||||||
if module.params['name']:
|
|
||||||
nics = [
|
|
||||||
e for e in nics_service.list()
|
|
||||||
if fnmatch.fnmatch(e.name, module.params['name'])
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
nics = nics_service.list()
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_nics=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in nics
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,166 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_permission_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV permissions
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_permission_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV permissions."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_permissions), which
|
|
||||||
contains a list of permissions. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
user_name:
|
|
||||||
description:
|
|
||||||
- "Username of the user to manage. In most LDAPs it's I(uid) of the user, but in Active Directory you must specify I(UPN) of the user."
|
|
||||||
group_name:
|
|
||||||
description:
|
|
||||||
- "Name of the group to manage."
|
|
||||||
authz_name:
|
|
||||||
description:
|
|
||||||
- "Authorization provider of the user/group. In previous versions of oVirt/RHV known as domain."
|
|
||||||
required: true
|
|
||||||
aliases: ['domain']
|
|
||||||
namespace:
|
|
||||||
description:
|
|
||||||
- "Namespace of the authorization provider, where user/group resides."
|
|
||||||
required: false
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all permissions of user with username john
|
|
||||||
ovirt_permission_info:
|
|
||||||
user_name: john
|
|
||||||
authz_name: example.com-authz
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_permissions }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_permissions:
|
|
||||||
description: "List of dictionaries describing the permissions. Permission attributes are mapped to dictionary keys,
|
|
||||||
all permissions attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/permission."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
try:
|
|
||||||
import ovirtsdk4 as sdk
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_link_name,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
search_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _permissions_service(connection, module):
|
|
||||||
if module.params['user_name']:
|
|
||||||
service = connection.system_service().users_service()
|
|
||||||
entity = next(
|
|
||||||
iter(
|
|
||||||
service.list(
|
|
||||||
search='usrname={0}'.format(
|
|
||||||
'{0}@{1}'.format(module.params['user_name'], module.params['authz_name'])
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
None
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
service = connection.system_service().groups_service()
|
|
||||||
entity = search_by_name(service, module.params['group_name'])
|
|
||||||
|
|
||||||
if entity is None:
|
|
||||||
raise Exception("User/Group wasn't found.")
|
|
||||||
|
|
||||||
return service.service(entity.id).permissions_service()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
authz_name=dict(required=True, aliases=['domain']),
|
|
||||||
user_name=dict(default=None),
|
|
||||||
group_name=dict(default=None),
|
|
||||||
namespace=dict(default=None),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_permission_facts', 'community.general.ovirt_permission_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_permission_facts' module has been renamed to 'ovirt_permission_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
permissions_service = _permissions_service(connection, module)
|
|
||||||
permissions = []
|
|
||||||
for p in permissions_service.list():
|
|
||||||
newperm = dict()
|
|
||||||
for key, value in p.__dict__.items():
|
|
||||||
if value and isinstance(value, sdk.Struct):
|
|
||||||
newperm[key[1:]] = get_link_name(connection, value)
|
|
||||||
newperm['%s_id' % key[1:]] = value.id
|
|
||||||
permissions.append(newperm)
|
|
||||||
|
|
||||||
result = dict(ovirt_permissions=permissions)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,143 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_quota_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV quotas
|
|
||||||
author: "Maor Lipchuk (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_quota_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV quotas."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_quotas), which
|
|
||||||
contains a list of quotas. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
data_center:
|
|
||||||
description:
|
|
||||||
- "Name of the datacenter where quota resides."
|
|
||||||
required: true
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- "Name of the quota, can be used as glob expression."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about quota named C<myquota> in Default datacenter
|
|
||||||
ovirt_quota_info:
|
|
||||||
data_center: Default
|
|
||||||
name: myquota
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_quotas }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_quotas:
|
|
||||||
description: "List of dictionaries describing the quotas. Quota attributes are mapped to dictionary keys,
|
|
||||||
all quotas attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/quota."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
search_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
data_center=dict(required=True),
|
|
||||||
name=dict(default=None),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_quota_facts', 'community.general.ovirt_quota_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_quota_facts' module has been renamed to 'ovirt_quota_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
datacenters_service = connection.system_service().data_centers_service()
|
|
||||||
dc_name = module.params['data_center']
|
|
||||||
dc = search_by_name(datacenters_service, dc_name)
|
|
||||||
if dc is None:
|
|
||||||
raise Exception("Datacenter '%s' was not found." % dc_name)
|
|
||||||
|
|
||||||
quotas_service = datacenters_service.service(dc.id).quotas_service()
|
|
||||||
if module.params['name']:
|
|
||||||
quotas = [
|
|
||||||
e for e in quotas_service.list()
|
|
||||||
if fnmatch.fnmatch(e.name, module.params['name'])
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
quotas = quotas_service.list()
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_quotas=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in quotas
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,140 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2017 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_scheduling_policy_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt scheduling policies
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_scheduling_policy_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt scheduling policies."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_scheduling_policies),
|
|
||||||
which contains a list of scheduling policies. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
id:
|
|
||||||
description:
|
|
||||||
- "ID of the scheduling policy."
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- "Name of the scheduling policy, can be used as glob expression."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all scheduling policies with name InClusterUpgrade
|
|
||||||
ovirt_scheduling_policy_info:
|
|
||||||
name: InClusterUpgrade
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_scheduling_policies }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_scheduling_policies:
|
|
||||||
description: "List of dictionaries describing the scheduling policies.
|
|
||||||
Scheduling policies attributes are mapped to dictionary keys,
|
|
||||||
all scheduling policies attributes can be found at following
|
|
||||||
url: https://ovirt.example.com/ovirt-engine/api/model#types/scheduling_policy."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
id=dict(default=None),
|
|
||||||
name=dict(default=None),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_scheduling_policy_facts', 'community.general.ovirt_scheduling_policy_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_scheduling_policy_facts' module has been renamed to 'ovirt_scheduling_policy_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
system_service = connection.system_service()
|
|
||||||
sched_policies_service = system_service.scheduling_policies_service()
|
|
||||||
if module.params['name']:
|
|
||||||
sched_policies = [
|
|
||||||
e for e in sched_policies_service.list()
|
|
||||||
if fnmatch.fnmatch(e.name, module.params['name'])
|
|
||||||
]
|
|
||||||
elif module.params['id']:
|
|
||||||
sched_policies = [
|
|
||||||
sched_policies_service.service(module.params['id']).get()
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
sched_policies = sched_policies_service.list()
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_scheduling_policies=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in sched_policies
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,137 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_snapshot_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV virtual machine snapshots
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_snapshot_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV virtual machine snapshots."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_snapshots), which
|
|
||||||
contains a list of snapshots. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
vm:
|
|
||||||
description:
|
|
||||||
- "Name of the VM with snapshot."
|
|
||||||
required: true
|
|
||||||
description:
|
|
||||||
description:
|
|
||||||
- "Description of the snapshot, can be used as glob expression."
|
|
||||||
snapshot_id:
|
|
||||||
description:
|
|
||||||
- "Id of the snapshot we want to retrieve information about."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all snapshots which description start with update for VM named centos7
|
|
||||||
ovirt_snapshot_info:
|
|
||||||
vm: centos7
|
|
||||||
description: update*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_snapshots }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_snapshots:
|
|
||||||
description: "List of dictionaries describing the snapshot. Snapshot attributes are mapped to dictionary keys,
|
|
||||||
all snapshot attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/snapshot."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
search_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
vm=dict(required=True),
|
|
||||||
description=dict(default=None),
|
|
||||||
snapshot_id=dict(default=None),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_snapshot_facts', 'community.general.ovirt_snapshot_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_snapshot_facts' module has been renamed to 'ovirt_snapshot_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
vms_service = connection.system_service().vms_service()
|
|
||||||
vm_name = module.params['vm']
|
|
||||||
vm = search_by_name(vms_service, vm_name)
|
|
||||||
if vm is None:
|
|
||||||
raise Exception("VM '%s' was not found." % vm_name)
|
|
||||||
|
|
||||||
snapshots_service = vms_service.service(vm.id).snapshots_service()
|
|
||||||
if module.params['description']:
|
|
||||||
snapshots = [
|
|
||||||
e for e in snapshots_service.list()
|
|
||||||
if fnmatch.fnmatch(e.description, module.params['description'])
|
|
||||||
]
|
|
||||||
elif module.params['snapshot_id']:
|
|
||||||
snapshots = [
|
|
||||||
snapshots_service.snapshot_service(module.params['snapshot_id']).get()
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
snapshots = snapshots_service.list()
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_snapshots=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in snapshots
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,126 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_storage_domain_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV storage domains
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_storage_domain_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV storage domains."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_storage_domains), which
|
|
||||||
contains a list of storage domains. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search storage domain X from datacenter Y use following pattern:
|
|
||||||
name=X and datacenter=Y"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: >
|
|
||||||
Gather information about all storage domains which names
|
|
||||||
start with data and belong to data center west
|
|
||||||
ovirt_storage_domain_info:
|
|
||||||
pattern: name=data* and datacenter=west
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_storage_domains }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_storage_domains:
|
|
||||||
description: "List of dictionaries describing the storage domains. Storage_domain attributes are mapped to dictionary keys,
|
|
||||||
all storage domains attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/storage_domain."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_storage_domain_facts', 'community.general.ovirt_storage_domain_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_storage_domain_facts' module has been renamed to 'ovirt_storage_domain_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
storage_domains_service = connection.system_service().storage_domains_service()
|
|
||||||
storage_domains = storage_domains_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_storage_domains=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in storage_domains
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,142 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2017 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_storage_template_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV templates relate to a storage domain.
|
|
||||||
author: "Maor Lipchuk (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_storage_template_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV templates relate to a storage domain."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_storage_templates), which
|
|
||||||
contains a list of templates. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
unregistered:
|
|
||||||
description:
|
|
||||||
- "Flag which indicates whether to get unregistered templates which contain one or more
|
|
||||||
disks which reside on a storage domain or diskless templates."
|
|
||||||
type: bool
|
|
||||||
default: false
|
|
||||||
max:
|
|
||||||
description:
|
|
||||||
- "Sets the maximum number of templates to return. If not specified all the templates are returned."
|
|
||||||
storage_domain:
|
|
||||||
description:
|
|
||||||
- "The storage domain name where the templates should be listed."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all templates which relate to a storage domain and are unregistered
|
|
||||||
ovirt_storage_template_info:
|
|
||||||
unregistered: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_storage_templates }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_storage_templates:
|
|
||||||
description: "List of dictionaries describing the Templates. Template attributes are mapped to dictionary keys,
|
|
||||||
all Templates attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/template."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
get_id_by_name
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
storage_domain=dict(default=None),
|
|
||||||
max=dict(default=None, type='int'),
|
|
||||||
unregistered=dict(default=False, type='bool'),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_storage_template_facts', 'community.general.ovirt_storage_template_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_storage_template_facts' module has been renamed to 'ovirt_storage_template_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
storage_domains_service = connection.system_service().storage_domains_service()
|
|
||||||
sd_id = get_id_by_name(storage_domains_service, module.params['storage_domain'])
|
|
||||||
storage_domain_service = storage_domains_service.storage_domain_service(sd_id)
|
|
||||||
templates_service = storage_domain_service.templates_service()
|
|
||||||
|
|
||||||
# Find the unregistered Template we want to register:
|
|
||||||
if module.params.get('unregistered'):
|
|
||||||
templates = templates_service.list(unregistered=True)
|
|
||||||
else:
|
|
||||||
templates = templates_service.list(max=module.params['max'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_storage_templates=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in templates
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,142 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2017 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_storage_vm_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV virtual machines relate to a storage domain.
|
|
||||||
author: "Maor Lipchuk (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_storage_vm_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV virtual machines relate to a storage domain."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_storage_vms), which
|
|
||||||
contains a list of virtual machines. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
unregistered:
|
|
||||||
description:
|
|
||||||
- "Flag which indicates whether to get unregistered virtual machines which contain one or more
|
|
||||||
disks which reside on a storage domain or diskless virtual machines."
|
|
||||||
type: bool
|
|
||||||
default: false
|
|
||||||
max:
|
|
||||||
description:
|
|
||||||
- "Sets the maximum number of virtual machines to return. If not specified all the virtual machines are returned."
|
|
||||||
storage_domain:
|
|
||||||
description:
|
|
||||||
- "The storage domain name where the virtual machines should be listed."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all VMs which relate to a storage domain and are unregistered
|
|
||||||
ovirt_vms_info:
|
|
||||||
unregistered: yes
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_storage_vms }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_storage_vms:
|
|
||||||
description: "List of dictionaries describing the VMs. VM attributes are mapped to dictionary keys,
|
|
||||||
all VMs attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/vm."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
get_id_by_name
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
storage_domain=dict(default=None),
|
|
||||||
max=dict(default=None, type='int'),
|
|
||||||
unregistered=dict(default=False, type='bool'),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_storage_vm_facts', 'community.general.ovirt_storage_vm_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_storage_vm_facts' module has been renamed to 'ovirt_storage_vm_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
storage_domains_service = connection.system_service().storage_domains_service()
|
|
||||||
sd_id = get_id_by_name(storage_domains_service, module.params['storage_domain'])
|
|
||||||
storage_domain_service = storage_domains_service.storage_domain_service(sd_id)
|
|
||||||
vms_service = storage_domain_service.vms_service()
|
|
||||||
|
|
||||||
# Find the unregistered VM we want to register:
|
|
||||||
if module.params.get('unregistered'):
|
|
||||||
vms = vms_service.list(unregistered=True)
|
|
||||||
else:
|
|
||||||
vms = vms_service.list()
|
|
||||||
result = dict(
|
|
||||||
ovirt_storage_vms=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in vms
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,172 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_tag_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV tags
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_tag_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV tags."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_tags), which
|
|
||||||
contains a list of tags. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- "Name of the tag which should be listed."
|
|
||||||
vm:
|
|
||||||
description:
|
|
||||||
- "Name of the VM, which tags should be listed."
|
|
||||||
host:
|
|
||||||
description:
|
|
||||||
- "Name of the host, which tags should be listed."
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all tags, which names start with tag
|
|
||||||
ovirt_tag_info:
|
|
||||||
name: tag*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_tags }}"
|
|
||||||
|
|
||||||
- name: Gather information about all tags, which are assigned to VM postgres
|
|
||||||
ovirt_tag_info:
|
|
||||||
vm: postgres
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_tags }}"
|
|
||||||
|
|
||||||
- name: Gather information about all tags, which are assigned to host west
|
|
||||||
ovirt_tag_info:
|
|
||||||
host: west
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_tags }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_tags:
|
|
||||||
description: "List of dictionaries describing the tags. Tags attributes are mapped to dictionary keys,
|
|
||||||
all tags attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/tag."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
search_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
name=dict(default=None),
|
|
||||||
host=dict(default=None),
|
|
||||||
vm=dict(default=None),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_tag_facts', 'community.general.ovirt_tag_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_tag_facts' module has been renamed to 'ovirt_tag_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
tags_service = connection.system_service().tags_service()
|
|
||||||
tags = []
|
|
||||||
all_tags = tags_service.list()
|
|
||||||
if module.params['name']:
|
|
||||||
tags.extend([
|
|
||||||
t for t in all_tags
|
|
||||||
if fnmatch.fnmatch(t.name, module.params['name'])
|
|
||||||
])
|
|
||||||
if module.params['host']:
|
|
||||||
hosts_service = connection.system_service().hosts_service()
|
|
||||||
host = search_by_name(hosts_service, module.params['host'])
|
|
||||||
if host is None:
|
|
||||||
raise Exception("Host '%s' was not found." % module.params['host'])
|
|
||||||
tags.extend(hosts_service.host_service(host.id).tags_service().list())
|
|
||||||
if module.params['vm']:
|
|
||||||
vms_service = connection.system_service().vms_service()
|
|
||||||
vm = search_by_name(vms_service, module.params['vm'])
|
|
||||||
if vm is None:
|
|
||||||
raise Exception("Vm '%s' was not found." % module.params['vm'])
|
|
||||||
tags.extend(vms_service.vm_service(vm.id).tags_service().list())
|
|
||||||
|
|
||||||
if not (module.params['vm'] or module.params['host'] or module.params['name']):
|
|
||||||
tags = all_tags
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_tags=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=t,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params['fetch_nested'],
|
|
||||||
attributes=module.params['nested_attributes'],
|
|
||||||
) for t in tags
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,124 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_template_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV templates
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_template_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV templates."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_templates), which
|
|
||||||
contains a list of templates. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search template X from datacenter Y use following pattern:
|
|
||||||
name=X and datacenter=Y"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all templates which names start with centos and belongs to data center west
|
|
||||||
ovirt_template_info:
|
|
||||||
pattern: name=centos* and datacenter=west
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_templates }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_templates:
|
|
||||||
description: "List of dictionaries describing the templates. Template attributes are mapped to dictionary keys,
|
|
||||||
all templates attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/template."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_template_facts', 'community.general.ovirt_template_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_template_facts' module has been renamed to 'ovirt_template_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
templates_service = connection.system_service().templates_service()
|
|
||||||
templates = templates_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_templates=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in templates
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,123 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_user_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV users
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_user_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV users."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_users), which
|
|
||||||
contains a list of users. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search user X use following pattern: name=X"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all users which first names start with john
|
|
||||||
ovirt_user_info:
|
|
||||||
pattern: name=john*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_users }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_users:
|
|
||||||
description: "List of dictionaries describing the users. User attributes are mapped to dictionary keys,
|
|
||||||
all users attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/user."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_user_facts', 'community.general.ovirt_user_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_user_facts' module has been renamed to 'ovirt_user_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
users_service = connection.system_service().users_service()
|
|
||||||
users = users_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_users=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in users
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,166 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_vm_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV virtual machines
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_vm_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV virtual machines."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_vms), which
|
|
||||||
contains a list of virtual machines. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search VM X from cluster Y use following pattern:
|
|
||||||
name=X and cluster=Y"
|
|
||||||
all_content:
|
|
||||||
description:
|
|
||||||
- "If I(true) all the attributes of the virtual machines should be
|
|
||||||
included in the response."
|
|
||||||
type: bool
|
|
||||||
default: false
|
|
||||||
case_sensitive:
|
|
||||||
description:
|
|
||||||
- "If I(true) performed search will take case into account."
|
|
||||||
type: bool
|
|
||||||
default: true
|
|
||||||
max:
|
|
||||||
description:
|
|
||||||
- "The maximum number of results to return."
|
|
||||||
next_run:
|
|
||||||
description:
|
|
||||||
- "Indicates if the returned result describes the virtual machine as it is currently running or if describes
|
|
||||||
the virtual machine with the modifications that have already been performed but that will only come into
|
|
||||||
effect when the virtual machine is restarted. By default the value is set by engine."
|
|
||||||
type: bool
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all VMs which names start with centos and belong to cluster west
|
|
||||||
ovirt_vm_info:
|
|
||||||
pattern: name=centos* and cluster=west
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_vms }}"
|
|
||||||
|
|
||||||
- name: Gather info about next run configuration of virtual machine named myvm
|
|
||||||
ovirt_vm_info:
|
|
||||||
pattern: name=myvm
|
|
||||||
next_run: true
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_vms[0] }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_vms:
|
|
||||||
description: "List of dictionaries describing the VMs. VM attributes are mapped to dictionary keys,
|
|
||||||
all VMs attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/vm."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
all_content=dict(default=False, type='bool'),
|
|
||||||
next_run=dict(default=None, type='bool'),
|
|
||||||
case_sensitive=dict(default=True, type='bool'),
|
|
||||||
max=dict(default=None, type='int'),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_vm_facts', 'community.general.ovirt_vm_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_vm_facts' module has been renamed to 'ovirt_vm_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
vms_service = connection.system_service().vms_service()
|
|
||||||
vms = vms_service.list(
|
|
||||||
search=module.params['pattern'],
|
|
||||||
all_content=module.params['all_content'],
|
|
||||||
case_sensitive=module.params['case_sensitive'],
|
|
||||||
max=module.params['max'],
|
|
||||||
)
|
|
||||||
if module.params['next_run']:
|
|
||||||
vms = [vms_service.vm_service(vm.id).get(next_run=True) for vm in vms]
|
|
||||||
|
|
||||||
result = dict(
|
|
||||||
ovirt_vms=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in vms
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,123 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Copyright (c) 2016 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
|
||||||
---
|
|
||||||
module: ovirt_vmpool_facts
|
|
||||||
short_description: Retrieve information about one or more oVirt/RHV vmpools
|
|
||||||
author: "Ondra Machacek (@machacekondra)"
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: When migrating to collection we decided to use only _info modules.
|
|
||||||
alternative: Use M(ovirt.ovirt.ovirt_vmpool_info) instead.
|
|
||||||
description:
|
|
||||||
- "Retrieve information about one or more oVirt/RHV vmpools."
|
|
||||||
notes:
|
|
||||||
- "This module returns a variable C(ovirt_vmpools), which
|
|
||||||
contains a list of vmpools. You need to register the result with
|
|
||||||
the I(register) keyword to use it."
|
|
||||||
options:
|
|
||||||
pattern:
|
|
||||||
description:
|
|
||||||
- "Search term which is accepted by oVirt/RHV search backend."
|
|
||||||
- "For example to search vmpool X: name=X"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ovirt_facts
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
|
||||||
# Examples don't contain auth parameter for simplicity,
|
|
||||||
# look at ovirt_auth module to see how to reuse authentication:
|
|
||||||
|
|
||||||
- name: Gather information about all vm pools which names start with centos
|
|
||||||
ovirt_vmpool_info:
|
|
||||||
pattern: name=centos*
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Print gathered information
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ result.ovirt_vm_pools }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = '''
|
|
||||||
ovirt_vm_pools:
|
|
||||||
description: "List of dictionaries describing the vmpools. Vm pool attributes are mapped to dictionary keys,
|
|
||||||
all vmpools attributes can be found at following url: http://ovirt.github.io/ovirt-engine-api-model/master/#types/vm_pool."
|
|
||||||
returned: On success.
|
|
||||||
type: list
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.common.removed import removed_module
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils._ovirt import (
|
|
||||||
check_sdk,
|
|
||||||
create_connection,
|
|
||||||
get_dict_of_struct,
|
|
||||||
ovirt_info_full_argument_spec,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = ovirt_info_full_argument_spec(
|
|
||||||
pattern=dict(default='', required=False),
|
|
||||||
)
|
|
||||||
module = AnsibleModule(argument_spec)
|
|
||||||
is_old_facts = module._name in ('ovirt_vmpool_facts', 'community.general.ovirt_vmpool_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'ovirt_vmpool_facts' module has been renamed to 'ovirt_vmpool_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
check_sdk(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
auth = module.params.pop('auth')
|
|
||||||
connection = create_connection(auth)
|
|
||||||
vmpools_service = connection.system_service().vm_pools_service()
|
|
||||||
vmpools = vmpools_service.list(search=module.params['pattern'])
|
|
||||||
result = dict(
|
|
||||||
ovirt_vm_pools=[
|
|
||||||
get_dict_of_struct(
|
|
||||||
struct=c,
|
|
||||||
connection=connection,
|
|
||||||
fetch_nested=module.params.get('fetch_nested'),
|
|
||||||
attributes=module.params.get('nested_attributes'),
|
|
||||||
) for c in vmpools
|
|
||||||
],
|
|
||||||
)
|
|
||||||
if is_old_facts:
|
|
||||||
module.exit_json(changed=False, ansible_facts=result)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **result)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
|
||||||
finally:
|
|
||||||
connection.close(logout=auth.get('token') is None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,125 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: scaleway_image_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.scaleway_image_info) instead.
|
|
||||||
short_description: Gather facts about the Scaleway images available.
|
|
||||||
description:
|
|
||||||
- Gather facts about the Scaleway images available.
|
|
||||||
author:
|
|
||||||
- "Yanis Guenane (@Spredzy)"
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.scaleway
|
|
||||||
|
|
||||||
|
|
||||||
options:
|
|
||||||
region:
|
|
||||||
type: str
|
|
||||||
description:
|
|
||||||
- Scaleway compute zone
|
|
||||||
required: true
|
|
||||||
choices:
|
|
||||||
- ams1
|
|
||||||
- EMEA-NL-EVS
|
|
||||||
- par1
|
|
||||||
- EMEA-FR-PAR1
|
|
||||||
- par2
|
|
||||||
- EMEA-FR-PAR2
|
|
||||||
- waw1
|
|
||||||
- EMEA-PL-WAW1
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Scaleway images facts
|
|
||||||
community.general.scaleway_image_facts:
|
|
||||||
region: par1
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
scaleway_image_facts:
|
|
||||||
description: Response from Scaleway API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"scaleway_image_facts": [
|
|
||||||
{
|
|
||||||
"arch": "x86_64",
|
|
||||||
"creation_date": "2018-07-17T16:18:49.276456+00:00",
|
|
||||||
"default_bootscript": {
|
|
||||||
"architecture": "x86_64",
|
|
||||||
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
|
|
||||||
"default": false,
|
|
||||||
"dtb": "",
|
|
||||||
"id": "15fbd2f7-a0f9-412b-8502-6a44da8d98b8",
|
|
||||||
"initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.5.gz",
|
|
||||||
"kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.9-4.9.93-rev1/vmlinuz-4.9.93",
|
|
||||||
"organization": "11111111-1111-4111-8111-111111111111",
|
|
||||||
"public": true,
|
|
||||||
"title": "x86_64 mainline 4.9.93 rev1"
|
|
||||||
},
|
|
||||||
"extra_volumes": [],
|
|
||||||
"from_server": null,
|
|
||||||
"id": "00ae4a88-3252-4eda-9feb-5f6b56bf5ef0",
|
|
||||||
"modification_date": "2018-07-17T16:42:06.319315+00:00",
|
|
||||||
"name": "Debian Stretch",
|
|
||||||
"organization": "51b656e3-4865-41e8-adbc-0c45bdd780db",
|
|
||||||
"public": true,
|
|
||||||
"root_volume": {
|
|
||||||
"id": "da32dfbb-c5ff-476d-ae2d-c297dd09b7dd",
|
|
||||||
"name": "snapshot-2a7229dc-d431-4dc5-b66e-95db08b773af-2018-07-17_16:18",
|
|
||||||
"size": 25000000000,
|
|
||||||
"volume_type": "l_ssd"
|
|
||||||
},
|
|
||||||
"state": "available"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
|
||||||
Scaleway, ScalewayException, scaleway_argument_spec, SCALEWAY_LOCATION)
|
|
||||||
|
|
||||||
|
|
||||||
class ScalewayImageFacts(Scaleway):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(ScalewayImageFacts, self).__init__(module)
|
|
||||||
self.name = 'images'
|
|
||||||
|
|
||||||
region = module.params["region"]
|
|
||||||
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = scaleway_argument_spec()
|
|
||||||
argument_spec.update(dict(
|
|
||||||
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
|
||||||
))
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=argument_spec,
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'scaleway_image_facts': ScalewayImageFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except ScalewayException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,108 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: scaleway_ip_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.scaleway_ip_info) instead.
|
|
||||||
short_description: Gather facts about the Scaleway ips available.
|
|
||||||
description:
|
|
||||||
- Gather facts about the Scaleway ips available.
|
|
||||||
author:
|
|
||||||
- "Yanis Guenane (@Spredzy)"
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.scaleway
|
|
||||||
|
|
||||||
options:
|
|
||||||
region:
|
|
||||||
type: str
|
|
||||||
description:
|
|
||||||
- Scaleway region to use (for example par1).
|
|
||||||
required: true
|
|
||||||
choices:
|
|
||||||
- ams1
|
|
||||||
- EMEA-NL-EVS
|
|
||||||
- par1
|
|
||||||
- EMEA-FR-PAR1
|
|
||||||
- par2
|
|
||||||
- EMEA-FR-PAR2
|
|
||||||
- waw1
|
|
||||||
- EMEA-PL-WAW1
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Scaleway ips facts
|
|
||||||
community.general.scaleway_ip_facts:
|
|
||||||
region: par1
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
scaleway_ip_facts:
|
|
||||||
description: Response from Scaleway API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"scaleway_ip_facts": [
|
|
||||||
{
|
|
||||||
"address": "163.172.170.243",
|
|
||||||
"id": "ea081794-a581-8899-8451-386ddaf0a451",
|
|
||||||
"organization": "3f709602-5e6c-4619-b80c-e324324324af",
|
|
||||||
"reverse": null,
|
|
||||||
"server": {
|
|
||||||
"id": "12f19bc7-109c-4517-954c-e6b3d0311363",
|
|
||||||
"name": "scw-e0d158"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
|
||||||
Scaleway,
|
|
||||||
ScalewayException,
|
|
||||||
scaleway_argument_spec,
|
|
||||||
SCALEWAY_LOCATION,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ScalewayIpFacts(Scaleway):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(ScalewayIpFacts, self).__init__(module)
|
|
||||||
self.name = 'ips'
|
|
||||||
|
|
||||||
region = module.params["region"]
|
|
||||||
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = scaleway_argument_spec()
|
|
||||||
argument_spec.update(dict(
|
|
||||||
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
|
||||||
))
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=argument_spec,
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'scaleway_ip_facts': ScalewayIpFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except ScalewayException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,104 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: scaleway_organization_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.scaleway_organization_info) instead.
|
|
||||||
short_description: Gather facts about the Scaleway organizations available.
|
|
||||||
description:
|
|
||||||
- Gather facts about the Scaleway organizations available.
|
|
||||||
author:
|
|
||||||
- "Yanis Guenane (@Spredzy)"
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
options:
|
|
||||||
api_url:
|
|
||||||
description:
|
|
||||||
- Scaleway API URL
|
|
||||||
default: 'https://account.scaleway.com'
|
|
||||||
aliases: ['base_url']
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.scaleway
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Scaleway organizations facts
|
|
||||||
community.general.scaleway_organization_facts:
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
scaleway_organization_facts:
|
|
||||||
description: Response from Scaleway API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"scaleway_organization_facts": [
|
|
||||||
{
|
|
||||||
"address_city_name": "Paris",
|
|
||||||
"address_country_code": "FR",
|
|
||||||
"address_line1": "42 Rue de l'univers",
|
|
||||||
"address_line2": null,
|
|
||||||
"address_postal_code": "75042",
|
|
||||||
"address_subdivision_code": "FR-75",
|
|
||||||
"creation_date": "2018-08-06T13:43:28.508575+00:00",
|
|
||||||
"currency": "EUR",
|
|
||||||
"customer_class": "individual",
|
|
||||||
"id": "3f709602-5e6c-4619-b80c-e8432ferewtr",
|
|
||||||
"locale": "fr_FR",
|
|
||||||
"modification_date": "2018-08-06T14:56:41.401685+00:00",
|
|
||||||
"name": "James Bond",
|
|
||||||
"support_id": "694324",
|
|
||||||
"support_level": "basic",
|
|
||||||
"support_pin": "9324",
|
|
||||||
"users": [],
|
|
||||||
"vat_number": null,
|
|
||||||
"warnings": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
|
||||||
Scaleway, ScalewayException, scaleway_argument_spec
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ScalewayOrganizationFacts(Scaleway):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(ScalewayOrganizationFacts, self).__init__(module)
|
|
||||||
self.name = 'organizations'
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = scaleway_argument_spec()
|
|
||||||
argument_spec.update(dict(
|
|
||||||
api_url=dict(fallback=(env_fallback, ['SCW_API_URL']), default='https://account.scaleway.com', aliases=['base_url']),
|
|
||||||
))
|
|
||||||
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=argument_spec,
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'scaleway_organization_facts': ScalewayOrganizationFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except ScalewayException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,112 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: scaleway_security_group_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.scaleway_security_group_info) instead.
|
|
||||||
short_description: Gather facts about the Scaleway security groups available.
|
|
||||||
description:
|
|
||||||
- Gather facts about the Scaleway security groups available.
|
|
||||||
author:
|
|
||||||
- "Yanis Guenane (@Spredzy)"
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
options:
|
|
||||||
region:
|
|
||||||
type: str
|
|
||||||
description:
|
|
||||||
- Scaleway region to use (for example par1).
|
|
||||||
required: true
|
|
||||||
choices:
|
|
||||||
- ams1
|
|
||||||
- EMEA-NL-EVS
|
|
||||||
- par1
|
|
||||||
- EMEA-FR-PAR1
|
|
||||||
- par2
|
|
||||||
- EMEA-FR-PAR2
|
|
||||||
- waw1
|
|
||||||
- EMEA-PL-WAW1
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.scaleway
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Scaleway security groups facts
|
|
||||||
community.general.scaleway_security_group_facts:
|
|
||||||
region: par1
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
scaleway_security_group_facts:
|
|
||||||
description: Response from Scaleway API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"scaleway_security_group_facts": [
|
|
||||||
{
|
|
||||||
"description": "test-ams",
|
|
||||||
"enable_default_security": true,
|
|
||||||
"id": "7fcde327-8bed-43a6-95c4-6dfbc56d8b51",
|
|
||||||
"name": "test-ams",
|
|
||||||
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
|
||||||
"organization_default": false,
|
|
||||||
"servers": [
|
|
||||||
{
|
|
||||||
"id": "12f19bc7-108c-4517-954c-e6b3d0311363",
|
|
||||||
"name": "scw-e0d158"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
|
||||||
Scaleway,
|
|
||||||
ScalewayException,
|
|
||||||
scaleway_argument_spec,
|
|
||||||
SCALEWAY_LOCATION,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ScalewaySecurityGroupFacts(Scaleway):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(ScalewaySecurityGroupFacts, self).__init__(module)
|
|
||||||
self.name = 'security_groups'
|
|
||||||
|
|
||||||
region = module.params["region"]
|
|
||||||
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = scaleway_argument_spec()
|
|
||||||
argument_spec.update(dict(
|
|
||||||
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
|
||||||
))
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=argument_spec,
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'scaleway_security_group_facts': ScalewaySecurityGroupFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except ScalewayException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,195 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: scaleway_server_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.scaleway_server_info) instead.
|
|
||||||
short_description: Gather facts about the Scaleway servers available.
|
|
||||||
description:
|
|
||||||
- Gather facts about the Scaleway servers available.
|
|
||||||
author:
|
|
||||||
- "Yanis Guenane (@Spredzy)"
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.scaleway
|
|
||||||
|
|
||||||
options:
|
|
||||||
region:
|
|
||||||
type: str
|
|
||||||
description:
|
|
||||||
- Scaleway region to use (for example par1).
|
|
||||||
required: true
|
|
||||||
choices:
|
|
||||||
- ams1
|
|
||||||
- EMEA-NL-EVS
|
|
||||||
- par1
|
|
||||||
- EMEA-FR-PAR1
|
|
||||||
- par2
|
|
||||||
- EMEA-FR-PAR2
|
|
||||||
- waw1
|
|
||||||
- EMEA-PL-WAW1
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Scaleway servers facts
|
|
||||||
community.general.scaleway_server_facts:
|
|
||||||
region: par1
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
scaleway_server_facts:
|
|
||||||
description: Response from Scaleway API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"scaleway_server_facts": [
|
|
||||||
{
|
|
||||||
"arch": "x86_64",
|
|
||||||
"boot_type": "local",
|
|
||||||
"bootscript": {
|
|
||||||
"architecture": "x86_64",
|
|
||||||
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
|
|
||||||
"default": true,
|
|
||||||
"dtb": "",
|
|
||||||
"id": "b1e68c26-a19c-4eac-9222-498b22bd7ad9",
|
|
||||||
"initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.5.gz",
|
|
||||||
"kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.4-4.4.127-rev1/vmlinuz-4.4.127",
|
|
||||||
"organization": "11111111-1111-4111-8111-111111111111",
|
|
||||||
"public": true,
|
|
||||||
"title": "x86_64 mainline 4.4.127 rev1"
|
|
||||||
},
|
|
||||||
"commercial_type": "START1-XS",
|
|
||||||
"creation_date": "2018-08-14T21:36:56.271545+00:00",
|
|
||||||
"dynamic_ip_required": false,
|
|
||||||
"enable_ipv6": false,
|
|
||||||
"extra_networks": [],
|
|
||||||
"hostname": "scw-e0d256",
|
|
||||||
"id": "12f19bc7-108c-4517-954c-e6b3d0311363",
|
|
||||||
"image": {
|
|
||||||
"arch": "x86_64",
|
|
||||||
"creation_date": "2018-04-26T12:42:21.619844+00:00",
|
|
||||||
"default_bootscript": {
|
|
||||||
"architecture": "x86_64",
|
|
||||||
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
|
|
||||||
"default": true,
|
|
||||||
"dtb": "",
|
|
||||||
"id": "b1e68c26-a19c-4eac-9222-498b22bd7ad9",
|
|
||||||
"initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.5.gz",
|
|
||||||
"kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.4-4.4.127-rev1/vmlinuz-4.4.127",
|
|
||||||
"organization": "11111111-1111-4111-8111-111111111111",
|
|
||||||
"public": true,
|
|
||||||
"title": "x86_64 mainline 4.4.127 rev1"
|
|
||||||
},
|
|
||||||
"extra_volumes": [],
|
|
||||||
"from_server": null,
|
|
||||||
"id": "67375eb1-f14d-4f02-bb42-6119cecbde51",
|
|
||||||
"modification_date": "2018-04-26T12:49:07.573004+00:00",
|
|
||||||
"name": "Ubuntu Xenial",
|
|
||||||
"organization": "51b656e3-4865-41e8-adbc-0c45bdd780db",
|
|
||||||
"public": true,
|
|
||||||
"root_volume": {
|
|
||||||
"id": "020b8d61-3867-4a0e-84a4-445c5393e05d",
|
|
||||||
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42",
|
|
||||||
"size": 25000000000,
|
|
||||||
"volume_type": "l_ssd"
|
|
||||||
},
|
|
||||||
"state": "available"
|
|
||||||
},
|
|
||||||
"ipv6": null,
|
|
||||||
"location": {
|
|
||||||
"cluster_id": "5",
|
|
||||||
"hypervisor_id": "412",
|
|
||||||
"node_id": "2",
|
|
||||||
"platform_id": "13",
|
|
||||||
"zone_id": "par1"
|
|
||||||
},
|
|
||||||
"maintenances": [],
|
|
||||||
"modification_date": "2018-08-14T21:37:28.630882+00:00",
|
|
||||||
"name": "scw-e0d256",
|
|
||||||
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
|
||||||
"private_ip": "10.14.222.131",
|
|
||||||
"protected": false,
|
|
||||||
"public_ip": {
|
|
||||||
"address": "163.172.170.197",
|
|
||||||
"dynamic": false,
|
|
||||||
"id": "ea081794-a581-4495-8451-386ddaf0a451"
|
|
||||||
},
|
|
||||||
"security_group": {
|
|
||||||
"id": "a37379d2-d8b0-4668-9cfb-1233fc436f7e",
|
|
||||||
"name": "Default security group"
|
|
||||||
},
|
|
||||||
"state": "running",
|
|
||||||
"state_detail": "booted",
|
|
||||||
"tags": [],
|
|
||||||
"volumes": {
|
|
||||||
"0": {
|
|
||||||
"creation_date": "2018-08-14T21:36:56.271545+00:00",
|
|
||||||
"export_uri": "device://dev/vda",
|
|
||||||
"id": "68386fae-4f55-4fbf-aabb-953036a85872",
|
|
||||||
"modification_date": "2018-08-14T21:36:56.271545+00:00",
|
|
||||||
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42",
|
|
||||||
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
|
||||||
"server": {
|
|
||||||
"id": "12f19bc7-108c-4517-954c-e6b3d0311363",
|
|
||||||
"name": "scw-e0d256"
|
|
||||||
},
|
|
||||||
"size": 25000000000,
|
|
||||||
"state": "available",
|
|
||||||
"volume_type": "l_ssd"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
|
||||||
Scaleway,
|
|
||||||
ScalewayException,
|
|
||||||
scaleway_argument_spec,
|
|
||||||
SCALEWAY_LOCATION,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ScalewayServerFacts(Scaleway):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(ScalewayServerFacts, self).__init__(module)
|
|
||||||
self.name = 'servers'
|
|
||||||
|
|
||||||
region = module.params["region"]
|
|
||||||
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = scaleway_argument_spec()
|
|
||||||
argument_spec.update(dict(
|
|
||||||
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
|
||||||
))
|
|
||||||
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=argument_spec,
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'scaleway_server_facts': ScalewayServerFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except ScalewayException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,113 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: scaleway_snapshot_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.scaleway_snapshot_info) instead.
|
|
||||||
short_description: Gather facts about the Scaleway snapshots available.
|
|
||||||
description:
|
|
||||||
- Gather facts about the Scaleway snapshot available.
|
|
||||||
author:
|
|
||||||
- "Yanis Guenane (@Spredzy)"
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.scaleway
|
|
||||||
|
|
||||||
options:
|
|
||||||
region:
|
|
||||||
type: str
|
|
||||||
description:
|
|
||||||
- Scaleway region to use (for example par1).
|
|
||||||
required: true
|
|
||||||
choices:
|
|
||||||
- ams1
|
|
||||||
- EMEA-NL-EVS
|
|
||||||
- par1
|
|
||||||
- EMEA-FR-PAR1
|
|
||||||
- par2
|
|
||||||
- EMEA-FR-PAR2
|
|
||||||
- waw1
|
|
||||||
- EMEA-PL-WAW1
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Scaleway snapshots facts
|
|
||||||
community.general.scaleway_snapshot_facts:
|
|
||||||
region: par1
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
scaleway_snapshot_facts:
|
|
||||||
description: Response from Scaleway API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"scaleway_snapshot_facts": [
|
|
||||||
{
|
|
||||||
"base_volume": {
|
|
||||||
"id": "68386fae-4f55-4fbf-aabb-953036a85872",
|
|
||||||
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42"
|
|
||||||
},
|
|
||||||
"creation_date": "2018-08-14T22:34:35.299461+00:00",
|
|
||||||
"id": "b61b4b03-a2e9-4da5-b5ea-e462ac0662d2",
|
|
||||||
"modification_date": "2018-08-14T22:34:54.520560+00:00",
|
|
||||||
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42 snapshot",
|
|
||||||
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
|
||||||
"size": 25000000000,
|
|
||||||
"state": "available",
|
|
||||||
"volume_type": "l_ssd"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
|
||||||
Scaleway,
|
|
||||||
ScalewayException,
|
|
||||||
scaleway_argument_spec,
|
|
||||||
SCALEWAY_LOCATION
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ScalewaySnapshotFacts(Scaleway):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(ScalewaySnapshotFacts, self).__init__(module)
|
|
||||||
self.name = 'snapshots'
|
|
||||||
|
|
||||||
region = module.params["region"]
|
|
||||||
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = scaleway_argument_spec()
|
|
||||||
argument_spec.update(dict(
|
|
||||||
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
|
||||||
))
|
|
||||||
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=argument_spec,
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'scaleway_snapshot_facts': ScalewaySnapshotFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except ScalewayException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1,108 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: scaleway_volume_facts
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.13
|
|
||||||
why: Deprecated in favour of C(_info) module.
|
|
||||||
alternative: Use M(community.general.scaleway_volume_info) instead.
|
|
||||||
short_description: Gather facts about the Scaleway volumes available.
|
|
||||||
description:
|
|
||||||
- Gather facts about the Scaleway volumes available.
|
|
||||||
author:
|
|
||||||
- "Yanis Guenane (@Spredzy)"
|
|
||||||
- "Remy Leone (@sieben)"
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.scaleway
|
|
||||||
|
|
||||||
options:
|
|
||||||
region:
|
|
||||||
type: str
|
|
||||||
description:
|
|
||||||
- Scaleway region to use (for example par1).
|
|
||||||
required: true
|
|
||||||
choices:
|
|
||||||
- ams1
|
|
||||||
- EMEA-NL-EVS
|
|
||||||
- par1
|
|
||||||
- EMEA-FR-PAR1
|
|
||||||
- par2
|
|
||||||
- EMEA-FR-PAR2
|
|
||||||
- waw1
|
|
||||||
- EMEA-PL-WAW1
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Gather Scaleway volumes facts
|
|
||||||
community.general.scaleway_volume_facts:
|
|
||||||
region: par1
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
---
|
|
||||||
scaleway_volume_facts:
|
|
||||||
description: Response from Scaleway API
|
|
||||||
returned: success
|
|
||||||
type: complex
|
|
||||||
sample:
|
|
||||||
"scaleway_volume_facts": [
|
|
||||||
{
|
|
||||||
"creation_date": "2018-08-14T20:56:24.949660+00:00",
|
|
||||||
"export_uri": null,
|
|
||||||
"id": "b8d51a06-daeb-4fef-9539-a8aea016c1ba",
|
|
||||||
"modification_date": "2018-08-14T20:56:24.949660+00:00",
|
|
||||||
"name": "test-volume",
|
|
||||||
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
|
||||||
"server": null,
|
|
||||||
"size": 50000000000,
|
|
||||||
"state": "available",
|
|
||||||
"volume_type": "l_ssd"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
'''
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.scaleway import (
|
|
||||||
Scaleway, ScalewayException, scaleway_argument_spec,
|
|
||||||
SCALEWAY_LOCATION)
|
|
||||||
|
|
||||||
|
|
||||||
class ScalewayVolumeFacts(Scaleway):
|
|
||||||
|
|
||||||
def __init__(self, module):
|
|
||||||
super(ScalewayVolumeFacts, self).__init__(module)
|
|
||||||
self.name = 'volumes'
|
|
||||||
|
|
||||||
region = module.params["region"]
|
|
||||||
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = scaleway_argument_spec()
|
|
||||||
argument_spec.update(dict(
|
|
||||||
region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
|
|
||||||
))
|
|
||||||
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=argument_spec,
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
module.exit_json(
|
|
||||||
ansible_facts={'scaleway_volume_facts': ScalewayVolumeFacts(module).get_resources()}
|
|
||||||
)
|
|
||||||
except ScalewayException as exc:
|
|
||||||
module.fail_json(msg=exc.message)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -1 +0,0 @@
|
||||||
smartos_image_info.py
|
|
|
@ -47,9 +47,6 @@ EXAMPLES = '''
|
||||||
has {{ result.smartos_images[item]['clones'] }} VM(s)"
|
has {{ result.smartos_images[item]['clones'] }} VM(s)"
|
||||||
with_items: "{{ result.smartos_images.keys() | list }}"
|
with_items: "{{ result.smartos_images.keys() | list }}"
|
||||||
|
|
||||||
# When the module is called as smartos_image_facts, return values are published
|
|
||||||
# in ansible_facts['smartos_images'] and can be used as follows.
|
|
||||||
# Note that this is deprecated and will stop working in community.general 3.0.0.
|
|
||||||
- name: Print information
|
- name: Print information
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ smartos_images[item]['name'] }}-{{ smartos_images[item]['version'] }}
|
msg: "{{ smartos_images[item]['name'] }}-{{ smartos_images[item]['version'] }}
|
||||||
|
@ -102,20 +99,12 @@ def main():
|
||||||
),
|
),
|
||||||
supports_check_mode=False,
|
supports_check_mode=False,
|
||||||
)
|
)
|
||||||
is_old_facts = module._name in ('smartos_image_facts', 'community.general.smartos_image_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'smartos_image_facts' module has been renamed to 'smartos_image_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
image_facts = ImageFacts(module)
|
image_facts = ImageFacts(module)
|
||||||
|
|
||||||
data = dict(smartos_images=image_facts.return_all_installed_images())
|
data = dict(smartos_images=image_facts.return_all_installed_images())
|
||||||
|
|
||||||
if is_old_facts:
|
module.exit_json(**data)
|
||||||
module.exit_json(ansible_facts=data)
|
|
||||||
else:
|
|
||||||
module.exit_json(**data)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
xenserver_guest_info.py
|
|
|
@ -204,10 +204,6 @@ def main():
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
if module._name in ('xenserver_guest_facts', 'community.general.xenserver_guest_facts'):
|
|
||||||
module.deprecate("The 'xenserver_guest_facts' module has been renamed to 'xenserver_guest_info'",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
result = {'failed': False, 'changed': False}
|
result = {'failed': False, 'changed': False}
|
||||||
|
|
||||||
# Module will exit with an error message if no VM is found.
|
# Module will exit with an error message if no VM is found.
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
vertica_info.py
|
|
|
@ -233,11 +233,6 @@ def main():
|
||||||
login_user=dict(default='dbadmin'),
|
login_user=dict(default='dbadmin'),
|
||||||
login_password=dict(default=None, no_log=True),
|
login_password=dict(default=None, no_log=True),
|
||||||
), supports_check_mode=True)
|
), supports_check_mode=True)
|
||||||
is_old_facts = module._name in ('vertica_facts', 'community.general.vertica_facts')
|
|
||||||
if is_old_facts:
|
|
||||||
module.deprecate("The 'vertica_facts' module has been renamed to 'vertica_info', "
|
|
||||||
"and the renamed one no longer returns ansible_facts",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
|
|
||||||
if not pyodbc_found:
|
if not pyodbc_found:
|
||||||
module.fail_json(msg=missing_required_lib('pyodbc'), exception=PYODBC_IMP_ERR)
|
module.fail_json(msg=missing_required_lib('pyodbc'), exception=PYODBC_IMP_ERR)
|
||||||
|
@ -269,20 +264,12 @@ def main():
|
||||||
configuration_facts = get_configuration_facts(cursor)
|
configuration_facts = get_configuration_facts(cursor)
|
||||||
node_facts = get_node_facts(cursor)
|
node_facts = get_node_facts(cursor)
|
||||||
|
|
||||||
if is_old_facts:
|
module.exit_json(changed=False,
|
||||||
module.exit_json(changed=False,
|
vertica_schemas=schema_facts,
|
||||||
ansible_facts={'vertica_schemas': schema_facts,
|
vertica_users=user_facts,
|
||||||
'vertica_users': user_facts,
|
vertica_roles=role_facts,
|
||||||
'vertica_roles': role_facts,
|
vertica_configuration=configuration_facts,
|
||||||
'vertica_configuration': configuration_facts,
|
vertica_nodes=node_facts)
|
||||||
'vertica_nodes': node_facts})
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False,
|
|
||||||
vertica_schemas=schema_facts,
|
|
||||||
vertica_users=user_facts,
|
|
||||||
vertica_roles=role_facts,
|
|
||||||
vertica_configuration=configuration_facts,
|
|
||||||
vertica_nodes=node_facts)
|
|
||||||
except NotSupportedError as e:
|
except NotSupportedError as e:
|
||||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
./storage/glusterfs/gluster_heal_info.py
|
|
|
@ -1 +0,0 @@
|
||||||
./storage/glusterfs/gluster_peer.py
|
|
|
@ -1 +0,0 @@
|
||||||
./storage/glusterfs/gluster_volume.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/misc/helm.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/hpilo/hpilo_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
onepassword_info.py
|
|
|
@ -20,9 +20,6 @@ requirements:
|
||||||
notes:
|
notes:
|
||||||
- Tested with C(op) version 0.5.5
|
- Tested with C(op) version 0.5.5
|
||||||
- "Based on the C(onepassword) lookup plugin by Scott Buchanan <sbuchanan@ri.pn>."
|
- "Based on the C(onepassword) lookup plugin by Scott Buchanan <sbuchanan@ri.pn>."
|
||||||
- When this module is called with the deprecated C(onepassword_facts) name, potentially sensitive data
|
|
||||||
from 1Password is returned as Ansible facts. Facts are subject to caching if enabled, which means this
|
|
||||||
data could be stored in clear text on disk or in a database.
|
|
||||||
short_description: Gather items from 1Password
|
short_description: Gather items from 1Password
|
||||||
description:
|
description:
|
||||||
- M(community.general.onepassword_info) wraps the C(op) command line utility to fetch data about one or more 1Password items.
|
- M(community.general.onepassword_info) wraps the C(op) command line utility to fetch data about one or more 1Password items.
|
||||||
|
@ -380,13 +377,7 @@ def main():
|
||||||
|
|
||||||
results = {'onepassword': OnePasswordInfo().run()}
|
results = {'onepassword': OnePasswordInfo().run()}
|
||||||
|
|
||||||
if module._name in ('onepassword_facts', 'community.general.onepassword_facts'):
|
module.exit_json(changed=False, **results)
|
||||||
module.deprecate("The 'onepassword_facts' module has been renamed to 'onepassword_info'. "
|
|
||||||
"When called with the new name it no longer returns 'ansible_facts'",
|
|
||||||
version='3.0.0', collection_name='community.general') # was Ansible 2.13
|
|
||||||
module.exit_json(changed=False, ansible_facts=results)
|
|
||||||
else:
|
|
||||||
module.exit_json(changed=False, **results)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/redfish/idrac_redfish_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
web_infrastructure/jenkins_job_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./net_tools/ldap/ldap_attr.py
|
|
|
@ -1 +0,0 @@
|
||||||
cloud/memset/memset_memstore_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
cloud/memset/memset_server_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./storage/netapp/na_ontap_gather_facts.py
|
|
|
@ -1,284 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Copyright: (c) 2016, Peter Sagerson <psagers@ignorare.net>
|
|
||||||
# Copyright: (c) 2016, Jiri Tyr <jiri.tyr@gmail.com>
|
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
__metaclass__ = type
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
|
||||||
---
|
|
||||||
module: ldap_attr
|
|
||||||
short_description: Add or remove LDAP attribute values
|
|
||||||
description:
|
|
||||||
- Add or remove LDAP attribute values.
|
|
||||||
notes:
|
|
||||||
- This only deals with attributes on existing entries. To add or remove
|
|
||||||
whole entries, see M(community.general.ldap_entry).
|
|
||||||
- The default authentication settings will attempt to use a SASL EXTERNAL
|
|
||||||
bind over a UNIX domain socket. This works well with the default Ubuntu
|
|
||||||
install for example, which includes a cn=peercred,cn=external,cn=auth ACL
|
|
||||||
rule allowing root to modify the server configuration. If you need to use
|
|
||||||
a simple bind to access your server, pass the credentials in I(bind_dn)
|
|
||||||
and I(bind_pw).
|
|
||||||
- For I(state=present) and I(state=absent), all value comparisons are
|
|
||||||
performed on the server for maximum accuracy. For I(state=exact), values
|
|
||||||
have to be compared in Python, which obviously ignores LDAP matching
|
|
||||||
rules. This should work out in most cases, but it is theoretically
|
|
||||||
possible to see spurious changes when target and actual values are
|
|
||||||
semantically identical but lexically distinct.
|
|
||||||
- "The I(params) parameter was removed due to circumventing Ansible's parameter
|
|
||||||
handling. The I(params) parameter started disallowing setting the I(bind_pw) parameter in
|
|
||||||
Ansible-2.7 as it was insecure to set the parameter that way."
|
|
||||||
deprecated:
|
|
||||||
removed_in: 3.0.0 # was Ansible 2.14
|
|
||||||
why: 'The current "ldap_attr" module does not support LDAP attribute insertions or deletions with objectClass dependencies.'
|
|
||||||
alternative: 'Use M(community.general.ldap_attrs) instead. Deprecated in community.general 0.2.0.'
|
|
||||||
author:
|
|
||||||
- Jiri Tyr (@jtyr)
|
|
||||||
requirements:
|
|
||||||
- python-ldap
|
|
||||||
options:
|
|
||||||
name:
|
|
||||||
description:
|
|
||||||
- The name of the attribute to modify.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
state:
|
|
||||||
description:
|
|
||||||
- The state of the attribute values.
|
|
||||||
- If C(present), all given values will be added if they're missing.
|
|
||||||
- If C(absent), all given values will be removed if present.
|
|
||||||
- If C(exact), the set of values will be forced to exactly those provided and no others.
|
|
||||||
- If I(state=exact) and I(value) is an empty list, all values for this attribute will be removed.
|
|
||||||
type: str
|
|
||||||
choices: [ absent, exact, present ]
|
|
||||||
default: present
|
|
||||||
values:
|
|
||||||
description:
|
|
||||||
- The value(s) to add or remove. This can be a string or a list of
|
|
||||||
strings. The complex argument format is required in order to pass
|
|
||||||
a list of strings (see examples).
|
|
||||||
type: raw
|
|
||||||
required: true
|
|
||||||
extends_documentation_fragment:
|
|
||||||
- community.general.ldap.documentation
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
- name: Configure directory number 1 for example.com
|
|
||||||
community.general.ldap_attr:
|
|
||||||
dn: olcDatabase={1}hdb,cn=config
|
|
||||||
name: olcSuffix
|
|
||||||
values: dc=example,dc=com
|
|
||||||
state: exact
|
|
||||||
|
|
||||||
# The complex argument format is required here to pass a list of ACL strings.
|
|
||||||
- name: Set up the ACL
|
|
||||||
community.general.ldap_attr:
|
|
||||||
dn: olcDatabase={1}hdb,cn=config
|
|
||||||
name: olcAccess
|
|
||||||
values:
|
|
||||||
- >-
|
|
||||||
{0}to attrs=userPassword,shadowLastChange
|
|
||||||
by self write
|
|
||||||
by anonymous auth
|
|
||||||
by dn="cn=admin,dc=example,dc=com" write
|
|
||||||
by * none'
|
|
||||||
- >-
|
|
||||||
{1}to dn.base="dc=example,dc=com"
|
|
||||||
by dn="cn=admin,dc=example,dc=com" write
|
|
||||||
by * read
|
|
||||||
state: exact
|
|
||||||
|
|
||||||
- name: Declare some indexes
|
|
||||||
community.general.ldap_attr:
|
|
||||||
dn: olcDatabase={1}hdb,cn=config
|
|
||||||
name: olcDbIndex
|
|
||||||
values: "{{ item }}"
|
|
||||||
with_items:
|
|
||||||
- objectClass eq
|
|
||||||
- uid eq
|
|
||||||
|
|
||||||
- name: Set up a root user, which we can use later to bootstrap the directory
|
|
||||||
community.general.ldap_attr:
|
|
||||||
dn: olcDatabase={1}hdb,cn=config
|
|
||||||
name: "{{ item.key }}"
|
|
||||||
values: "{{ item.value }}"
|
|
||||||
state: exact
|
|
||||||
with_dict:
|
|
||||||
olcRootDN: cn=root,dc=example,dc=com
|
|
||||||
olcRootPW: "{SSHA}tabyipcHzhwESzRaGA7oQ/SDoBZQOGND"
|
|
||||||
|
|
||||||
- name: Get rid of an unneeded attribute
|
|
||||||
community.general.ldap_attr:
|
|
||||||
dn: uid=jdoe,ou=people,dc=example,dc=com
|
|
||||||
name: shadowExpire
|
|
||||||
values: []
|
|
||||||
state: exact
|
|
||||||
server_uri: ldap://localhost/
|
|
||||||
bind_dn: cn=admin,dc=example,dc=com
|
|
||||||
bind_pw: password
|
|
||||||
|
|
||||||
#
|
|
||||||
# The same as in the previous example but with the authentication details
|
|
||||||
# stored in the ldap_auth variable:
|
|
||||||
#
|
|
||||||
# ldap_auth:
|
|
||||||
# server_uri: ldap://localhost/
|
|
||||||
# bind_dn: cn=admin,dc=example,dc=com
|
|
||||||
# bind_pw: password
|
|
||||||
#
|
|
||||||
# In the example below, 'args' is a task keyword, passed at the same level as the module
|
|
||||||
- name: Get rid of an unneeded attribute
|
|
||||||
community.general.ldap_attr:
|
|
||||||
dn: uid=jdoe,ou=people,dc=example,dc=com
|
|
||||||
name: shadowExpire
|
|
||||||
values: []
|
|
||||||
state: exact
|
|
||||||
args: "{{ ldap_auth }}"
|
|
||||||
'''
|
|
||||||
|
|
||||||
RETURN = r'''
|
|
||||||
modlist:
|
|
||||||
description: list of modified parameters
|
|
||||||
returned: success
|
|
||||||
type: list
|
|
||||||
sample: '[[2, "olcRootDN", ["cn=root,dc=example,dc=com"]]]'
|
|
||||||
'''
|
|
||||||
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
|
||||||
from ansible.module_utils._text import to_native, to_bytes
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.ldap import LdapGeneric, gen_specs
|
|
||||||
|
|
||||||
LDAP_IMP_ERR = None
|
|
||||||
try:
|
|
||||||
import ldap
|
|
||||||
|
|
||||||
HAS_LDAP = True
|
|
||||||
except ImportError:
|
|
||||||
LDAP_IMP_ERR = traceback.format_exc()
|
|
||||||
HAS_LDAP = False
|
|
||||||
|
|
||||||
|
|
||||||
class LdapAttr(LdapGeneric):
|
|
||||||
def __init__(self, module):
|
|
||||||
LdapGeneric.__init__(self, module)
|
|
||||||
|
|
||||||
# Shortcuts
|
|
||||||
self.name = self.module.params['name']
|
|
||||||
self.state = self.module.params['state']
|
|
||||||
|
|
||||||
# Normalize values
|
|
||||||
if isinstance(self.module.params['values'], list):
|
|
||||||
self.values = list(map(to_bytes, self.module.params['values']))
|
|
||||||
else:
|
|
||||||
self.values = [to_bytes(self.module.params['values'])]
|
|
||||||
|
|
||||||
def add(self):
|
|
||||||
values_to_add = list(filter(self._is_value_absent, self.values))
|
|
||||||
|
|
||||||
if len(values_to_add) > 0:
|
|
||||||
modlist = [(ldap.MOD_ADD, self.name, values_to_add)]
|
|
||||||
else:
|
|
||||||
modlist = []
|
|
||||||
|
|
||||||
return modlist
|
|
||||||
|
|
||||||
def delete(self):
|
|
||||||
values_to_delete = list(filter(self._is_value_present, self.values))
|
|
||||||
|
|
||||||
if len(values_to_delete) > 0:
|
|
||||||
modlist = [(ldap.MOD_DELETE, self.name, values_to_delete)]
|
|
||||||
else:
|
|
||||||
modlist = []
|
|
||||||
|
|
||||||
return modlist
|
|
||||||
|
|
||||||
def exact(self):
|
|
||||||
try:
|
|
||||||
results = self.connection.search_s(
|
|
||||||
self.dn, ldap.SCOPE_BASE, attrlist=[self.name])
|
|
||||||
except ldap.LDAPError as e:
|
|
||||||
self.fail("Cannot search for attribute %s" % self.name, e)
|
|
||||||
|
|
||||||
current = results[0][1].get(self.name, [])
|
|
||||||
modlist = []
|
|
||||||
|
|
||||||
if frozenset(self.values) != frozenset(current):
|
|
||||||
if len(current) == 0:
|
|
||||||
modlist = [(ldap.MOD_ADD, self.name, self.values)]
|
|
||||||
elif len(self.values) == 0:
|
|
||||||
modlist = [(ldap.MOD_DELETE, self.name, None)]
|
|
||||||
else:
|
|
||||||
modlist = [(ldap.MOD_REPLACE, self.name, self.values)]
|
|
||||||
|
|
||||||
return modlist
|
|
||||||
|
|
||||||
def _is_value_present(self, value):
|
|
||||||
""" True if the target attribute has the given value. """
|
|
||||||
try:
|
|
||||||
is_present = bool(
|
|
||||||
self.connection.compare_s(self.dn, self.name, value))
|
|
||||||
except ldap.NO_SUCH_ATTRIBUTE:
|
|
||||||
is_present = False
|
|
||||||
|
|
||||||
return is_present
|
|
||||||
|
|
||||||
def _is_value_absent(self, value):
|
|
||||||
""" True if the target attribute doesn't have the given value. """
|
|
||||||
return not self._is_value_present(value)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec=gen_specs(
|
|
||||||
name=dict(type='str', required=True),
|
|
||||||
params=dict(type='dict'),
|
|
||||||
state=dict(type='str', default='present', choices=['absent', 'exact', 'present']),
|
|
||||||
values=dict(type='raw', required=True),
|
|
||||||
),
|
|
||||||
supports_check_mode=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
if not HAS_LDAP:
|
|
||||||
module.fail_json(msg=missing_required_lib('python-ldap'),
|
|
||||||
exception=LDAP_IMP_ERR)
|
|
||||||
|
|
||||||
if module.params['params']:
|
|
||||||
module.fail_json(msg="The `params` option to ldap_attr was removed in since it circumvents Ansible's option handling")
|
|
||||||
|
|
||||||
# Instantiate the LdapAttr object
|
|
||||||
ldap = LdapAttr(module)
|
|
||||||
|
|
||||||
state = module.params['state']
|
|
||||||
|
|
||||||
# Perform action
|
|
||||||
if state == 'present':
|
|
||||||
modlist = ldap.add()
|
|
||||||
elif state == 'absent':
|
|
||||||
modlist = ldap.delete()
|
|
||||||
elif state == 'exact':
|
|
||||||
modlist = ldap.exact()
|
|
||||||
|
|
||||||
changed = False
|
|
||||||
|
|
||||||
if len(modlist) > 0:
|
|
||||||
changed = True
|
|
||||||
|
|
||||||
if not module.check_mode:
|
|
||||||
try:
|
|
||||||
ldap.connection.modify_s(ldap.dn, modlist)
|
|
||||||
except Exception as e:
|
|
||||||
module.fail_json(msg="Attribute action failed.", details=to_native(e))
|
|
||||||
|
|
||||||
module.exit_json(changed=changed, modlist=modlist)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -17,7 +17,7 @@ short_description: Add or remove LDAP entries.
|
||||||
description:
|
description:
|
||||||
- Add or remove LDAP entries. This module only asserts the existence or
|
- Add or remove LDAP entries. This module only asserts the existence or
|
||||||
non-existence of an LDAP entry, not its attributes. To assert the
|
non-existence of an LDAP entry, not its attributes. To assert the
|
||||||
attribute values of an entry, see M(community.general.ldap_attr).
|
attribute values of an entry, see M(community.general.ldap_attrs).
|
||||||
notes:
|
notes:
|
||||||
- The default authentication settings will attempt to use a SASL EXTERNAL
|
- The default authentication settings will attempt to use a SASL EXTERNAL
|
||||||
bind over a UNIX domain socket. This works well with the default Ubuntu
|
bind over a UNIX domain socket. This works well with the default Ubuntu
|
||||||
|
@ -37,7 +37,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- If I(state=present), attributes necessary to create an entry. Existing
|
- If I(state=present), attributes necessary to create an entry. Existing
|
||||||
entries are never modified. To assert specific attribute values on an
|
entries are never modified. To assert specific attribute values on an
|
||||||
existing entry, use M(community.general.ldap_attr) module instead.
|
existing entry, use M(community.general.ldap_attrs) module instead.
|
||||||
type: dict
|
type: dict
|
||||||
objectClass:
|
objectClass:
|
||||||
description:
|
description:
|
||||||
|
@ -199,7 +199,7 @@ def main():
|
||||||
exception=LDAP_IMP_ERR)
|
exception=LDAP_IMP_ERR)
|
||||||
|
|
||||||
if module.params['params']:
|
if module.params['params']:
|
||||||
module.fail_json(msg="The `params` option to ldap_attr was removed since it circumvents Ansible's option handling")
|
module.fail_json(msg="The `params` option to ldap_entry was removed since it circumvents Ansible's option handling")
|
||||||
|
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
./web_infrastructure/nginx_status_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
cloud/opennebula/one_image_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
identity/onepassword_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_datacenter_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_enclosure_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_ethernet_network_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_fc_network_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_fcoe_network_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_logical_interconnect_group_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_network_set_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
remote_management/oneview/oneview_san_manager_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/online/online_server_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/online/online_user_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/misc/ovirt.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_affinity_label_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_api_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_cluster_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_datacenter_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_disk_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_event_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_external_provider_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_group_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_host_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_host_storage_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_network_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_nic_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_permission_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_quota_facts.py
|
|
|
@ -1 +0,0 @@
|
||||||
./cloud/ovirt/ovirt_scheduling_policy_facts.py
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue