---
- hosts: "{{ hosts }}"
  tasks:
    - name:
      shell: cd /data/www/data/dnsmasq && wget -O dnsmasq.conf vc-res.ops.yangege.cn/res/dnsmasq/{{ useType }}/dnsmasq.conf
    - name: check conf
      shell: /usr/sbin/dnsmasq --test -C /data/www/data/dnsmasq/dnsmasq.conf
      register: result
    - name: check if deploy fail
      fail: msg="conf check fail"
      when: result.failed == true
    - name: restart service
      shell: /etc/init.d/dnsmasq restart