mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #11537 from chrismeyersfsu/azure-test
assert password or ssh key provided on new image creation
This commit is contained in:
commit
c6dde19a5e
2 changed files with 36 additions and 4 deletions
|
@ -14,8 +14,8 @@ pem_file:
|
||||||
project_id:
|
project_id:
|
||||||
|
|
||||||
# Azure Credentials
|
# Azure Credentials
|
||||||
azure_subscription_id:
|
azure_subscription_id: "{{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }}"
|
||||||
azure_cert_path:
|
azure_cert_path: "{{ lookup('env', 'AZURE_CERT_PATH') }}"
|
||||||
|
|
||||||
# GITHUB SSH private key - a path to a SSH private key for use with github.com
|
# GITHUB SSH private key - a path to a SSH private key for use with github.com
|
||||||
github_ssh_private_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa"
|
github_ssh_private_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa"
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
azure:
|
azure:
|
||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
environment:
|
||||||
|
AZURE_SUBSCRIPTION_ID: ""
|
||||||
|
AZURE_CERT_PATH: ""
|
||||||
|
|
||||||
- name: assert failure when called with no credentials
|
- name: assert failure when called with no credentials
|
||||||
assert:
|
assert:
|
||||||
|
@ -14,6 +17,7 @@
|
||||||
- 'result.msg == "No subscription_id provided. Please set ''AZURE_SUBSCRIPTION_ID'' or use the ''subscription_id'' parameter"'
|
- 'result.msg == "No subscription_id provided. Please set ''AZURE_SUBSCRIPTION_ID'' or use the ''subscription_id'' parameter"'
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
- name: test credentials
|
- name: test credentials
|
||||||
azure:
|
azure:
|
||||||
subscription_id: "{{ subscription_id }}"
|
subscription_id: "{{ subscription_id }}"
|
||||||
|
@ -27,6 +31,27 @@
|
||||||
- 'result.failed'
|
- 'result.failed'
|
||||||
- 'result.msg == "name parameter is required for new instance"'
|
- 'result.msg == "name parameter is required for new instance"'
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
- 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"'
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
- name: test status=Running (expected changed=true)
|
- name: test status=Running (expected changed=true)
|
||||||
azure:
|
azure:
|
||||||
|
@ -41,6 +66,7 @@
|
||||||
location: "{{ location }}"
|
location: "{{ location }}"
|
||||||
wait: yes
|
wait: yes
|
||||||
state: present
|
state: present
|
||||||
|
wait_timeout: 1200
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: assert state=Running (expected changed=true)
|
- name: assert state=Running (expected changed=true)
|
||||||
|
@ -56,8 +82,14 @@
|
||||||
subscription_id: "{{ subscription_id }}"
|
subscription_id: "{{ subscription_id }}"
|
||||||
management_cert_path: "{{ cert_path }}"
|
management_cert_path: "{{ cert_path }}"
|
||||||
name: "{{ instance_name }}"
|
name: "{{ instance_name }}"
|
||||||
#storage_account: "{{ storage_account }}"
|
|
||||||
#location: "{{ location }}"
|
|
||||||
wait: yes
|
wait: yes
|
||||||
state: absent
|
state: absent
|
||||||
|
wait_timeout: 1200
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
- name: assert named deployment changed (expected changed=true)
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed'
|
||||||
|
- 'result.deployment.name == "{{ instance_name }}"'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue