2015-05-05 03:42:46 +00:00
|
|
|
# TODO: Implement create storage account feature. Currently, storage_account must be manually created on azure account.
|
|
|
|
# TODO: When more granular azure operations are implemented (i.e. list disk, list cloud services, etc). Use the
|
|
|
|
# fine-grain listings to ensure higher level operations are performed.
|
|
|
|
# ============================================================
|
|
|
|
- name: test with no credentials
|
|
|
|
azure:
|
|
|
|
register: result
|
|
|
|
ignore_errors: true
|
2015-07-09 14:50:31 +00:00
|
|
|
environment:
|
|
|
|
AZURE_SUBSCRIPTION_ID: ""
|
|
|
|
AZURE_CERT_PATH: ""
|
2015-05-05 03:42:46 +00:00
|
|
|
|
|
|
|
- name: assert failure when called with no credentials
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- 'result.failed'
|
|
|
|
- 'result.msg == "No subscription_id provided. Please set ''AZURE_SUBSCRIPTION_ID'' or use the ''subscription_id'' parameter"'
|
|
|
|
|
|
|
|
# ============================================================
|
2015-07-09 14:50:31 +00:00
|
|
|
|
2015-05-05 03:42:46 +00:00
|
|
|
- name: test credentials
|
|
|
|
azure:
|
|
|
|
subscription_id: "{{ subscription_id }}"
|
|
|
|
management_cert_path: "{{ cert_path }}"
|
|
|
|
register: result
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: assert failure when called with credentials and no parameters
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- 'result.failed'
|
|
|
|
- 'result.msg == "name parameter is required for new instance"'
|
|
|
|
|
2015-07-09 14:50:31 +00:00
|
|
|
# ============================================================
|
|
|
|
- name: test with no password or ssh cert
|
|
|
|
azure:
|
|
|
|
subscription_id: "{{ subscription_id }}"
|
|
|
|
management_cert_path: "{{ cert_path }}"
|
|
|
|
name: "{{ instance_name }}"
|
|
|
|
image: "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_4-LTS-amd64-server-20140514-en-us-30GB"
|
|
|
|
storage_account: "{{ storage_account }}"
|
|
|
|
user: "{{ user }}"
|
|
|
|
role_size: "{{ role_size }}"
|
|
|
|
location: "{{ location }}"
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: assert failure when called with no password or ssh cert
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- 'result.failed'
|
|
|
|
- 'result.msg == "password or ssh_cert_path parameter is required for new instance"'
|
|
|
|
|
2015-05-05 03:42:46 +00:00
|
|
|
# ============================================================
|
|
|
|
- name: test status=Running (expected changed=true)
|
|
|
|
azure:
|
|
|
|
subscription_id: "{{ subscription_id }}"
|
|
|
|
management_cert_path: "{{ cert_path }}"
|
|
|
|
name: "{{ instance_name }}"
|
|
|
|
image: "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_4-LTS-amd64-server-20140514-en-us-30GB"
|
|
|
|
storage_account: "{{ storage_account }}"
|
|
|
|
user: "{{ user }}"
|
|
|
|
role_size: "{{ role_size }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
location: "{{ location }}"
|
|
|
|
wait: yes
|
|
|
|
state: present
|
2015-07-09 14:50:31 +00:00
|
|
|
wait_timeout: 1200
|
2015-05-05 03:42:46 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: assert state=Running (expected changed=true)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed'
|
|
|
|
- 'result.deployment.name == "{{ instance_name }}"'
|
|
|
|
- 'result.deployment.status == "Running"'
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
- name: test state=absent (expected changed=true)
|
|
|
|
azure:
|
|
|
|
subscription_id: "{{ subscription_id }}"
|
|
|
|
management_cert_path: "{{ cert_path }}"
|
|
|
|
name: "{{ instance_name }}"
|
|
|
|
wait: yes
|
|
|
|
state: absent
|
2015-07-09 14:50:31 +00:00
|
|
|
wait_timeout: 1200
|
2015-05-05 03:42:46 +00:00
|
|
|
register: result
|
2015-07-09 14:50:31 +00:00
|
|
|
|
|
|
|
- name: assert named deployment changed (expected changed=true)
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed'
|
|
|
|
- 'result.deployment.name == "{{ instance_name }}"'
|