Authored by chunhua.zhang

switch ufo

  1 +---
  2 +# switch ufo entrance
  3 +
  4 +- hosts: localhost
  5 +
  6 + vars_prompt:
  7 + - name: "confirmation"
  8 + prompt: "Start to change . Please Enter YES to continue."
  9 + private: no
  10 + - name: "switch_to_where"
  11 + prompt: "switch to qcloud, please enter [qq], switch to aws, enter [aws]"
  12 + private: no
  13 +
  14 + vars_files:
  15 + - extra_vars/all.yml
  16 +
  17 + vars:
  18 + qcloud_key: "{{ lookup('hashi_vault', 'secret=yoho/ops/qcloud token='+'{{vault.token}}'+' url='+'{{vault.server}}') }}"
  19 +
  20 + tasks:
  21 + - name: "make sure user type YES to confirm"
  22 + fail:
  23 + msg: "user do not type YES"
  24 + when: confirmation != 'YES'
  25 +
  26 + - name: switch to qq
  27 + domain_modify:
  28 + secretId: "{{ qcloud_key.SecretId }}"
  29 + secretKey: "{{ qcloud_key.SecretKey }}"
  30 + domain_name: "2.yohobuy.com"
  31 + value: "140.143.217.201"
  32 + when: switch_to_where == 'qq'
  33 +
  34 + - name: switch to aws
  35 + domain_modify:
  36 + secretId: "{{ qcloud_key.SecretId }}"
  37 + secretKey: "{{ qcloud_key.SecretKey }}"
  38 + domain_name: "2.yohobuy.com"
  39 + value: "java-public-lb-862332839.cn-north-1.elb.amazonaws.com.cn"
  40 + when: switch_to_where == 'aws'