-
Notifications
You must be signed in to change notification settings - Fork 350
/
rediscache.yml
77 lines (67 loc) · 2.09 KB
/
rediscache.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Description
# ===========
# This playbook creates Azure Cache for Redis instance, scales it up, rebooots it, adds firewall rule, and deletes it.
# This playbook requires ansible >= 2.8, or role azure.azure_preview_modules.
---
- name: Manage Azure Cache for Redis
hosts: localhost
connection: local
vars:
resource_group: "{{ resource_group_name }}"
redis_name: "redis{{ resource_group_name }}"
location: eastus2
roles:
- azure.azure_preview_modules
tasks:
- name: Create resource group
azure_rm_resourcegroup:
name: "{{ resource_group }}"
location: "{{ location }}"
- name: Create Azure Cache for Redis
azure_rm_rediscache:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
sku:
name: basic
size: C1
- name: Wait for Redis provisioning to complete
azure_rm_rediscache_facts:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
register: facts
until: "{{ facts.rediscaches[0]['provisioning_state'] == 'Succeeded' }}"
retries: 100
delay: 60
- name: Scale up Azure Cache for Redis
azure_rm_rediscache:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
sku:
name: standard
size: C1
- name: Wait for Redis scaling up to complete
azure_rm_rediscache_facts:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
register: facts
until: "{{ facts.rediscaches[0]['provisioning_state'] == 'Succeeded' }}"
retries: 100
delay: 60
- name: Reboot Azure Cache for Redis
azure_rm_rediscache:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
reboot:
reboot_type: all
- name: Add Firewall rule
azure_rm_rediscachefirewallrule:
resource_group: "{{ resource_group }}"
cache_name: "{{ redis_name }}"
name: rule1
start_ip_address: 168.1.1.1
end_ip_address: 168.1.1.4
- name: Delete Azure Cache for Redis
azure_rm_rediscache:
resource_group: "{{ resource_group }}"
name: "{{ redis_name }}"
state: absent