forked from Azure-Samples/ansible-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postgresql_create.yml
47 lines (43 loc) · 1.31 KB
/
postgresql_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 PostgreSQL server and an instance of PostgreSQL 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: westeurope
postgresqlserver_name: postgresql{{ rpfx }}
postgresqldb_name: sqldbtest
admin_username: admxyz
admin_password: Abcpasswordxyz12!
tasks:
- name: Create a resource group
azure_rm_resourcegroup:
name: "{{ resource_group }}"
location: "{{ location }}"
- name: Create PostgreSQL Server
azure_rm_postgresqlserver:
resource_group: "{{ resource_group }}"
name: "{{ postgresqlserver_name }}"
sku:
name: B_Gen5_1
tier: Basic
capacity: 1
location: "{{ location }}"
enforce_ssl: True
admin_username: "{{ admin_username }}"
admin_password: "{{ admin_password }}"
storage_mb: 51200
- name: Create instance of PostgreSQL Database
azure_rm_postgresqldatabase:
resource_group: "{{ resource_group }}"
server_name: "{{ postgresqlserver_name }}"
name: "{{ postgresqldb_name }}"