1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/azure_rm_aks/tasks/main.yml
Sertaç Özercan 6e4a2b17de [new module] Managed Azure Container Service (AKS) (azure_rm_aks) (#35888)
* add aks module and integration tests

* linting

* update tests

* sanity check

* make some changes to AKS module

* make integration test work

* add fact

* add resource_group name

* add fact test

* fix test

* fix test

* linting

* changed line endings for facts

* output kubeconfig

* Update azure_rm_aks.py

* update integration test aliases

* update aliases

* add cloud_environment and auth_source to args

* Fix comments from Jborean93 (#3)

* update

* fix

* fix

* fix

* fix

* update doc

* fix
2018-05-16 16:08:27 -07:00

172 lines
6.9 KiB
YAML

- name: Create an AKS instance (check mode)
azure_rm_aks:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
location: eastus
dns_prefix: "aks{{ resource_group | hash('md5') | truncate(10, True, '') }}"
kubernetes_version: 1.7.7
service_principal:
client_id: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
client_secret: "{{ lookup('env', 'AZURE_SECRET') }}"
linux_profile:
admin_username: azureuser
ssh_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
agent_pool_profiles:
- name: default
count: 1
vm_size: Standard_DS1_v2
check_mode: yes
- name: Check there is no AKS created
azure_rm_aks_facts:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
register: fact
- name: Check there is no AKS created
assert:
that:
- "fact.aks | length == 0"
- name: Create an AKS instance
azure_rm_aks:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
location: eastus
dns_prefix: "aks{{ resource_group | hash('md5') | truncate(10, True, '') }}"
kubernetes_version: 1.7.7
service_principal:
client_id: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
client_secret: "{{ lookup('env', 'AZURE_SECRET') }}"
linux_profile:
admin_username: azureuser
ssh_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
agent_pool_profiles:
- name: default
count: 1
vm_size: Standard_DS1_v2
register: output
- name: Assert the AKS instance is well created
assert:
that:
- output.changed
- output.provisioning_state == 'Succeeded'
- name: Get AKS fact
azure_rm_aks_facts:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
register: fact
- name: Assert fact returns the created one
assert:
that:
- "fact.aks | length == 1"
- fact.aks[0].id == output.id
- name: Create an AKS instance (idempotent)
azure_rm_aks:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
location: eastus
dns_prefix: "aks{{ resource_group | hash('md5') | truncate(10, True, '') }}"
kubernetes_version: 1.7.7
service_principal:
client_id: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
linux_profile:
admin_username: azureuser
ssh_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
agent_pool_profiles:
- name: default
count: 1
vm_size: Standard_DS1_v2
register: output
- name: Assert idempotent
assert:
that:
- not output.changed
- name: Upgrade the AKS instance
azure_rm_aks:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
location: eastus
dns_prefix: "aks{{ resource_group | hash('md5') | truncate(10, True, '') }}"
kubernetes_version: 1.8.1
service_principal:
client_id: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
linux_profile:
admin_username: azureuser
ssh_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
agent_pool_profiles:
- name: default
count: 1
vm_size: Standard_DS1_v2
register: output
- name: Assert the AKS instance is upgraded
assert:
that:
- output.changed
- output.kubernetes_version == '1.8.1'
- name: Scale the AKS instance agent count from 1 to 2
azure_rm_aks:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
location: eastus
dns_prefix: "aks{{ resource_group | hash('md5') | truncate(10, True, '') }}"
kubernetes_version: 1.8.1
service_principal:
client_id: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
linux_profile:
admin_username: azureuser
ssh_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSPmiqkvDH1/+MDAVDZT8381aYqp73Odz8cnD5hegNhqtXajqtiH0umVg7HybX3wt1HjcrwKJovZURcIbbcDvzdH2bnYbF93T4OLXA0bIfuIp6M86x1iutFtXdpN3TTicINrmSXEE2Ydm51iMu77B08ZERjVaToya2F7vC+egfoPvibf7OLxE336a5tPCywavvNihQjL8sjgpDT5AAScjb3YqK/6VLeQ18Ggt8/ufINsYkb+9/Ji/3OcGFeflnDXq80vPUyF3u4iIylob6RSZenC38cXmQB05tRNxS1B6BXCjMRdy0v4pa7oKM2GA4ADKpNrr0RI9ed+peRFwmsclH test@ansible
agent_pool_profiles:
- name: default
count: 2
vm_size: Standard_DS1_v2
register: output
- name: Assert the AKS instance is well scaled
assert:
that:
- output.changed
- output.agent_pool_profiles[0].count == 2
- name: Delete the AKS instance
azure_rm_aks:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
state: absent
register: output
- name: Assert the AKS instance is well deleted
assert:
that:
- output.changed
- name: Delete the AKS instance (idempotent)
azure_rm_aks:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
state: absent
register: output
- name: Assert idempotent
assert:
that:
- not output.changed
- name: Get AKS fact
azure_rm_aks_facts:
name: "aks{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
register: fact
- name: Assert fact returns empty
assert:
that:
- "fact.aks | length == 0"