media.dns.yml 711 Bytes
---
- hosts: nameserver-master
  vars_prompt:
    - name: "confirmation"
      prompt: "Sync and reload dns server. Please Enter DNS to continue."
      private: no
  remote_user: root

  tasks:
    - name: "make sure user type DNS to confirm"
      fail:
        msg: "user do not type DNS"
      when: confirmation != 'DNS'

    - name: get current time
      set_fact:
        timestamp: "{{ lookup('pipe','date +%Y-%m-%d-%H-%M-%S') }}"
        zone_serical: "{{ ansible_date_time.epoch }}"

    - name: Sync bind9 zone files
      template:
        src: media.zone.j2
        dest: /Data/named/aws.zone
        backup: yes

    - name: reload bind
      command: "/Data/local/named/sbin/rndc -p954 reload"