Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

8 years ago
  1. ---
  2. - name: restart {{ service_name }}
  3. debug: msg="notify restart on all os"
  4. changed_when: true
  5. notify:
  6. - restart {{ service_name }} on all distro
  7. - restart {{ service_name }} on openwrt
  8. - name: reload {{ service_name }}
  9. debug: msg="notify reload on all os"
  10. changed_when: true
  11. notify:
  12. - reload {{ service_name }} on all distro
  13. - reload {{ service_name }} on openwrt
  14. - block:
  15. - name: restart {{ service_name }} on all distro
  16. service:
  17. name: "{{ service_name }}"
  18. state: restarted
  19. - name: reload {{ service_name }} on all distro
  20. service:
  21. name: "{{ service_name }}"
  22. state: reloaded
  23. when: ansible_distribution != 'openwrt'
  24. - block:
  25. # waithing for ansible 2.3 (https://docs.ansible.com/ansible/openwrt_init_module.html)
  26. # - openwrt_init:
  27. # name: "{{ service_name }}"
  28. # state: reloaded
  29. - name: restart {{ service_name }} on openwrt
  30. shell: "/etc/init.d/{{ service_name }} restart"
  31. - name: reload {{ service_name }} on openwrt
  32. shell: /etc/init.d/"{{ service_name }} reload"
  33. when: ansible_distribution == 'openwrt'