-
Notifications
You must be signed in to change notification settings - Fork 1
/
120.3_playbook_start_policy.yaml
67 lines (66 loc) · 2.63 KB
/
120.3_playbook_start_policy.yaml
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
# Example Playbok to Start a Policy
- name: Start Policy by name Query
hosts: localhost
gather_facts: no
connection: local
vars:
policy_name:
policy_type: # one of VMWARE_VIRTUAL_MACHINE,ORACLE_DATABASE,MICROSOFT_SQL_DATABASE,FILE_SYSTEM,KUBERNETES,MICROSOFT_EXCHANGE_DATABASE,SAP_HANA_DATABASE,NAS_SHARE,POWERSTORE_BLOCK
vars_files:
- ./vars/main.yml
tasks:
- name: Checking Required Variable policy_type
fail:
msg: "We do not have a policy_type set or policy_type not one of VMWARE_VIRTUAL_MACHINE,ORACLE_DATABASE,MICROSOFT_SQL_DATABASE,FILE_SYSTEM,KUBERNETES,MICROSOFT_EXCHANGE_DATABASE,SAP_HANA_DATABASE,NAS_SHARE,POWERSTORE_BLOCK!"
when: (policy_type is not defined) or (policy_type not in ("VMWARE_VIRTUAL_MACHINE","ORACLE_DATABASE","MICROSOFT_SQL_DATABASE","FILE_SYSTEM","KUBERNETES","MICROSOFT_EXCHANGE_DATABASE","SAP_HANA_DATABASE","NAS_SHARE","POWERSTORE_BLOCK"))
- name: Checking Required Variable policy_name
fail:
msg: "We do not have a policy_name set !"
when: (policy_name is not defined) or (policy_name|length == 0)
- name: Checking Required Variable ppdm_fqdn
fail:
msg: "We do not have a ppdm_fqdn set !"
when: (ppdm_fqdn is not defined) or (ppdm_fqdn|length <= 8)
- name: Checking Required Variables
fail:
msg: "We do not have ppdm_new_password set !"
when: (ppdm_new_password is not defined) or (ppdm_new_password|length == 0)
- name: Checking Required Variable ddve_fqdn
fail:
msg: "We do not have ddve_fqdn set !"
when: (ddve_fqdn is not defined) or (ddve_fqdn|length == 0)
- name: Setting Base URL
set_fact:
ppdm_baseurl: "https://{{ ppdm_fqdn | regex_replace('^https://') }}"
- name: Get PPDM Token for https://{{ ppdm_fqdn | regex_replace('^https://') }}
include_role:
name: get_ppdm_token
vars:
ppdm_password: "{{ ppdm_new_password }}"
- debug:
msg: "{{ access_token }}"
verbosity: 1
name: do we have a token ?
- name: Get Protection Policy
include_role:
name: get_ppdm_protection_policy
vars:
filter: assetType eq "{{ policy_type }}" and name eq "{{ policy_name }}"
- name: Run Protection Policy
vars:
policy_id: "{{ protection_policy[0].id }}"
backup:
assetIds:
stages:
- id: "{{ protection_policy[0].stages[0].id }}"
retention:
interval: 3
unit: DAY
operation:
backupType: FULL
include_role:
name: run_ppdm_protection_policy
when: protection_policy[0].id is defined
- debug:
msg: "{{ protection_policy_run }}"
verbosity: 0