From fc1e4f78dc9b5e415ad71a4664638bddfa190fd2 Mon Sep 17 00:00:00 2001 From: Matthew Thode Date: Tue, 26 Jun 2018 16:50:25 -0500 Subject: [PATCH] Overhaul ironic role Removed unused variables when able and updated to the new ironic driver definitions found here. https://docs.openstack.org/ironic/latest/admin/upgrade-to-hardware-types.html The intention is to support the drivers via profiles, so the table from the above link was converted to a dictionary. This dictionary was used as a source when combining / concatenating the various drivers for each profile into a usable list. The standalone logic was simplified. Change-Id: I19553af41b5e669386b855209c61235bf37371f2 Closes-Bug: 1758351 --- defaults/main.yml | 37 +++------ tasks/ironic_post_install.yml | 24 ------ templates/ironic.conf.j2 | 19 +++-- vars/main.yml | 145 ++++++++++++++++++++++++++++++++++ 4 files changed, 171 insertions(+), 54 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 34fb4b4e..ced55eed 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -69,7 +69,7 @@ ironic_services: ironic-oneviewd: group: ironic_conductor service_name: ironic-oneviewd - service_en: "{{ ironic_oneview_enabled | bool }}" + service_en: "{{ 'oneview' in filtered_ironic_drivers.hardware_type }}" init_config_overrides: "{{ ironic_oneviewd_init_config_overrides }}" @@ -119,10 +119,6 @@ ironic_automated_clean: false ironic_erase_devices_priority: 10 ## ironic-oneview -ironic_oneview_enabled: "{% if 'agent_pxe_oneview' in ironic_openstack_driver_list or - 'agent_pxe_oneview' in ironic_standalone_driver_list or - 'iscsi_pxe_oneview' in ironic_openstack_driver_list or - 'iscsi_pxe_oneview' in ironic_standalone_driver_list %}True{% else %}False{% endif %}" ironic_oneview_manager_url: "" ironic_oneview_username: "" ironic_oneview_password: "" @@ -177,25 +173,13 @@ ironic_keystone_auth_plugin: password # Integrated Openstack configuration ironic_enabled_network_interfaces_list: "flat,noop{{ (ironic_neutron_provisioning_network_uuid is defined) | ternary(',neutron','') }}" ironic_default_network_interface: "{{ (ironic_neutron_provisioning_network_uuid is defined) | ternary('neutron','flat') }}" -ironic_openstack_driver_list: - - agent_ipmitool - - pxe_ipmitool -ironic_openstack_driver_loaded_list: "{% for driver in ironic_openstack_driver_list %}{{ driver }}{% if not loop.last %},{% endif %}{% endfor %}" -ironic_openstack_auth_strategy: keystone -#ironic_openstack_api_url: '' # Not required when we have keystone -ironic_openstack_dhcp_provider: neutron -ironic_openstack_sync_power_state_interval: 60 -ironic_openstack_db_connection_string: "mysql+pymysql://{{ ironic_galera_user }}:{{ ironic_container_mysql_password }}@{{ ironic_galera_address }}/ironic{% if ironic_galera_use_ssl | bool %}&ssl_ca={{ ironic_galera_ssl_ca_cert }}{% endif %}" +ironic_auth_strategy: keystone +ironic_dhcp_provider: "{{ (ironic_standalone | bool) | ternary('none', 'neutron') }}" +ironic_sync_power_state_interval: "{{ (ironic_standalone | bool) | ternary('-1', '60') }}" +ironic_db_connection_string: "mysql+pymysql://{{ ironic_galera_user }}:{{ ironic_container_mysql_password }}@{{ ironic_galera_address }}/ironic{% if ironic_galera_use_ssl | bool %}&ssl_ca={{ ironic_galera_ssl_ca_cert }}{% endif %}" # Standalone Ironic configuration -ironic_standalone_driver_list: - - agent_ipmitool -ironic_standalone_driver_loaded_list: "{% for driver in ironic_standalone_driver_list %}{{ driver }}{% if not loop.last %},{% endif %}{% endfor %}" -ironic_standalone_auth_strategy: noauth -ironic_standalone_api_url: "{{ ironic_service_internaluri }}/" -ironic_standalone_dhcp_provider: none -ironic_standalone_sync_power_state_interval: -1 -ironic_standalone_db_connection_string: "{{ ironic_openstack_db_connection_string }}" +ironic_service_internaluri: "{{ ironic_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ ironic_service_port }}" # Ironic db tuning ironic_db_max_overflow: 10 @@ -265,7 +249,7 @@ ironic_uwsgi_bind_address: 0.0.0.0 ### OpenStack Services to integrate with # Glance -ironic_glance_auth_strategy: "{{ ironic_openstack_auth_strategy }}" +ironic_glance_auth_strategy: "{{ ironic_auth_strategy }}" ironic_glance_service_project_name: "{{ glance_service_project_name | default('service') }}" ironic_glance_service_project_domain_id: "{{ glance_service_project_domain_id | default('default') }}" ironic_glance_keystone_auth_plugin: "{{ glance_keystone_auth_plugin | default('password') }}" @@ -274,7 +258,7 @@ ironic_glance_service_user_domain_id: "{{ glance_service_user_domain_id | defaul ironic_glance_keystone_auth_url: "{{ keystone_service_internalurl | default('http://localhost:5000/v3') }}" # Neutron -ironic_neutron_auth_strategy: "{{ ironic_openstack_auth_strategy }}" +ironic_neutron_auth_strategy: "{{ ironic_auth_strategy }}" # This variable is used by the repo_build process to determine # which host group to check for members of before building the @@ -295,3 +279,8 @@ ironic_pxe_append_params: "ipa-debug=1 systemd.journald.forward_to_console=yes" ironic_api_init_config_overrides: {} ironic_conductor_init_config_overrides: {} ironic_oneviewd_init_config_overrides: {} + +# driver definitions +ironic_drivers_enabled: + - agent_ipmitool + - pxe_ipmitool diff --git a/tasks/ironic_post_install.yml b/tasks/ironic_post_install.yml index 0d438cde..bce2cff3 100644 --- a/tasks/ironic_post_install.yml +++ b/tasks/ironic_post_install.yml @@ -13,30 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Setup ironic for standalone usage - set_fact: - ironic_driver_list: "{{ ironic_standalone_driver_loaded_list }}" - ironic_auth_strategy: "{{ ironic_standalone_auth_strategy }}" - ironic_api_url: "{{ ironic_standalone_api_url }}" - ironic_dhcp_provider: "{{ ironic_standalone_dhcp_provider }}" - ironic_sync_power_state_interval: "{{ ironic_standalone_sync_power_state_interval }}" - ironic_db_connection_string: "{{ ironic_standalone_db_connection_string }}" - when: ironic_standalone | bool - tags: - - always - -- name: Setup ironic for integrated Openstack usage - set_fact: - ironic_driver_list: "{{ ironic_openstack_driver_loaded_list }}" - ironic_auth_strategy: "{{ ironic_openstack_auth_strategy }}" - ironic_api_url: "{{ ironic_openstack_api_url | default(omit) }}" - ironic_dhcp_provider: "{{ ironic_openstack_dhcp_provider }}" - ironic_sync_power_state_interval: "{{ ironic_openstack_sync_power_state_interval }}" - ironic_db_connection_string: "{{ ironic_openstack_db_connection_string }}" - when: not ironic_standalone | bool - tags: - - always - - name: Post swift tempURL secret key command: > {{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure','') }} diff --git a/templates/ironic.conf.j2 b/templates/ironic.conf.j2 index 79f1228a..3c5a6a48 100644 --- a/templates/ironic.conf.j2 +++ b/templates/ironic.conf.j2 @@ -5,8 +5,7 @@ use_stderr = False debug = {{ debug }} -auth_strategy = {{ ironic_openstack_auth_strategy }} -enabled_drivers = {{ ironic_driver_list }} +auth_strategy = {{ ironic_auth_strategy }} host = {{ inventory_hostname }} memcached_servers = {{ memcached_servers }} @@ -16,6 +15,14 @@ default_network_interface = {{ ironic_default_network_interface }} ## RPC Backend transport_url = {{ ironic_oslomsg_rpc_transport }}://{% for host in ironic_oslomsg_rpc_servers.split(',') %}{{ ironic_oslomsg_rpc_userid }}:{{ ironic_oslomsg_rpc_password }}@{{ host }}:{{ ironic_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ ironic_oslomsg_rpc_vhost }}{% if ironic_oslomsg_rpc_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +# drivers +enabled_hardware_types = {{ filtered_ironic_drivers.hardware_type | join(',') }} +enabled_boot_interfaces = {{ filtered_ironic_drivers.boot | join(',') }} +enabled_deploy_interfaces = {{ filtered_ironic_drivers.deploy | join(',') }} +enabled_inspect_interfaces = {{ filtered_ironic_drivers.inspect | join(',') }} +enabled_management_interfaces = {{ filtered_ironic_drivers.management | join(',') }} +enabled_power_interfaces = {{ filtered_ironic_drivers.power | join(',') }} + [agent] [amt] @@ -27,8 +34,8 @@ transport_url = {{ ironic_oslomsg_rpc_transport }}://{% for host in ironic_oslom [cisco_ucs] [conductor] -{% if ironic_api_url is defined %} -api_url = {{ ironic_api_url }} +{% if ironic_standalone | bool %} +api_url = {{ ironic_service_internaluri }}/ {% endif %} sync_power_state_interval = {{ ironic_sync_power_state_interval }} automated_clean = {{ ironic_automated_clean }} @@ -134,14 +141,14 @@ cleaning_network = {{ ironic_neutron_cleaning_network_uuid | default(ironic_neut {% endif %} [oneview] -{% if ironic_oneview_enabled %} +{%- if 'oneview' in filtered_ironic_drivers.hardware_type -%} manager_url = {{ ironic_oneview_manager_url }} username = {{ ironic_oneview_username }} password = {{ ironic_oneview_password }} allow_insecure_connections = {{ ironic_oneview_allow_insecure_connections }} tls_cacert_file = {{ ironic_oneview_tls_cacert_file }} max_polling_attempts = {{ ironic_oneview_max_polling_attempts }} -{% endif %} +{%- endif -%} [oslo_concurrency] lock_path = {{ ironic_lock_path }} diff --git a/vars/main.yml b/vars/main.yml index 97b1e4c2..f212c6f8 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -15,6 +15,142 @@ # This special list brings together all of the package installations into one # task to save time. + +ironic_driver_types: + agent_ilo: + hardware_type: ilo + boot: ilo-virtual-media + deploy: direct + inspect: ilo + management: ilo + power: ilo + agent_ipmitool: + hardware_type: ipmi + boot: pxe + deploy: direct + inspect: inspector + management: ipmitool + power: ipmitool + agent_ipmitool_socat: + hardware_type: ipmi + boot: pxe + deploy: direct + inspect: inspector + management: ipmitool + power: ipmitool + agent_irmc: + hardware_type: irmc + boot: irmc-virtual-media + deploy: direct + inspect: irmc + management: irmc + power: irmc + agent_pxe_oneview: + hardware_type: oneview + boot: pxe + deploy: oneview-direct + inspect: oneview + management: oneview + power: oneview + agent_ucs: + hardware_type: cisco-ucs-managed + boot: pxe + deploy: direct + inspect: inspector + management: ucsm + power: ucsm + iscsi_ilo: + hardware_type: ilo + boot: ilo-virtual-media + deploy: iscsi + inspect: ilo + management: ilo + power: ilo + iscsi_irmc: + hardware_type: irmc + boot: irmc-virtual-media + deploy: iscsi + inspect: irmc + management: irmc + power: irmc + iscsi_pxe_oneview: + hardware_type: oneview + boot: pxe + deploy: oneview-iscsi + inspect: oneview + management: oneview + power: oneview + pxe_agent_cimc: + hardware_type: cisco-ucs-standalone + boot: pxe + deploy: direct + inspect: inspector + management: cimc + power: cimc + pxe_drac: + hardware_type: idrac + boot: pxe + deploy: iscsi + inspect: idrac + management: idrac + power: idrac + pxe_drac_inspector: + hardware_type: idrac + boot: pxe + deploy: iscsi + inspect: inspector + management: idrac + power: idrac + pxe_ilo: + hardware_type: ilo + boot: ilo-pxe + deploy: iscsi + inspect: ilo + management: ilo + power: ilo + pxe_ipmitool: + hardware_type: ipmi + boot: pxe + deploy: iscsi + inspect: inspector + management: ipmitool + power: ipmitool + pxe_ipmitool_socat: + hardware_type: ipmi + boot: pxe + deploy: iscsi + inspect: inspector + management: ipmitool + power: ipmitool + pxe_iscsi_cimc: + hardware_type: cisco-ucs-standalone + boot: pxe + deploy: iscsi + inspect: inspector + management: cimc + power: cimc + pxe_irmc: + hardware_type: irmc + boot: irmc-pxe + deploy: iscsi + inspect: irmc + management: irmc + power: irmc + pxe_snmp: + hardware_type: snmp + boot: pxe + deploy: iscsi + inspect: no-inspect + management: fake + power: snmp + pxe_ucs: + hardware_type: cisco-ucs-managed + boot: pxe + deploy: iscsi + inspect: inspector + management: ucsm + power: ucsm + ironic_packages_list: > {%- set package_list = [] %} {%- if ironic_developer_mode | bool %} @@ -42,3 +178,12 @@ filtered_ironic_services: |- {% endif %} {% endfor %} {{ services }} + +filtered_ironic_drivers: |- + {% set concat_drivers = {} %} + {% for driver in ironic_drivers_enabled %} + {% if driver in ironic_driver_types.keys() %} + {% set _ = concat_drivers.update(ironic_driver_types[driver]) %} + {% endif %} + {% endfor %} + {{ concat_drivers }}