domain.switch.ufo.yml
1.13 KB
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
---
# switch ufo entrance
- hosts: localhost
vars_prompt:
- name: "confirmation"
prompt: "Start to change . Please Enter YES to continue."
private: no
- name: "switch_to_where"
prompt: "switch to qcloud, please enter [qq], switch to aws, enter [aws]"
private: no
vars_files:
- extra_vars/all.yml
vars:
qcloud_key: "{{ lookup('hashi_vault', 'secret=yoho/ops/qcloud token='+'{{vault.token}}'+' url='+'{{vault.server}}') }}"
tasks:
- name: "make sure user type YES to confirm"
fail:
msg: "user do not type YES"
when: confirmation != 'YES'
- name: switch to qq
domain_modify:
secretId: "{{ qcloud_key.SecretId }}"
secretKey: "{{ qcloud_key.SecretKey }}"
domain_name: "2.yohobuy.com"
value: "140.143.217.201"
when: switch_to_where == 'qq'
- name: switch to aws
domain_modify:
secretId: "{{ qcloud_key.SecretId }}"
secretKey: "{{ qcloud_key.SecretKey }}"
domain_name: "2.yohobuy.com"
value: "java-public-lb-862332839.cn-north-1.elb.amazonaws.com.cn"
when: switch_to_where == 'aws'