tftp.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Start tftp and dhcp
  16. hosts: localhost
  17. connection: local
  18. tasks:
  19. - name: Fetch tftp status
  20. command: systemctl is-active tftp
  21. args:
  22. warn: no
  23. register: tftp_status
  24. ignore_errors: yes
  25. changed_when: false
  26. - name: Start tftp if inactive state
  27. command: systemctl start tftp.service
  28. args:
  29. warn: no
  30. when: "('inactive' in tftp_status.stdout) or ('unknown' in tftp_status.stdout)"
  31. - name: Fetch dhcp status
  32. command: systemctl is-active dhcpd
  33. args:
  34. warn: no
  35. register: dhcp_status
  36. ignore_errors: yes
  37. changed_when: false
  38. - name: Start dhcp if inactive state
  39. command: systemctl start dhcpd.service
  40. args:
  41. warn: no
  42. when: "('inactive' in dhcp_status.stdout) or ('unknown' in dhcp_status.stdout)"