├── changelogs ├── fragments │ ├── .keep │ └── initialize.yml └── config.yaml ├── plugins ├── modules │ ├── __init__.py │ ├── ces_quotas_info.py │ ├── dds_datastore_info.py │ ├── availability_zone_info.py │ ├── swr_organization_info.py │ ├── cce_cluster_cert_info.py │ ├── rds_datastore_info.py │ ├── volume_backup_info.py │ ├── as_config_info.py │ ├── waf_certificate_info.py │ ├── as_group_info.py │ ├── dds_flavor_info.py │ ├── dns_nameserver_info.py │ ├── dms_queue_info.py │ ├── dns_zone_info.py │ ├── vpc_info.py │ ├── server_group_info.py │ └── cce_cluster_info.py └── README.md ├── doc ├── source │ ├── _static │ │ └── .placeholder │ ├── sfsturbo.rst │ ├── mrs.rst │ ├── ecs.rst │ ├── vpn.rst │ ├── antiddos.rst │ ├── misc.rst │ ├── volume.rst │ ├── css.rst │ ├── deh.rst │ ├── dws.rst │ ├── dds.rst │ ├── waf.rst │ ├── dns.rst │ ├── nat.rst │ ├── rds.rst │ ├── ces.rst │ ├── as.rst │ ├── cce.rst │ ├── index.rst │ ├── dms.rst │ ├── vpc.rst │ ├── elb.rst │ └── swr.rst ├── requirements.txt └── examples │ ├── 2_volume_backup_and_maintenance.yaml │ ├── 7_loadbalancer_info.yaml │ ├── 9_cloud_search.yaml │ ├── 4_as_policy.yaml │ ├── 10_relation_database.yaml │ ├── 6_loadbalancer.yaml │ └── 3_autoscaling.yaml ├── tests ├── sanity │ ├── ignore-2.10.txt │ ├── ignore-2.11.txt │ ├── ignore-2.12.txt │ ├── ignore-2.13.txt │ ├── ignore-2.14.txt │ ├── ignore-2.15.txt │ ├── ignore-2.16.txt │ ├── ignore-2.17.txt │ ├── ignore-2.18.txt │ └── requirements.txt ├── integration │ ├── targets │ │ ├── prepare_tests │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── ces │ │ │ └── aliases │ │ ├── nat │ │ │ └── aliases │ │ ├── vpc │ │ │ └── aliases │ │ ├── availability_zone_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── kms_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── vpc_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── deh_host_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dns_private │ │ │ └── aliases │ │ ├── dns_public │ │ │ └── aliases │ │ ├── floating_ip │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── ims_image_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── lb_certificate │ │ │ └── aliases │ │ ├── object_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── rds_backup │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── subnet │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_domain │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_repository │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── vpc_peering_test │ │ │ └── aliases │ │ ├── vpc_route_test │ │ │ └── aliases │ │ ├── waf_domain │ │ │ └── aliases │ │ ├── as_config │ │ │ ├── aliases │ │ │ ├── defaults │ │ │ │ └── main.yaml │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── as_group │ │ │ ├── aliases │ │ │ └── defaults │ │ │ │ └── main.yaml │ │ ├── as_policy │ │ │ └── aliases │ │ ├── cbr │ │ │ └── aliases │ │ ├── css_snapshot_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dds_datastore_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dds_flavor_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dds_instance_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── deh_host_type_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dms │ │ │ └── aliases │ │ ├── dns_recordset_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── lb_certificate_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── nat_dnat_rule_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── nat_gateway_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── nat_snat_rule_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── rds_backup_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── rds_datastore_info │ │ │ ├── aliases │ │ │ ├── meta │ │ │ │ └── main.yml │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── rds_instance_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── security_group │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── server_group_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── subnet_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_domain_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_organization │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_repository_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── volume_backup_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── vpc_peering_info_test │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── vpc_route_info_test │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── vpn_service_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── waf_certificate │ │ │ └── aliases │ │ ├── waf_domain_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── as_config_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── as_instance_info │ │ │ └── aliases │ │ ├── as_policy_info │ │ │ └── aliases │ │ ├── as_quota_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── cce_cluster │ │ │ └── aliases │ │ ├── css_cluster │ │ │ └── aliases │ │ ├── deh_host │ │ │ └── aliases │ │ ├── dws_cluster │ │ │ └── aliases │ │ ├── lb_healtmonitor_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── lb_listener_certificates │ │ │ └── aliases │ │ ├── security_group_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_organization_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── waf_certificate_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── cce_cluster_node │ │ │ └── aliases │ │ ├── cce_lifecycle │ │ │ └── aliases │ │ ├── cce_node_pool │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── css_cluster_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── css_snapshot │ │ │ └── aliases │ │ ├── dds_instance │ │ │ └── aliases │ │ ├── dms_instance │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dws_cluster_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dws_snapshot │ │ │ └── aliases │ │ ├── loadbalancer │ │ │ └── aliases │ │ ├── mrs_cluster_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── rds_flavor_info │ │ │ ├── aliases │ │ │ ├── meta │ │ │ │ └── main.yml │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── rds_instance │ │ │ └── aliases │ │ ├── sfsturbo │ │ │ └── aliases │ │ ├── swr_organization_permissions │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_repository_permissions │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── volume_backup │ │ │ └── aliases │ │ ├── volume_snapshot_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── anti_ddos_fip_statuses_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── as_instance │ │ │ ├── aliases │ │ │ └── defaults │ │ │ │ └── main.yaml │ │ ├── cce_node_pool_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── dws_snapshot_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_organization_permissions_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ │ └── main.yaml │ │ ├── swr_repository_permissions_info │ │ │ └── aliases │ │ └── anti_ddos_optional_policies_info │ │ │ ├── aliases │ │ │ └── tasks │ │ │ └── main.yaml │ ├── requirements.txt │ └── integration_config.yml.template ├── unit │ └── requirements.txt ├── .gitignore └── utils │ ├── render.sh │ ├── units.sh │ ├── integration.sh │ └── sanity.sh ├── roles └── vpc_peering │ ├── tasks │ ├── destroy.yaml │ ├── main.yaml │ └── provision.yaml │ ├── meta │ └── main.yml │ └── README.md ├── test-requirements.txt ├── test-requirements-2.9.txt ├── bindep.txt ├── .gitignore ├── setup.py ├── galaxy.yml ├── tools ├── check-import.sh ├── build.py └── run-ansible-sanity.sh ├── .ansible-lint ├── examples └── playbooks │ ├── 2_volume_backup_and_maintenance.yaml │ ├── 7_loadbalancer_info.yaml │ ├── 13_dms_kafka.yaml │ ├── 9_cloud_search.yaml │ ├── 12_dedicated_host.yaml │ ├── 4_as_policy.yaml │ ├── 10_relation_database.yaml │ ├── 6_loadbalancer.yaml │ └── 3_autoscaling.yaml ├── setup.cfg ├── meta └── runtime.yml └── zuul.yaml /changelogs/fragments/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plugins/modules/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/source/_static/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/sanity/ignore-2.10.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.11.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.12.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.13.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.14.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.15.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.16.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.17.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /tests/sanity/ignore-2.18.txt: -------------------------------------------------------------------------------- 1 | ignore.txt -------------------------------------------------------------------------------- /roles/vpc_peering/tasks/destroy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /tests/integration/targets/prepare_tests/aliases: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/integration/targets/ces/aliases: -------------------------------------------------------------------------------- 1 | ces/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/nat/aliases: -------------------------------------------------------------------------------- 1 | nat/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc/aliases: -------------------------------------------------------------------------------- 1 | vpc/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/availability_zone_info/aliases: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/integration/targets/kms_info/aliases: -------------------------------------------------------------------------------- 1 | kms/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_info/aliases: -------------------------------------------------------------------------------- 1 | vpc/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/deh_host_info/aliases: -------------------------------------------------------------------------------- 1 | deh/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/dns_private/aliases: -------------------------------------------------------------------------------- 1 | dns/private 2 | -------------------------------------------------------------------------------- /tests/integration/targets/dns_public/aliases: -------------------------------------------------------------------------------- 1 | dns/public 2 | -------------------------------------------------------------------------------- /tests/integration/targets/floating_ip/aliases: -------------------------------------------------------------------------------- 1 | fip/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/ims_image_info/aliases: -------------------------------------------------------------------------------- 1 | ims/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/lb_certificate/aliases: -------------------------------------------------------------------------------- 1 | elb/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/object_info/aliases: -------------------------------------------------------------------------------- 1 | obs/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_backup/aliases: -------------------------------------------------------------------------------- 1 | rds/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/subnet/aliases: -------------------------------------------------------------------------------- 1 | network/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_domain/aliases: -------------------------------------------------------------------------------- 1 | swr/group2 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_repository/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_peering_test/aliases: -------------------------------------------------------------------------------- 1 | vpc/vpcp 2 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_route_test/aliases: -------------------------------------------------------------------------------- 1 | vpc/route 2 | -------------------------------------------------------------------------------- /tests/integration/targets/waf_domain/aliases: -------------------------------------------------------------------------------- 1 | waf/group1 2 | -------------------------------------------------------------------------------- /tests/unit/requirements.txt: -------------------------------------------------------------------------------- 1 | openstacksdk 2 | otcextensions 3 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | output/ 2 | integration/integration_config.yml 3 | -------------------------------------------------------------------------------- /tests/integration/targets/as_config/aliases: -------------------------------------------------------------------------------- 1 | autoscaling/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/as_group/aliases: -------------------------------------------------------------------------------- 1 | autoscaling/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/as_policy/aliases: -------------------------------------------------------------------------------- 1 | autoscaling/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/cbr/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | cbr/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/css_snapshot_info/aliases: -------------------------------------------------------------------------------- 1 | css/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/dds_datastore_info/aliases: -------------------------------------------------------------------------------- 1 | dds/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/dds_flavor_info/aliases: -------------------------------------------------------------------------------- 1 | dds/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/dds_instance_info/aliases: -------------------------------------------------------------------------------- 1 | dds/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/deh_host_type_info/aliases: -------------------------------------------------------------------------------- 1 | deh/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/dms/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | dms/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/dns_recordset_info/aliases: -------------------------------------------------------------------------------- 1 | dns/public 2 | -------------------------------------------------------------------------------- /tests/integration/targets/lb_certificate_info/aliases: -------------------------------------------------------------------------------- 1 | elb/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/nat_dnat_rule_info/aliases: -------------------------------------------------------------------------------- 1 | nat/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/nat_gateway_info/aliases: -------------------------------------------------------------------------------- 1 | nat/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/nat_snat_rule_info/aliases: -------------------------------------------------------------------------------- 1 | nat/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_backup_info/aliases: -------------------------------------------------------------------------------- 1 | rds/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_datastore_info/aliases: -------------------------------------------------------------------------------- 1 | rds/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_instance_info/aliases: -------------------------------------------------------------------------------- 1 | rds/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/security_group/aliases: -------------------------------------------------------------------------------- 1 | network/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/server_group_info/aliases: -------------------------------------------------------------------------------- 1 | ecs/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/subnet_info/aliases: -------------------------------------------------------------------------------- 1 | network/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_domain_info/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_repository_info/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/volume_backup_info/aliases: -------------------------------------------------------------------------------- 1 | storage/vbs 2 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_peering_info_test/aliases: -------------------------------------------------------------------------------- 1 | vpc/vpcp 2 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_route_info_test/aliases: -------------------------------------------------------------------------------- 1 | vpc/route 2 | -------------------------------------------------------------------------------- /tests/integration/targets/vpn_service_info/aliases: -------------------------------------------------------------------------------- 1 | vpn/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/waf_certificate/aliases: -------------------------------------------------------------------------------- 1 | waf/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/waf_domain_info/aliases: -------------------------------------------------------------------------------- 1 | waf/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/as_config_info/aliases: -------------------------------------------------------------------------------- 1 | autoscaling/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/as_instance_info/aliases: -------------------------------------------------------------------------------- 1 | autoscaling/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/as_policy_info/aliases: -------------------------------------------------------------------------------- 1 | autoscaling/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/as_quota_info/aliases: -------------------------------------------------------------------------------- 1 | autoscaling/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/cce_cluster/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | cce/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/css_cluster/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | css/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/deh_host/aliases: -------------------------------------------------------------------------------- 1 | deh/group1 2 | disabled 3 | -------------------------------------------------------------------------------- /tests/integration/targets/dws_cluster/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | dws/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/lb_healtmonitor_info/aliases: -------------------------------------------------------------------------------- 1 | elb/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/lb_listener_certificates/aliases: -------------------------------------------------------------------------------- 1 | elb/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/security_group_info/aliases: -------------------------------------------------------------------------------- 1 | network/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization_info/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/waf_certificate_info/aliases: -------------------------------------------------------------------------------- 1 | waf/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/cce_cluster_node/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | cce/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/cce_lifecycle/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | cce/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/cce_node_pool/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | cce/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/css_cluster_info/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | css/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/css_snapshot/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | css/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/dds_instance/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | dds/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/dms_instance/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | dms/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/dws_cluster_info/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | dws/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/dws_snapshot/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | dws/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/loadbalancer/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | elb/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/mrs_cluster_info/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | mrs/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_flavor_info/aliases: -------------------------------------------------------------------------------- 1 | rds_flavor_info/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_instance/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | rds/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/sfsturbo/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | sfsturbo/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization_permissions/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_repository_permissions/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/volume_backup/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | storage/vbs 3 | -------------------------------------------------------------------------------- /tests/integration/targets/volume_snapshot_info/aliases: -------------------------------------------------------------------------------- 1 | storage/snapshot 2 | -------------------------------------------------------------------------------- /tests/integration/targets/anti_ddos_fip_statuses_info/aliases: -------------------------------------------------------------------------------- 1 | antiddos/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/as_instance/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | autoscaling/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/cce_node_pool_info/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | cce/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/dws_snapshot_info/aliases: -------------------------------------------------------------------------------- 1 | disabled 2 | dws/group1 3 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization_permissions_info/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_repository_permissions_info/aliases: -------------------------------------------------------------------------------- 1 | swr/group1 2 | -------------------------------------------------------------------------------- /tests/integration/targets/anti_ddos_optional_policies_info/aliases: -------------------------------------------------------------------------------- 1 | antiddos/group1 2 | -------------------------------------------------------------------------------- /changelogs/fragments/initialize.yml: -------------------------------------------------------------------------------- 1 | major_changes: 2 | - initializing changelog handling 3 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_flavor_info/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_datastore_info/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_tests 4 | -------------------------------------------------------------------------------- /tests/integration/requirements.txt: -------------------------------------------------------------------------------- 1 | otcextensions 2 | openstacksdk 3 | six # Workaround for broken keystoneauth 5.2.0 4 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # Cloud modules collection 2 | 3 | This collection delivers all modules for working with otc specific services 4 | -------------------------------------------------------------------------------- /tests/integration/targets/as_config/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | as_test_image: "Standard_Debian_10_latest" 2 | as_test_flavor: "s3.2xlarge.2" 3 | -------------------------------------------------------------------------------- /tests/integration/targets/as_group/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | as_test_image: "Standard_Debian_10_latest" 2 | as_test_flavor: "s3.2xlarge.2" 3 | -------------------------------------------------------------------------------- /tests/integration/targets/as_instance/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | as_test_image: Standard_Ubuntu_22.04_latest 2 | as_test_flavor: "s3.medium.1" 3 | -------------------------------------------------------------------------------- /doc/source/sfsturbo.rst: -------------------------------------------------------------------------------- 1 | SFSTurbo (SFS) Modules 2 | =================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | sfsturbo_share 8 | -------------------------------------------------------------------------------- /roles/vpc_peering/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - include_tasks: "provision.yaml" 3 | when: "state != 'absent'" 4 | 5 | - include_tasks: "destroy.yaml" 6 | when: "state == 'absent'" 7 | -------------------------------------------------------------------------------- /doc/source/mrs.rst: -------------------------------------------------------------------------------- 1 | Map Reduce Service (MRS) Modules 2 | ================================ 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | mrs_cluster_info 8 | -------------------------------------------------------------------------------- /doc/source/ecs.rst: -------------------------------------------------------------------------------- 1 | Elastic Cloud Server (ECS) Modules 2 | ================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | server_group_info 8 | -------------------------------------------------------------------------------- /doc/source/vpn.rst: -------------------------------------------------------------------------------- 1 | Virtual Private Network (VPN) Modules 2 | ===================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | vpn_service_info -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | stestr 2 | openstacksdk 3 | # pycodestyle==2.8.0 4 | ansible-lint 5 | flake8>=4.0.0 6 | pylint 7 | voluptuous 8 | yamllint 9 | rstcheck 10 | ruamel.yaml 11 | otcextensions 12 | -------------------------------------------------------------------------------- /tests/integration/targets/prepare_tests/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # - name: set fact 3 | # ansible.builtin.set_fact: 4 | # otc_cloud: "{{ lookup('env', 'OS_CLOUD') | default('otc') }}" 5 | # otc_cloud: otc 6 | -------------------------------------------------------------------------------- /tests/integration/integration_config.yml.template: -------------------------------------------------------------------------------- 1 | --- 2 | test_cloud: ${OS_CLOUD} 3 | has_snat: ${has_snat:-false} 4 | region: ${region:-eu-de} 5 | deh_host_type: ${deh_host_type:-s2-medium} 6 | deh_az: ${deh_az:-eu-de-01} 7 | -------------------------------------------------------------------------------- /test-requirements-2.9.txt: -------------------------------------------------------------------------------- 1 | ansible==7.2.0 2 | ansible-lint 3 | openstacksdk 4 | pycodestyle==2.10.0 5 | flake8==3.8.4 6 | pylint 7 | voluptuous==0.13.1 8 | yamllint 9 | rstcheck 10 | ruamel.yaml 11 | tox 12 | otcextensions 13 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | otcdocstheme # Ansible-2.0 2 | sphinx 3 | otc-sphinx-directives>=0.1.0 4 | sphinx-minify>=0.0.1 # Apache-2.0 5 | git+https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata-rework.git#egg=otc_metadata 6 | setuptools 7 | gitpython 8 | -------------------------------------------------------------------------------- /doc/source/antiddos.rst: -------------------------------------------------------------------------------- 1 | Anti-DDoS Modules 2 | ================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | anti_ddos_fip_statuses_info 8 | anti_ddos_optional_policies_info 9 | 10 | -------------------------------------------------------------------------------- /doc/source/misc.rst: -------------------------------------------------------------------------------- 1 | Other Modules 2 | ============= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | availability_zone_info 8 | object_info 9 | server_group_info 10 | tag 11 | 12 | -------------------------------------------------------------------------------- /doc/source/volume.rst: -------------------------------------------------------------------------------- 1 | Elastic Volume Service (EVS) Modules 2 | ==================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | volume_backup 8 | volume_backup_info 9 | volume_snapshot_info 10 | 11 | -------------------------------------------------------------------------------- /roles/vpc_peering/meta/main.yml: -------------------------------------------------------------------------------- 1 | galaxy_info: 2 | author: Artem Goncharov 3 | description: Manage VPC Peering between 2 VPCs in the Open Telekom Cloud 4 | company: Open Telekom Cloud 5 | 6 | license: Apache-2.0 7 | 8 | min_ansible_version: '2.10' 9 | platforms: [] 10 | 11 | dependencies: [] 12 | -------------------------------------------------------------------------------- /doc/source/css.rst: -------------------------------------------------------------------------------- 1 | Cloud Search Service (CSS) Modules 2 | ================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | css_cluster 8 | css_cluster_info 9 | css_snapshot 10 | css_snapshot_info 11 | -------------------------------------------------------------------------------- /doc/source/deh.rst: -------------------------------------------------------------------------------- 1 | Dedicated Host Service (DEH) Modules 2 | ==================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | deh_host 8 | deh_host_info 9 | deh_host_type_info 10 | deh_server_info 11 | -------------------------------------------------------------------------------- /doc/source/dws.rst: -------------------------------------------------------------------------------- 1 | Data Warehouse Service (DWS) Modules 2 | ==================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | dws_cluster 8 | dws_cluster_info 9 | dws_snapshot 10 | dws_snapshot_info 11 | -------------------------------------------------------------------------------- /tests/utils/render.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | set -o pipefail 4 | 5 | function main() 6 | { 7 | readonly template="$1"; shift 8 | readonly content="$(cat "$template")" 9 | 10 | eval "echo \"$content\"" 11 | } 12 | 13 | main tests/integration/integration_config.yml.template > tests/integration/integration_config.yml 14 | -------------------------------------------------------------------------------- /doc/source/dds.rst: -------------------------------------------------------------------------------- 1 | Document Database Service (DDS) Modules 2 | ======================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | dds_instance 8 | dds_datastore_info 9 | dds_flavor_info 10 | dds_instance_info -------------------------------------------------------------------------------- /doc/source/waf.rst: -------------------------------------------------------------------------------- 1 | Web Application Firewall (WAF) Modules 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | waf_certificate 8 | waf_certificate_info 9 | waf_domain 10 | waf_domain_info 11 | -------------------------------------------------------------------------------- /bindep.txt: -------------------------------------------------------------------------------- 1 | # This is a cross-platform list tracking distribution packages needed by tests; 2 | # see https://docs.openstack.org/infra/bindep/ for additional information. 3 | 4 | gcc-c++ [doc test platform:rpm] 5 | libyaml-devel [test platform:rpm] 6 | libyaml-dev [test platform:dpkg] 7 | python3-devel [test platform:rpm] 8 | python3 [test platform:rpm] 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | __pycache__ 3 | .tox 4 | build_artifact 5 | ansible_collections 6 | galaxy.yml 7 | FILES.json 8 | MANIFEST.json 9 | importer_result.json 10 | **.swp 11 | 12 | *.tar.gz 13 | doc/build 14 | tmp 15 | 16 | #idea 17 | .idea/** 18 | */.idea/** 19 | 20 | # ansible-test inventory 21 | tests/integration/inventory 22 | 23 | *.egg-info/ 24 | -------------------------------------------------------------------------------- /doc/source/dns.rst: -------------------------------------------------------------------------------- 1 | Domain Name Service (DNS) Modules 2 | ================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | dns_floating_ip 8 | dns_recordset 9 | dns_recordset_info 10 | dns_zone 11 | dns_nameserver_info 12 | -------------------------------------------------------------------------------- /tests/integration/targets/kms_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: KMS Info test 3 | block: 4 | - name: Get AS config info 5 | opentelekomcloud.cloud.kms_info: 6 | register: key 7 | 8 | - name: Assert result 9 | ansible.builtin.assert: 10 | that: 11 | - key is success 12 | - key is not changed 13 | - key is defined 14 | -------------------------------------------------------------------------------- /tests/sanity/requirements.txt: -------------------------------------------------------------------------------- 1 | packaging # needed for update-bundled and changelog 2 | sphinx ; python_version >= '3.5' # docs build requires python 3+ 3 | sphinx-notfound-page ; python_version >= '3.5' # docs build requires python 3+ 4 | straight.plugin ; python_version >= '3.5' # needed for hacking/build-ansible.py which will host changelog generation and requires python 3+ 5 | 6 | openstacksdk 7 | -------------------------------------------------------------------------------- /doc/source/nat.rst: -------------------------------------------------------------------------------- 1 | NAT Gateway Modules 2 | =================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | nat_dnat_rule 8 | nat_dnat_rule_info 9 | nat_gateway 10 | nat_gateway_info 11 | nat_snat_rule 12 | nat_snat_rule_info 13 | 14 | -------------------------------------------------------------------------------- /doc/source/rds.rst: -------------------------------------------------------------------------------- 1 | Relational Database Service (RDS) Modules 2 | ========================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | rds_backup 8 | rds_backup_info 9 | rds_datastore_info 10 | rds_flavor_info 11 | rds_instance 12 | rds_instance_info 13 | -------------------------------------------------------------------------------- /doc/source/ces.rst: -------------------------------------------------------------------------------- 1 | Cloud Eye Service (CES) Modules 2 | =============================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ces_alarms 8 | ces_alarms_info 9 | ces_event_data_info 10 | ces_metric_data_info 11 | ces_metrics_info 12 | ces_quotas_info 13 | 14 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_backup_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: RDS Backup Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.rds_backup_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get error message that required parameter is missing 8 | opentelekomcloud.cloud.rds_backup_info: 9 | register: rds_backup_info 10 | failed_when: 'rds_backup_info.msg != "missing required arguments: instance"' 11 | -------------------------------------------------------------------------------- /doc/source/as.rst: -------------------------------------------------------------------------------- 1 | Auto Scaling (AS) Modules 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | as_config 8 | as_config_info 9 | as_group 10 | as_group_info 11 | as_instance_info 12 | as_policy 13 | as_policy_info 14 | as_quota 15 | 16 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_repository_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR repository tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_repository_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get repositories list 8 | opentelekomcloud.cloud.swr_repository_info: 9 | register: repositories 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - repositories is success 15 | -------------------------------------------------------------------------------- /tests/integration/targets/as_quota_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: AS Quota Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.as_quota_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get as quota info 8 | opentelekomcloud.cloud.as_quota_info: 9 | register: as_quotas 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - as_quotas is success 15 | - as_quotas is not changed 16 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR organization tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_organization_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get organizations list 8 | opentelekomcloud.cloud.swr_organization_info: 9 | register: organizations 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - organizations is success 15 | -------------------------------------------------------------------------------- /doc/source/cce.rst: -------------------------------------------------------------------------------- 1 | Cloud Container Engine (CCE) Modules 2 | ==================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | cce_cluster 8 | cce_cluster_cert_info 9 | cce_cluster_info 10 | cce_cluster_node 11 | cce_cluster_node_info 12 | cce_node_pool 13 | cce_node_pool_info 14 | -------------------------------------------------------------------------------- /tests/integration/targets/object_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Object Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.object_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: List available containers 8 | opentelekomcloud.cloud.object_info: 9 | register: containers 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - containers is success 15 | - containers.swift.containers is defined 16 | -------------------------------------------------------------------------------- /tests/integration/targets/server_group_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # author: @tischrei 3 | - name: Server Group Info tests 4 | module_defaults: 5 | opentelekomcloud.cloud.server_group_info: 6 | cloud: "{{ test_cloud }}" 7 | block: 8 | - name: List server groups 9 | opentelekomcloud.cloud.server_group_info: 10 | register: sg 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - sg is success 16 | - sg.server_groups is defined 17 | -------------------------------------------------------------------------------- /tests/integration/targets/volume_backup_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Volume Backup Info tests 3 | block: 4 | - name: Get backup info 5 | opentelekomcloud.cloud.volume_backup_info: 6 | register: backup 7 | 8 | - name: Debug backup 9 | ansible.builtin.debug: 10 | var: backup 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - backup is success 16 | - backup is not changed 17 | - backup.backups is defined 18 | -------------------------------------------------------------------------------- /tests/integration/targets/security_group_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # author: @tischrei 3 | - name: Security Group Info tests 4 | module_defaults: 5 | opentelekomcloud.cloud.security_group_info: 6 | cloud: "{{ test_cloud }}" 7 | block: 8 | - name: List security groups 9 | opentelekomcloud.cloud.security_group_info: 10 | register: sg 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - sg is success 16 | - sg.security_groups is defined 17 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_route_info_test/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: VPC Route Info tests 3 | block: 4 | - name: Get vpc routes info 5 | opentelekomcloud.cloud.vpc_route_info: 6 | register: vpc_routes 7 | 8 | - name: Debug vpc route 9 | ansible.builtin.debug: 10 | var: vpc_routes 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - vpc_routes is success 16 | - vpc_routes is not changed 17 | - vpc_routes.vpc_routes is defined 18 | -------------------------------------------------------------------------------- /tests/integration/targets/dds_instance_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DDS Instance Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.dds_instance_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about instances 8 | opentelekomcloud.cloud.dds_instance_info: 9 | register: result 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - result is success 15 | - result is not changed 16 | - result.instances is defined 17 | -------------------------------------------------------------------------------- /tests/integration/targets/deh_host_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DeH Host Info tests 3 | block: 4 | - name: Get Dedicated host info 5 | opentelekomcloud.cloud.deh_host_info: 6 | cloud: "{{ test_cloud }}" 7 | register: deh 8 | 9 | - name: Debug deh 10 | ansible.builtin.debug: 11 | var: deh.deh_hosts 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - deh is success 17 | - deh is not changed 18 | - deh.deh_hosts is defined 19 | -------------------------------------------------------------------------------- /tests/integration/targets/dws_cluster_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DWS Cluster Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.dws_cluster_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about clusters. 8 | opentelekomcloud.cloud.dws_cluster_info: 9 | register: result 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - result is success 15 | - result is not changed 16 | - result.dws_clusters is defined 17 | -------------------------------------------------------------------------------- /tests/integration/targets/nat_dnat_rule_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nat DNAT Rule Info tests 3 | block: 4 | - name: Get DNAT rule info 5 | opentelekomcloud.cloud.nat_dnat_rule_info: 6 | cloud: "{{ test_cloud }}" 7 | register: dn 8 | 9 | - name: Debug configs 10 | ansible.builtin.debug: 11 | var: dn.dnat_rules 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - dn is success 17 | - dn is not changed 18 | - dn.dnat_rules is defined 19 | -------------------------------------------------------------------------------- /tests/integration/targets/nat_gateway_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nat Gateway Info tests 3 | block: 4 | - name: Get NAT gateway info 5 | opentelekomcloud.cloud.nat_gateway_info: 6 | cloud: "{{ test_cloud }}" 7 | register: gw 8 | 9 | - name: Debug configs 10 | ansible.builtin.debug: 11 | var: gw.nat_gateways 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - gw is success 17 | - gw is not changed 18 | - gw.nat_gateways is defined 19 | -------------------------------------------------------------------------------- /tests/integration/targets/nat_snat_rule_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Nat SNAT Rule Info tests 3 | block: 4 | - name: Get SNAT rule info 5 | opentelekomcloud.cloud.nat_snat_rule_info: 6 | cloud: "{{ test_cloud }}" 7 | register: sn 8 | 9 | - name: Debug configs 10 | ansible.builtin.debug: 11 | var: sn.snat_rules 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - sn is success 17 | - sn is not changed 18 | - sn.snat_rules is defined 19 | -------------------------------------------------------------------------------- /tests/integration/targets/volume_snapshot_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Volume Snapshot Info tests 3 | block: 4 | - name: Get volume snapshot info 5 | opentelekomcloud.cloud.volume_snapshot_info: 6 | register: snapshot 7 | 8 | - name: Debug snapshots 9 | ansible.builtin.debug: 10 | var: snapshot 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - snapshot is success 16 | - snapshot is not changed 17 | - snapshot.volume_snapshots is defined 18 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_peering_info_test/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: VPC Peering Info tests 3 | block: 4 | - name: Get vpc peerings info 5 | opentelekomcloud.cloud.vpc_peering_info: 6 | register: vpc_peerings 7 | 8 | - name: Debug vpc peerings 9 | ansible.builtin.debug: 10 | var: vpc_peerings 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - vpc_peerings is success 16 | - vpc_peerings is not changed 17 | - vpc_peerings.vpc_peerings is defined 18 | -------------------------------------------------------------------------------- /tests/integration/targets/ims_image_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: IMS image info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.ims_image_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about images. 8 | opentelekomcloud.cloud.ims_image_info: 9 | name: 10 | register: result 11 | ignore_errors: true 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - result is success 17 | - result is not changed 18 | - result.images is defined 19 | -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | Opentelekomcloud.Cloud 2 | ====================== 3 | 4 | Collection version 0.14.2 5 | 6 | 7 | 8 | Plugin Index 9 | ------------ 10 | 11 | These are the plugins in the opentelekomcloud.cloud collection 12 | 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | 17 | antiddos 18 | as 19 | cce 20 | ces 21 | css 22 | dds 23 | deh 24 | dms 25 | dns 26 | dws 27 | ecs 28 | elb 29 | misc 30 | mrs 31 | nat 32 | rds 33 | sfsturbo 34 | swr 35 | volume 36 | vpc 37 | vpn 38 | waf 39 | -------------------------------------------------------------------------------- /doc/source/dms.rst: -------------------------------------------------------------------------------- 1 | Distributed Message Service (DMS) Modules 2 | ========================================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | dms_instance 8 | dms_instance_info 9 | dms_instance_topic 10 | dms_instance_topic_info 11 | dms_message 12 | dms_queue 13 | dms_queue_info 14 | dms_queue_group 15 | dms_queue_group_info -------------------------------------------------------------------------------- /tests/integration/targets/as_config_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: AS Config Info tests 3 | block: 4 | - name: Get AS config info 5 | opentelekomcloud.cloud.as_config_info: 6 | cloud: "{{ test_cloud }}" 7 | register: auto_scale 8 | 9 | - name: Debug configs 10 | ansible.builtin.debug: 11 | var: auto_scale.as_configs 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - auto_scale is success 17 | - auto_scale is not changed 18 | - auto_scale.as_configs is defined 19 | -------------------------------------------------------------------------------- /tests/integration/targets/css_cluster_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: CSS Cluster Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.css_cluster_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about clusters. 8 | opentelekomcloud.cloud.css_cluster_info: 9 | limit: 1 10 | start: 0 11 | register: result 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - result is success 17 | - result is not changed 18 | - result.clusters is defined 19 | -------------------------------------------------------------------------------- /tests/integration/targets/dds_flavor_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DDS Flavor Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.dds_flavor_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about flavor 8 | opentelekomcloud.cloud.dds_flavor_info: 9 | region: "{{ region | default('eu-de') }}" 10 | register: result 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - result is success 16 | - result is not changed 17 | - result.flavors is defined 18 | -------------------------------------------------------------------------------- /tests/integration/targets/dds_datastore_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DDS Datastore Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.dds_datastore_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about datastore 8 | opentelekomcloud.cloud.dds_datastore_info: 9 | datastore_name: "DDS-Community" 10 | register: result 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - result is success 16 | - result is not changed 17 | - result.datastores is defined 18 | -------------------------------------------------------------------------------- /tests/integration/targets/dws_snapshot_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DWS Snapshot Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.dws_snapshot_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about snapshots. 8 | opentelekomcloud.cloud.dws_snapshot_info: 9 | name: 10 | register: result 11 | ignore_errors: true 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - result is success 17 | - result is not changed 18 | - result.dws_snapshots is defined 19 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_datastore_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: RDS Datastore Info tests 3 | block: 4 | - name: Get datastore info 5 | opentelekomcloud.cloud.rds_datastore_info: 6 | cloud: "{{ test_cloud }}" 7 | datastore: "postgresql" 8 | register: rds 9 | 10 | - name: Assert result 11 | ansible.builtin.assert: 12 | that: 13 | - rds is success 14 | - rds is not changed 15 | - rds.rds_datastores is defined 16 | - rds.rds_datastores[0]['id'] is defined 17 | - rds.rds_datastores[0]['name'] is defined 18 | -------------------------------------------------------------------------------- /tests/integration/targets/css_snapshot_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: CSS Snapshot Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.css_snapshot_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about snapshots. 8 | opentelekomcloud.cloud.css_snapshot_info: 9 | cluster: 10 | register: result 11 | ignore_errors: true 12 | 13 | - name: Assert result 14 | ansible.builtin.assert: 15 | that: 16 | - result is not success 17 | - result is not changed 18 | - 'result.msg == "CSS cluster is missing"' 19 | -------------------------------------------------------------------------------- /tests/integration/targets/deh_host_type_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DeH Host Type Info tests 3 | block: 4 | - name: Get DeH host types in AZ 5 | opentelekomcloud.cloud.deh_host_type_info: 6 | cloud: "{{ test_cloud }}" 7 | az: "{{ deh_az | default('eu-de-01') }}" 8 | register: deh 9 | 10 | - name: Debug deh 11 | ansible.builtin.debug: 12 | var: deh.deh_host_types 13 | 14 | - name: Assert result 15 | ansible.builtin.assert: 16 | that: 17 | - deh is success 18 | - deh is not changed 19 | - deh.deh_host_types is defined 20 | -------------------------------------------------------------------------------- /tests/integration/targets/cce_node_pool_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: CCE Node Pool Info tests 3 | block: 4 | - name: Get all Node Pools of a cluster 5 | opentelekomcloud.cloud.cce_node_pool_info: 6 | cloud: "{{ test_cloud }}" 7 | cce_cluster: test-cluster 8 | register: pools 9 | 10 | - name: Debug pools 11 | ansible.builtin.debug: 12 | var: pools.cce_node_pools 13 | 14 | - name: Assert result 15 | ansible.builtin.assert: 16 | that: 17 | - pools is success 18 | - pools is not changed 19 | - pools.cce_node_pools is defined 20 | -------------------------------------------------------------------------------- /tests/integration/targets/mrs_cluster_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: MRS Cluster Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.mrs_cluster_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get info about clusters. 8 | opentelekomcloud.cloud.mrs_cluster_info: 9 | limit: 1 10 | status: terminated 11 | tags: 12 | - key1=value1 13 | register: result 14 | 15 | - name: Assert result 16 | ansible.builtin.assert: 17 | that: 18 | - result is success 19 | - result is not changed 20 | - result.mrs_clusters is defined 21 | -------------------------------------------------------------------------------- /tests/integration/targets/anti_ddos_optional_policies_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: AntiDDoS Optional Policies Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.anti_ddos_optional_policies_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get Anti-DDoS optional defense policies 8 | opentelekomcloud.cloud.anti_ddos_optional_policies_info: 9 | register: anti_ddos_optional_policies_info 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - anti_ddos_optional_policies_info is success 15 | - anti_ddos_optional_policies_info is not changed 16 | -------------------------------------------------------------------------------- /tests/integration/targets/lb_healtmonitor_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: LoadBalancer HealthMonitor Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.lb_healthmonitor_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get health checks info 8 | opentelekomcloud.cloud.lb_healthmonitor_info: 9 | register: hm 10 | 11 | - name: Debug configs 12 | ansible.builtin.debug: 13 | var: hm.healthmonitors 14 | 15 | - name: Assert result 16 | ansible.builtin.assert: 17 | that: 18 | - hm is success 19 | - hm is not changed 20 | - hm.healthmonitors is defined 21 | -------------------------------------------------------------------------------- /doc/source/vpc.rst: -------------------------------------------------------------------------------- 1 | Virtual Private Cloud (VPC) Modules 2 | =================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | associate_bandwidth 8 | bandwidth 9 | floating_ip 10 | security_group 11 | security_group_info 12 | subnet 13 | subnet_info 14 | vpc 15 | vpc_peering 16 | vpc_peering_info 17 | vpc_peering_mode 18 | vpc_route 19 | vpc_route_info 20 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | import setuptools 14 | 15 | setuptools.setup( 16 | setup_requires=['pbr'], 17 | pbr=True) 18 | -------------------------------------------------------------------------------- /tests/integration/targets/availability_zone_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Availability Zone Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.availability_zone_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get AZ info (check mode) 8 | opentelekomcloud.cloud.availability_zone_info: 9 | check_mode: true 10 | register: az 11 | 12 | - name: Get AZ info 13 | opentelekomcloud.cloud.availability_zone_info: 14 | register: az 15 | 16 | - name: Assert result 17 | ansible.builtin.assert: 18 | that: 19 | - az is success 20 | - az is not changed 21 | - az.availability_zones is defined 22 | -------------------------------------------------------------------------------- /doc/source/elb.rst: -------------------------------------------------------------------------------- 1 | Elastic Load Balancing (ELB) Modules 2 | ==================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | lb_certificate 8 | lb_certificate_info 9 | lb_healthmonitor 10 | lb_healthmonitor_info 11 | lb_listener 12 | lb_listener_info 13 | lb_member 14 | lb_member_info 15 | lb_pool 16 | lb_pool_info 17 | loadbalancer 18 | loadbalancer_info 19 | 20 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_backup/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: RDS Backup tests 3 | module_defaults: 4 | opentelekomcloud.cloud.rds_backup: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get error message that rds instance is absent 8 | opentelekomcloud.cloud.rds_backup: 9 | instance: "test-db" 10 | name: "test_ansible_module" 11 | register: rds_backup 12 | check_mode: true 13 | ignore_errors: true 14 | 15 | - name: Assert result 16 | ansible.builtin.assert: 17 | that: 18 | - rds_backup is not success 19 | - rds_backup is not changed 20 | - 'rds_backup.msg == "RDS instance test-db does not exist"' 21 | -------------------------------------------------------------------------------- /doc/source/swr.rst: -------------------------------------------------------------------------------- 1 | Software Repository for Containers (SWR) Modules 2 | ================================================ 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | swr_organization_info 8 | swr_repository_info 9 | swr_organization 10 | swr_repository 11 | swr_domain_info 12 | swr_domain 13 | swr_repository_permissions 14 | swr_repository_permissions_info 15 | swr_organization_permissions 16 | swr_organization_permissions_info 17 | -------------------------------------------------------------------------------- /changelogs/config.yaml: -------------------------------------------------------------------------------- 1 | changelog_filename_template: ../CHANGELOG.rst 2 | changelog_filename_version_depth: 0 3 | changes_file: changelog.yaml 4 | changes_format: combined 5 | keep_fragments: false 6 | mention_ancestor: true 7 | new_plugins_after_name: removed_features 8 | notesdir: fragments 9 | prelude_section_name: release_summary 10 | prelude_section_title: Release Summary 11 | sections: 12 | - - major_changes 13 | - Major Changes 14 | - - minor_changes 15 | - Minor Changes 16 | - - breaking_changes 17 | - Breaking Changes 18 | - - deprecated_features 19 | - Deprecated Features 20 | - - removed_features 21 | - Removed Features (previously deprecated) 22 | - - security_fixes 23 | - Security Fixes 24 | - - bugfixes 25 | - Bugfixes 26 | - - known_issues 27 | - Known Issues 28 | title: opentelekomcloud.cloud 29 | trivial_section_name: trivial 30 | -------------------------------------------------------------------------------- /tests/integration/targets/waf_domain_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: WAF Domain Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.waf_domain_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get WAF Domains info 8 | opentelekomcloud.cloud.waf_domain_info: 9 | register: domain 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - domain is success 15 | - domain is not changed 16 | - domain.waf_domains is defined 17 | 18 | - name: Get WAF Domain with name filter info 19 | opentelekomcloud.cloud.waf_domain_info: 20 | name: www.fakedomain.otc 21 | register: domain 22 | 23 | - name: Assert result 24 | ansible.builtin.assert: 25 | that: 26 | - domain is success 27 | - domain is not changed 28 | - domain.waf_domains is defined 29 | -------------------------------------------------------------------------------- /tests/integration/targets/waf_certificate_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: WAF Certificate tests 3 | module_defaults: 4 | opentelekomcloud.cloud.waf_certificate_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get WAF Cert info 8 | opentelekomcloud.cloud.waf_certificate_info: 9 | register: result 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - result is success 15 | - result is not changed 16 | - result.waf_certificates is defined 17 | 18 | - name: Get WAF Cert with name filter info 19 | opentelekomcloud.cloud.waf_certificate_info: 20 | name: some_fake 21 | register: result 22 | 23 | - name: Assert result 24 | ansible.builtin.assert: 25 | that: 26 | - result is success 27 | - result is not changed 28 | - result.waf_certificates is defined 29 | -------------------------------------------------------------------------------- /tests/integration/targets/lb_certificate_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: LoadBalancer Certificate Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.lb_certificate_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get ELB Cert info 8 | opentelekomcloud.cloud.lb_certificate_info: 9 | register: result 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - result is success 15 | - result is not changed 16 | - result.elb_certificates is defined 17 | 18 | - name: Get ELB Cert with name filter info 19 | opentelekomcloud.cloud.lb_certificate_info: 20 | name: some_fake 21 | register: result 22 | 23 | - name: Assert result 24 | ansible.builtin.assert: 25 | that: 26 | - result is success 27 | - result is not changed 28 | - result.elb_certificates is defined 29 | -------------------------------------------------------------------------------- /galaxy.yml: -------------------------------------------------------------------------------- 1 | namespace: opentelekomcloud 2 | name: cloud 3 | version: 0.14.9 4 | readme: README.md 5 | authors: 6 | - Artem Goncharov 7 | 8 | description: Modules for working with OpenTelekomCloud (base on OpenStack modules, adding proprietary services) 9 | license: 10 | - Apache-2.0 11 | tags: 12 | - cloud 13 | - openstack 14 | - opentelekomcloud 15 | dependencies: 16 | "openstack.cloud": "*" 17 | repository: http://github.com/OpenTelekomCloud/ansible_collections 18 | documentation: http://docs.otc.t-systems.com 19 | homepage: https://open-telekom-cloud.com 20 | issues: http://github.com/OpenTelekomCloud/ansible_collections/issue/tracker 21 | build_ignore: 22 | - "*.tar.gz" 23 | - build_artifact/ 24 | - ci/ 25 | - galaxy.yml.in 26 | - setup.cfg 27 | - setup.py 28 | - tools 29 | - tox.ini 30 | - .gitignore 31 | - .gitreview 32 | - .zuul.yaml 33 | - .pytest_cache 34 | - importer_result.json 35 | -------------------------------------------------------------------------------- /tools/check-import.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Red Hat, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | set -e 17 | 18 | TOXDIR=${1:-.} 19 | 20 | # galaxy_importer.main does not return non-zero error code on error 21 | output=$(python -m galaxy_importer.main $TOXDIR/build_artifact/*) 22 | echo $output 23 | if echo $output | grep ERROR: ; then 24 | echo $output 25 | exit 1 26 | fi 27 | 28 | -------------------------------------------------------------------------------- /tests/integration/targets/floating_ip/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Floating IP tests 3 | block: 4 | - name: Allocate floating ip 5 | opentelekomcloud.cloud.floating_ip: 6 | cloud: "{{ test_cloud }}" 7 | network: admin_external_net 8 | register: fip 9 | 10 | - name: Assert allocation 11 | ansible.builtin.assert: 12 | that: 13 | - fip is changed 14 | - fip is success 15 | - fip.floating_ip.floating_ip_address is defined 16 | 17 | always: 18 | - name: Cleanup 19 | block: 20 | - name: Drop fip 21 | opentelekomcloud.cloud.floating_ip: 22 | cloud: "{{ test_cloud }}" 23 | floating_ip_address: "{{ fip.floating_ip.floating_ip_address }}" 24 | purge: true 25 | state: absent 26 | register: removed 27 | until: removed is not failed 28 | ignore_errors: true 29 | retries: 10 30 | -------------------------------------------------------------------------------- /.ansible-lint: -------------------------------------------------------------------------------- 1 | --- 2 | parseable: true 3 | exclude_paths: 4 | - ci/playbooks 5 | - examples 6 | skip_list: 7 | - '106' # Role name does not match ``^[a-z][a-z0-9_]+$`` pattern 8 | - '204' # Lines should be no longer than 160 chars 9 | - '301' # Commands should not change things if nothing needs doing 10 | - '701' # No 'galaxy_info' found\ 11 | - 'var-spacing' # Jinja2 variables and filters should have spaces before and after. 12 | - deprecated-module # Deprecated module. 13 | - experimental # all rules tagged as experimental 14 | - fqcn[action-core] # Use FQCN for builtin actions. 15 | - galaxy[no-changelog] # Rule for checking collection version is greater than 1.0.0 and checking for changelog. 16 | - galaxy[version-incorrect] # Rule for checking collection version is greater than 1.0.0 and checking for changelog. 17 | - name[missing] # Rule for checking task and play names. 18 | - name[casing] 19 | - var-naming[no-role-prefix] 20 | -------------------------------------------------------------------------------- /tests/integration/targets/dms_instance/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: SWR organization tests 2 | module_defaults: 3 | opentelekomcloud.cloud.dms_instance: 4 | cloud: "{{ test_cloud }}" 5 | block: 6 | - name: Create DMS instance 7 | opentelekomcloud.cloud.dms_instance: 8 | name: 'kafka-c76z' 9 | storage_space: 600 10 | vpc_id: 'a82d8c31-1f1b-4d55-bd45-e01ec3de417c' 11 | security_group_id: '120888d9-65be-4899-b07d-aa151c2895d4' 12 | subnet_id: '0f9d5426-ab11-471f-b5a0-d7b413cd2cfa' 13 | available_zones: ['eu-de-03'] 14 | product_id: '00300-30308-0--0' 15 | storage_spec_code: 'dms.physical.storage.ultra' 16 | register: 17 | dms_instance 18 | 19 | - name: Assert result 20 | ansible.builtin.assert: 21 | that: 22 | - dms_instance is success 23 | 24 | - name: Delete DMS instance 25 | opentelekomcloud.cloud.dms_instance: 26 | name: 'kafka-c76z' 27 | state: absent 28 | -------------------------------------------------------------------------------- /doc/examples/2_volume_backup_and_maintenance.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # You're able to backup both types of disks: system and additionally attached. Cloud Server 4 | # Backups will be cover in a next examples 5 | - name: Create a backup of the system volume 6 | opentelekomcloud.cloud.volume_backup: 7 | display_name: "{{ backup_name }}" 8 | display_description: "Full backup of the test instance" 9 | state: absent 10 | volume: "{{ ecs_1_vol }}" 11 | force: true 12 | wait: true 13 | timeout: 123 14 | register: bckp 15 | tags: 16 | - volume_backup 17 | 18 | - name: Let's check whether we have a backup of the ECS volume 19 | opentelekomcloud.cloud.volume_backup_info: 20 | volume: "{{ ecs_1_vol }}" 21 | tags: backup_info 22 | 23 | # Snapshot is mandatory for any kind of backup, both full or incremental. If there are no any 24 | # backups created before, and current backup is the first one for this volume, snapshot will be 25 | # create automatically. 26 | - name: Check if we have a snapshot 27 | opentelekomcloud.cloud.volume_snapshot_info: 28 | name: "yet_another**" 29 | tags: 30 | - snapshot_info 31 | -------------------------------------------------------------------------------- /doc/examples/7_loadbalancer_info.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # This playbook contains examples with info modules related with load balancer infrastructure. 3 | - name: Get info about specified load balancer 4 | opentelekomcloud.cloud.loadbalancer_info: 5 | name: "{{ lb_name }}" 6 | register: lb_info 7 | 8 | - name: Get info about specified certificate 9 | opentelekomcloud.cloud.lb_certificate: 10 | name: "elb_https_cert" 11 | register: elb_cert_info 12 | 13 | - name: Get info about specified litener 14 | opentelekomcloud.cloud.lb_listener_info: 15 | name: "{{ listener_https_name }}" 16 | register: listener_https_info 17 | 18 | - name: Get info about specified backend server group 19 | opentelekomcloud.cloud.lb_pool: 20 | name: "{{ backend_server_name }}" 21 | register: backend_group_info 22 | 23 | - name: Get info about specified pool members 24 | opentelekomcloud.cloud.lb_member_info: 25 | pool: "{{ backend_server_name }}" 26 | register: bcknd_members_info 27 | 28 | - name: Get info about health checks for HTTP protocol 29 | opentelekomcloud.cloud.lb_healthmonitor_info: 30 | type: http 31 | register: https_health_info 32 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_flavor_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: RDS Flavor Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.rds_flavor_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get flavor info 8 | opentelekomcloud.cloud.rds_flavor_info: 9 | datastore: "postgresql" 10 | version: "16" 11 | instance_mode: "single" 12 | register: rds 13 | 14 | - name: Assert result 15 | ansible.builtin.assert: 16 | that: 17 | - rds is success 18 | - rds is not changed 19 | - rds.rds_flavors is defined 20 | - rds.rds_flavors[0]['instance_mode'] is defined 21 | - rds.rds_flavors[0]['name'] is defined 22 | - rds.rds_flavors[0]['ram'] is defined 23 | - rds.rds_flavors[0]['spec_code'] is defined 24 | - rds.rds_flavors[0]['vcpus'] is defined 25 | 26 | - name: Get flavor info for wrong ds 27 | opentelekomcloud.cloud.rds_flavor_info: 28 | datastore: "postgresql1" 29 | version: "16" 30 | instance_mode: "single" 31 | register: rds 32 | failed_when: 'rds.msg != "value of datastore must be one of: mysql, postgresql, sqlserver, got: postgresql1"' 33 | -------------------------------------------------------------------------------- /examples/playbooks/2_volume_backup_and_maintenance.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # You're able to backup both types of disks: system and additionally attached. Cloud Server 6 | # Backups will be cover in a next examples 7 | - name: Create a backup of the system volume 8 | opentelekomcloud.cloud.volume_backup: 9 | display_name: "{{ backup_name }}" 10 | display_description: "Full backup of the test instance" 11 | state: absent 12 | volume: "{{ ecs_1_vol }}" 13 | force: true 14 | wait: true 15 | timeout: 123 16 | register: bckp 17 | tags: 18 | - volume_backup 19 | 20 | - name: Let's check whether we have a backup of the ECS volume 21 | opentelekomcloud.cloud.volume_backup_info: 22 | volume: "{{ ecs_1_vol }}" 23 | tags: backup_info 24 | 25 | # Snapshot is mandatory for any kind of backup, both full or incremental. If there are no any 26 | # backups created before, and current backup is the first one for this volume, snapshot will be 27 | # create automatically. 28 | - name: Check if we have a snapshot 29 | opentelekomcloud.cloud.volume_snapshot_info: 30 | name: "yet_another**" 31 | tags: 32 | - snapshot_info 33 | -------------------------------------------------------------------------------- /examples/playbooks/7_loadbalancer_info.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # This playbook contains examples with info modules related with load balancer infrastructure. 6 | - name: Get info about specified load balancer 7 | opentelekomcloud.cloud.loadbalancer_info: 8 | name: "{{ lb_name }}" 9 | register: lb_info 10 | 11 | - name: Get info about specified certificate 12 | opentelekomcloud.cloud.lb_certificate_info: 13 | name: "elb_https_cert" 14 | register: elb_cert_info 15 | 16 | - name: Get info about specified litener 17 | opentelekomcloud.cloud.lb_listener_info: 18 | name: "{{ listener_https_name }}" 19 | register: listener_https_info 20 | 21 | - name: Get info about specified backend server group 22 | opentelekomcloud.cloud.lb_pool_info: 23 | name: "{{ backend_server_name }}" 24 | register: backend_group_info 25 | 26 | - name: Get info about specified pool members 27 | opentelekomcloud.cloud.lb_member_info: 28 | pool: "{{ backend_server_name }}" 29 | register: bcknd_members_info 30 | 31 | - name: Get info about health checks for HTTP protocol 32 | opentelekomcloud.cloud.lb_healthmonitor_info: 33 | type: http 34 | register: https_health_info 35 | -------------------------------------------------------------------------------- /tests/integration/targets/anti_ddos_fip_statuses_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: AntiDDoS FIP Statuses Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.anti_ddos_fip_statuses_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get Anti-DDoS Floating IPs statuses 8 | opentelekomcloud.cloud.anti_ddos_fip_statuses_info: 9 | register: anti_ddos 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - anti_ddos is success 15 | - anti_ddos is not changed 16 | 17 | - name: Get Anti-DDoS Floating IPs statuses using status filter 18 | opentelekomcloud.cloud.anti_ddos_fip_statuses_info: 19 | status: "notConfig" 20 | register: anti_ddos 21 | 22 | - name: Assert result 23 | ansible.builtin.assert: 24 | that: 25 | - anti_ddos is success 26 | - anti_ddos is not changed 27 | 28 | - name: Get error when name of status is wrong 29 | opentelekomcloud.cloud.anti_ddos_fip_statuses_info: 30 | status: "wrongStatus" 31 | register: anti_ddos 32 | ignore_errors: true 33 | 34 | - name: Assert result 35 | ansible.builtin.assert: 36 | that: 37 | - anti_ddos is not success 38 | - anti_ddos is not changed 39 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = ansible-collections-opentelekomcloud 3 | summary = Ansible collections for Opentelekomcloud 4 | description-file = 5 | README.md 6 | 7 | author = opentelekomcloud 8 | home-page = https://open.telekom.cloud 9 | classifier = 10 | License :: OSI Approved :: Apache License 11 | Development Status :: 5 - Production/Stable 12 | Intended Audience :: Developers 13 | Intended Audience :: System Administrators 14 | Intended Audience :: Information Technology 15 | Topic :: System :: Systems Administration 16 | Topic :: Utilities 17 | 18 | [global] 19 | setup-hooks = 20 | pbr.hooks.setup_hook 21 | 22 | [files] 23 | data_files = 24 | share/ansible/collections/ansible_collections/opentelekomcloud/cloud/ = README.md 25 | share/ansible/collections/ansible_collections/opentelekomcloud/cloud/roles/ = roles/* 26 | share/ansible/collections/ansible_collections/opentelekomcloud/cloud/plugins/ = plugins/* 27 | share/ansible/collections/ansible_collections/opentelekomcloud/cloud/playbooks/ = playbooks/* 28 | share/ansible/collections/ansible_collections/opentelekomcloud/cloud/scripts/ = scripts/* 29 | share/ansible/collections/ansible_collections/opentelekomcloud/cloud/docs/ = docs/* 30 | share/ansible/collections/ansible_collections/opentelekomcloud/cloud/meta/ = meta/* 31 | 32 | [wheel] 33 | universal = 1 34 | 35 | [pbr] 36 | skip_authors = True 37 | skip_changelog = True 38 | -------------------------------------------------------------------------------- /tests/utils/units.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o pipefail -eu 4 | 5 | ANSIBLE_COLLECTIONS_PATH=$(mktemp -d) 6 | NAMESPACE="$1"; shift 7 | NAME="$1"; shift 8 | TEST_DIR="${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/${NAMESPACE}/${NAME}" 9 | 10 | trap 'rm -rf ${ANSIBLE_COLLECTIONS_PATH}' err exit 11 | 12 | rm -rf "${ANSIBLE_COLLECTIONS_PATH}" 13 | 14 | mkdir -p "$TEST_DIR" 15 | 16 | rsync -av . \ 17 | --exclude tests/output \ 18 | --exclude tools \ 19 | --exclude ci \ 20 | --exclude .tox \ 21 | --exclude .git \ 22 | "$TEST_DIR" > /dev/null|| true 23 | 24 | if [ -f "requirements.txt" ]; then 25 | ansible-galaxy collection install -r requirements.txt -p ${ANSIBLE_COLLECTIONS_PATH} 26 | ansible-galaxy role install -r requirements.txt -p ${ANSIBLE_COLLECTIONS_PATH} 27 | fi 28 | 29 | # Install the necessary openstack.cloud collection explicitly 30 | ansible-galaxy collection install openstack.cloud -f -p ${ANSIBLE_COLLECTIONS_PATH} 31 | 32 | # Initialize PYTHONPATH and ANSIBLE_COLLECTIONS_PATHS if not set 33 | export PYTHONPATH=${ANSIBLE_COLLECTIONS_PATH}:${PYTHONPATH:-""} 34 | export ANSIBLE_COLLECTIONS_PATHS=${ANSIBLE_COLLECTIONS_PATH}:${ANSIBLE_COLLECTIONS_PATHS:-""} 35 | 36 | # Verify that the collection is installed 37 | if [ ! -d "${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/openstack/cloud" ]; then 38 | echo "Error: openstack.cloud collection is not installed correctly." 39 | exit 1 40 | fi 41 | 42 | cd "$TEST_DIR" 43 | ansible-test units --docker --requirements --python 3.6 44 | -------------------------------------------------------------------------------- /tools/build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright 2019 Red Hat, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import pbr.version 17 | 18 | from ruamel.yaml import YAML 19 | 20 | import os 21 | import shutil 22 | 23 | 24 | def generate_version_info(): 25 | version_info = pbr.version.VersionInfo('fake') 26 | semantic_version = version_info.semantic_version() 27 | release_string = semantic_version._long_version('-') 28 | 29 | yaml = YAML() 30 | yaml.explicit_start = True 31 | yaml.indent(sequence=4, offset=2) 32 | 33 | config = yaml.load(open('galaxy.yml.in')) 34 | config['version'] = release_string 35 | 36 | with open('galaxy.yml', 'w') as fp: 37 | yaml.dump(config, fp) 38 | 39 | 40 | def main(): 41 | generate_version_info() 42 | shutil.rmtree('build_artifact', ignore_errors=True) 43 | if os.path.exists('MANIFEST.json'): 44 | os.unlink('MANIFEST.json') 45 | 46 | 47 | if __name__ == '__main__': 48 | main() 49 | -------------------------------------------------------------------------------- /tests/integration/targets/vpc_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: VPC Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.vpc: 5 | cloud: "{{ test_cloud }}" 6 | opentelekomcloud.cloud.vpc_info: 7 | cloud: "{{ test_cloud }}" 8 | 9 | block: 10 | - name: Set random prefix 11 | ansible.builtin.set_fact: 12 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 13 | 14 | - name: Set initial facts 15 | ansible.builtin.set_fact: 16 | vpc_name: "{{ ( prefix + 'vpc') }}" 17 | 18 | - name: Creating a vpc 19 | opentelekomcloud.cloud.vpc: 20 | name: "{{ vpc_name }}" 21 | state: present 22 | register: vpc 23 | 24 | - name: Getting info about all vpcs 25 | opentelekomcloud.cloud.vpc_info: 26 | register: all_vpcs 27 | 28 | - name: Assert result 29 | ansible.builtin.assert: 30 | that: 31 | - all_vpcs is success 32 | - all_vpcs is not changed 33 | - all_vpcs | length > 0 34 | 35 | - name: Getting info about new vpc 36 | opentelekomcloud.cloud.vpc_info: 37 | name_or_id: "{{ vpc_name }}" 38 | register: new_vpc 39 | 40 | - name: Assert result 41 | ansible.builtin.assert: 42 | that: 43 | - new_vpc is success 44 | - new_vpc is not changed 45 | - new_vpc | length > 0 46 | 47 | always: 48 | - name: Cleanup 49 | block: 50 | - name: Drop created vpc 51 | opentelekomcloud.cloud.vpc: 52 | name: "{{ vpc_name }}" 53 | state: absent 54 | failed_when: false 55 | -------------------------------------------------------------------------------- /tests/integration/targets/security_group/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Security Group tests 3 | module_defaults: 4 | opentelekomcloud.cloud.security_group: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | security_group_name: "{{ ( prefix + 'security_group') }}" 14 | 15 | - name: Create security group 16 | opentelekomcloud.cloud.security_group: 17 | state: present 18 | name: "{{ security_group_name }}" 19 | description: security group for foo servers 20 | exclusive: true 21 | security_group_rules: 22 | - "direction": "egress" 23 | "ethertype": "IPv4" 24 | "port_range_min": "1" 25 | "port_range_max": "50000" 26 | "protocol": "tcp" 27 | - "direction": "egress" 28 | "ethertype": "IPv6" 29 | - "direction": "ingress" 30 | "ethertype": "IPv4" 31 | "protocol": "icmp" 32 | register: sg 33 | 34 | - name: Assert result 35 | ansible.builtin.assert: 36 | that: 37 | - sg is success 38 | - sg is changed 39 | 40 | always: 41 | - name: Cleanup 42 | block: 43 | - name: Drop security group 44 | opentelekomcloud.cloud.security_group: 45 | name: "{{ security_group_name }}" 46 | state: "absent" 47 | register: removed 48 | until: removed is not failed 49 | ignore_errors: true 50 | retries: 10 51 | -------------------------------------------------------------------------------- /tests/integration/targets/cce_node_pool/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: CCE Node Pool tests 3 | block: 4 | - name: Create Node Pool 5 | opentelekomcloud.cloud.cce_node_pool: 6 | cloud: "{{ test_cloud }}" 7 | availability_zone: "random" 8 | autoscaling_enabled: true 9 | cluster: test-cluster 10 | data_volumes: 11 | - volumetype: SSD 12 | size: 120 13 | - volumetype: SATA 14 | size: 100 15 | encrypted: false 16 | cmk_id: '' 17 | flavor: s2.large.2 18 | initial_node_count: 0 19 | k8s_tags: 20 | mytag: myvalue 21 | mysecondtag: mysecondvalue 22 | min_node_count: 1 23 | max_node_count: 3 24 | name: test-ansible2 25 | network_id: '25d24fc8-d019-4a34-9fff-0a09fde6a123' 26 | priority: 2 27 | os: 'EulerOS 2.5' 28 | scale_down_cooldown_time: 5 29 | ssh_key: 'ssh-pub' 30 | tags: 31 | - key: 'my_first_key' 32 | value: 'my_first_value' 33 | - key: 'my_second_key' 34 | value: 'my_secound_value' 35 | taints: 36 | - key: 'first_taint_key' 37 | value: 'first_taint_value' 38 | effect: 'NoSchedule' 39 | - key: 'second_taint_key' 40 | value: 'secound_taint_value' 41 | effect: 'NoExecute' 42 | state: present 43 | register: pool 44 | 45 | - name: Debug pool 46 | ansible.builtin.debug: 47 | var: pool.cce_node_pool 48 | 49 | - name: Assert result 50 | ansible.builtin.assert: 51 | that: 52 | - pool.cce_node_pool is defined 53 | -------------------------------------------------------------------------------- /roles/vpc_peering/README.md: -------------------------------------------------------------------------------- 1 | # opentelekomcloud.cloud.vpc_peering 2 | 3 | Configure VPC Peering between 2 routers. 4 | 5 | ## Requirements 6 | 7 | Python packages: 8 | - openstacksdk 9 | - otcextensions 10 | 11 | Ansible collections: 12 | - openstack.cloud 13 | - opentelekomcloud.cloud 14 | 15 | ## Role Variables 16 | 17 | cloud_a: Connection to cloud A 18 | local_router: Name or ID of the router on side A 19 | local_project: Name or ID of the project of the side A 20 | local_cidr: CIDR for the route 21 | cloud_b: Connection to the cloud B 22 | remote_router: Name or ID of the router on side B 23 | remote_cidr: CIDR for the route 24 | 25 | A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. 26 | 27 | ## Example Playbook 28 | 29 | Role is designed to work best looping over the structure of peering 30 | definitions: 31 | 32 | # Inventory 33 | cloud_peerings: 34 | - cloud: "cloud_a" 35 | name: "peering_cloud_a_cloud_b" 36 | local_router: "router_a" 37 | local_project: "project_a" 38 | local_cidr: "192.168.1.0/24" 39 | remote_cloud: "cloud_b" 40 | remote_router: "router_b" 41 | remote_project: "project_b" 42 | remote_cidr: "192.168.2.0/24" 43 | 44 | # playbook 45 | - hosts: localhost 46 | name: "Manage cloud VPC peerings" 47 | tasks: 48 | - name: Manage VPC Peerings 49 | include_role: 50 | name: opentelekomcloud.cloud.vpc_peering 51 | loop: "{{ cloud_peerings }}" 52 | loop_control: 53 | loop_var: vpcp 54 | 55 | ## License 56 | 57 | Apache-2.0 58 | -------------------------------------------------------------------------------- /tests/utils/integration.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o pipefail -eu 4 | 5 | function render_config() 6 | { 7 | readonly template="tests/integration/integration_config.yml.template" 8 | readonly content="$(cat "$template")" 9 | 10 | eval "echo \"$content\"" > tests/integration/integration_config.yml 11 | } 12 | 13 | render_config 14 | 15 | ANSIBLE_COLLECTIONS_PATH=$(mktemp -d) 16 | NAMESPACE="$1"; shift 17 | NAME="$1"; shift 18 | TEST_DIR="${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/${NAMESPACE}/${NAME}" 19 | 20 | trap 'rm -rf ${ANSIBLE_COLLECTIONS_PATH}' err exit 21 | 22 | rm -rf "${ANSIBLE_COLLECTIONS_PATH}" 23 | 24 | mkdir -p "$TEST_DIR" 25 | 26 | rsync -av . \ 27 | --exclude tests/output \ 28 | --exclude .tox \ 29 | --exclude .git \ 30 | "$TEST_DIR" > /dev/null|| true 31 | 32 | if [ -f "requirements.txt" ]; then 33 | ansible-galaxy collection install -r requirements.txt -p ${ANSIBLE_COLLECTIONS_PATH} 34 | ansible-galaxy role install -r requirements.txt -p ${ANSIBLE_COLLECTIONS_PATH} 35 | fi 36 | 37 | # Initialize PYTHONPATH and ANSIBLE_COLLECTIONS_PATHS if not set 38 | export PYTHONPATH=${ANSIBLE_COLLECTIONS_PATH}:${PYTHONPATH:-""} 39 | export ANSIBLE_COLLECTIONS_PATHS=${ANSIBLE_COLLECTIONS_PATH}:${ANSIBLE_COLLECTIONS_PATHS:-""} 40 | 41 | # Install the necessary openstack.cloud collection explicitly 42 | ansible-galaxy collection install openstack.cloud -f -p ${ANSIBLE_COLLECTIONS_PATH} 43 | 44 | # Verify that the collection is installed 45 | if [ ! -d "${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/openstack/cloud" ]; then 46 | echo "Error: openstack.cloud collection is not installed correctly." 47 | exit 1 48 | fi 49 | 50 | cd "$TEST_DIR" 51 | ansible-test integration --no-temp-unicode 52 | -------------------------------------------------------------------------------- /doc/examples/9_cloud_search.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Here we'll create Cloud Search cluster contained 1 node. Attribute 'cmk_id' is the Master 4 | # Key, which encrypts system. This attribute has been created beforehand. Please pay attention that 5 | # backup strategy is setting up also in this module. 6 | - name: Create Cloud Search cluster 7 | opentelekomcloud.cloud.css_cluster: 8 | name: "{{ css_cluster_name }}" 9 | state: present 10 | flavor: "{{ css_flavour }}" 11 | instance_num: 1 12 | datastore_version: "7.6.2" 13 | datastore_type: "elasticsearch" 14 | volume_type: "common" 15 | volume_size: 40 16 | system_encrypted: 1 17 | system_cmkid: "{{ cmk_id }}" 18 | https_enable: false 19 | authority_enable: false 20 | admin_pwd: "{{ password }}" 21 | router: "{{ router }}" 22 | net: "{{ network_id }}" 23 | security_group: "{{ secgroup_id }}" 24 | backup_period: "00:00 GMT+03:00" 25 | backup_prefix: "yetanother" 26 | backup_keepday: 1 27 | register: css_cluster 28 | 29 | - name: Get info about created cluster 30 | opentelekomcloud.cloud.css_cluster_info: 31 | name: "{{ css_cluster.id }}" 32 | register: css_info 33 | 34 | # By default, data of all indices is backed up. You can use the asterisk (*) to back up data of 35 | # certain indices. 36 | - name: Create snapshot of the cluster 37 | opentelekomcloud.cloud.css_snapshot: 38 | cluster: "{{ css_cluster.id }}" 39 | name: "{{ css_snapshot_name }}" 40 | description: "Example snapshot of the CSS cluster" 41 | state: present 42 | indices: "yetanother*" 43 | register: css_snapshot 44 | 45 | - name: Get info about CSS snapshot 46 | opentelekomcloud.cloud.css_snapshot_info: 47 | cluster: "{{ css_cluster.id }}" 48 | -------------------------------------------------------------------------------- /tests/integration/targets/rds_instance_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: RDS Instance Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.rds_instance_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: List instances without queries 8 | opentelekomcloud.cloud.rds_instance_info: 9 | register: rds 10 | 11 | - name: Assert result 12 | ansible.builtin.assert: 13 | that: 14 | - rds is success 15 | - rds is not changed 16 | 17 | - name: List pg instances 18 | opentelekomcloud.cloud.rds_instance_info: 19 | datastore_type: postgresql 20 | 21 | - name: List mysql instances 22 | opentelekomcloud.cloud.rds_instance_info: 23 | datastore_type: mysql 24 | 25 | - name: List sqlserver instances 26 | opentelekomcloud.cloud.rds_instance_info: 27 | datastore_type: sqlserver 28 | 29 | - name: List instances with name filter 30 | opentelekomcloud.cloud.rds_instance_info: 31 | name: some_name 32 | 33 | - name: List instances with single type filter 34 | opentelekomcloud.cloud.rds_instance_info: 35 | instance_type: single 36 | 37 | - name: List instances with ha type filter 38 | opentelekomcloud.cloud.rds_instance_info: 39 | instance_type: ha 40 | 41 | - name: List instances with replica type filter 42 | opentelekomcloud.cloud.rds_instance_info: 43 | instance_type: replica 44 | 45 | - name: List instances with net filters 46 | opentelekomcloud.cloud.rds_instance_info: 47 | network: admin_external_net 48 | router: some_fake_router 49 | register: rds 50 | 51 | - name: Assert result 52 | ansible.builtin.assert: 53 | that: 54 | - rds is success 55 | - rds is not changed 56 | - 'rds.message == "No router with name or id some_fake_router found"' 57 | -------------------------------------------------------------------------------- /examples/playbooks/13_dms_kafka.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - hosts: localhost 4 | tasks: 5 | 6 | # This playbook shows how to create a DMS Kafka instance in OTC 7 | # Please specify your vpc_id, subnet_id and security_group_id first 8 | 9 | - set_fact: 10 | my_sg_id: "123456789" 11 | my_vpc_id: "123456789" 12 | my_subnet_id: "123456789" 13 | new_dms_inst_name: "my_dms_instance" 14 | 15 | - block: 16 | 17 | # This play creates the DMS Kafka instance in eu-de-03 18 | # Specify different values for available_zones, product_id, storage_spec_code and engine_version if necessary 19 | - name: Create DMS Kafka Instance 20 | opentelekomcloud.cloud.dms_instance: 21 | name: "{{ new_dms_inst_name }}" 22 | storage_space: '600' 23 | vpc_id: "{{ my_vpc_id }}" 24 | security_group_id: "{{ my_sg_id }}" 25 | subnet_id: "{{ my_subnet_id }}" 26 | available_zones: [ "eu-de-03" ] 27 | engine_version: '2.7' 28 | product_id: '00300-30308-0--0' 29 | storage_spec_code: 'dms.physical.storage.ultra' 30 | description: 'New DMS instance' 31 | 32 | # Let's wait for 10 minutes for the instance to become active 33 | - name: Wait for DMS Kafka instance 34 | opentelekomcloud.cloud.dms_instance_info: 35 | name: "{{ new_dms_inst_name }}" 36 | register: dmsinfo 37 | retries: 20 38 | delay: 30 39 | until: dmsinfo.dms_instances[0].status == "RUNNING" 40 | 41 | # Get infos about the newly created instance 42 | - name: List DMS Kafka instance 43 | opentelekomcloud.cloud.dms_instance_info: 44 | name: "{{ new_dms_inst_name }}" 45 | 46 | # Delete the instance 47 | - name: Delete DMS Kafka Instance 48 | opentelekomcloud.cloud.dms_instance: 49 | name: "{{ new_dms_inst_name }}" 50 | state: absent 51 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR organization tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_organization: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | organization_name: "{{ ( 'org_' + prefix) }}" 14 | 15 | - name: Create organization 16 | opentelekomcloud.cloud.swr_organization: 17 | namespace: "{{ organization_name }}" 18 | register: organization 19 | 20 | - name: Assert result 21 | ansible.builtin.assert: 22 | that: 23 | - organization is success 24 | - organization is changed 25 | 26 | - name: Create existing organization 27 | opentelekomcloud.cloud.swr_organization: 28 | namespace: "{{ organization_name }}" 29 | register: organization 30 | 31 | - name: Assert result 32 | ansible.builtin.assert: 33 | that: 34 | - organization is success 35 | - organization is not changed 36 | 37 | - name: Delete organization 38 | opentelekomcloud.cloud.swr_organization: 39 | namespace: "{{ organization_name }}" 40 | state: absent 41 | register: organization 42 | 43 | - name: Assert result 44 | ansible.builtin.assert: 45 | that: 46 | - organization is success 47 | - organization is changed 48 | 49 | - name: Delete non existing organization 50 | opentelekomcloud.cloud.swr_organization: 51 | namespace: "{{ organization_name }}" 52 | state: absent 53 | register: organization 54 | 55 | - name: Assert result 56 | ansible.builtin.assert: 57 | that: 58 | - organization is success 59 | - organization is not changed 60 | -------------------------------------------------------------------------------- /examples/playbooks/9_cloud_search.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # Here we'll create Cloud Search cluster contained 1 node. Attribute 'cmk_id' is the Master 6 | # Key, which encrypts system. This attribute has been created beforehand. Please pay attention that 7 | # backup strategy is setting up also in this module. 8 | - name: Create Cloud Search cluster 9 | opentelekomcloud.cloud.css_cluster: 10 | name: "{{ css_cluster_name }}" 11 | state: present 12 | flavor: "{{ css_flavour }}" 13 | instance_num: 1 14 | datastore_version: "7.6.2" 15 | datastore_type: "elasticsearch" 16 | volume_type: "common" 17 | volume_size: 40 18 | system_encrypted: 1 19 | system_cmkid: "{{ cmk_id }}" 20 | https_enable: false 21 | authority_enable: false 22 | admin_pwd: "{{ password }}" 23 | router: "{{ router }}" 24 | net: "{{ network_id }}" 25 | security_group: "{{ secgroup_id }}" 26 | backup_period: "00:00 GMT+03:00" 27 | backup_prefix: "yetanother" 28 | backup_keepday: 1 29 | register: css_cluster 30 | 31 | - name: Get info about created cluster 32 | opentelekomcloud.cloud.css_cluster_info: 33 | name: "{{ css_cluster.id }}" 34 | register: css_info 35 | 36 | # By default, data of all indices is backed up. You can use the asterisk (*) to back up data of 37 | # certain indices. 38 | - name: Create snapshot of the cluster 39 | opentelekomcloud.cloud.css_snapshot: 40 | cluster: "{{ css_cluster.id }}" 41 | name: "{{ css_snapshot_name }}" 42 | description: "Example snapshot of the CSS cluster" 43 | state: present 44 | indices: "yetanother*" 45 | register: css_snapshot 46 | 47 | - name: Get info about CSS snapshot 48 | opentelekomcloud.cloud.css_snapshot_info: 49 | cluster: "{{ css_cluster.id }}" 50 | -------------------------------------------------------------------------------- /examples/playbooks/12_dedicated_host.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # This playbook shows how to allocate dedicated host in OTC. First, query list of available host 6 | # types to choose one of them. 7 | - name: Query list of available host types 8 | opentelekomcloud.cloud.deh_host_type_info: 9 | az: "eu-de-01" 10 | register: deh_type 11 | 12 | # This play is allocating Dedicated host. Set 'auto_placement' to true to allow an ECS to be placed 13 | # on any available DeH if its DeH ID is not specified during its creation. And please pay 14 | # attention that more than one DEHs with the same name are possible! 15 | - name: Allocate Dedicated host 16 | opentelekomcloud.cloud.deh_host: 17 | name: "{{ deh_name }}" 18 | state: present 19 | auto_placement: true 20 | availability_zone: "eu-de-01" 21 | quantity: 1 22 | host_type: "s2" 23 | tags: 24 | - key: "First" 25 | value: "101" 26 | register: deh 27 | 28 | # In this play we'll change the hostname. For this, you need an host's ID as the only attribute to 29 | # unequivocally define the host. 30 | - name: Change host name 31 | opentelekomcloud.cloud.deh_host: 32 | id: "{{ deh.deh_host.dedicated_host_ids[0] }}" 33 | name: "{{ deh_new_name }}" 34 | register: deh_change 35 | 36 | - name: Get info about host after name changing 37 | opentelekomcloud.cloud.deh_host_info: 38 | host: "{{ deh_change.deh_host.name }}" 39 | register: deh_new_info 40 | 41 | # Let's check whether hostname has been changed. 42 | - name: Assert result 43 | ansible.builtin.assert: 44 | that: 45 | - deh.deh_host.name != deh_change.deh_host.name 46 | - deh_new_info.deh_hosts[0].name == deh_change.deh_host.name 47 | 48 | 49 | - name: Get info about ECSs allocated on dedicated host 50 | opentelekomcloud.cloud.deh_server_info: 51 | dedicated_host: "{{ deh_change.deh_host.id }}" 52 | -------------------------------------------------------------------------------- /roles/vpc_peering/tasks/provision.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Provision VPC Peerings 3 | - name: Find local project 4 | openstack.cloud.project_info: 5 | cloud: "{{ vpcp.cloud }}" 6 | name: "{{ vpcp.local_project }}" 7 | register: local_project 8 | 9 | - name: Find Local router 10 | openstack.cloud.routers_info: 11 | cloud: "{{ vpcp.cloud }}" 12 | name: "{{ vpcp.local_router }}" 13 | register: local_router 14 | 15 | - name: Find Remote project 16 | openstack.cloud.project_info: 17 | cloud: "{{ vpcp.remote_cloud }}" 18 | name: "{{ vpcp.remote_project }}" 19 | register: remote_project 20 | 21 | - name: Find Remote router 22 | openstack.cloud.routers_info: 23 | cloud: "{{ vpcp.remote_cloud }}" 24 | name: "{{ vpcp.remote_router }}" 25 | register: remote_router 26 | 27 | - name: Create VPC Peering - A side 28 | opentelekomcloud.cloud.vpc_peering: 29 | cloud: "{{ vpcp.cloud }}" 30 | name: "{{ vpcp.name }}" 31 | local_router: "{{ local_router.openstack_routers[0].id }}" 32 | local_project: "{{ local_project.openstack_projects[0].id }}" 33 | remote_router: "{{ remote_router.openstack_routers[0].id }}" 34 | remote_project: "{{ remote_project.openstack_projects[0].id }}" 35 | register: peering_a 36 | 37 | - name: Accept Peering - B side 38 | opentelekomcloud.cloud.vpc_peering_mode: 39 | cloud: "{{ vpcp.remote_cloud }}" 40 | name: "{{ vpcp.name }}" 41 | mode: "accept" 42 | register: peering_b 43 | 44 | - name: Create VPC Peering route - A side 45 | opentelekomcloud.cloud.vpc_route: 46 | cloud: "{{ vpcp.cloud }}" 47 | type: "peering" 48 | router: "{{ local_router.openstack_routers[0].id }}" 49 | destination: "{{ vpcp.remote_cidr }}" 50 | nexthop: "{{ peering_a.vpc_peering.id }}" 51 | 52 | - name: Create VPC Peering route - B side 53 | opentelekomcloud.cloud.vpc_route: 54 | cloud: "{{ vpcp.remote_cloud }}" 55 | type: "peering" 56 | router: "{{ remote_router.openstack_routers[0].id }}" 57 | destination: "{{ vpcp.local_cidr }}" 58 | nexthop: "{{ peering_b.vpc_peering.id }}" 59 | -------------------------------------------------------------------------------- /tests/utils/sanity.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o pipefail -eu 4 | 5 | ANSIBLE_COLLECTIONS_PATH=$(mktemp -d) 6 | NAMESPACE="$1"; shift 7 | NAME="$1"; shift 8 | TEST_DIR="${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/${NAMESPACE}/${NAME}" 9 | 10 | trap 'rm -rf ${ANSIBLE_COLLECTIONS_PATH}' err exit 11 | 12 | rm -rf "${ANSIBLE_COLLECTIONS_PATH}" 13 | 14 | mkdir -p "$TEST_DIR" 15 | 16 | rsync -av . \ 17 | --exclude tests/output \ 18 | --exclude tools \ 19 | --exclude ci \ 20 | --exclude .tox \ 21 | --exclude .git \ 22 | "$TEST_DIR" > /dev/null || true 23 | 24 | if [ -f "requirements.txt" ]; then 25 | ansible-galaxy collection install -r requirements.txt -p ${ANSIBLE_COLLECTIONS_PATH} 26 | ansible-galaxy role install -r requirements.txt -p ${ANSIBLE_COLLECTIONS_PATH} 27 | fi 28 | 29 | # Install the necessary openstack.cloud collection explicitly 30 | ansible-galaxy collection install openstack.cloud -f -p ${ANSIBLE_COLLECTIONS_PATH} 31 | 32 | # Initialize PYTHONPATH and ANSIBLE_COLLECTIONS_PATHS if not set 33 | export PYTHONPATH=${ANSIBLE_COLLECTIONS_PATH}:${PYTHONPATH:-""} 34 | export ANSIBLE_COLLECTIONS_PATHS=${ANSIBLE_COLLECTIONS_PATH}:${ANSIBLE_COLLECTIONS_PATHS:-""} 35 | 36 | # Verify that the collection is installed 37 | if [ ! -d "${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/openstack/cloud" ]; then 38 | echo "Error: openstack.cloud collection is not installed correctly." 39 | exit 1 40 | fi 41 | 42 | cd "$TEST_DIR" 43 | SKIP_TESTS="" 44 | # Ansible-core 2.17 dropped support for the metaclass-boilerplate and future-import-boilerplate tests. 45 | ANSIBLE_VER=$(python3 -m pip show ansible-core | awk '$1 == "Version:" { print $2 }') 46 | ANSIBLE_MAJOR_VER=$(echo "$ANSIBLE_VER" | sed 's/^\([0-9]\)\..*/\1/g') 47 | if [[ $ANSIBLE_MAJOR_VER -eq 2 ]]; then 48 | ANSIBLE_MINOR_VER=$(echo "$ANSIBLE_VER" | sed 's/^2\.\([^\.]*\)\..*/\1/g') 49 | if [[ $ANSIBLE_MINOR_VER -le 16 ]]; then 50 | SKIP_TESTS="--skip-test metaclass-boilerplate --skip-test future-import-boilerplate" 51 | fi 52 | fi 53 | 54 | echo "Ansible version: $ANSIBLE_VER" 55 | echo "Tests to skip: $SKIP_TESTS" 56 | 57 | ansible-test sanity -v $SKIP_TESTS 58 | -------------------------------------------------------------------------------- /tools/run-ansible-sanity.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Red Hat, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | path_from_yaml() { 17 | python3 -c "from ruamel.yaml import YAML;\ 18 | yaml=YAML();\ 19 | c=yaml.load(open('galaxy.yml.in'));\ 20 | print('%s/%s'%(c['namespace'],c['name']))" 21 | } 22 | 23 | TOXDIR=${1:-.} 24 | 25 | # Detect collection namespace and name from galaxy.yml.in 26 | collection_path=$(path_from_yaml) 27 | ANSIBLE_COLLECTIONS_PATH=$(mktemp -d) 28 | COLLECTION_PATH=${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/${collection_path} 29 | echo "Executing ansible-test sanity checks in ${ANSIBLE_COLLECTIONS_PATH}" 30 | 31 | trap "rm -rf ${ANSIBLE_COLLECTIONS_PATH}" err exit 32 | 33 | rm -rf "${ANSIBLE_COLLECTIONS_PATH}" 34 | mkdir -p ${COLLECTION_PATH} 35 | 36 | # Created collection x.y at z 37 | output=$(ansible-galaxy collection build --force | sed 's,.* at ,,') 38 | location=$(ansible-galaxy collection install ${output} \ 39 | -p ${ANSIBLE_COLLECTIONS_PATH} --force) 40 | #for folder in {docs,playbooks,plugins,roles,tests}; do 41 | # if [ -d $folder ]; then 42 | # cp -av ${TOXDIR}/$folder ${COLLECTION_PATH}/$folder; 43 | # fi 44 | #done 45 | #cp -av ${TOXDIR}/{plugins,docs,plugins,roles,tests} \ 46 | # ${COLLECTION_PATH} || true 47 | #cp ${TOXDIR}/galaxy.yml ${COLLECTION_PATH} 48 | #mkdir ${COLLECTION_PATH}/logs 49 | #rm -rf ${COLLECTION_PATH}/tests/output || true 50 | cd ${COLLECTION_PATH} 51 | #tree . 52 | ANSIBLE_COLLECTIONS_PATH=${ANSIBLE_COLLECTIONS_PATH} && ansible-test sanity \ 53 | --docker \ 54 | --skip-test metaclass-boilerplate \ 55 | --skip-test future-import-boilerplate 56 | # plugins/ tests/ 57 | 58 | 59 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_domain_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR domain info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_domain_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | organization_name: "{{ ( 'org_' + prefix) }}" 14 | repository_name: "{{ ( 'repo_' + prefix) }}" 15 | 16 | - name: Create organization 17 | opentelekomcloud.cloud.swr_organization: 18 | namespace: "{{ organization_name }}" 19 | register: organization 20 | 21 | - name: Assert result 22 | ansible.builtin.assert: 23 | that: 24 | - organization is success 25 | 26 | - name: Create repository in this organization 27 | opentelekomcloud.cloud.swr_repository: 28 | namespace: "{{ organization_name }}" 29 | repository: "{{ repository_name }}" 30 | register: repository 31 | 32 | - name: Assert result 33 | ansible.builtin.assert: 34 | that: 35 | - repository is success 36 | - repository is changed 37 | 38 | - name: Get domain list 39 | opentelekomcloud.cloud.swr_domain_info: 40 | namespace: "{{ organization_name }}" 41 | repository: "{{ repository_name }}" 42 | register: domains 43 | 44 | - name: Assert result 45 | ansible.builtin.assert: 46 | that: 47 | - domains is success 48 | 49 | always: 50 | - name: Delete this repository 51 | opentelekomcloud.cloud.swr_repository: 52 | namespace: "{{ organization_name }}" 53 | repository: "{{ repository_name }}" 54 | state: absent 55 | register: repository 56 | 57 | - name: Assert result 58 | ansible.builtin.assert: 59 | that: 60 | - repository is success 61 | - repository is changed 62 | 63 | - name: Delete organization 64 | opentelekomcloud.cloud.swr_organization: 65 | namespace: "{{ organization_name }}" 66 | state: absent 67 | register: organization 68 | 69 | - name: Assert result 70 | ansible.builtin.assert: 71 | that: 72 | - organization is success 73 | -------------------------------------------------------------------------------- /doc/examples/4_as_policy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # There are many services interconnected with Cloud eye. All the services are logically united 4 | # into groups named Namespaces. Every Namespace supports plenty of metrics, and each of them can 5 | # be monitored. Besides particular metric you want to check up, you need to know Dimension - 6 | # this entity pecifies the metric dimension of the selected resource type. In this 7 | # example we want to monitor inbound bandwidth of public IP connected to our VPC. So first of 8 | # all we will assign a new public IP for further monitoring. 9 | - name: Assign Floating IP 10 | opentelekomcloud.cloud.floating_ip: 11 | network: admin_external_net 12 | register: fl 13 | 14 | # First we need to create an Alarm, which will be included in AS Policy. 15 | - name: Create Cloud Eye Alarm 16 | opentelekomcloud.cloud.ces_alarms: 17 | alarm_name: "{{ alarm_name }}" 18 | state: present 19 | metric: 20 | namespace: "SYS.VPC" 21 | dimensions: 22 | - name: "publicip_id" 23 | value: "{{ fl.floating_ip.id }}" 24 | metric_name: "down_stream" 25 | condition: 26 | period: 300 27 | filter: average 28 | comparison_operator: ">=" 29 | value: 6 30 | unit: "B" 31 | count: 1 32 | alarm_enabled: true 33 | alarm_action_enabled: false 34 | register: alarm 35 | 36 | - name: Create AS policy 37 | opentelekomcloud.cloud.as_policy: 38 | scaling_group: "{{ as_group_name }}" 39 | scaling_policy: "{{ as_policy_name }}" 40 | scaling_policy_type: "alarm" 41 | alarm: "{{ alarm_name }}" 42 | state: "present" 43 | register: as_policy 44 | 45 | - name: Get list of AS Policies 46 | opentelekomcloud.cloud.as_policy_info: 47 | scaling_group: "{{ as_group_name }}" 48 | register: as_policies 49 | 50 | - name: Update AS policy (add scaling_policy_action) 51 | opentelekomcloud.cloud.as_policy: 52 | scaling_group: "{{ as_group_name }}" 53 | scaling_policy: "{{ as_policy_name }}" 54 | scaling_policy_type: "alarm" 55 | alarm: "{{ alarm_name }}" 56 | state: "present" 57 | scaling_policy_action: 58 | operation: "add" 59 | instance_number: 1 60 | register: as_policy 61 | 62 | - name: Check AS group quotas 63 | opentelekomcloud.cloud.as_quota_info: 64 | scaling_group_id: "{{ scaling_group_id }}" 65 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_repository/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR repository tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_repository: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | organization_name: "{{ ( 'org_' + prefix) }}" 14 | repository_name: "{{ ( 'repo_' + prefix) }}" 15 | 16 | - name: Create organization 17 | opentelekomcloud.cloud.swr_organization: 18 | namespace: "{{ organization_name }}" 19 | register: organization 20 | 21 | - name: Assert result 22 | ansible.builtin.assert: 23 | that: 24 | - organization is success 25 | 26 | - name: Create repository in this organization 27 | opentelekomcloud.cloud.swr_repository: 28 | namespace: "{{ organization_name }}" 29 | repository: "{{ repository_name }}" 30 | register: repository 31 | 32 | - name: Assert result 33 | ansible.builtin.assert: 34 | that: 35 | - repository is success 36 | - repository is changed 37 | 38 | - name: Change this repository 39 | opentelekomcloud.cloud.swr_repository: 40 | namespace: "{{ organization_name }}" 41 | repository: "{{ repository_name }}" 42 | category: "other" 43 | register: repository 44 | 45 | - name: Assert result 46 | ansible.builtin.assert: 47 | that: 48 | - repository is success 49 | - repository is changed 50 | 51 | always: 52 | - name: Delete this repository 53 | opentelekomcloud.cloud.swr_repository: 54 | namespace: "{{ organization_name }}" 55 | repository: "{{ repository_name }}" 56 | state: absent 57 | register: repository 58 | 59 | - name: Assert result 60 | ansible.builtin.assert: 61 | that: 62 | - repository is success 63 | - repository is changed 64 | 65 | - name: Delete organization 66 | opentelekomcloud.cloud.swr_organization: 67 | namespace: "{{ organization_name }}" 68 | state: absent 69 | register: organization 70 | 71 | - name: Assert result 72 | ansible.builtin.assert: 73 | that: 74 | - organization is success 75 | -------------------------------------------------------------------------------- /plugins/modules/ces_quotas_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | module: ces_quotas_info 16 | short_description: Get ressource Quotas 17 | extends_documentation_fragment: opentelekomcloud.cloud.otc 18 | version_added: "0.3.0" 19 | author: "Sebastian Gode (@SebastianGode)" 20 | description: 21 | - Get ressource Quotas 22 | requirements: ["openstacksdk", "otcextensions"] 23 | ''' 24 | 25 | RETURN = ''' 26 | quotas: 27 | description: Dictionary of Quotas 28 | returned: changed 29 | type: list 30 | sample: [ 31 | { 32 | "id": null, 33 | "name": null, 34 | "resources": [ 35 | { 36 | "id": null, 37 | "location": null, 38 | "name": null, 39 | "quota": 100, 40 | "type": "alarm", 41 | "unit": "", 42 | "used": 1 43 | } 44 | ] 45 | } 46 | ] 47 | ''' 48 | 49 | EXAMPLES = ''' 50 | # Query Alarm Quotas 51 | - opentelekomcloud.cloud.ces_quotas_info: 52 | ''' 53 | 54 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 55 | 56 | 57 | class CesQuotasInfoModule(OTCModule): 58 | argument_spec = dict() 59 | module_kwargs = dict( 60 | supports_check_mode=True 61 | ) 62 | 63 | def run(self): 64 | 65 | data = [] 66 | query = {} 67 | 68 | for raw in self.conn.ces.quotas(**query): 69 | dt = raw.to_dict() 70 | dt.pop('location') 71 | data.append(dt) 72 | 73 | self.exit( 74 | changed=False, 75 | quotas=data 76 | ) 77 | 78 | 79 | def main(): 80 | module = CesQuotasInfoModule() 81 | module() 82 | 83 | 84 | if __name__ == '__main__': 85 | main() 86 | -------------------------------------------------------------------------------- /plugins/modules/dds_datastore_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Unless required by applicable law or agreed to in writing, software 3 | # distributed under the License is distributed on an "AS IS" BASIS, 4 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5 | # See the License for the specific language governing permissions, 6 | # limitations under the License. 7 | 8 | DOCUMENTATION = ''' 9 | module: dds_datastore_info 10 | short_description: Obtain database version information about a specified type of a DB instance. 11 | extends_documentation_fragment: opentelekomcloud.cloud.otc 12 | version_added: "0.9.0" 13 | author: "Yustina Kvrivishvili (@YustinaKvr)" 14 | description: 15 | - Get datastore info 16 | options: 17 | datastore_name: 18 | description: 19 | - Specifies the database type. DDS Community Edition is supported. 20 | type: str 21 | required: true 22 | requirements: ["openstacksdk", "otcextensions"] 23 | ''' 24 | 25 | RETURN = ''' 26 | datastores: 27 | description: Info about datastore. 28 | returned: On Success 29 | type: complex 30 | contains: 31 | storage_engine: 32 | description: Storage engine. 33 | type: str 34 | type: 35 | description: Datastore type. 36 | type: str 37 | version: 38 | description: Datastore version. 39 | type: str 40 | ''' 41 | 42 | EXAMPLES = ''' 43 | # Get info about datastore 44 | - opentelekomcloud.cloud.dds_datastore_info: 45 | datastore_name: "test_ds" 46 | register: result 47 | ''' 48 | 49 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 50 | 51 | 52 | class DDSDatastoreInfo(OTCModule): 53 | argument_spec = dict( 54 | datastore_name=dict(required=True) 55 | ) 56 | module_kwargs = dict( 57 | supports_check_mode=True 58 | ) 59 | 60 | def run(self): 61 | datastore_name = self.params['datastore_name'] 62 | 63 | data = [] 64 | for raw in self.conn.dds.datastores(datastore_name): 65 | dt = raw.to_dict() 66 | dt.pop('location') 67 | dt.pop('id') 68 | dt.pop('name') 69 | data.append(dt) 70 | 71 | self.exit( 72 | changed=False, 73 | datastores=data 74 | ) 75 | 76 | 77 | def main(): 78 | module = DDSDatastoreInfo() 79 | module() 80 | 81 | 82 | if __name__ == '__main__': 83 | main() 84 | -------------------------------------------------------------------------------- /tests/integration/targets/subnet_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Subnet Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.vpc: 5 | cloud: "{{ test_cloud }}" 6 | opentelekomcloud.cloud.vpc_info: 7 | cloud: "{{ test_cloud }}" 8 | opentelekomcloud.cloud.subnet: 9 | cloud: "{{ test_cloud }}" 10 | opentelekomcloud.cloud.subnet_info: 11 | cloud: "{{ test_cloud }}" 12 | 13 | block: 14 | - name: Set random prefix 15 | ansible.builtin.set_fact: 16 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 17 | 18 | - name: Set initial facts 19 | ansible.builtin.set_fact: 20 | vpc_name: "{{ ( prefix + 'vpc') }}" 21 | subnet_name: "{{ ( prefix + 'subnet') }}" 22 | cidr: "192.168.0.0/24" 23 | gateway: "192.168.0.1" 24 | 25 | - name: Creating a vpc 26 | opentelekomcloud.cloud.vpc: 27 | name: "{{ vpc_name }}" 28 | state: present 29 | register: vpc 30 | 31 | - name: Creating a subnet 32 | opentelekomcloud.cloud.subnet: 33 | name: "{{ subnet_name }}" 34 | description: "Subnet example" 35 | vpc: "{{ vpc_name }}" 36 | cidr: "{{ cidr }}" 37 | gateway_ip: "{{ gateway }}" 38 | dns_list: 39 | - "100.125.4.25" 40 | - "100.125.129.199" 41 | register: vpc 42 | 43 | - name: Getting info about all subnets 44 | opentelekomcloud.cloud.subnet_info: 45 | vpc: "{{ vpc_name }}" 46 | register: all_subnets 47 | 48 | - name: Assert result 49 | ansible.builtin.assert: 50 | that: 51 | - all_subnets is success 52 | - all_subnets is not changed 53 | - all_subnets | length > 0 54 | 55 | - name: Getting info about new subnet 56 | opentelekomcloud.cloud.subnet_info: 57 | name_or_id: "{{ subnet_name }}" 58 | register: new_subnet 59 | 60 | - name: Assert result 61 | ansible.builtin.assert: 62 | that: 63 | - new_subnet is success 64 | - new_subnet is not changed 65 | - new_subnet | length > 0 66 | 67 | always: 68 | - name: Cleanup 69 | block: 70 | - name: Drop created subnet 71 | opentelekomcloud.cloud.subnet: 72 | name: "{{ subnet_name }}" 73 | vpc: "{{ vpc_name }}" 74 | state: absent 75 | failed_when: false 76 | 77 | - name: Drop created vpc 78 | opentelekomcloud.cloud.vpc: 79 | name: "{{ vpc_name }}" 80 | state: absent 81 | failed_when: false 82 | -------------------------------------------------------------------------------- /tests/integration/targets/as_config/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: AS Config tests 3 | module_defaults: 4 | opentelekomcloud.cloud.loadbalancer: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | config_name: "{{ ( prefix + '_config') }}" 14 | key_name: "{{ ( prefix + '_key') }}" 15 | 16 | - name: Create keypair 17 | openstack.cloud.keypair: 18 | name: "{{ key_name }}" 19 | 20 | - name: Create as config - check_mode 21 | opentelekomcloud.cloud.as_config: 22 | scaling_configuration: "{{ config_name }}" 23 | key_name: "{{ key_name }}" 24 | image: "{{ as_test_image }}" 25 | flavor: "{{ as_test_flavor }}" 26 | disk: 27 | - size: 10 28 | volume_type: 'SAS' 29 | disk_type: 'SYS' 30 | register: as_config_check 31 | check_mode: true 32 | 33 | - name: Assert result 34 | ansible.builtin.assert: 35 | that: 36 | - as_config_check is changed 37 | 38 | - name: Create as config 39 | opentelekomcloud.cloud.as_config: 40 | scaling_configuration: "{{ config_name }}" 41 | key_name: "{{ key_name }}" 42 | image: "{{ as_test_image }}" 43 | flavor: "{{ as_test_flavor }}" 44 | disk: 45 | - size: 10 46 | volume_type: 'SAS' 47 | disk_type: 'SYS' 48 | register: as_config 49 | 50 | - name: Assert result 51 | ansible.builtin.assert: 52 | that: 53 | - as_config is changed 54 | - as_config is success 55 | 56 | always: 57 | - name: Cleanup 58 | block: 59 | - name: Delete as config 60 | opentelekomcloud.cloud.as_config: 61 | scaling_configuration: "{{ config_name }}" 62 | state: absent 63 | register: removed 64 | until: removed is not failed 65 | ignore_errors: true 66 | retries: 10 67 | 68 | - name: Assert result 69 | ansible.builtin.assert: 70 | that: 71 | - removed is success 72 | - removed is changed 73 | 74 | - name: Delete keypair 75 | openstack.cloud.keypair: 76 | name: "{{ key_name }}" 77 | state: absent 78 | register: removed 79 | until: removed is not failed 80 | ignore_errors: true 81 | retries: 10 82 | -------------------------------------------------------------------------------- /tests/integration/targets/dns_recordset_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: DNS Recordset Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.dns_recordset: 5 | cloud: "{{ test_cloud }}" 6 | opentelekomcloud.cloud.dns_recordset_info: 7 | cloud: "{{ test_cloud }}" 8 | opentelekomcloud.cloud.dns_zone: 9 | cloud: "{{ test_cloud }}" 10 | 11 | block: 12 | - name: Set random prefix 13 | ansible.builtin.set_fact: 14 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 15 | 16 | - name: Set initial facts 17 | ansible.builtin.set_fact: 18 | zone_name: "{{ ( prefix + 'test.zone') }}" 19 | recordset_random_name: "{{ ( prefix + 'recordset.' + prefix + 'test.zone') }}" 20 | 21 | - name: Creating a public DNS Zone 22 | opentelekomcloud.cloud.dns_zone: 23 | name: "{{ zone_name }}" 24 | state: present 25 | register: dns_zo 26 | 27 | - name: Creating a DNS Recordset 28 | opentelekomcloud.cloud.dns_recordset: 29 | zone_id: "{{ dns_zo.zone.id }}" 30 | recordset_name: "{{ recordset_random_name }}" 31 | type: A 32 | records: 33 | - "1.1.1.1" 34 | - "2.2.2.2" 35 | state: present 36 | register: dns_rs 37 | 38 | - name: Getting info about recordset in created zone 39 | opentelekomcloud.cloud.dns_recordset_info: 40 | zone: "{{ dns_zo.zone.id }}" 41 | register: recordsets 42 | 43 | - name: Assert result 44 | ansible.builtin.assert: 45 | that: 46 | - recordsets is success 47 | - recordsets is not changed 48 | - recordsets | length > 0 49 | 50 | - name: Get info about created recordset 51 | opentelekomcloud.cloud.dns_recordset_info: 52 | zone: "{{ dns_zo.zone.id }}" 53 | name: "{{ dns_rs.recordset.name }}" 54 | register: rs 55 | 56 | - name: Assert result 57 | ansible.builtin.assert: 58 | that: 59 | - rs is success 60 | - rs is not changed 61 | - rs | length > 0 62 | 63 | always: 64 | - name: Cleanup 65 | block: 66 | - name: Drop created recordset 67 | opentelekomcloud.cloud.dns_recordset: 68 | recordset_name: "{{ recordset_random_name }}" 69 | state: absent 70 | zone_id: "{{ dns_zo.zone.id }}" 71 | failed_when: false 72 | 73 | - name: Drop created DNS zone 74 | opentelekomcloud.cloud.dns_zone: 75 | name: "{{ dns_zo.zone.name }}" 76 | state: absent 77 | failed_when: false 78 | -------------------------------------------------------------------------------- /examples/playbooks/4_as_policy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # There are many services interconnected with Cloud eye. All the services are logically united 6 | # into groups named Namespaces. Every Namespace supports plenty of metrics, and each of them can 7 | # be monitored. Besides particular metric you want to check up, you need to know Dimension - 8 | # this entity pecifies the metric dimension of the selected resource type. In this 9 | # example we want to monitor inbound bandwidth of public IP connected to our VPC. So first of 10 | # all we will assign a new public IP for further monitoring. 11 | - name: Assign Floating IP 12 | opentelekomcloud.cloud.floating_ip: 13 | network: admin_external_net 14 | register: fl 15 | 16 | # First we need to create an Alarm, which will be included in AS Policy. 17 | - name: Create Cloud Eye Alarm 18 | opentelekomcloud.cloud.ces_alarms: 19 | alarm_name: "{{ alarm_name }}" 20 | state: present 21 | metric: 22 | namespace: "SYS.VPC" 23 | dimensions: 24 | - name: "publicip_id" 25 | value: "{{ fl.floating_ip.id }}" 26 | metric_name: "down_stream" 27 | condition: 28 | period: 300 29 | filter: average 30 | comparison_operator: ">=" 31 | value: 6 32 | unit: "B" 33 | count: 1 34 | alarm_enabled: true 35 | alarm_action_enabled: false 36 | register: alarm 37 | 38 | - name: Create AS policy 39 | opentelekomcloud.cloud.as_policy: 40 | scaling_group: "{{ as_group_name }}" 41 | scaling_policy: "{{ as_policy_name }}" 42 | scaling_policy_type: "alarm" 43 | alarm: "{{ alarm_name }}" 44 | state: "present" 45 | register: as_policy 46 | 47 | - name: Get list of AS Policies 48 | opentelekomcloud.cloud.as_policy_info: 49 | scaling_group: "{{ as_group_name }}" 50 | register: as_policies 51 | 52 | - name: Update AS policy (add scaling_policy_action) 53 | opentelekomcloud.cloud.as_policy: 54 | scaling_group: "{{ as_group_name }}" 55 | scaling_policy: "{{ as_policy_name }}" 56 | scaling_policy_type: "alarm" 57 | alarm: "{{ alarm_name }}" 58 | state: "present" 59 | scaling_policy_action: 60 | operation: "add" 61 | instance_number: 1 62 | register: as_policy 63 | 64 | - name: Check AS group quotas 65 | opentelekomcloud.cloud.as_quota_info: 66 | scaling_group_id: "{{ scaling_group_id }}" 67 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization_permissions/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR organization permissions tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_organization_permissions: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | organization_name: "{{ ( 'org_' + prefix) }}" 14 | repository_name: "{{ ( 'repo_' + prefix) }}" 15 | user_id: "cfe93b289ece46cd84a22b17c4e6671e" 16 | user_name: "test_user" 17 | 18 | - name: Create organization 19 | opentelekomcloud.cloud.swr_organization: 20 | namespace: "{{ organization_name }}" 21 | register: organization 22 | 23 | - name: Assert result 24 | ansible.builtin.assert: 25 | that: 26 | - organization is success 27 | 28 | - name: Create user permission in this organization 29 | opentelekomcloud.cloud.swr_organization_permissions: 30 | namespace: "{{ organization_name }}" 31 | user_id: "{{ user_id }}" 32 | user_name: "{{ user_name }}" 33 | user_auth: 7 34 | register: permission 35 | 36 | - name: Assert result 37 | ansible.builtin.assert: 38 | that: 39 | - permission is success 40 | - permission is changed 41 | 42 | - name: Update user permission in this organization 43 | opentelekomcloud.cloud.swr_organization_permissions: 44 | namespace: "{{ organization_name }}" 45 | user_id: "{{ user_id }}" 46 | user_name: "{{ user_name }}" 47 | user_auth: 1 48 | register: permission 49 | 50 | - name: Assert result 51 | ansible.builtin.assert: 52 | that: 53 | - permission is success 54 | - permission is changed 55 | 56 | - name: Delete user permission in this organization 57 | opentelekomcloud.cloud.swr_organization_permissions: 58 | namespace: "{{ organization_name }}" 59 | user_id: "{{ user_id }}" 60 | user_name: "{{ user_name }}" 61 | state: absent 62 | register: permission 63 | 64 | - name: Assert result 65 | ansible.builtin.assert: 66 | that: 67 | - permission is success 68 | - permission is changed 69 | 70 | always: 71 | - name: Delete organization 72 | opentelekomcloud.cloud.swr_organization: 73 | namespace: "{{ organization_name }}" 74 | state: absent 75 | failed_when: false 76 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_organization_permissions_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR organization permissions tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_organization_permissions_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | organization_name: "{{ ( 'org_' + prefix) }}" 14 | user_id: "cfe93b289ece46cd84a22b17c4e6671e" 15 | user_name: "test_user" 16 | 17 | - name: Create organization 18 | opentelekomcloud.cloud.swr_organization: 19 | namespace: "{{ organization_name }}" 20 | register: organization 21 | 22 | - name: Assert result 23 | ansible.builtin.assert: 24 | that: 25 | - organization is success 26 | 27 | - name: Create user permission in this repository 28 | opentelekomcloud.cloud.swr_organization_permissions: 29 | namespace: "{{ organization_name }}" 30 | user_id: "{{ user_id }}" 31 | user_name: "{{ user_name }}" 32 | user_auth: 7 33 | register: permission 34 | 35 | - name: Assert result 36 | ansible.builtin.assert: 37 | that: 38 | - permission is success 39 | 40 | - name: List user permissions 41 | opentelekomcloud.cloud.swr_organization_permissions_info: 42 | namespace: "{{ organization_name }}" 43 | register: permissions 44 | 45 | - name: Assert result 46 | ansible.builtin.assert: 47 | that: 48 | - permissions is success 49 | 50 | - name: Get existing user permission 51 | opentelekomcloud.cloud.swr_organization_permissions_info: 52 | namespace: "{{ organization_name }}" 53 | user_name: "{{ user_name }}" 54 | register: permissions 55 | 56 | - name: Assert result 57 | ansible.builtin.assert: 58 | that: 59 | - permissions is success 60 | 61 | - name: Get existing user permission 62 | opentelekomcloud.cloud.swr_organization_permissions_info: 63 | namespace: "{{ organization_name }}" 64 | user_name: "non_existing_user" 65 | register: permissions 66 | 67 | - name: Assert result 68 | ansible.builtin.assert: 69 | that: 70 | - permissions is success 71 | 72 | always: 73 | 74 | - name: Delete organization 75 | opentelekomcloud.cloud.swr_organization: 76 | namespace: "{{ organization_name }}" 77 | state: absent 78 | failed_when: false 79 | -------------------------------------------------------------------------------- /plugins/modules/availability_zone_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: availability_zone_info 17 | short_description: Get AZ info 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.7.0" 20 | author: "Artem Goncharov (@gtema)" 21 | description: 22 | - Get AZ info. 23 | options: 24 | name: 25 | description: The name or ID of a AZ. 26 | type: str 27 | service: 28 | description: 29 | - Service name to list supported availability zones for. 30 | - Currently only compute is supported 31 | type: str 32 | default: compute 33 | requirements: ["openstacksdk"] 34 | ''' 35 | 36 | RETURN = ''' 37 | availability_zone_info: 38 | description: List of Availability zones. 39 | type: complex 40 | returned: On Success. 41 | contains: 42 | name: 43 | description: Specifies the AZ name. 44 | type: str 45 | ''' 46 | 47 | EXAMPLES = ''' 48 | # Get AZ. 49 | - opentelekomcloud.cloud.availability_zone_info: 50 | name: 'eu-de' 51 | register: az 52 | ''' 53 | 54 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 55 | 56 | 57 | class AvailabilityZoneInfoModule(OTCModule): 58 | argument_spec = dict( 59 | name=dict(type='str', required=False), 60 | service=dict(type='str', default='compute') 61 | ) 62 | 63 | module_kwargs = dict( 64 | supports_check_mode=True 65 | ) 66 | 67 | def run(self): 68 | data = [] 69 | 70 | raw_data = [] 71 | if self.params['service'] == 'compute': 72 | raw_data = self.conn.compute.availability_zones() 73 | if raw_data: 74 | for raw in raw_data: 75 | dt = raw.to_dict() 76 | dt.pop('location') 77 | data.append(dt) 78 | 79 | self.exit( 80 | changed=False, 81 | availability_zones=data 82 | ) 83 | 84 | 85 | def main(): 86 | module = AvailabilityZoneInfoModule() 87 | module() 88 | 89 | 90 | if __name__ == '__main__': 91 | main() 92 | -------------------------------------------------------------------------------- /tests/integration/targets/vpn_service_info/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: VPC Service Info tests 3 | module_defaults: 4 | opentelekomcloud.cloud.vpn_service_info: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Get list of vpn services 8 | opentelekomcloud.cloud.vpn_service_info: 9 | register: vpn_service_info 10 | failed_when: false 11 | 12 | - name: Assert result 13 | ansible.builtin.assert: 14 | that: 15 | - vpn_service_info is success 16 | - vpn_service_info is not changed 17 | 18 | - name: Get empty list when name of VPN service is wrong 19 | opentelekomcloud.cloud.vpn_service_info: 20 | vpn_service: "fake_vpn" 21 | register: vpn_service_info 22 | failed_when: false 23 | 24 | - name: Assert result 25 | ansible.builtin.assert: 26 | that: 27 | - vpn_service_info is success 28 | - vpn_service_info is not changed 29 | - 'vpn_service_info.msg == "VPN service fake_vpn not found"' 30 | - vpn_service_info['vpn_services']|length == 0 31 | 32 | - name: Get empty list when subnet is not found 33 | opentelekomcloud.cloud.vpn_service_info: 34 | subnet: "fake_subnet" 35 | register: vpn_service_info 36 | failed_when: false 37 | 38 | - name: Assert result 39 | ansible.builtin.assert: 40 | that: 41 | - vpn_service_info is success 42 | - vpn_service_info is not changed 43 | - 'vpn_service_info.msg == "Subnet fake_subnet not found"' 44 | - vpn_service_info['vpn_services']|length == 0 45 | 46 | - name: Get empty list when router is not found 47 | opentelekomcloud.cloud.vpn_service_info: 48 | router: "fake_router" 49 | register: vpn_service_info 50 | failed_when: false 51 | 52 | - name: Assert result 53 | ansible.builtin.assert: 54 | that: 55 | - vpn_service_info is success 56 | - vpn_service_info is not changed 57 | - 'vpn_service_info.msg == "Router fake_router not found"' 58 | - vpn_service_info['vpn_services']|length == 0 59 | 60 | - name: Get empty list when name, subnet, router is not found 61 | opentelekomcloud.cloud.vpn_service_info: 62 | vpn_service: "fake_vpn" 63 | subnet: "fake_subnet" 64 | router: "fake_router" 65 | register: vpn_service_info 66 | failed_when: false 67 | 68 | - name: Assert result 69 | ansible.builtin.assert: 70 | that: 71 | - vpn_service_info is success 72 | - vpn_service_info is not changed 73 | - vpn_service_info['vpn_services']|length == 0 74 | -------------------------------------------------------------------------------- /plugins/modules/swr_organization_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: swr_organization_info 17 | short_description: Get SWR organisations info 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.14.2" 20 | author: "Ziukina Valeriia (@RusselSand)" 21 | description: 22 | - Get organizations info from Software Repository for Containers 23 | options: 24 | namespace: 25 | description: 26 | - Optional name of an organisation 27 | type: str 28 | requirements: ["openstacksdk", "otcextensions"] 29 | ''' 30 | 31 | RETURN = ''' 32 | organizations: 33 | description: Dictionary describing organizations 34 | type: complex 35 | returned: On Success. 36 | contains: 37 | id: 38 | description: Organization ID 39 | type: int 40 | sample: 1343008 41 | name: 42 | description: Organization name 43 | type: str 44 | sample: "group" 45 | creator_name: 46 | description: IAM username 47 | type: str 48 | sample: "username" 49 | auth: 50 | description: User permission 51 | type: int 52 | sample: 7 53 | ''' 54 | 55 | EXAMPLES = ''' 56 | # Get SWR organisations information 57 | - opentelekomcloud.cloud.swr_organization_info: 58 | namespace: org_name 59 | register: swr_organization_info 60 | ''' 61 | 62 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 63 | 64 | 65 | class SwrOrganisationInfoModule(OTCModule): 66 | argument_spec = dict( 67 | namespace=dict(required=False) 68 | ) 69 | module_kwargs = dict( 70 | supports_check_mode=True 71 | ) 72 | 73 | def run(self): 74 | if self.params['namespace']: 75 | orgs = self.conn.swr.get_organization(self.params['namespace']) 76 | else: 77 | orgs = list(self.conn.swr.organizations()) 78 | self.exit_json( 79 | changed=False, 80 | organizations=orgs 81 | ) 82 | 83 | 84 | def main(): 85 | module = SwrOrganisationInfoModule() 86 | module() 87 | 88 | 89 | if __name__ == "__main__": 90 | main() 91 | -------------------------------------------------------------------------------- /doc/examples/10_relation_database.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # First of all, let's choose type and version of DB of an RDS instance. For example, we want it 4 | # to be a MySQL (besides that you can choose postgresql or sqlserver on Microsoft) in HA (or single or replica) mode 5 | - name: Get info about choosen type of DB 6 | opentelekomcloud.cloud.rds_flavor_info: 7 | datastore: "mysql" 8 | instance_mode: "ha" 9 | register: rds_flavors 10 | 11 | # In this debug you can see all the flavors of the chosen DB type, and now you can decide what 12 | # flavor exactly fits your needs 13 | - name: debug 14 | ansible.builtin.debug: 15 | msg: "{{ rds_flavors.rds_flavors[0].name }}" 16 | 17 | # Now let's create RDS instance. You can locate it in two or more availability zones. 18 | # Password you pass to the module handles in secure mode: this means that it won't be shown in 19 | # module's output. Please pay attention that automatic backup strategy is setting here, too. 20 | # Attribute 'cmk_id' needed for system encryption, has been created beforehand. 21 | - name: Create RDS instance 22 | opentelekomcloud.cloud.rds_instance: 23 | name: "{{ rds_instance_name }}" 24 | state: present 25 | region: "eu-de" 26 | availability_zone: "eu-de-01,eu-de-02" 27 | datastore_type: "mysql" 28 | datastore_version: "8.0" 29 | flavor: "{{ rds_flavors.rds_flavors[0].name }}" 30 | ha_mode: "semisync" 31 | router: "{{ router }}" 32 | network: "{{ network_id }}" 33 | port: 8080 34 | security_group: "{{ secgroup_id }}" 35 | password: "{{ password }}" 36 | volume_type: "ultrahigh" 37 | volume_size: 40 38 | disk_encryption: "{{ cmk_id }}" 39 | backup_keepdays: 1 40 | backup_timeframe: "02:00-03:00" 41 | wait: true 42 | timeout: 777 43 | register: rds 44 | 45 | # With this info module you can get info about your instance 46 | - name: Let's get info about whole RDS instance 47 | opentelekomcloud.cloud.rds_instance_info: 48 | name: "{{ rds.instance.name }}" 49 | 50 | - name: Let's get info about datastore 51 | opentelekomcloud.cloud.rds_datastore_info: 52 | name: "{{ rds.instance.id }}" 53 | 54 | - name: Now create backup of the created instance 55 | opentelekomcloud.cloud.rds_backup: 56 | instance: "{{ rds.instance.id }}" 57 | name: "{{ rds_backup_name }}" 58 | state: present 59 | description: "Backup of the RDS instance" 60 | wait: true 61 | register: rds_bckp 62 | 63 | # Queirying RDS backup info. You can use any of specified attributes, together or separetely. 64 | - name: Get RDS backup info 65 | opentelekomcloud.cloud.rds_backup_info: 66 | instance: "{{ rds.instance.id }}" 67 | backup: "{{ rds_bckp.backup.id }}" 68 | backup_type: "{{ rds_bckp.backup.type }}" 69 | -------------------------------------------------------------------------------- /plugins/modules/cce_cluster_cert_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: cce_cluster_cert_info 17 | short_description: Get Certificates of a CCE cluster 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.0.1" 20 | author: "Artem Goncharov (@gtema)" 21 | description: 22 | - Get CCE cluster certificates info from the OTC. 23 | options: 24 | cluster: 25 | description: Name of the cluster. 26 | required: true 27 | type: str 28 | requirements: ["openstacksdk", "otcextensions"] 29 | ''' 30 | 31 | RETURN = ''' 32 | cce_cluster_certs: 33 | description: Dictionary containing cluster certificates. 34 | type: complex 35 | returned: On Success. 36 | contains: 37 | ca: 38 | description: Authority Certificate content. 39 | type: str 40 | client_certificate: 41 | description: Client Certificate content. 42 | type: str 43 | client_key: 44 | description: Private key for Client Certificate. 45 | type: str 46 | context: 47 | description: Dictionary with the certificate context information. 48 | type: dict 49 | ''' 50 | 51 | EXAMPLES = ''' 52 | # Get configs versions. 53 | - cce_cluster_info: 54 | register: data 55 | ''' 56 | 57 | 58 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 59 | 60 | 61 | class CceClusterCertInfoModule(OTCModule): 62 | argument_spec = dict( 63 | cluster=dict(required=True), 64 | ) 65 | module_kwargs = dict( 66 | supports_check_mode=True 67 | ) 68 | 69 | def run(self): 70 | cluster = self.params['cluster'] 71 | 72 | cluster = self.conn.cce.find_cluster(cluster, ignore_missing=False) 73 | 74 | certs = self.conn.cce.get_cluster_certificates(cluster).to_dict() 75 | certs.pop('location') 76 | certs.pop('id') 77 | certs.pop('name') 78 | 79 | self.exit_json( 80 | changed=False, 81 | cce_cluster_certs=certs 82 | ) 83 | 84 | 85 | def main(): 86 | module = CceClusterCertInfoModule() 87 | module() 88 | 89 | 90 | if __name__ == '__main__': 91 | main() 92 | -------------------------------------------------------------------------------- /plugins/modules/rds_datastore_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: rds_datastore_info 17 | short_description: Get supported RDS datastore versions 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.0.1" 20 | author: "Artem Goncharov (@gtema)" 21 | description: 22 | - Get RDS datastore info from the OTC. 23 | options: 24 | datastore: 25 | description: 26 | - Name of the database (datastore type). 27 | choices: [mysql, postgresql, sqlserver] 28 | default: postgresql 29 | type: str 30 | name: 31 | description: datastore name 32 | type: str 33 | requirements: ["openstacksdk", "otcextensions"] 34 | ''' 35 | 36 | RETURN = ''' 37 | rds_datastore_versions: 38 | description: List of dictionaries describing RDS datastore version. 39 | type: complex 40 | returned: On Success. 41 | contains: 42 | id: 43 | description: Unique UUID. 44 | type: str 45 | sample: "39007a7e-ee4f-4d13-8283-b4da2e037c69" 46 | name: 47 | description: Name (version) of the datastore. 48 | type: str 49 | sample: "10.0" 50 | ''' 51 | 52 | EXAMPLES = ''' 53 | # Get datastore versions. 54 | - rds_datastore_info: 55 | datastore: "postgresql" 56 | register: rds 57 | ''' 58 | 59 | 60 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 61 | 62 | 63 | class RdsDatastoreInfoModule(OTCModule): 64 | argument_spec = dict( 65 | name=dict(required=False), 66 | datastore=dict(choices=['mysql', 'postgresql', 'sqlserver'], 67 | default='postgresql'), 68 | ) 69 | module_kwargs = dict( 70 | supports_check_mode=True 71 | ) 72 | 73 | def run(self): 74 | datastore = self.params['datastore'] 75 | 76 | data = [] 77 | for raw in self.conn.rds.datastores(database_name=datastore): 78 | dt = raw.to_dict() 79 | dt.pop('location') 80 | data.append(dt) 81 | 82 | self.exit_json( 83 | changed=False, 84 | rds_datastores=data 85 | ) 86 | 87 | 88 | def main(): 89 | module = RdsDatastoreInfoModule() 90 | module() 91 | 92 | 93 | if __name__ == "__main__": 94 | main() 95 | -------------------------------------------------------------------------------- /meta/runtime.yml: -------------------------------------------------------------------------------- 1 | --- 2 | requires_ansible: '>=2.17.0' 3 | action_groups: 4 | otc: 5 | - as_config 6 | - as_config_info 7 | - as_group 8 | - as_group_info 9 | - as_instance 10 | - as_instance_info 11 | - as_policy 12 | - as_policy_info 13 | - as_quota_info 14 | - associate_bandwidth 15 | - availability_zone_info 16 | - bandwidth 17 | - cce_cluster 18 | - cce_cluster_cert_info 19 | - cce_cluster_info 20 | - cce_cluster_node_info 21 | - cce_cluster_node 22 | - cce_node_pool_info 23 | - cce_node_pool 24 | - css_cluster 25 | - css_cluster_info 26 | - css_snapshot 27 | - css_snapshot_info 28 | - cbr_backup 29 | - cbr_backup_info 30 | - cbr_restore_point 31 | - cbr_policy 32 | - cbr_vault 33 | - deh_host 34 | - deh_host_info 35 | - deh_host_type_info 36 | - deh_server_info 37 | - dns_recordset_info 38 | - dds_flavor_info 39 | - dds_instance_info 40 | - dds_instance 41 | - dws_cluster 42 | - dws_cluster_info 43 | - dws_snapshot 44 | - dws_snapshot_info 45 | - floating_ip 46 | - loadbalancer 47 | - loadbalancer_info 48 | - loadbalancer_v3_info 49 | - mrs_cluster_info 50 | - nat_dnat_info 51 | - nat_dnat_rule 52 | - nat_gateway_info 53 | - nat_gateway 54 | - nat_snat_info 55 | - nat_snat_rule 56 | - rds_datastore_info 57 | - rds_flavor_info 58 | - rds_instance 59 | - rds_backup 60 | - rds_backup_info 61 | - router 62 | - security_group 63 | - security_group_info 64 | - server_group_info 65 | - subnet 66 | - subnet_info 67 | - sfsturbo_share 68 | - tag 69 | - volume_backup 70 | - waf_certificate 71 | - waf_certificate_info 72 | - vpc 73 | - vpc_info 74 | - volume_backup_info 75 | - volume_snapshot_info 76 | - vpc_peering 77 | - vpc_peering_info 78 | - vpc_route_info 79 | - vpc_route 80 | - vpn_service_info 81 | - waf_domain 82 | - waf_domain_info 83 | - lb_listener 84 | - lb_listener_info 85 | - lb_pool 86 | - lb_pool_info 87 | - lb_member 88 | - lb_member_info 89 | - lb_healthmonitor 90 | - lb_healthmonitor_info 91 | - lb_certificate_info 92 | - lb_certificate 93 | - anti_ddos_fip_statuses_info.py 94 | - anti_ddos_optional_policies_info.py 95 | - object_info.py 96 | - dns_nameserver_info.py 97 | - kms_info.py 98 | - swr_organization_info.py 99 | - swr_repository_info.py 100 | - swr_organization.py 101 | - swr_repository.py 102 | - swr_domain_info.py 103 | - swr_domain.py 104 | - swr_repository_permissions.py 105 | - swr_repository_permissions_info.py 106 | - swr_organization_permissions.py 107 | - swr_organization_permissions_info.py 108 | -------------------------------------------------------------------------------- /examples/playbooks/10_relation_database.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # First of all, let's choose type and version of DB of an RDS instance. For example, we want it 6 | # to be a MySQL (besides that you can choose postgresql or sqlserver on Microsoft) in HA (or single or replica) mode 7 | - name: Get info about choosen type of DB 8 | opentelekomcloud.cloud.rds_flavor_info: 9 | datastore: "mysql" 10 | instance_mode: "ha" 11 | register: rds_flavors 12 | 13 | # In this debug you can see all the flavors of the chosen DB type, and now you can decide what 14 | # flavor exactly fits your needs 15 | - name: debug 16 | ansible.builtin.debug: 17 | msg: "{{ rds_flavors.rds_flavors[0].name }}" 18 | 19 | # Now let's create RDS instance. You can locate it in two or more availability zones. 20 | # Password you pass to the module handles in secure mode: this means that it won't be shown in 21 | # module's output. Please pay attention that automatic backup strategy is setting here, too. 22 | # Attribute 'cmk_id' needed for system encryption, has been created beforehand. 23 | - name: Create RDS instance 24 | opentelekomcloud.cloud.rds_instance: 25 | name: "{{ rds_instance_name }}" 26 | state: present 27 | region: "eu-de" 28 | availability_zone: "eu-de-01,eu-de-02" 29 | datastore_type: "mysql" 30 | datastore_version: "8.0" 31 | flavor: "{{ rds_flavors.rds_flavors[0].name }}" 32 | ha_mode: "semisync" 33 | router: "{{ router }}" 34 | network: "{{ network_id }}" 35 | port: 8080 36 | security_group: "{{ secgroup_id }}" 37 | password: "{{ password }}" 38 | volume_type: "ultrahigh" 39 | volume_size: 40 40 | disk_encryption: "{{ cmk_id }}" 41 | backup_keepdays: 1 42 | backup_timeframe: "02:00-03:00" 43 | wait: true 44 | timeout: 777 45 | register: rds 46 | 47 | # With this info module you can get info about your instance 48 | - name: Let's get info about whole RDS instance 49 | opentelekomcloud.cloud.rds_instance_info: 50 | name: "{{ rds.instance.name }}" 51 | 52 | - name: Let's get info about datastore 53 | opentelekomcloud.cloud.rds_datastore_info: 54 | name: "{{ rds.instance.id }}" 55 | 56 | - name: Now create backup of the created instance 57 | opentelekomcloud.cloud.rds_backup: 58 | instance: "{{ rds.instance.id }}" 59 | name: "{{ rds_backup_name }}" 60 | state: present 61 | description: "Backup of the RDS instance" 62 | wait: true 63 | register: rds_bckp 64 | 65 | # Queirying RDS backup info. You can use any of specified attributes, together or separetely. 66 | - name: Get RDS backup info 67 | opentelekomcloud.cloud.rds_backup_info: 68 | instance: "{{ rds.instance.id }}" 69 | backup: "{{ rds_bckp.backup.id }}" 70 | backup_type: "{{ rds_bckp.backup.type }}" 71 | -------------------------------------------------------------------------------- /plugins/modules/volume_backup_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: volume_backup_info 17 | short_description: Get Backups 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.0.3" 20 | author: "Vladimir Hasko (@vladimirhasko)" 21 | description: 22 | - Get Backup info from the OTC. 23 | options: 24 | name: 25 | description: 26 | - Name of the Backup. 27 | type: str 28 | volume: 29 | description: 30 | - Name of the volume. 31 | type: str 32 | requirements: ["openstacksdk", "otcextensions"] 33 | ''' 34 | 35 | RETURN = ''' 36 | backups: 37 | description: List of dictionaries describing volume backups. 38 | type: complex 39 | returned: On Success. 40 | contains: 41 | id: 42 | description: Unique UUID. 43 | type: str 44 | sample: "39007a7e-ee4f-4d13-8283-b4da2e037c69" 45 | name: 46 | description: Name (version) of the backup. 47 | type: str 48 | sample: "10.0" 49 | ''' 50 | 51 | EXAMPLES = ''' 52 | # Get backups. 53 | - volume_backup_info: 54 | register: backup 55 | - volume_backup_info: 56 | name: my_fake_backup 57 | register: backup 58 | ''' 59 | 60 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 61 | 62 | 63 | class VolumeBackupInfoModule(OTCModule): 64 | argument_spec = dict( 65 | name=dict(required=False), 66 | volume=dict(required=False) 67 | ) 68 | module_kwargs = dict( 69 | supports_check_mode=True 70 | ) 71 | 72 | def run(self): 73 | name_filter = self.params['name'] 74 | volume = self.params['volume'] 75 | 76 | data = [] 77 | attrs = {} 78 | 79 | if name_filter: 80 | attrs['name'] = name_filter 81 | if volume: 82 | attrs['volume_id'] = self.conn.block_storage.find_volume(volume) 83 | 84 | for raw in self.conn.block_storage.backups(**attrs): 85 | dt = raw.to_dict() 86 | dt.pop('location') 87 | data.append(dt) 88 | 89 | self.exit_json( 90 | changed=False, 91 | backups=data 92 | ) 93 | 94 | 95 | def main(): 96 | module = VolumeBackupInfoModule() 97 | module() 98 | 99 | 100 | if __name__ == '__main__': 101 | main() 102 | -------------------------------------------------------------------------------- /doc/examples/6_loadbalancer.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # This loadbalancer would be attached to the couple of ECSs united into one backend server group. 3 | - name: Create loadbalancer for cluster 4 | opentelekomcloud.cloud.loadbalancer: 5 | state: present 6 | auto_public_ip: true 7 | name: "{{ lb_name }}" 8 | vip_subnet: "{{ vpc_subnet_name }}" 9 | register: lb 10 | 11 | # This module just integrate public and private keys into certificate for listener. Both public 12 | # and private keys you should obtain before on third-party resources, for instance, Letsencrypt, 13 | # and put in available for Ansible engine place. 14 | - name: Create certificate for HTTPS connections 15 | opentelekomcloud.cloud.lb_certificate: 16 | name: "elb_https_cert" 17 | type: "server" 18 | content: "/home/user/files/rootCA.pem" 19 | private_key: "/home/user/files/rootCA.key" 20 | register: elb_cert 21 | 22 | # For every type of protocol you can create its own listener. In case of HTTP listener, please pay 23 | # attention on your subnet addresses pool, it must be sufficient for all the instances including 24 | # listener itself. 25 | - name: Create listener for HTTPS traffic 26 | opentelekomcloud.cloud.lb_listener: 27 | name: "{{ listener_https_name }}" 28 | protocol: terminated_https 29 | protocol_port: 443 30 | loadbalancer: "{{ lb.loadbalancer.id }}" 31 | default_tls_container_ref: "{{ elb_cert.elb_certificate.id }}" 32 | register: listener_https 33 | 34 | # This backend server group will contain multiple ECSs. 35 | # Here we use roundrobin algorithm, as we use http protocol, but you can choose source_ip or least_connection. 36 | - name: Create backend server group 37 | opentelekomcloud.cloud.lb_pool: 38 | state: present 39 | name: "{{ backend_server_name }}" 40 | protocol: http 41 | lb_algorithm: round_robin 42 | listener: "{{ listener_https }}" 43 | loadbalancer: "{{ lb.loadbalancer.id }}" 44 | register: backend 45 | 46 | - name: Add first to the backend server group 47 | opentelekomcloud.cloud.lb_member: 48 | name: "{{ ecs1_name }}" 49 | address: "10.10.0.18" 50 | protocol_port: 443 51 | subnet: "{{ vpc_subnet_name }}" 52 | pool: "{{ backend.server_group.id }}" 53 | register: bcknd_1 54 | 55 | - name: Add second server to the backend server group 56 | opentelekomcloud.cloud.lb_member: 57 | name: "{{ ecs2_name }}" 58 | address: "10.10.0.23" 59 | protocol_port: 443 60 | subnet: "{{ vpc_subnet_name }}" 61 | pool: "{{ backend_group_id }}" 62 | register: bcknd_2 63 | 64 | # After setting up an backend server group, it's highly recommend that you attach health check 65 | # monitoring to it. 66 | - name: Add HTTPS health check for the backend server group 67 | opentelekomcloud.cloud.lb_healthmonitor: 68 | name: "{{ health_https_name }}" 69 | state: present 70 | delay: 9 71 | max_retries: 3 72 | pool: "{{ backend_group_id }}" 73 | monitor_timeout: 5 74 | type: http 75 | monitor_port: 443 76 | expected_codes: 200 77 | http_method: get 78 | register: https_health 79 | -------------------------------------------------------------------------------- /doc/examples/3_autoscaling.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Keypair is mandatory condition for creating and modifying AS configurations and groups. Be avoid 4 | # of accidental deleting of this entity, because in this case you'll lost control on your AS 5 | # entities. 6 | - name: Create new keypair for accessing AS config 7 | openstack.cloud.keypair: 8 | name: "{{ keypair_name }}" 9 | register: kp 10 | tags: 11 | - create_keypair 12 | 13 | # You're able to create a new AS config based on existing ECS, using it as a template. For this, 14 | # point ECS's id as a parameter. Here is example of a new AS config, taken from scratch. 15 | - name: Create new AS config 16 | opentelekomcloud.cloud.as_config: 17 | scaling_configuration: "{{ as_new_config_name }}" 18 | key_name: "{{ keypair_name }}" 19 | image: "Standard_CentOS_7_latest" 20 | flavor: "s3.medium.1" 21 | disk: 22 | - size: 10 23 | volume_type: 'SAS' 24 | disk_type: 'SYS' 25 | register: as_config_new 26 | tags: 27 | - create_as_config 28 | 29 | # Please pay attention to numbers of desiring instances. It should fall within range given in CIDR 30 | # block of attaching subnet. Router parameter points to VPC ID. 31 | - name: Create AS Group 32 | opentelekomcloud.cloud.as_group: 33 | scaling_group: 34 | name: "{{ as_group_name }}" 35 | scaling_configuration: "{{ as_config_new.as_config.name }}" 36 | min_instance_number: 0 37 | desire_instance_number: 2 38 | max_instance_number: 4 39 | availability_zones: ["eu-de-01"] 40 | networks: [{"id": "{{ network_id }}"}] 41 | security_groups: [{"id": "{{ secgroup_id }}"}] 42 | router: "{{ router }}" 43 | delete_publicip: true 44 | delete_volume: true 45 | action: "resume" 46 | state: "present" 47 | wait: true 48 | timeout: 400 49 | register: as_group 50 | tags: 51 | - create_as_group 52 | 53 | - name: Rename AS group 54 | opentelekomcloud.cloud.as_group: 55 | scaling_group: 56 | id: "{{ as_group.as_group.id }}" 57 | name: "{{ new_as_group_name }}" 58 | max_instance_number: 4 59 | register: as_group_new 60 | 61 | - name: Get list of AS instances using AS group id 62 | opentelekomcloud.cloud.as_instance_info: 63 | scaling_group: "{{ as_group_new.as_group.id }}" 64 | register: as_inst_list 65 | tags: 66 | - get_list 67 | 68 | # Besides creating instances directly from AS group module, you can add already existing ECSs to the 69 | # AS group. Please pay attention that instances to be added must be in the same AZ as AS group. 70 | - name: Add AS instances to the AS group 71 | opentelekomcloud.cloud.as_instance: 72 | scaling_group: "{{ as_group_new.as_group.id }}" 73 | scaling_instances: 74 | - "{{ ecs1.server.id }}" 75 | - "{{ ecs2.server.id }}" 76 | action: "add" 77 | state: present 78 | register: as_instances 79 | tags: 80 | - add_instances 81 | 82 | - name: Get list of AS Instances after adding new instances 83 | opentelekomcloud.cloud.as_instance_info: 84 | scaling_group: "{{ as_group.as_group.id }}" 85 | register: as_inst_list_af 86 | -------------------------------------------------------------------------------- /plugins/modules/as_config_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: as_config_info 17 | short_description: Get AutoScaling configs 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.0.1" 20 | author: "Artem Goncharov (@gtema)" 21 | description: 22 | - Get AS config info from the OTC. 23 | options: 24 | name: 25 | description: 26 | - Name of the AS config. 27 | type: str 28 | image_id: 29 | description: 30 | - ID of the image to filter results. 31 | type: str 32 | requirements: ["openstacksdk", "otcextensions"] 33 | ''' 34 | 35 | RETURN = ''' 36 | as_configs: 37 | description: List of dictionaries describing AutoScaling Configs. 38 | type: complex 39 | returned: On Success. 40 | contains: 41 | id: 42 | description: Unique UUID. 43 | type: str 44 | sample: "39007a7e-ee4f-4d13-8283-b4da2e037c69" 45 | name: 46 | description: Name (version) of the datastore. 47 | type: str 48 | sample: "10.0" 49 | ''' 50 | 51 | EXAMPLES = ''' 52 | # Get configs versions. 53 | - as_config_info: 54 | register: as 55 | 56 | - as_config_info: 57 | name: my_fake_config 58 | register: as 59 | ''' 60 | 61 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 62 | 63 | 64 | class AutoScalingConfigInfoModule(OTCModule): 65 | argument_spec = dict( 66 | name=dict(required=False), 67 | image_id=dict(required=False) 68 | ) 69 | module_kwargs = dict( 70 | supports_check_mode=True 71 | ) 72 | 73 | def run(self): 74 | name_filter = self.params['name'] 75 | image_id_filter = self.params['image_id'] 76 | 77 | data = [] 78 | # TODO: Pass filters into SDK 79 | for raw in self.conn.auto_scaling.configs(): 80 | if name_filter and raw.name != name_filter: 81 | continue 82 | if (image_id_filter 83 | and raw.instance_config['image_id'] != image_id_filter): 84 | continue 85 | dt = raw.to_dict() 86 | dt.pop('location') 87 | data.append(dt) 88 | 89 | self.exit( 90 | changed=False, 91 | as_configs=data 92 | ) 93 | 94 | 95 | def main(): 96 | module = AutoScalingConfigInfoModule() 97 | module() 98 | 99 | 100 | if __name__ == '__main__': 101 | main() 102 | -------------------------------------------------------------------------------- /plugins/modules/waf_certificate_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: waf_certificate_info 17 | short_description: Get WAF certificate info 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.0.3" 20 | author: "Artem Goncharov (@gtema)" 21 | description: 22 | - Get WAF Certificate info from the OTC or list all certificates. 23 | options: 24 | name: 25 | description: 26 | - Name or ID of the certificate. 27 | type: str 28 | requirements: ["openstacksdk", "otcextensions"] 29 | ''' 30 | 31 | RETURN = ''' 32 | waf_certificate_info: 33 | description: List of dictionaries describing Certificates matching query. 34 | type: complex 35 | returned: On Success. 36 | contains: 37 | id: 38 | description: Unique UUID. 39 | type: str 40 | sample: "39007a7e-ee4f-4d13-8283-b4da2e037c69" 41 | name: 42 | description: Certificate name 43 | type: str 44 | timestamp: 45 | description: Certificate upload timestamp 46 | type: int 47 | expire_time: 48 | description: Expiration timestamp 49 | type: int 50 | ''' 51 | 52 | EXAMPLES = ''' 53 | # Get Certificates. 54 | - waf_certificate_info: 55 | name: SDK-Daccde21b17b7d4617bb7d4617b 56 | register: cert 57 | ''' 58 | 59 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 60 | 61 | 62 | class WafCertificateInfoModule(OTCModule): 63 | argument_spec = dict( 64 | name=dict(required=False), 65 | ) 66 | module_kwargs = dict( 67 | supports_check_mode=True 68 | ) 69 | 70 | otce_min_version = '0.8.0' 71 | 72 | def run(self): 73 | 74 | data = [] 75 | 76 | if self.params['name']: 77 | raw = self.conn.waf.find_certificate( 78 | self.params['name'], ignore_missing=True) 79 | if raw: 80 | dt = raw.to_dict() 81 | dt.pop('location') 82 | data.append(dt) 83 | else: 84 | for raw in self.conn.waf.certificates(): 85 | dt = raw.to_dict() 86 | dt.pop('location') 87 | data.append(dt) 88 | 89 | self.exit( 90 | changed=False, 91 | waf_certificates=data 92 | ) 93 | 94 | 95 | def main(): 96 | module = WafCertificateInfoModule() 97 | module() 98 | 99 | 100 | if __name__ == '__main__': 101 | main() 102 | -------------------------------------------------------------------------------- /plugins/modules/as_group_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: as_group_info 17 | short_description: Get AutoScaling groups 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.0.1" 20 | author: "Artem Goncharov (@gtema)" 21 | description: 22 | - Get details about AutoScaling groups available in the project. 23 | options: 24 | name: 25 | description: 26 | - Name of the AS group. 27 | type: str 28 | status: 29 | description: 30 | - Status of the group. 31 | choices: ['inservice', 'paused', 'error', 'deleting'] 32 | type: str 33 | requirements: ["openstacksdk", "otcextensions"] 34 | ''' 35 | 36 | RETURN = ''' 37 | as_groups: 38 | description: List of dictionaries describing AS groups version. 39 | type: complex 40 | returned: On Success. 41 | contains: 42 | id: 43 | description: Unique UUID. 44 | type: str 45 | sample: "39007a7e-ee4f-4d13-8283-b4da2e037c69" 46 | name: 47 | description: Name (version) of the datastore. 48 | type: str 49 | sample: "10.0" 50 | ''' 51 | 52 | EXAMPLES = ''' 53 | # Get configs versions. 54 | - as_group_info: 55 | name: my_prod_as_group 56 | register: data 57 | ''' 58 | 59 | 60 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 61 | 62 | 63 | class AutoScalingGroupInfoModule(OTCModule): 64 | 65 | argument_spec = dict( 66 | name=dict(required=False), 67 | status=dict(required=False, choices=[ 68 | 'inservice', 'paused', 'error', 'deleting']) 69 | ) 70 | module_kwargs = dict( 71 | supports_check_mode=True 72 | ) 73 | 74 | def run(self): 75 | 76 | name_filter = self.params['name'] 77 | status_filter = self.params['status'] 78 | 79 | data = [] 80 | # TODO: Pass filters into SDK 81 | attrs = {} 82 | if name_filter: 83 | attrs['scaling_groups_name'] = name_filter 84 | if status_filter: 85 | attrs['scaling_group_status'] = status_filter.upper() 86 | for raw in self.conn.auto_scaling.groups(**attrs): 87 | dt = raw.to_dict() 88 | dt.pop('location') 89 | data.append(dt) 90 | 91 | self.exit_json( 92 | changed=False, 93 | as_groups=data 94 | ) 95 | 96 | 97 | def main(): 98 | module = AutoScalingGroupInfoModule() 99 | module() 100 | 101 | 102 | if __name__ == '__main__': 103 | main() 104 | -------------------------------------------------------------------------------- /plugins/modules/dds_flavor_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Unless required by applicable law or agreed to in writing, software 3 | # distributed under the License is distributed on an "AS IS" BASIS, 4 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5 | # See the License for the specific language governing permissions, 6 | # limitations under the License. 7 | 8 | DOCUMENTATION = ''' 9 | module: dds_flavor_info 10 | short_description: Obtain flavor type information about a specified region and DB type. 11 | extends_documentation_fragment: opentelekomcloud.cloud.otc 12 | version_added: "0.9.0" 13 | author: "Yustina Kvrivishvili (@YustinaKvr)" 14 | description: 15 | - Get DDS flavor info 16 | options: 17 | region: 18 | description: 19 | - Specifies the region where the DB instance exists. 20 | type: str 21 | required: true 22 | engine_name: 23 | description: 24 | - Specifies the database type. The value is DDS-Community. 25 | type: str 26 | required: false 27 | default: 'DDS-Community' 28 | requirements: ["openstacksdk", "otcextensions"] 29 | ''' 30 | 31 | RETURN = ''' 32 | flavors: 33 | description: Info about flavor. 34 | returned: On Success 35 | type: complex 36 | contains: 37 | az_status: 38 | description: Indicates the status of specifications in an AZ. 39 | type: list 40 | engine_name: 41 | description: Indicates the engine name. 42 | type: str 43 | id: 44 | description: Datastore version. 45 | type: str 46 | name: 47 | description: Name of the datastore. 48 | type: str 49 | ram: 50 | description: Indicates the memory size in gigabyte (GB). 51 | type: str 52 | spec_code: 53 | description: Indicates the resource specifications code. 54 | type: str 55 | type: 56 | description: Indicates the node type. 57 | type: str 58 | vcpus: 59 | description: Number of vCPUs. 60 | type: str 61 | ''' 62 | 63 | EXAMPLES = ''' 64 | # Get info about flavor 65 | - opentelekomcloud.cloud.dds_flavor_info: 66 | region: "eu-de" 67 | register: result 68 | ''' 69 | 70 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 71 | 72 | 73 | class DDSFlavorInfo(OTCModule): 74 | argument_spec = dict( 75 | region=dict(required=True), 76 | engine_name=dict(default='DDS-Community'), 77 | ) 78 | module_kwargs = dict( 79 | supports_check_mode=True 80 | ) 81 | 82 | def run(self): 83 | region = self.params['region'] 84 | engine_name = self.params['engine_name'] 85 | 86 | data = [] 87 | for raw in self.conn.dds.flavors(region=region, engine_name=engine_name): 88 | dt = raw.to_dict() 89 | dt.pop('location') 90 | data.append(dt) 91 | 92 | self.exit( 93 | changed=False, 94 | flavors=data 95 | ) 96 | 97 | 98 | def main(): 99 | module = DDSFlavorInfo() 100 | module() 101 | 102 | 103 | if __name__ == '__main__': 104 | main() 105 | -------------------------------------------------------------------------------- /plugins/modules/dns_nameserver_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | module: dns_nameserver_info 16 | short_description: Get info about DNS nameservers. 17 | extends_documentation_fragment: opentelekomcloud.cloud.otc 18 | version_added: "0.12.2" 19 | author: "Anton Sidelnikov (@anton-sidelnikov)" 20 | description: 21 | - Get DNS nameservers info from the OTC. 22 | options: 23 | zone: 24 | description: 25 | - ID or name of the required zone. If name had been provided, only public zone could be\ 26 | returned. If private zone is required, only ID should be passed. 27 | type: str 28 | required: true 29 | requirements: ["openstacksdk", "otcextensions"] 30 | ''' 31 | 32 | RETURN = ''' 33 | nameservers: 34 | description: List of dictionaries describing nameservers. 35 | type: complex 36 | returned: On Success. 37 | contains: 38 | hostname: 39 | description: Host name of a name server. 40 | type: str 41 | sample: "ns1.example.com." 42 | address: 43 | description: IP address of a DNS server (Private Zone only). 44 | type: str 45 | sample: "100.125.0.81" 46 | priority: 47 | description: Priority of a name server. 48 | type: int 49 | ''' 50 | 51 | EXAMPLES = ''' 52 | # Get info about choosen DNS recordset. 53 | - opentelekomcloud.cloud.dns_nameserver_info: 54 | zone: "ff80808275f5fc0f017e886898315ee9" 55 | register: nameservers 56 | ''' 57 | 58 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 59 | 60 | 61 | class DNSNameserverInfoModule(OTCModule): 62 | 63 | argument_spec = dict( 64 | zone=dict(required=True), 65 | ) 66 | module_kwargs = dict( 67 | supports_check_mode=True, 68 | ) 69 | 70 | def run(self): 71 | 72 | data = [] 73 | query = {} 74 | 75 | if self.params['zone']: 76 | try: 77 | query['zone'] = self.conn.dns.find_zone( 78 | name_or_id=self.params['zone'], ignore_missing=False).id 79 | except self.sdk.exceptions.ResourceNotFound: 80 | self.fail_json(msg="Zone not found") 81 | 82 | for raw in self.conn.dns.nameservers(**query): 83 | dt = raw.to_dict() 84 | dt.pop('location') 85 | dt.pop('name') 86 | dt.pop('id') 87 | data.append(dt) 88 | 89 | self.exit( 90 | changed=False, 91 | nameservers=data 92 | ) 93 | 94 | 95 | def main(): 96 | module = DNSNameserverInfoModule() 97 | module() 98 | 99 | 100 | if __name__ == '__main__': 101 | main() 102 | -------------------------------------------------------------------------------- /tests/integration/targets/subnet/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Subnet tests 3 | module_defaults: 4 | opentelekomcloud.cloud.vpc: 5 | cloud: "{{ test_cloud }}" 6 | opentelekomcloud.cloud.subnet: 7 | cloud: "{{ test_cloud }}" 8 | 9 | block: 10 | - name: Set random prefix 11 | ansible.builtin.set_fact: 12 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 13 | 14 | - name: Set initial facts 15 | ansible.builtin.set_fact: 16 | vpc_name: "{{ ( prefix + '_vpc') }}" 17 | subnet_name: "test-subnet" 18 | cidr: "192.168.0.0/24" 19 | gateway: "192.168.0.1" 20 | 21 | - name: Create VPC 22 | opentelekomcloud.cloud.vpc: 23 | name: "{{ vpc_name }}" 24 | cidr: "{{ cidr }}" 25 | register: vpc 26 | 27 | - name: Create subnet 28 | opentelekomcloud.cloud.subnet: 29 | name: "{{ subnet_name }}" 30 | description: "Subnet example" 31 | vpc: "{{ vpc_name }}" 32 | cidr: "{{ cidr }}" 33 | gateway_ip: "{{ gateway }}" 34 | dns_list: 35 | - "100.125.4.25" 36 | - "100.125.129.199" 37 | register: subnet 38 | 39 | - name: Assert result 40 | ansible.builtin.assert: 41 | that: 42 | - subnet is success 43 | - subnet is changed 44 | - subnet.subnet is defined 45 | 46 | - name: Check created subnet 47 | opentelekomcloud.cloud.subnet: 48 | name: "{{ subnet_name }}" 49 | description: "Subnet example" 50 | vpc: "{{ vpc_name }}" 51 | cidr: "{{ cidr }}" 52 | gateway_ip: "{{ gateway }}" 53 | dns_list: 54 | - "100.125.4.25" 55 | - "100.125.129.199" 56 | check_mode: true 57 | register: subnet_check_mode 58 | 59 | - name: Assert check result 60 | ansible.builtin.assert: 61 | that: 62 | - subnet_check_mode is success 63 | - subnet_check_mode is not changed 64 | - subnet_check_mode.subnet is defined 65 | 66 | - name: Update subnet 67 | opentelekomcloud.cloud.subnet: 68 | name: "{{ subnet_name }}" 69 | vpc: "{{ vpc_name }}" 70 | dns_list: 71 | - "100.125.4.25" 72 | - "100.125.129.199" 73 | dhcp_enable: false 74 | register: updated_subnet 75 | 76 | - name: Assert result 77 | ansible.builtin.assert: 78 | that: 79 | - updated_subnet is success 80 | - updated_subnet is changed 81 | - updated_subnet.subnet is defined 82 | 83 | always: 84 | - name: Cleanup 85 | block: 86 | - name: Delete subnet 87 | opentelekomcloud.cloud.subnet: 88 | name: "{{ subnet_name }}" 89 | vpc: "{{ vpc_name }}" 90 | state: absent 91 | register: removed 92 | until: removed is not failed 93 | ignore_errors: true 94 | retries: 10 95 | 96 | - name: Delete VPC 97 | opentelekomcloud.cloud.vpc: 98 | name: "{{ vpc_name }}" 99 | state: absent 100 | register: removed 101 | until: removed is not failed 102 | ignore_errors: true 103 | retries: 10 104 | -------------------------------------------------------------------------------- /plugins/modules/dms_queue_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | module: dms_queue_info 16 | short_description: Get info about DMS queues 17 | extends_documentation_fragment: opentelekomcloud.cloud.otc 18 | version_added: "0.1.2" 19 | author: "Sebastian Gode (@SebastianGode)" 20 | description: 21 | - Get info about DMS queues 22 | options: 23 | queue: 24 | description: 25 | - Name or ID of a target queue. Leave it empty to query all queues. 26 | type: str 27 | required: false 28 | requirements: ["openstacksdk", "otcextensions"] 29 | ''' 30 | 31 | RETURN = ''' 32 | dms_queues: 33 | description: Dictionary of Queues 34 | returned: changed 35 | type: list 36 | sample: [ 37 | { 38 | "created": 1517385090349, 39 | "description": "", 40 | "id": "12345678-73e4-449f-a157-53d5d9900e21", 41 | "max_consume_count": null, 42 | "name": "test-test", 43 | "queue_mode": "NORMAL", 44 | "redrive_policy": null, 45 | "retention_hours": null 46 | } 47 | ] 48 | ''' 49 | 50 | EXAMPLES = ''' 51 | # Query a single DMS Queue 52 | - opentelekomcloud.cloud.dms_queue_info: 53 | queue: 'test-test' 54 | register: dms-queue 55 | ''' 56 | 57 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 58 | 59 | 60 | class DmsQueueInfoModule(OTCModule): 61 | argument_spec = dict( 62 | queue=dict(required=False) 63 | ) 64 | module_kwargs = dict( 65 | supports_check_mode=True 66 | ) 67 | 68 | def run(self): 69 | 70 | data = [] 71 | 72 | if self.params['queue']: 73 | queue = self.conn.dms.find_queue( 74 | name_or_id=self.params['queue'] 75 | ) 76 | if queue: 77 | dt = queue.to_dict() 78 | dt.pop('location') 79 | data.append(dt) 80 | else: 81 | self.exit( 82 | changed=False, 83 | failed=True, 84 | message=('No Queue found with ID or Name: %s' % 85 | self.params['queue']) 86 | ) 87 | else: 88 | for raw in self.conn.dms.queues(): 89 | dt = raw.to_dict() 90 | dt.pop('location') 91 | data.append(dt) 92 | 93 | self.exit( 94 | changed=False, 95 | dms_queues=data 96 | ) 97 | 98 | 99 | def main(): 100 | module = DmsQueueInfoModule() 101 | module() 102 | 103 | 104 | if __name__ == '__main__': 105 | main() 106 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_repository_permissions/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR repository permissions tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_repository_permissions: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | organization_name: "{{ ( 'org_' + prefix) }}" 14 | repository_name: "{{ ( 'repo_' + prefix) }}" 15 | user_id: "cfe93b289ece46cd84a22b17c4e6671e" 16 | user_name: "test_user" 17 | 18 | - name: Create organization 19 | opentelekomcloud.cloud.swr_organization: 20 | namespace: "{{ organization_name }}" 21 | register: organization 22 | 23 | - name: Assert result 24 | ansible.builtin.assert: 25 | that: 26 | - organization is success 27 | 28 | - name: Create repository in this organization 29 | opentelekomcloud.cloud.swr_repository: 30 | namespace: "{{ organization_name }}" 31 | repository: "{{ repository_name }}" 32 | register: repository 33 | 34 | - name: Assert result 35 | ansible.builtin.assert: 36 | that: 37 | - repository is success 38 | - repository is changed 39 | 40 | - name: Create user permission in this repository 41 | opentelekomcloud.cloud.swr_repository_permissions: 42 | namespace: "{{ organization_name }}" 43 | repository: "{{ repository_name }}" 44 | user_id: "{{ user_id }}" 45 | user_name: "{{ user_name }}" 46 | user_auth: 7 47 | register: permission 48 | 49 | - name: Assert result 50 | ansible.builtin.assert: 51 | that: 52 | - permission is success 53 | - permission is changed 54 | 55 | - name: Update user permission in this repository 56 | opentelekomcloud.cloud.swr_repository_permissions: 57 | namespace: "{{ organization_name }}" 58 | repository: "{{ repository_name }}" 59 | user_id: "{{ user_id }}" 60 | user_name: "{{ user_name }}" 61 | user_auth: 1 62 | register: permission 63 | 64 | - name: Assert result 65 | ansible.builtin.assert: 66 | that: 67 | - permission is success 68 | - permission is changed 69 | 70 | - name: Delete user permission in this repository 71 | opentelekomcloud.cloud.swr_repository_permissions: 72 | namespace: "{{ organization_name }}" 73 | repository: "{{ repository_name }}" 74 | user_id: "{{ user_id }}" 75 | user_name: "{{ user_name }}" 76 | state: absent 77 | register: permission 78 | 79 | - name: Assert result 80 | ansible.builtin.assert: 81 | that: 82 | - permission is success 83 | - permission is changed 84 | 85 | always: 86 | - name: Delete this repository 87 | opentelekomcloud.cloud.swr_repository: 88 | namespace: "{{ organization_name }}" 89 | repository: "{{ repository_name }}" 90 | state: absent 91 | failed_when: false 92 | 93 | - name: Delete organization 94 | opentelekomcloud.cloud.swr_organization: 95 | namespace: "{{ organization_name }}" 96 | state: absent 97 | failed_when: false 98 | -------------------------------------------------------------------------------- /examples/playbooks/6_loadbalancer.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # This loadbalancer would be attached to the couple of ECSs united into one backend server group. 6 | - name: Create loadbalancer for cluster 7 | opentelekomcloud.cloud.loadbalancer: 8 | state: present 9 | auto_public_ip: true 10 | name: "{{ lb_name }}" 11 | vip_subnet: "{{ vpc_subnet_name }}" 12 | register: lb 13 | 14 | # This module just integrate public and private keys into certificate for listener. Both public 15 | # and private keys you should obtain before on third-party resources, for instance, Letsencrypt, 16 | # and put in available for Ansible engine place. 17 | - name: Create certificate for HTTPS connections 18 | opentelekomcloud.cloud.lb_certificate: 19 | name: "elb_https_cert" 20 | type: "server" 21 | content: "/home/user/files/rootCA.pem" 22 | private_key: "/home/user/files/rootCA.key" 23 | register: elb_cert 24 | 25 | # For every type of protocol you can create its own listener. In case of HTTP listener, please pay 26 | # attention on your subnet addresses pool, it must be sufficient for all the instances including 27 | # listener itself. 28 | - name: Create listener for HTTPS traffic 29 | opentelekomcloud.cloud.lb_listener: 30 | name: "{{ listener_https_name }}" 31 | protocol: terminated_https 32 | protocol_port: 443 33 | loadbalancer: "{{ lb.loadbalancer.id }}" 34 | default_tls_container_ref: "{{ elb_cert.elb_certificate.id }}" 35 | register: listener_https 36 | 37 | # This backend server group will contain multiple ECSs. Here we use roundrobin algorithm, as we use http protocol, 38 | # but you can choose source_ip or least_connection. 39 | - name: Create backend server group 40 | opentelekomcloud.cloud.lb_pool: 41 | state: present 42 | name: "{{ backend_server_name }}" 43 | protocol: http 44 | lb_algorithm: round_robin 45 | listener: "{{ listener_https }}" 46 | loadbalancer: "{{ lb.loadbalancer.id }}" 47 | register: backend 48 | 49 | - name: Add first to the backend server group 50 | opentelekomcloud.cloud.lb_member: 51 | name: "{{ ecs1_name }}" 52 | address: "10.10.0.18" 53 | protocol_port: 443 54 | subnet: "{{ vpc_subnet_name }}" 55 | pool: "{{ backend.server_group.id }}" 56 | register: bcknd_1 57 | 58 | - name: Add second server to the backend server group 59 | opentelekomcloud.cloud.lb_member: 60 | name: "{{ ecs2_name }}" 61 | address: "10.10.0.23" 62 | protocol_port: 443 63 | subnet: "{{ vpc_subnet_name }}" 64 | pool: "{{ backend_group_id }}" 65 | register: bcknd_2 66 | 67 | # After setting up an backend server group, it's highly recommend that you attach health check 68 | # monitoring to it. 69 | - name: Add HTTPS health check for the backend server group 70 | opentelekomcloud.cloud.lb_healthmonitor: 71 | name: "{{ health_https_name }}" 72 | state: present 73 | delay: 9 74 | max_retries: 3 75 | pool: "{{ backend_group_id }}" 76 | monitor_timeout: 5 77 | type: http 78 | monitor_port: 443 79 | expected_codes: 200 80 | http_method: get 81 | register: https_health 82 | -------------------------------------------------------------------------------- /tests/integration/targets/swr_domain/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: SWR domain tests 3 | module_defaults: 4 | opentelekomcloud.cloud.swr_domain: 5 | cloud: "{{ test_cloud }}" 6 | block: 7 | - name: Set random prefix 8 | ansible.builtin.set_fact: 9 | prefix: "{{ 99999999 | random | to_uuid | hash('md5') }}" 10 | 11 | - name: Set initial facts 12 | ansible.builtin.set_fact: 13 | organization_name: "{{ ( 'org_' + prefix) }}" 14 | repository_name: "{{ ( 'repo_' + prefix) }}" 15 | 16 | - name: Create organization 17 | opentelekomcloud.cloud.swr_organization: 18 | namespace: "{{ organization_name }}" 19 | register: organization 20 | 21 | - name: Assert result 22 | ansible.builtin.assert: 23 | that: 24 | - organization is success 25 | 26 | - name: Create repository in this organization 27 | opentelekomcloud.cloud.swr_repository: 28 | namespace: "{{ organization_name }}" 29 | repository: "{{ repository_name }}" 30 | register: repository 31 | 32 | - name: Assert result 33 | ansible.builtin.assert: 34 | that: 35 | - repository is success 36 | 37 | - name: Create domain in this repository 38 | opentelekomcloud.cloud.swr_domain: 39 | namespace: "{{ organization_name }}" 40 | repository: "{{ repository_name }}" 41 | access_domain: "{{ domain_name }}" 42 | description: "some" 43 | register: domain 44 | 45 | - name: Assert result 46 | ansible.builtin.assert: 47 | that: 48 | - domain is success 49 | - domain is changed 50 | 51 | - name: Update domain in this repository 52 | opentelekomcloud.cloud.swr_domain: 53 | namespace: "{{ organization_name }}" 54 | repository: "{{ repository_name }}" 55 | access_domain: "{{ domain_name }}" 56 | description: "Some description" 57 | register: domain 58 | 59 | - name: Assert result 60 | ansible.builtin.assert: 61 | that: 62 | - domain is success 63 | - domain is changed 64 | 65 | always: 66 | - name: Delete domain in this repository 67 | opentelekomcloud.cloud.swr_domain: 68 | namespace: "{{ organization_name }}" 69 | repository: "{{ repository_name }}" 70 | access_domain: "{{ domain_name }}" 71 | state: absent 72 | register: domain 73 | 74 | - name: Assert result 75 | ansible.builtin.assert: 76 | that: 77 | - domain is success 78 | - domain is changed 79 | 80 | - name: Delete this repository 81 | opentelekomcloud.cloud.swr_repository: 82 | namespace: "{{ organization_name }}" 83 | repository: "{{ repository_name }}" 84 | state: absent 85 | register: repository 86 | 87 | - name: Assert result 88 | ansible.builtin.assert: 89 | that: 90 | - repository is success 91 | - repository is changed 92 | 93 | - name: Delete organization 94 | opentelekomcloud.cloud.swr_organization: 95 | namespace: "{{ organization_name }}" 96 | state: absent 97 | register: organization 98 | 99 | - name: Assert result 100 | ansible.builtin.assert: 101 | that: 102 | - organization is success 103 | -------------------------------------------------------------------------------- /examples/playbooks/3_autoscaling.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | tasks: 4 | 5 | # Keypair is mandatory condition for creating and modifying AS configurations and groups. Be avoid 6 | # of accidental deleting of this entity, because in this case you'll lost control on your AS 7 | # entities. 8 | - name: Create new keypair for accessing AS config 9 | openstack.cloud.keypair: 10 | name: "{{ keypair_name }}" 11 | register: kp 12 | tags: 13 | - create_keypair 14 | 15 | # You're able to create a new AS config based on existing ECS, using it as a template. For this, 16 | # point ECS's id as a parameter. Here is example of a new AS config, taken from scratch. 17 | - name: Create new AS config 18 | opentelekomcloud.cloud.as_config: 19 | scaling_configuration: "{{ as_new_config_name }}" 20 | key_name: "{{ keypair_name }}" 21 | image: "Standard_CentOS_7_latest" 22 | flavor: "s3.medium.1" 23 | disk: 24 | - size: 10 25 | volume_type: 'SAS' 26 | disk_type: 'SYS' 27 | register: as_config_new 28 | tags: 29 | - create_as_config 30 | 31 | # Please pay attention to numbers of desiring instances. It should fall within range given in CIDR 32 | # block of attaching subnet. Router parameter points to VPC ID. 33 | - name: Create AS Group 34 | opentelekomcloud.cloud.as_group: 35 | scaling_group: 36 | name: "{{ as_group_name }}" 37 | scaling_configuration: "{{ as_config_new.as_config.name }}" 38 | min_instance_number: 0 39 | desire_instance_number: 2 40 | max_instance_number: 4 41 | availability_zones: ["eu-de-01"] 42 | networks: [{"id": "{{ network_id }}"}] 43 | security_groups: [{"id": "{{ secgroup_id }}"}] 44 | router: "{{ router }}" 45 | delete_publicip: true 46 | delete_volume: true 47 | action: "resume" 48 | state: "present" 49 | wait: true 50 | timeout: 400 51 | register: as_group 52 | tags: 53 | - create_as_group 54 | 55 | - name: Rename AS group 56 | opentelekomcloud.cloud.as_group: 57 | scaling_group: 58 | id: "{{ as_group.as_group.id }}" 59 | name: "{{ new_as_group_name }}" 60 | max_instance_number: 4 61 | register: as_group_new 62 | 63 | - name: Get list of AS instances using AS group id 64 | opentelekomcloud.cloud.as_instance_info: 65 | scaling_group: "{{ as_group_new.as_group.id }}" 66 | register: as_inst_list 67 | tags: 68 | - get_list 69 | 70 | # Besides creating instances directly from AS group module, you can add already existing ECSs to the 71 | # AS group. Please pay attention that instances to be added must be in the same AZ as AS group. 72 | - name: Add AS instances to the AS group 73 | opentelekomcloud.cloud.as_instance: 74 | scaling_group: "{{ as_group_new.as_group.id }}" 75 | scaling_instances: 76 | - "{{ ecs1.server.id }}" 77 | - "{{ ecs2.server.id }}" 78 | action: "add" 79 | state: present 80 | register: as_instances 81 | tags: 82 | - add_instances 83 | 84 | - name: Get list of AS Instances after adding new instances 85 | opentelekomcloud.cloud.as_instance_info: 86 | scaling_group: "{{ as_group.as_group.id }}" 87 | register: as_inst_list_af 88 | -------------------------------------------------------------------------------- /zuul.yaml: -------------------------------------------------------------------------------- 1 | # yamllint disable 2 | --- 3 | - project: 4 | merge-mode: squash-merge 5 | templates: 6 | - ansible-collection 7 | vars: 8 | ansible_collection_namespace: "opentelekomcloud" 9 | ansible_collection_name: "cloud" 10 | check: 11 | jobs: 12 | - otc-ansible-collection-test-integration-eu-de: 13 | nodeset: ubuntu-jammy 14 | files: &integration-files 15 | - ^plugins/ 16 | - ^tests/integration/ 17 | vars: &vars-eu-de 18 | python_version: "3.10" 19 | ansible_test_integration_env: 20 | ANSIBLE_TEST_PYTHON_VERSION: "3.10" 21 | has_snat: true 22 | region: eu-de 23 | ansible_test_exclude_tests: 24 | - autoscaling/group1/ 25 | - elb/group1/ 26 | - obs/group1/ 27 | - swr/group2/ 28 | - otc-ansible-collection-test-integration-eu-nl: 29 | nodeset: ubuntu-jammy 30 | files: *integration-files 31 | vars: &vars-eu-nl 32 | python_version: "3.10" 33 | ansible_test_integration_env: 34 | ANSIBLE_TEST_PYTHON_VERSION: "3.10" 35 | has_snat: false 36 | region: eu-nl 37 | deh_host_type: s3 38 | deh_az: eu-nl-01 39 | # CES is too slow in NL (used also in AS test) 40 | # no public DNS mgmt 41 | # obs needs tweaks 42 | # elbv2 not available 43 | # no VBS 44 | ansible_test_exclude_tests: 45 | - autoscaling/group1/ 46 | - ces/group1/ 47 | - dns/public/ 48 | - elb/group1/ 49 | - obs/group1/ 50 | - storage/vbs/ 51 | - swr/group1/ 52 | - swr/group2/ 53 | - otc-ansible-collection-test-integration-eu-ch: 54 | nodeset: ubuntu-jammy 55 | files: *integration-files 56 | vars: &vars-eu-ch 57 | python_version: "3.10" 58 | ansible_test_integration_env: 59 | ANSIBLE_TEST_PYTHON_VERSION: "3.10" 60 | has_snat: false 61 | region: eu-ch2 62 | ansible_test_exclude_tests: 63 | - autoscaling/group1/ 64 | - antiddos/group1/ 65 | - ces/group1/ 66 | - css/group1/ 67 | - dds/group1/ 68 | - deh/group1/ 69 | - dms/group1/ 70 | - dns/public/ 71 | - elb/group1/ 72 | - obs/group1/ 73 | - rds_flavor_info/group1/ 74 | - storage/vbs/ 75 | - swr/group1/ 76 | - swr/group2/ 77 | - waf/group1/ 78 | gate: 79 | jobs: 80 | - otc-ansible-collection-test-integration-eu-de: 81 | nodeset: ubuntu-jammy 82 | files: *integration-files 83 | vars: *vars-eu-de 84 | - otc-ansible-collection-test-integration-eu-nl: 85 | nodeset: ubuntu-jammy 86 | files: *integration-files 87 | vars: *vars-eu-nl 88 | - otc-ansible-collection-test-integration-eu-ch: 89 | nodeset: ubuntu-jammy 90 | files: *integration-files 91 | vars: *vars-eu-ch 92 | -------------------------------------------------------------------------------- /plugins/modules/dns_zone_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | module: dns_zone_info 16 | short_description: Get DNS Zones info 17 | extends_documentation_fragment: opentelekomcloud.cloud.otc 18 | version_added: "0.13.1" 19 | author: "Vladimir Vshivkov (@vladimirvshivkov)" 20 | description: 21 | - Get DNS Zones info from the OTC. 22 | options: 23 | name: 24 | description: 25 | - Zone Name 26 | type: str 27 | required: true 28 | zone_type: 29 | description: 30 | - Zone Type, either public or private 31 | type: str 32 | 33 | requirements: ["openstacksdk", "otcextensions"] 34 | ''' 35 | 36 | RETURN = ''' 37 | zone: 38 | description: Modify DNS Zones 39 | type: complex 40 | returned: On Success. 41 | contains: 42 | description: 43 | description: Description of the Zone 44 | type: str 45 | sample: "MyZone123" 46 | email: 47 | description: assigned E-Mail of the Zone 48 | type: str 49 | sample: "mail@mail.com" 50 | id: 51 | description: Zone ID 52 | type: str 53 | sample: "fe80804323f2065d0175980e81617c10" 54 | name: 55 | description: Name of the zone 56 | type: str 57 | sample: "test.test2." 58 | router: 59 | description: Assigned VPC 60 | type: list 61 | sample: "[ 62 | router_id: 79c32783-e560-4e3a-95b1-5a0756441e12, 63 | router_region: eu-de, 64 | status: PENDING_CREATE 65 | ]" 66 | status: 67 | description: Resource status 68 | type: str 69 | sample: "PENDING_CREATE" 70 | ttl: 71 | description: Cache duration (in second) on a local DNS server 72 | type: int 73 | sample: 300 74 | zone_type: 75 | description: Zone Type, either public or private 76 | type: str 77 | sample: "private" 78 | ''' 79 | 80 | EXAMPLES = ''' 81 | # Get a Zone: 82 | - name: Testing 83 | opentelekomcloud.cloud.dns_zone_info: 84 | name: "test.com." 85 | zone_type: private 86 | ''' 87 | 88 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 89 | 90 | 91 | class DNSZonesInfoModule(OTCModule): 92 | argument_spec = dict( 93 | name=dict(required=True), 94 | zone_type=dict() 95 | ) 96 | module_kwargs = dict( 97 | supports_check_mode=True 98 | ) 99 | 100 | def run(self): 101 | query = { 102 | 'type': self.params['zone_type'], 103 | 'name_or_id': self.params['name'] 104 | } 105 | 106 | zone = self.conn.dns.find_zone(**query) 107 | self.exit(changed=True, zone=zone.to_dict()) 108 | 109 | 110 | def main(): 111 | module = DNSZonesInfoModule() 112 | module() 113 | 114 | 115 | if __name__ == '__main__': 116 | main() 117 | -------------------------------------------------------------------------------- /plugins/modules/vpc_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: vpc_info 17 | short_description: Get vpc info from OpenTelekomCloud 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.11.1" 20 | author: "Polina Gubina(@polina-gubina)" 21 | description: 22 | - Get vpc from the OTC. 23 | options: 24 | name_or_id: 25 | description: 26 | - Name or id of the vpc. 27 | type: str 28 | requirements: ["openstacksdk", "otcextensions"] 29 | ''' 30 | 31 | RETURN = ''' 32 | vpcs: 33 | description: Dictionary describing vpcs. 34 | type: complex 35 | returned: On Success. 36 | contains: 37 | id: 38 | description: Specifies the ID of the vpc. 39 | type: str 40 | sample: "39007a7e-ee4f-4d13-8283-b4da2e037c69" 41 | name: 42 | description: Specifies the vpc name. 43 | type: str 44 | sample: "vpc-test" 45 | description: 46 | description: Provides supplementary information about the vpc. 47 | type: str 48 | sample: "vpc for testing" 49 | cidr: 50 | description: Specifies the available IP address ranges for subnets in the VPC. 51 | type: str 52 | sample: "10.0.0.0/8" 53 | status: 54 | description: Specifies the VPC status. 55 | type: str 56 | sample: "CREATING" 57 | routes: 58 | description: Specifies the route information. 59 | type: list 60 | enable_shared_snat: 61 | description: Specifies whether the shared SNAT function is enabled. The value true\ 62 | indicates that the function is enabled, and the value false indicates that the function is not enabled. 63 | type: bool 64 | ''' 65 | 66 | EXAMPLES = ''' 67 | # Get all vpcs 68 | - opentelekomcloud.cloud.vpc_info: 69 | register: vpc_info 70 | ''' 71 | 72 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 73 | 74 | 75 | class VpcInfoModule(OTCModule): 76 | argument_spec = dict( 77 | name_or_id=dict(required=False) 78 | ) 79 | 80 | module_kwargs = dict( 81 | supports_check_mode=True 82 | ) 83 | 84 | def run(self): 85 | data = [] 86 | 87 | if self.params['name_or_id']: 88 | raw = self.conn.vpc.find_vpc(name_or_id=self.params['name_or_id']) 89 | dt = raw.to_dict() 90 | dt.pop('location') 91 | data.append(dt) 92 | else: 93 | for raw in self.conn.vpc.vpcs(): 94 | dt = raw.to_dict() 95 | dt.pop('location') 96 | data.append(dt) 97 | 98 | self.exit_json( 99 | changed=False, 100 | vpcs=data 101 | ) 102 | 103 | 104 | def main(): 105 | module = VpcInfoModule() 106 | module() 107 | 108 | 109 | if __name__ == '__main__': 110 | main() 111 | -------------------------------------------------------------------------------- /plugins/modules/server_group_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | module: server_group_info 16 | short_description: Lists server groups 17 | extends_documentation_fragment: opentelekomcloud.cloud.otc 18 | version_added: "0.5.0" 19 | author: "Tino Schreiber (@tischrei)" 20 | description: 21 | - List server groups 22 | requirements: ["openstacksdk", "otcextensions"] 23 | ''' 24 | 25 | RETURN = ''' 26 | server_groups: 27 | description: List of dictionaries describing server groups. 28 | type: complex 29 | returned: On Success. 30 | contains: 31 | id: 32 | description: ID of the server group 33 | type: str 34 | sample: "d90e55ba-23bd-4d97-b722-8cb6fb485d69" 35 | member_ids: 36 | description: The list of members in the server group 37 | type: list 38 | elements: str 39 | metadata: 40 | description: The metadata associated with the server group 41 | type: str 42 | name: 43 | description: Name of the server group. 44 | type: str 45 | sample: "my-sg" 46 | policies: 47 | description: The list of policies supported by the server group 48 | type: list 49 | elements: str 50 | policy: 51 | description: The policy field represents the name of the policy 52 | type: str 53 | project_id: 54 | description: The project ID who owns the server group 55 | type: str 56 | sample: "d90e55ba-23bd-4d97-b722-8cb6fb485d69" 57 | rules: 58 | description: The rules, which is a dict, can be applied to the policy 59 | type: list 60 | elements: dict 61 | user_id: 62 | description: The user ID who owns the server group 63 | type: str 64 | sample: "d90e55ba-23bd-4d97-b722-8cb6fb485d69" 65 | ''' 66 | 67 | EXAMPLES = ''' 68 | # Get all server groups of a project 69 | - opentelekomcloud.cloud.server_group_info: 70 | register: server_groups 71 | ''' 72 | 73 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 74 | 75 | 76 | class ServerGroupInfoModule(OTCModule): 77 | argument_spec = {} 78 | module_kwargs = dict( 79 | supports_check_mode=True 80 | ) 81 | 82 | def run(self): 83 | 84 | data = [] 85 | 86 | for raw in self.conn.compute.server_groups(): 87 | dt = raw.to_dict() 88 | dt.pop('location') 89 | data.append(dt) 90 | 91 | self.exit( 92 | changed=False, 93 | server_groups=data 94 | ) 95 | 96 | 97 | def main(): 98 | module = ServerGroupInfoModule() 99 | module() 100 | 101 | 102 | if __name__ == "__main__": 103 | main() 104 | -------------------------------------------------------------------------------- /plugins/modules/cce_cluster_info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | DOCUMENTATION = ''' 15 | --- 16 | module: cce_cluster_info 17 | short_description: Get information about CCE clusters 18 | extends_documentation_fragment: opentelekomcloud.cloud.otc 19 | version_added: "0.0.1" 20 | author: "Artem Goncharov (@gtema)" 21 | description: 22 | - Get CCE cluster info from the OTC. 23 | options: 24 | name: 25 | description: 26 | - Name of the cluster config. 27 | type: str 28 | status: 29 | description: 30 | - Status of the group. 31 | choices: ['available', 'creating', 'deleting'] 32 | type: str 33 | requirements: ["openstacksdk", "otcextensions"] 34 | ''' 35 | 36 | RETURN = ''' 37 | cce_clusters: 38 | description: List of dictionaries describing AS groups version. 39 | type: complex 40 | returned: On Success. 41 | contains: 42 | id: 43 | description: Unique UUID. 44 | type: str 45 | sample: "39007a7e-ee4f-4d13-8283-b4da2e037c69" 46 | metadata: 47 | description: Cluster Metadata dictionary. 48 | type: dict 49 | name: 50 | description: Cluster Name. 51 | type: str 52 | spec: 53 | description: Cluster specification dictionary. 54 | type: dict 55 | status: 56 | description: Cluster status dictionary. 57 | type: dict 58 | ''' 59 | 60 | EXAMPLES = ''' 61 | # Get configs versions. 62 | - cce_cluster_info: 63 | name: my_cluster 64 | status: available 65 | register: data 66 | ''' 67 | 68 | from ansible_collections.opentelekomcloud.cloud.plugins.module_utils.otc import OTCModule 69 | 70 | 71 | class CceClusterInfoModule(OTCModule): 72 | argument_spec = dict( 73 | name=dict(required=False), 74 | status=dict(required=False, choices=['available', 'creating', 75 | 'deleting']) 76 | ) 77 | module_kwargs = dict( 78 | supports_check_mode=True 79 | ) 80 | 81 | def run(self): 82 | 83 | name_filter = self.params['name'] 84 | status_filter = self.params['status'] 85 | 86 | data = [] 87 | for raw in self.conn.cce.clusters(): 88 | if name_filter and raw.name != name_filter: 89 | continue 90 | if status_filter and raw.status != status_filter.lower(): 91 | continue 92 | dt = raw.to_dict() 93 | dt.pop('location') 94 | dt.pop('api_version') 95 | dt.pop('kind') 96 | data.append(dt) 97 | 98 | self.exit_json( 99 | changed=False, 100 | cce_clusters=data 101 | ) 102 | 103 | 104 | def main(): 105 | module = CceClusterInfoModule() 106 | module() 107 | 108 | 109 | if __name__ == '__main__': 110 | main() 111 | --------------------------------------------------------------------------------