diff --git a/README.md b/README.md index fe8b475..e5c472c 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,17 @@ Default: `"{{ hpc_install_nvidia_container_toolkit }}"` Type: `bool` +### hpc_docker_subnet + +The default docker bridge interface address and subnet configuration of 172.17.0.1/16 conflicts with the subnets Azure CycleCloud uses for internal physical cluster networks. + +To avoid this conflict with the Azure CycleCloud networks, the system role will configure the docker interface with a 10.88.0.1/16 address and subnet. +However, if this is inappropriate for the cluster being deployed, the subnet can be customised to any private subnet using this variable. + +Default: `10.88.0.1/16` + +Type: `string` + ### hpc_install_moneo Whether to install the Azure Moneo monitoring tool. diff --git a/defaults/main.yml b/defaults/main.yml index 07e9108..1b3f67b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,6 +28,7 @@ hpc_build_openmpi_w_nvidia_gpu_support: true hpc_install_moneo: true hpc_install_nvidia_container_toolkit: true hpc_install_docker: "{{ hpc_install_nvidia_container_toolkit }}" +hpc_docker_subnet: 10.88.0.1/16 hpc_install_azurehpc_health_checks: "{{ hpc_install_nvidia_container_toolkit }}" hpc_tuning: true hpc_sku_customisation: true diff --git a/tasks/docker-subnet.yml b/tasks/docker-subnet.yml new file mode 100644 index 0000000..82133a3 --- /dev/null +++ b/tasks/docker-subnet.yml @@ -0,0 +1,36 @@ +--- +- name: Ensure docker config directory exists + file: + path: "{{ __hpc_docker_conf_dir }}" + state: directory + owner: root + group: root + mode: '0755' + +- name: Check if daemon.json exists + stat: + path: "{{ __hpc_docker_conf_file }}" + register: __hpc_docker_conf_stat + +- name: Slurp file if it exists + slurp: + src: "{{ __hpc_docker_conf_file }}" + register: __hpc_docker_daemon_json_raw + when: __hpc_docker_conf_stat.stat.exists and __hpc_docker_conf_stat.stat.size > 0 + +- name: Write the updated JSON safely + copy: + content: "{{ updated_daemon_config | to_nice_json }}" + dest: "{{ __hpc_docker_conf_file }}" + owner: root + group: root + mode: '0644' + validate: '/usr/bin/python3 -m json.tool %s' + vars: + updated_daemon_config: >- + {{ + (__hpc_docker_daemon_json_raw.content | b64decode | from_json + if (__hpc_docker_daemon_json_raw.content is defined) + else {}) + | combine({"bip": hpc_docker_subnet | default('10.88.0.1/16')}) + }} diff --git a/tasks/main.yml b/tasks/main.yml index e213818..6a72f93 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -941,6 +941,9 @@ register: __hpc_docker_packages_install until: __hpc_docker_packages_install is success + - name: Configure Docker bridge network address range + include_tasks: tasks/docker-subnet.yml + - name: Enable and start Docker service service: name: docker diff --git a/vars/main.yml b/vars/main.yml index 860b529..9d31d86 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -21,6 +21,8 @@ __hpc_microsoft_prod_rpm_key: https://packages.microsoft.com/keys/microsoft.asc __hpc_base_packages: - pssh +__hpc_docker_conf_dir: /etc/docker +__hpc_docker_conf_file: "{{ __hpc_docker_conf_dir }}/daemon.json" __hpc_rdma_rename_path: /usr/lib/udev/rdma_rename __hpc_dkms_packages: