Authored by root

Enable center switch

@@ -4,9 +4,8 @@ @@ -4,9 +4,8 @@
4 - name: "confirmation" 4 - name: "confirmation"
5 prompt: "Sync and reload dns server. Please Enter DNS to continue." 5 prompt: "Sync and reload dns server. Please Enter DNS to continue."
6 private: no 6 private: no
7 - - name: "center"  
8 - prompt: "Select the zone center. Please Enter zone1 or zone2 to continue."  
9 - private: no 7 + vars:
  8 + center: "zone1"
10 remote_user: root 9 remote_user: root
11 roles: 10 roles:
12 - yoho.dns 11 - yoho.dns
  1 +---
  2 +# Playbook for center switch
  3 +- hosts: nameservers
  4 + vars_prompt:
  5 + - name: "center"
  6 + prompt: "Select the zone center. Please Enter zone1 or zone2 to continue."
  7 + private: no
  8 + remote_user: root
  9 + roles:
  10 + - yoho.switch
  11 +
  12 +- import_playbook: yoho.dns.yml center=center
@@ -14,10 +14,20 @@ @@ -14,10 +14,20 @@
14 timestamp: "{{ lookup('pipe','date +%Y-%m-%d-%H-%M-%S') }}" 14 timestamp: "{{ lookup('pipe','date +%Y-%m-%d-%H-%M-%S') }}"
15 zone_serical: "{{ ansible_date_time.epoch }}" 15 zone_serical: "{{ ansible_date_time.epoch }}"
16 16
17 -- name: sync bind9 zone files 17 +- name: sync bind9 zone files with center zone1
18 template: 18 template:
19 src: qcloud.zone.j2 19 src: qcloud.zone.j2
20 dest: /Data/named/qcloud.zone 20 dest: /Data/named/qcloud.zone
21 backup: yes 21 backup: yes
22 notify: 22 notify:
23 - - reload bind  
  23 + - reload bind
  24 + when: center == 'zone1'
  25 +
  26 +- name: sync bind9 zone files with center zone2
  27 + template:
  28 + src: qcloud_az2.zone.j2
  29 + dest: /Data/named/qcloud.zone
  30 + backup: yes
  31 + notify:
  32 + - reload bind
  33 + when: center == 'zone2'
1 --- 1 ---
2 -# tasks file for yoho.switch  
  2 +# tasks file for yoho.switch