From 79675d4c5fc2f53719d9e9442ce2c4428ef152a7 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 12 Feb 2025 13:46:42 +0100 Subject: [PATCH] Auto-fix yaml rules In order to reduce divergance with ansible-lint rules, we apply auto-fixing of violations. In current patch we replace all kind of truthy variables with `true` or `false` values to align with recommendations along with alignment of used quotes. Change-Id: Ibcbb660f39c067e68b699436ef2da0903c8500fd --- .gitignore | 1 + defaults/main.yml | 31 +++++++++++++++--------------- handlers/main.yml | 7 +++---- tasks/main.yml | 6 ++---- tasks/neutron_apparmor.yml | 20 +++++++++---------- tasks/neutron_db_setup.yml | 4 ++-- tasks/neutron_install.yml | 6 +++--- tasks/neutron_post_install.yml | 2 +- tasks/neutron_pre_install.yml | 2 +- tasks/providers/ovn_config.yml | 5 +++-- tasks/providers/setup_ovs_dpdk.yml | 4 ++-- tasks/providers/setup_ovs_ovn.yml | 1 + vars/main.yml | 14 +++++++------- 13 files changed, 51 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 3a772066..c46a9ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ logs/* # OS generated files # ###################### ._* +.ansible .tox *.egg-info .eggs diff --git a/defaults/main.yml b/defaults/main.yml index 91e3a5b6..d7cba954 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,8 +17,7 @@ ### Verbosity Options ### -debug: False - +debug: false ### ### Service setup options @@ -97,7 +96,7 @@ neutron_venv_tag: "{{ venv_tag | default('untagged') }}" ### # Fatal Deprecations -neutron_fatal_deprecations: False +neutron_fatal_deprecations: false # If ``neutron_api_workers`` is unset the system will use half the number of available VCPUs to # compute the number of api workers to use with a default capping value of 16. @@ -135,7 +134,7 @@ neutron_dhcp_config_list: [] # When dnsmasq_dns_servers are not set, # and neutron_dnsmasq_noresolv is set to True, dnsmasq will reply with # empty respose on DNS requests. -neutron_dnsmasq_noresolv: False +neutron_dnsmasq_noresolv: false ### ### Tunable Overrides (Sorted alphabetically) @@ -196,7 +195,7 @@ neutron_ovn_metadata_agent_init_overrides: {} ### UWSGI ### # NOTE(noonedeadpunk): uWSGI is still not fully supported. See: https://bugs.launchpad.net/neutron/+bug/1912359 -neutron_use_uwsgi: False +neutron_use_uwsgi: false neutron_wsgi_processes_max: 16 neutron_wsgi_processes: "{{ [[ansible_facts['processor_vcpus'] | default(1), 1] | max * 2, neutron_wsgi_processes_max] | min }}" neutron_wsgi_threads: 1 @@ -369,7 +368,7 @@ neutron_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (group ### neutron_designate_enabled: "{{ (groups['designate_all'] is defined) and (groups['designate_all'] | length > 0) }}" -neutron_allow_reverse_dns_lookup: True +neutron_allow_reverse_dns_lookup: true neutron_ipv4_ptr_zone_prefix_size: 24 neutron_ipv6_ptr_zone_prefix_size: 116 @@ -401,7 +400,7 @@ neutron_memcached_servers: "{{ memcached_servers }}" # The neutron core plugin (ML2) is defined with neutron_plugin_type, # you can not load multiple ML2 plugins as core. -neutron_plugin_type: 'ml2.ovn' +neutron_plugin_type: "ml2.ovn" # Additional ML2 plugins can be loaded with neutron_plugin_types (as list) neutron_plugin_types: [] @@ -447,7 +446,7 @@ neutron_local_ip: "{{ tunnel_address | default('127.0.0.1') }}" neutron_ha_vrrp_auth_type: PASS neutron_l3_ha_net_cidr: 169.254.192.0/18 -neutron_l3_cleanup_on_shutdown: False +neutron_l3_cleanup_on_shutdown: false ## List of extensions enabled for L3 ## The list can be extended by operator if needed, ie in user_variables.yml: @@ -469,7 +468,7 @@ neutron_dnsmasq_dns_servers: "" neutron_dnsmasq_lease_max: 16777216 # Specify if dnsmasq should send a route to metadata server through DHCP 121 message to VM -neutron_dnsmasq_force_metadata: False +neutron_dnsmasq_force_metadata: false # Specify the maximum number of DHCP agents per tenant network. Defaults to the total number of agents deployed # neutron_dhcp_agents_max: 2 @@ -520,13 +519,13 @@ neutron_ovn_vpn_agent_overrides: {} neutron_ovn_vpn_agent_init_overrides: {} # OVN Defaults -neutron_ovn_ssl: True +neutron_ovn_ssl: true ovn_proto: "{{ (neutron_ovn_ssl) | ternary('ssl', 'tcp') }}" neutron_ovn_primary_cluster_node: "{{ groups[neutron_services['neutron-ovn-northd']['group']] | first }}" neutron_ovn_northd_service_name: ovn-northd neutron_ovn_controller_service_name: ovn-controller neutron_ovn_l3_scheduler: leastloaded -neutron_ovn_distributed_fip: False +neutron_ovn_distributed_fip: false neutron_ovn_nb_connection: >- {{ ovn_proto }}:{{ groups['neutron_ovn_northd'] | map('extract', hostvars, ['ansible_host']) | join(':6641,' + ovn_proto + ':') }}:6641 neutron_ovn_sb_connection: >- @@ -540,12 +539,12 @@ neutron_ovn_sb_inactivity_probe: 60000 neutron_ovn_nb_inactivity_probe: 60000 # OVN BGP Agent -neutron_ovn_bgp_enable: False +neutron_ovn_bgp_enable: false neutron_ovn_bgp_agent_group: "{{ neutron_ovn_distributed_fip | ternary('neutron_ovn_controller', 'neutron_ovn_gateway') }}" neutron_ovn_bgp_agent_driver: nb_ovn_bgp_driver neutron_ovn_bgp_exposing_method: underlay -neutron_ovn_bgp_expose_tenant_networks: False -neutron_ovn_bgp_expose_ipv6_gua_tenant_networks: False +neutron_ovn_bgp_expose_tenant_networks: false +neutron_ovn_bgp_expose_ipv6_gua_tenant_networks: false # Provide config needed for BGP peering # neutron_ovn_bgp_config: # AS: 64999 @@ -644,7 +643,7 @@ neutron_ovn_pki_install_certificates: ovs_datapath: "netdev" ovs_dpdk_pci_addresses: [] ovs_dpdk_driver: vfio-pci -ovs_dpdk_support: False +ovs_dpdk_support: false ovs_dpdk_lcore_mask: 1 ovs_dpdk_pmd_cpu_mask: 2 ovs_dpdk_socket_mem: "1024" @@ -669,7 +668,7 @@ neutron_pki_setup_host: "{{ openstack_pki_setup_host | default('localhost') }}" neutron_pki_keys_path: "{{ neutron_pki_dir ~ '/certs/private/' }}" neutron_pki_certs_path: "{{ neutron_pki_dir ~ '/certs/certs/' }}" neutron_pki_intermediate_cert_name: "{{ openstack_pki_service_intermediate_cert_name | default('ExampleCorpIntermediate') }}" -neutron_pki_regen_cert: '' +neutron_pki_regen_cert: "" neutron_pki_san: "{{ openstack_pki_san | default('DNS:' ~ ansible_facts['hostname'] ~ ',IP:' ~ management_address) }}" neutron_pki_certificates: - name: "neutron_{{ ansible_facts['hostname'] }}" diff --git a/handlers/main.yml b/handlers/main.yml index 9a64d740..9de54a86 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -17,7 +17,7 @@ service: name: "{{ item.service_name }}" state: "stopped" - daemon_reload: yes + daemon_reload: true with_items: "{{ filtered_neutron_services }}" register: _stop until: _stop is success @@ -29,7 +29,6 @@ - "systemd service changed" - "cert installed" - # NOTE # When restarting neutron-l3-agent, a non-default systemd KillMode of 'process' is used # to prevent Keepalived from exiting and causing a data-plane outage. As a result of this @@ -89,7 +88,7 @@ - name: Perform a DB contract command: "{{ neutron_bin }}/neutron-db-manage upgrade --contract" - become: yes + become: true become_user: "{{ neutron_system_user_name }}" changed_when: false when: @@ -104,7 +103,7 @@ name: "{{ item.service_name }}" enabled: "{{ item.enabled | default(True) }}" state: "{{ item.state | default('started') }}" - daemon_reload: yes + daemon_reload: true with_items: "{{ filtered_neutron_services }}" register: _start until: _start is success diff --git a/tasks/main.yml b/tasks/main.yml index b3a078eb..3c269d2d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -12,8 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - - - name: Importing neutron_check tasks import_tasks: neutron_check.yml @@ -207,8 +205,8 @@ systemd: name: "{{ item['service_name'] }}" state: stopped - enabled: False - masked: True + enabled: false + masked: true when: - item['group'] in group_names - item['service_name'] ~ '.service' in ansible_facts.services diff --git a/tasks/neutron_apparmor.yml b/tasks/neutron_apparmor.yml index f64f43d3..d8a46303 100644 --- a/tasks/neutron_apparmor.yml +++ b/tasks/neutron_apparmor.yml @@ -21,15 +21,15 @@ until: apparmor_packages is success retries: 5 delay: 2 - become: yes + become: true delegate_to: "{{ physical_host | default('localhost') }}" - name: Ensure apparmor service is running systemd: name: "apparmor" - enabled: yes + enabled: true state: "started" - become: yes + become: true delegate_to: "{{ physical_host | default('localhost') }}" - name: "Disable apparmor profile" @@ -50,12 +50,12 @@ failed_when: _apparmor_profile_disabled.rc not in [0,2] args: executable: /bin/bash - become: yes + become: true delegate_to: "{{ physical_host | default('localhost') }}" with_items: - - profile: 'usr.sbin.haproxy' - process: 'haproxy' - - profile: 'bin.ping' - process: 'ping' - - profile: 'usr.sbin.dnsmasq' - process: 'dnsmasq' + - profile: "usr.sbin.haproxy" + process: "haproxy" + - profile: "bin.ping" + process: "ping" + - profile: "usr.sbin.dnsmasq" + process: "dnsmasq" diff --git a/tasks/neutron_db_setup.yml b/tasks/neutron_db_setup.yml index b72540ba..726dc4fb 100644 --- a/tasks/neutron_db_setup.yml +++ b/tasks/neutron_db_setup.yml @@ -15,7 +15,7 @@ - name: Perform a DB expand command: "{{ neutron_bin }}/neutron-db-manage --config-file {{ neutron_conf_version_dir }}/neutron.conf upgrade --expand" - become: yes + become: true become_user: "{{ neutron_system_user_name }}" changed_when: false when: @@ -34,7 +34,7 @@ command: "{{ neutron_bin }}/neutron-db-manage --config-file {{ neutron_conf_version_dir }}/neutron.conf has_offline_migrations" environment: LANGUAGE: en_US.UTF-8 - become: yes + become: true become_user: "{{ neutron_system_user_name }}" when: - "_neutron_is_first_play_host" diff --git a/tasks/neutron_install.yml b/tasks/neutron_install.yml index 485eb649..ed0af685 100644 --- a/tasks/neutron_install.yml +++ b/tasks/neutron_install.yml @@ -79,7 +79,7 @@ - name: Retrieve the constraints URL uri: url: "{{ neutron_upper_constraints_url }}" - return_content: yes + return_content: true register: _u_c_contents check_mode: false @@ -137,8 +137,8 @@ # NOTE(hwoarang) contains may share the same physical host so we only # need to execute the apparmor configuration once per physical host. - name: Record the first container on each physical host - delegate_to: 'localhost' - run_once: True + delegate_to: "localhost" + run_once: true set_fact: neutron_apparmor_hosts: | {%- set apparmor_hosts = [] -%} diff --git a/tasks/neutron_post_install.yml b/tasks/neutron_post_install.yml index fb2f2e03..a8345ffa 100644 --- a/tasks/neutron_post_install.yml +++ b/tasks/neutron_post_install.yml @@ -108,7 +108,7 @@ fetch: src: "{{ item.target_f }}.original" dest: "{{ item.tmp_f }}" - flat: yes + flat: true changed_when: false with_items: "{{ neutron_core_files }}" run_once: true diff --git a/tasks/neutron_pre_install.yml b/tasks/neutron_pre_install.yml index a15d6d9d..e1b7d77d 100644 --- a/tasks/neutron_pre_install.yml +++ b/tasks/neutron_pre_install.yml @@ -75,7 +75,7 @@ mode: "0755" - path: "{{ neutron_system_home_folder }}/ovn-metadata-proxy" mode: "u=rwX,g=rX,o=rX" - recurse: True + recurse: true condition: "{{ (neutron_plugin_type == 'ml2.ovn' and neutron_services['neutron-ovn-metadata-agent']['group'] in group_names) }}" - path: "{{ neutron_system_home_folder }}/ha_confs" state: "{{ (neutron_plugin_type == 'ml2.ovn') | ternary('absent', 'directory') }}" diff --git a/tasks/providers/ovn_config.yml b/tasks/providers/ovn_config.yml index 7e5bb133..0c5da0e8 100644 --- a/tasks/providers/ovn_config.yml +++ b/tasks/providers/ovn_config.yml @@ -1,3 +1,4 @@ +--- # (c) 2018, James Denton # # Copyright 2018, Rackspace US, Inc. @@ -42,7 +43,7 @@ systemd: name: "{{ neutron_ovn_northd_service_name }}" state: started - enabled: yes + enabled: true when: - neutron_services['neutron-ovn-northd']['group'] in group_names @@ -50,7 +51,7 @@ systemd: name: "{{ neutron_ovn_controller_service_name }}" state: "{{ (ovn_controller_config.changed) | ternary('restarted', 'started') }}" - enabled: yes + enabled: true when: - neutron_services['neutron-ovn-controller']['group'] in group_names diff --git a/tasks/providers/setup_ovs_dpdk.yml b/tasks/providers/setup_ovs_dpdk.yml index 93d2a3c8..215f4fa0 100644 --- a/tasks/providers/setup_ovs_dpdk.yml +++ b/tasks/providers/setup_ovs_dpdk.yml @@ -48,7 +48,7 @@ systemd: name: "{{ dpdk_service_name }}" state: restarted - enabled: yes + enabled: true when: - neutron_services['neutron-openvswitch-agent']['group'] in group_names - '"nova_compute" in group_names' @@ -57,7 +57,7 @@ systemd: name: "{{ neutron_ovs_service_name }}" state: restarted - enabled: yes + enabled: true when: - neutron_services['neutron-openvswitch-agent']['group'] in group_names diff --git a/tasks/providers/setup_ovs_ovn.yml b/tasks/providers/setup_ovs_ovn.yml index 31625b55..5425c6a2 100644 --- a/tasks/providers/setup_ovs_ovn.yml +++ b/tasks/providers/setup_ovs_ovn.yml @@ -1,3 +1,4 @@ +--- # (c) 2018, James Denton # # Copyright 2018, Rackspace US, Inc. diff --git a/vars/main.yml b/vars/main.yml index 509676e0..c1bf56b1 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -182,7 +182,7 @@ neutron_plugins: l2_population: "{{ neutron_l2_population }}" mechanisms: "openvswitch" l3_agent_mode: "{% if 'network_hosts' in group_names %}dvr_snat{% else %}dvr{% endif %}" - router_distributed: True + router_distributed: true plugin_conf_ini_overrides: "{{ neutron_ml2_conf_ini_overrides }}" plugin_core: ml2 plugin_ini: plugins/ml2/ml2_conf.ini @@ -205,7 +205,7 @@ neutron_plugins: ml2.genericswitch: drivers_type: "vlan" mechanisms: "genericswitch" - plugin_conf_bare: True + plugin_conf_bare: true plugin_conf_ini_overrides: "{{ neutron_ml2_conf_genericswitch_ini_overrides }}" plugin_core: ml2 plugin_ini: plugins/ml2/ml2_conf_genericswitch.ini @@ -473,7 +473,7 @@ neutron_services: neutron-server: group: neutron_server service_name: neutron-server - service_en: True + service_en: true start_order: 1 wsgi_app: "{{ neutron_use_uwsgi }}" uwsgi_overrides: "{{ neutron_api_uwsgi_ini_overrides }}" @@ -496,7 +496,7 @@ neutron_services: neutron-rpc-server: group: neutron_server service_name: neutron-rpc-server - service_en: True + service_en: true enabled: "{{ neutron_use_uwsgi }}" state: "{{ neutron_use_uwsgi | ternary('started', 'stopped') }}" init_config_overrides: "{{ neutron_rpc_server_init_overrides | combine(neutron_server_init_overrides) }}" @@ -510,7 +510,7 @@ neutron_services: neutron-periodic-workers: group: neutron_server service_name: neutron-periodic-workers - service_en: True + service_en: true enabled: "{{ neutron_use_uwsgi }}" state: "{{ neutron_use_uwsgi | ternary('started', 'stopped') }}" init_config_overrides: "{{ neutron_periodic_workers_init_overrides | combine(neutron_server_init_overrides) }}" @@ -547,10 +547,10 @@ neutron_services: start_order: 3 neutron-ovn-northd: group: neutron_ovn_northd - service_en: False + service_en: false neutron-ovn-controller: group: neutron_ovn_controller - service_en: False + service_en: false neutron-ovn-bgp-agent: group: "{{ neutron_ovn_bgp_agent_group }}" systemd_lock_dir: /run/lock/ovn-bgp-agent