12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- ---
- - name: Start tftp and dhcp
- hosts: localhost
- connection: local
- tasks:
- - name: Fetch tftp status
- command: systemctl is-active tftp
- args:
- warn: no
- register: tftp_status
- ignore_errors: yes
- changed_when: false
- - name: Start tftp if inactive state
- command: systemctl start tftp.service
- args:
- warn: no
- when: "('inactive' in tftp_status.stdout) or ('unknown' in tftp_status.stdout)"
- - name: Fetch dhcp status
- command: systemctl is-active dhcpd
- args:
- warn: no
- register: dhcp_status
- ignore_errors: yes
- changed_when: false
- - name: Start dhcp if inactive state
- command: systemctl start dhcpd.service
- args:
- warn: no
- when: "('inactive' in dhcp_status.stdout) or ('unknown' in dhcp_status.stdout)"
|