dhcp_configure.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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: 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 DHCP range
  33. replace:
  34. path: "{{ role_path }}/files/dhcp.template"
  35. regexp: '^range dynamic-bootp start end;'
  36. replace: 'range dynamic-bootp {{ dhcp_start_ip }} {{ dhcp_end_ip }};'
  37. - name: Create the cobbler settings file
  38. copy:
  39. src: "{{ role_path }}/files/cobbler_settings"
  40. dest: "{{ role_path }}/files/settings"
  41. mode: 0775
  42. tags: install
  43. - name: Assign server ip
  44. replace:
  45. path: "{{ role_path }}/files/settings"
  46. regexp: '^server: ip'
  47. replace: 'server: {{ hpc_ip }}'
  48. - name: Assign next server ip
  49. replace:
  50. path: "{{ role_path }}/files/settings"
  51. regexp: '^next_server: ip'
  52. replace: 'next_server: {{ hpc_ip }}'