dhcp_configure.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/dhcp.template"
  19. mode: 0775
  20. tags: install
  21. - name: Assign subnet and netmask
  22. replace:
  23. path: "{{ role_path }}/files/dhcp.template"
  24. regexp: '^subnet subnet_mask netmask net_mask {'
  25. replace: 'subnet {{ subnet }} netmask {{ netmask }} {'
  26. tags: install
  27. - name: Assign netmask
  28. replace:
  29. path: "{{ role_path }}/files/dhcp.template"
  30. regexp: '^option subnet-mask net_mask;'
  31. replace: 'option subnet-mask {{ netmask }};'
  32. - name: Assign default lease time
  33. replace:
  34. path: "{{ role_path }}/files/dhcp.template"
  35. regexp: '^default-lease-time default;'
  36. replace: 'default-lease-time {{ default_lease_time }};'
  37. - name: Assign max lease time
  38. replace:
  39. path: "{{ role_path }}/files/dhcp.template"
  40. regexp: '^max-lease-time max;'
  41. replace: 'max-lease-time {{ max_lease_time }};'
  42. - name: Assign DHCP range
  43. replace:
  44. path: "{{ role_path }}/files/dhcp.template"
  45. regexp: '^range dynamic-bootp start end;'
  46. replace: 'range dynamic-bootp {{ host_network_dhcp_start_range }} {{ host_network_dhcp_end_range }};'
  47. - name: Create the cobbler settings file
  48. copy:
  49. src: "{{ role_path }}/files/cobbler_settings"
  50. dest: "{{ role_path }}/files/settings.yaml"
  51. mode: 0775
  52. tags: install
  53. - name: Assign server ip
  54. replace:
  55. path: "{{ role_path }}/files/settings.yaml"
  56. regexp: '^server: 127.0.0.1'
  57. replace: 'server: {{ hpc_ip }}'
  58. - name: Assign next server ip
  59. replace:
  60. path: "{{ role_path }}/files/settings.yaml"
  61. regexp: '^next_server: 127.0.0.1'
  62. replace: 'next_server: {{ hpc_ip }}'