dhcp_configure.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright 2021 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: Create the dhcp template
  16. copy:
  17. src: "{{ role_path }}/files/temp_dhcp.template"
  18. dest: "{{ role_path }}/files/dhcpd.conf"
  19. mode: 0775
  20. tags: install
  21. - name: Assign subnet and netmask
  22. replace:
  23. path: "{{ role_path }}/files/dhcpd.conf"
  24. regexp: '^subnet subnet_mask netmask net_mask {'
  25. replace: 'subnet {{ ib_subnet }} netmask {{ ib_netmask }} {'
  26. tags: install
  27. - name: Assign netmask
  28. replace:
  29. path: "{{ role_path }}/files/dhcpd.conf"
  30. regexp: '^option subnet-mask net_mask;'
  31. replace: 'option subnet-mask {{ ib_netmask }};'
  32. - name: Assign DHCP range
  33. replace:
  34. path: "{{ role_path }}/files/dhcpd.conf"
  35. regexp: '^range dynamic-bootp start end;'
  36. replace: 'range dynamic-bootp {{ ib_network_dhcp_start_range }} {{ ib_network_dhcp_end_range }};'
  37. - name: Assign default lease time
  38. replace:
  39. path: "{{ role_path }}/files/dhcpd.conf"
  40. regexp: '^default-lease-time default;'
  41. replace: 'default-lease-time {{ default_lease_time }};'
  42. - name: Assign max lease time
  43. replace:
  44. path: "{{ role_path }}/files/dhcpd.conf"
  45. regexp: '^max-lease-time max;'
  46. replace: 'max-lease-time {{ max_lease_time }};'
  47. - name: Assign next server range
  48. replace:
  49. path: "{{ role_path }}/files/dhcpd.conf"
  50. regexp: '^next-server next_server;'
  51. replace: 'next-server {{ ib_ip }};'