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.

47 lines
1.3 KiB

9 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. - name: 'restart {{ service_name }} on openwrt'
  26. openwrt_init:
  27. name: '{{ service_name }}'
  28. state: 'restarted'
  29. - name: 'reload {{ service_name }} on openwrt'
  30. openwrt_init:
  31. name: '{{ service_name }}'
  32. state: 'reloaded'
  33. when: (ansible_distribution == 'openwrt') and (service_name != 'ssh')
  34. - block:
  35. - name: 'restart {{ service_name }} on openwrt'
  36. openwrt_init:
  37. name: 'sshd'
  38. state: 'restarted'
  39. - name: 'reload {{ service_name }} on openwrt'
  40. openwrt_init:
  41. name: 'sshd'
  42. state: 'reloaded'
  43. when: (ansible_distribution == 'openwrt') and (service_name == 'ssh')