dhcp_configure.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. tags: install
  33. - name: Assign gateway
  34. replace:
  35. path: "{{ role_path }}/files/dhcp.template"
  36. regexp: '^option routers router-ip;'
  37. replace: 'option routers {{ dhcp_gateway }};'
  38. tags: install
  39. - name: Assign DNS
  40. replace:
  41. path: "{{ role_path }}/files/dhcp.template"
  42. regexp: '^option domain-name-servers dns1, dns2;'
  43. replace: 'option domain-name-servers {{ dhcp_dns1 }}, {{ dhcp_dns2 }};'
  44. tags: install
  45. - name: Assign DHCP range
  46. replace:
  47. path: "{{ role_path }}/files/dhcp.template"
  48. regexp: '^range dynamic-bootp start end;'
  49. replace: 'range dynamic-bootp {{ dhcp_start_ip }} {{ dhcp_end_ip }};'
  50. - name: Create the cobbler settings file
  51. copy:
  52. src: "{{ role_path }}/files/cobbler_settings"
  53. dest: "{{ role_path }}/files/settings"
  54. mode: 0775
  55. tags: install
  56. - name: Assign server ip
  57. replace:
  58. path: "{{ role_path }}/files/settings"
  59. regexp: '^server: ip'
  60. replace: 'server: {{ hpc_ip }}'
  61. - name: Assign next server ip
  62. replace:
  63. path: "{{ role_path }}/files/settings"
  64. regexp: '^next_server: ip'
  65. replace: 'next_server: {{ hpc_ip }}'