forked from Azure-Samples/ansible-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysql_create.yml
47 lines (43 loc) · 1.25 KB
/
mysql_create.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Description
# ===========
# This playbook create a MySQL server and an instance of MySQL Database,
---
- hosts: localhost
tasks:
- name: Prepare random postfix
set_fact:
rpfx: "{{ 1000 | random }}"
run_once: yes
- hosts: localhost
#roles:
# - Azure.azure_preview_modules
vars:
resource_group: "{{ resource_group_name }}"
location: eastus
mysqlserver_name: mysql{{ rpfx }}
mysqldb_name: sqldbtest
admin_username: admxyz
admin_password: Abcpasswordxyz12!
tasks:
- name: Create a resource group
azure_rm_resourcegroup:
name: "{{ resource_group }}"
location: "{{ location }}"
- name: Create MySQL Server
azure_rm_mysqlserver:
resource_group: "{{ resource_group }}"
name: "{{ mysqlserver_name }}"
sku:
name: GP_Gen4_2
tier: GeneralPurpose
location: "{{ location }}"
version: 5.6
enforce_ssl: True
admin_username: "{{ admin_username }}"
admin_password: "{{ admin_password }}"
storage_mb: 51200
- name: Create instance of MySQL Database
azure_rm_mysqldatabase:
resource_group: "{{ resource_group }}"
server_name: "{{ mysqlserver_name }}"
name: "{{ mysqldb_name }}"