From 059bd92b242592471ce56074531a61e9abb48b77 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 16 Sep 2022 12:33:06 +0200 Subject: [PATCH] Rename include_dhcp_server -> enable_dhcp for consistency Change-Id: Iff141df7adbe69775ce264d591be0466bd4a7e3b --- bifrost/cli.py | 2 +- doc/source/user/architecture.rst | 2 +- .../roles/bifrost-ironic-install/README.md | 2 +- .../bifrost-ironic-install/defaults/main.yml | 6 +++--- .../tasks/bootstrap.yml | 20 +++++++++---------- .../bifrost-ironic-install/tasks/start.yml | 4 ++-- .../notes/disable-dhcp-1f2b1557ac574056.yaml | 5 +++++ 7 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 releasenotes/notes/disable-dhcp-1f2b1557ac574056.yaml diff --git a/bifrost/cli.py b/bifrost/cli.py index 7efc6d8ca..aaa8b1968 100644 --- a/bifrost/cli.py +++ b/bifrost/cli.py @@ -187,7 +187,7 @@ def cmd_install(args): developer_mode=args.develop, enable_prometheus_exporter=args.enable_prometheus_exporter, default_boot_mode=args.boot_mode or 'uefi', - include_dhcp_server=not args.disable_dhcp, + enable_dhcp=not args.disable_dhcp, extra_vars=args.extra_vars, params_output_file=args.output, **kwargs) diff --git a/doc/source/user/architecture.rst b/doc/source/user/architecture.rst index cb08bf6f9..56acd6333 100644 --- a/doc/source/user/architecture.rst +++ b/doc/source/user/architecture.rst @@ -42,7 +42,7 @@ dnsmasq_ when booting nodes over the network. It can also be used to provide DHCP to deployed nodes. - Dnsmasq can be disabled by setting ``include_dhcp_server=false`` + Dnsmasq can be disabled by setting ``enable_dhcp=false`` or passing ``--disable-dhcp`` to ``bifrost-cli``. The following components can be enabled if needed: diff --git a/playbooks/roles/bifrost-ironic-install/README.md b/playbooks/roles/bifrost-ironic-install/README.md index 7251f520b..a816a3366 100644 --- a/playbooks/roles/bifrost-ironic-install/README.md +++ b/playbooks/roles/bifrost-ironic-install/README.md @@ -67,7 +67,7 @@ The IP address and network interface information which will be used by bare metal machines to connect to the conductor and the internal HTTP server, and for cross-service interactions. -include_dhcp_server: false +enable_dhcp: false If you chose to utilize the dhcp server, You may wish to set default ranges: diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index 77386761b..2166630b9 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -117,9 +117,9 @@ update_ipa: "{{ update_repos }}" ipa_add_ssh_key: false cirros_deploy_image_upstream_url: https://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img # By default bifrost will deploy dnsmasq to utilize as an integrated DHCP -# server. If you already have a DHCP server, you can pass --disable-dhcp -# to the bifrost-cli install command to disable it. -include_dhcp_server: true +# server. If you already have a DHCP server or do not need DHCP/TFTP at all, +# you can pass --disable-dhcp to the bifrost-cli install command to disable it. +enable_dhcp: "{{ include_dhcp_server | default(true) }}" # *_git_url can be overridden by local clones for offline installs dib_git_url: https://opendev.org/openstack/diskimage-builder ironicclient_git_url: https://opendev.org/openstack/python-ironicclient diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index d47124110..be80332a0 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -309,14 +309,14 @@ set_fact: itf_infos: "{{ internal_interface }}" dhcp_netaddr: "{{ dhcp_pool_start }}/{{ dhcp_static_mask }}" - when: include_dhcp_server | bool + when: enable_dhcp | bool - name: "Compute interface and DHCP network informations" set_fact: itf_netaddr1: "{{ itf_infos['address'] }}/{{ itf_infos['netmask'] }}" itf_netaddr2: "{{ itf_infos['network'] }}/{{ itf_infos['netmask'] }}" itf_broadcast: "{{ itf_infos['broadcast'] }}/{{ itf_infos['netmask'] }}" dhcp_netaddr: "{{ dhcp_netaddr | ipaddr('network') }}/{{ dhcp_static_mask }}" - when: include_dhcp_server | bool + when: enable_dhcp | bool - name: "Validate interface network addresses" fail: msg: > @@ -324,7 +324,7 @@ {{ itf_netaddr1 | ipaddr('network') }}/{{ itf_netaddr1 | ipaddr('prefix') }} vs {{ itf_netaddr2 }}/{{ itf_netaddr2 | ipaddr('prefix') }} when: - - include_dhcp_server | bool + - enable_dhcp | bool - itf_netaddr1 | ipaddr('network') != itf_netaddr2 | ipaddr('network') - name: "Validate interface broadcast addresses" fail: @@ -333,7 +333,7 @@ {{ itf_netaddr1 | ipaddr('broadcast') }}/{{ itf_netaddr1 | ipaddr('prefix') }} vs {{ itf_broadcast | ipaddr('broadcast') }}/{{ itf_broadcast | ipaddr('prefix') }} when: - - include_dhcp_server | bool + - enable_dhcp | bool - itf_netaddr1 | ipaddr('broadcast') != itf_broadcast | ipaddr('broadcast') - name: "Validate DHCP and interface addresses" debug: @@ -343,7 +343,7 @@ {{ dhcp_netaddr | ipaddr('network') }}/{{ dhcp_netaddr | ipaddr('prefix') }} overriding DHCP with interface settings" when: - - include_dhcp_server | bool + - enable_dhcp | bool - itf_netaddr2 | ipaddr('network') != dhcp_netaddr | ipaddr('network') - name: "Computing new DHCP informations" set_fact: @@ -351,7 +351,7 @@ dhcp_end_ip: "{{ dhcp_pool_end.split('.')[-1] }}" dhcp_netaddr: "{{ itf_netaddr1 | ipaddr('network') }}" when: - - include_dhcp_server | bool + - enable_dhcp | bool - itf_netaddr2 | ipaddr('network') != dhcp_netaddr | ipaddr('network') # Note(olivierbourdon38): we could do much more complex network # computation to derive exact (or way closer to exact) range for @@ -361,21 +361,21 @@ dhcp_pool_start: "{{ '.'.join(dhcp_netaddr.split('.')[0:-1]) }}.{{ dhcp_start_ip }}" dhcp_pool_end: "{{ '.'.join(dhcp_netaddr.split('.')[0:-1]) }}.{{ dhcp_end_ip }}" when: - - include_dhcp_server | bool + - enable_dhcp | bool - itf_netaddr2 | ipaddr('network') != dhcp_netaddr | ipaddr('network') - name: "Deploy dnsmasq configuration file" template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf - when: include_dhcp_server | bool + when: enable_dhcp | bool # NOTE(Shrews) When testing, we want to use our custom dnsmasq.conf file, # not the one supplied by libvirt. - name: "Look for libvirt dnsmasq config" stat: path=/etc/dnsmasq.d/libvirt-bin register: test_libvirt_dnsmasq - when: include_dhcp_server | bool + when: enable_dhcp | bool - name: "Disable libvirt dnsmasq config" command: mv /etc/dnsmasq.d/libvirt-bin /etc/dnsmasq.d/libvirt-bin~ when: - - include_dhcp_server | bool + - enable_dhcp | bool - test_libvirt_dnsmasq.stat.exists - testing | bool - name: "Download Ironic Python Agent kernel & image" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/start.yml b/playbooks/roles/bifrost-ironic-install/tasks/start.yml index 33919921f..90d29ef6e 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/start.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/start.yml @@ -67,11 +67,11 @@ service: name={{ item }} state=restarted enabled=yes loop: - dnsmasq - when: include_dhcp_server | bool + when: enable_dhcp | bool - name: "Send dnsmasq a force-reload signal" service: name=dnsmasq state=restarted - when: include_dhcp_server | bool + when: enable_dhcp | bool - name: "Start nginx" import_role: diff --git a/releasenotes/notes/disable-dhcp-1f2b1557ac574056.yaml b/releasenotes/notes/disable-dhcp-1f2b1557ac574056.yaml new file mode 100644 index 000000000..8d72b0164 --- /dev/null +++ b/releasenotes/notes/disable-dhcp-1f2b1557ac574056.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + The variable ``include_dhcp_server`` has been removed to ``enable_dhcp`` + for consistency with other variables.