dhcp_configure.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Copyright 2022 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 }}'
  63. - name: Assign proxy_url_ext url
  64. replace:
  65. path: "{{ role_path }}/files/settings.yaml"
  66. regexp: '^proxy_url_ext: "http://ip:port"'
  67. replace: 'proxy_url_ext: "http://{{ hpc_ip }}:{{ http_port }}"'
  68. - name: Set the server_args for {{ provision_os }} in tftp file
  69. replace:
  70. path: "{{ role_path }}/files/tftp"
  71. regexp: '^ server_args = -s /srv/tftpboot'
  72. replace: ' server_args = -s /var/lib/tftpboot'
  73. when:
  74. - mgmt_os == os_supported_rocky
  75. - name: Set the parameters for {{ provision_os }}
  76. block:
  77. - name: Set the tftpboot_location for {{ provision_os }}
  78. replace:
  79. path: "{{ role_path }}/files/settings.yaml"
  80. regexp: '^tftpboot_location: "/var/lib/tftpboot"'
  81. replace: 'tftpboot_location: "/srv/tftpboot"'
  82. - name: Set the webdir for {{ provision_os }}
  83. replace:
  84. path: "{{ role_path }}/files/settings.yaml"
  85. regexp: '^webdir: "/var/www/cobbler"'
  86. replace: 'webdir: "/srv/www/cobbler"'
  87. - name: Set the server_args for {{ provision_os }} in tftp file
  88. replace:
  89. path: "{{ role_path }}/files/tftp"
  90. regexp: '^ server_args = -s /var/lib/tftpboot'
  91. replace: ' server_args = -s /srv/tftpboot'
  92. when: os_supported_leap in mgmt_os