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

---
- name: 'restart {{ service_name }}'
debug: msg='notify restart on all os'
changed_when: true
notify:
- 'restart {{ service_name }} on all distro'
- 'restart {{ service_name }} on openwrt'
- name: 'reload {{ service_name }}'
debug: msg='notify reload on all os'
changed_when: true
notify:
- 'reload {{ service_name }} on all distro'
- 'reload {{ service_name }} on openwrt'
- block:
- name: 'restart {{ service_name }} on all distro'
service:
name: '{{ service_name }}'
state: 'restarted'
- name: 'reload {{ service_name }} on all distro'
service:
name: '{{ service_name }}'
state: 'reloaded'
when: ansible_distribution != 'openwrt'
- block:
- name: 'restart {{ service_name }} on openwrt'
openwrt_init:
name: '{{ service_name }}'
state: 'restarted'
- name: 'reload {{ service_name }} on openwrt'
openwrt_init:
name: '{{ service_name }}'
state: 'reloaded'
when: (ansible_distribution == 'openwrt') and (service_name != 'ssh')
- block:
- name: 'restart {{ service_name }} on openwrt'
openwrt_init:
name: 'sshd'
state: 'restarted'
- name: 'reload {{ service_name }} on openwrt'
openwrt_init:
name: 'sshd'
state: 'reloaded'
when: (ansible_distribution == 'openwrt') and (service_name == 'ssh')