123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- ---
- - name: Create the dhcp template
- copy:
- src: "{{ role_path }}/files/temp_dhcp.template"
- dest: "{{ role_path }}/files/dhcp.template"
- mode: 0775
- tags: install
- - name: Configure DHCP routing settings
- block:
- - name: Add option routers when dns provided
- lineinfile:
- path: "{{ role_path }}/files/dhcp.template"
- insertafter: "^(.*)range dynamic-bootp"
- line: "option routers {{ hpc_ip }};"
- - name: Add domain name servers when primary dns only provided
- lineinfile:
- path: "{{ role_path }}/files/dhcp.template"
- insertafter: "^(.*)range dynamic-bootp"
- line: "option domain-name-servers {{ primary_dns }};"
- when: secondary_dns | length < 1
- - name: Add domain name servers when primary and secondary dns provided
- lineinfile:
- path: "{{ role_path }}/files/dhcp.template"
- insertafter: "^(.*)range dynamic-bootp"
- line: "option domain-name-servers {{ primary_dns }}, {{ secondary_dns }};"
- when: secondary_dns | length > 1
- when: primary_dns | length > 1
-
- - name: Assign subnet and netmask
- replace:
- path: "{{ role_path }}/files/dhcp.template"
- regexp: '^subnet subnet_mask netmask net_mask {'
- replace: 'subnet {{ subnet }} netmask {{ netmask }} {'
- tags: install
- - name: Assign netmask
- replace:
- path: "{{ role_path }}/files/dhcp.template"
- regexp: '^option subnet-mask net_mask;'
- replace: 'option subnet-mask {{ netmask }};'
-
- - name: Assign default lease time
- replace:
- path: "{{ role_path }}/files/dhcp.template"
- regexp: '^default-lease-time default;'
- replace: 'default-lease-time {{ default_lease_time }};'
- - name: Assign max lease time
- replace:
- path: "{{ role_path }}/files/dhcp.template"
- regexp: '^max-lease-time max;'
- replace: 'max-lease-time {{ max_lease_time }};'
- - name: Assign DHCP range
- replace:
- path: "{{ role_path }}/files/dhcp.template"
- regexp: '^range dynamic-bootp start end;'
- replace: 'range dynamic-bootp {{ host_network_dhcp_start_range }} {{ host_network_dhcp_end_range }};'
- - name: Create the cobbler settings file
- copy:
- src: "{{ role_path }}/files/cobbler_settings"
- dest: "{{ role_path }}/files/settings.yaml"
- mode: 0775
- tags: install
- - name: Assign server ip
- replace:
- path: "{{ role_path }}/files/settings.yaml"
- regexp: '^server: 127.0.0.1'
- replace: 'server: {{ hpc_ip }}'
- - name: Assign next server ip
- replace:
- path: "{{ role_path }}/files/settings.yaml"
- regexp: '^next_server: 127.0.0.1'
- replace: 'next_server: {{ hpc_ip }}'
- - name: Assign proxy_url_ext url
- replace:
- path: "{{ role_path }}/files/settings.yaml"
- regexp: '^proxy_url_ext: "http://ip:port"'
- replace: 'proxy_url_ext: "http://{{ hpc_ip }}:{{ http_port }}"'
- - name: Set the server_args for {{ provision_os }} in tftp file
- replace:
- path: "{{ role_path }}/files/tftp"
- regexp: '^ server_args = -s /srv/tftpboot'
- replace: ' server_args = -s /var/lib/tftpboot'
- when:
- - mgmt_os == os_supported_rocky
-
- - name: Set the parameters for {{ provision_os }}
- block:
- - name: Set the tftpboot_location for {{ provision_os }}
- replace:
- path: "{{ role_path }}/files/settings.yaml"
- regexp: '^tftpboot_location: "/var/lib/tftpboot"'
- replace: 'tftpboot_location: "/srv/tftpboot"'
- - name: Set the webdir for {{ provision_os }}
- replace:
- path: "{{ role_path }}/files/settings.yaml"
- regexp: '^webdir: "/var/www/cobbler"'
- replace: 'webdir: "/srv/www/cobbler"'
- - name: Set the server_args for {{ provision_os }} in tftp file
- replace:
- path: "{{ role_path }}/files/tftp"
- regexp: '^ server_args = -s /var/lib/tftpboot'
- replace: ' server_args = -s /srv/tftpboot'
- when: os_supported_leap in mgmt_os
|