ade02bcce5
* updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts * updates to azure_rm_sqlserver_facts
104 lines
3.7 KiB
YAML
104 lines
3.7 KiB
YAML
- name: Prepare random number
|
|
set_fact:
|
|
rpfx: "{{ 1000 | random }}{{ resource_group | hash('md5') | truncate(7, True, '') }}"
|
|
run_once: yes
|
|
|
|
- name: Create SQL Server
|
|
azure_rm_sqlserver:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "sqlsrv{{ rpfx }}"
|
|
location: eastus
|
|
admin_username: mylogin
|
|
admin_password: Testpasswordxyz12!
|
|
|
|
- name: Create SQL Server - 2
|
|
azure_rm_sqlserver:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "sqlsrv{{ rpfx }}x"
|
|
location: eastus
|
|
admin_username: mylogin
|
|
admin_password: Testpasswordxyz12!
|
|
|
|
- name: Gather facts SQL Server
|
|
azure_rm_sqlserver_facts:
|
|
resource_group: "{{ resource_group }}"
|
|
server_name: "sqlsrv{{ rpfx }}"
|
|
register: output
|
|
- name: Assert that facts are returned
|
|
assert:
|
|
that:
|
|
- output.changed == False
|
|
- output.servers.sqlsrv{{ rpfx }}.id != None
|
|
- output.servers.sqlsrv{{ rpfx }}.name == "sqlsrv{{ rpfx }}"
|
|
- output.servers.sqlsrv{{ rpfx }}.type != None
|
|
- output.servers.sqlsrv{{ rpfx }}.location != None
|
|
- output.servers.sqlsrv{{ rpfx }}.kind != None
|
|
- output.servers.sqlsrv{{ rpfx }}.version != None
|
|
- output.servers.sqlsrv{{ rpfx }}.state != None
|
|
- output.servers.sqlsrv{{ rpfx }}.fully_qualified_domain_name != None
|
|
|
|
- name: Gather facts SQL Server - second
|
|
azure_rm_sqlserver_facts:
|
|
resource_group: "{{ resource_group }}"
|
|
server_name: "sqlsrv{{ rpfx }}x"
|
|
register: output
|
|
- name: Assert that facts are returned
|
|
assert:
|
|
that:
|
|
- output.changed == False
|
|
- output.servers.sqlsrv{{ rpfx }}x.id != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.name == "sqlsrv{{ rpfx }}x"
|
|
- output.servers.sqlsrv{{ rpfx }}x.type != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.location != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.kind != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.version != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.state != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.fully_qualified_domain_name != None
|
|
|
|
- name: Gather facts SQL Server - unexisting
|
|
azure_rm_sqlserver_facts:
|
|
resource_group: "{{ resource_group }}"
|
|
server_name: "unexisting"
|
|
register: output
|
|
- name: Assert that facts are returned
|
|
assert:
|
|
that:
|
|
- output.changed == False
|
|
- output.servers == {}
|
|
|
|
- name: Gather facts SQL Server - list
|
|
azure_rm_sqlserver_facts:
|
|
resource_group: "{{ resource_group }}"
|
|
register: output
|
|
- name: Assert that facts are returned
|
|
assert:
|
|
that:
|
|
- output.changed == False
|
|
- output.servers.sqlsrv{{ rpfx }}.id != None
|
|
- output.servers.sqlsrv{{ rpfx }}.name == "sqlsrv{{ rpfx }}"
|
|
- output.servers.sqlsrv{{ rpfx }}.type != None
|
|
- output.servers.sqlsrv{{ rpfx }}.location != None
|
|
- output.servers.sqlsrv{{ rpfx }}.kind != None
|
|
- output.servers.sqlsrv{{ rpfx }}.version != None
|
|
- output.servers.sqlsrv{{ rpfx }}.state != None
|
|
- output.servers.sqlsrv{{ rpfx }}.fully_qualified_domain_name != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.id != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.name == "sqlsrv{{ rpfx }}x"
|
|
- output.servers.sqlsrv{{ rpfx }}x.type != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.location != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.kind != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.version != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.state != None
|
|
- output.servers.sqlsrv{{ rpfx }}x.fully_qualified_domain_name != None
|
|
|
|
- name: Delete instance of SQL Server
|
|
azure_rm_sqlserver:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "sqlsrv{{ rpfx }}"
|
|
state: absent
|
|
|
|
- name: Delete instance of SQL Server
|
|
azure_rm_sqlserver:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "sqlsrv{{ rpfx }}x"
|
|
state: absent
|