Skip to content

Commit 8ca944b

Browse files
committed
Fix nova04delta template
Signed-off-by: Bohdan Dobrelia <[email protected]>
1 parent 5c6c0df commit 8ca944b

File tree

1 file changed

+62
-54
lines changed
  • roles/ci_gen_kustomize_values/templates/nova04delta/edpm-nodeset-values

1 file changed

+62
-54
lines changed

roles/ci_gen_kustomize_values/templates/nova04delta/edpm-nodeset-values/values.yaml.j2

Lines changed: 62 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,49 @@
22
# source: nova04delta/edpm-nodeset-values/values.yaml.j2
33
{% set _ipv = cifmw_ci_gen_kustomize_values_ip_version_var_mapping %}
44
{% set instances_names = [] %}
5-
{% set _original_nodeset = (original_content.data | default({})).nodeset | default({}) %}
5+
{% set _original_nodeset = original_content.data.nodeset | default({}) %}
66
{% set _original_nodes = _original_nodeset.nodes | default({}) %}
77
{% set _original_services = _original_nodeset['services'] | default([]) %}
8-
{% for _inst in cifmw_networking_env_definition.instances.keys() %}
9-
{% if _inst.startswith('compute') %}
10-
{% set _ = instances_names.append(_inst) %}
11-
{% endif %}
8+
{% set _vm_type = (_original_nodes.keys() | first).split('-')[1] %}
9+
{% for _inst in cifmw_baremetal_hosts.keys() %}
10+
{% if 'compute' in _inst %}
11+
{% set _ = instances_names.append(_inst) %}
12+
{% endif %}
1213
{% endfor %}
13-
{% set inst_stop_idx = (instances_names | length) // 2 %}
14-
{% set nodeset_one_instances = instances_names[:inst_stop_idx] %}
14+
{% set nodeset_one_instances = [instances_names[0]] %}
1515
data:
16+
baremetalSetTemplate:
17+
provisioningInterface: null
1618
ssh_keys:
1719
authorized: {{ cifmw_ci_gen_kustomize_values_ssh_authorizedkeys | b64encode }}
1820
private: {{ cifmw_ci_gen_kustomize_values_ssh_private_key | b64encode }}
1921
public: {{ cifmw_ci_gen_kustomize_values_ssh_public_key | b64encode }}
20-
nova:
21-
migration:
22-
ssh_keys:
23-
private: {{ cifmw_ci_gen_kustomize_values_migration_priv_key | b64encode }}
24-
public: {{ cifmw_ci_gen_kustomize_values_migration_pub_key | b64encode }}
2522
nodeset:
2623
ansible:
2724
ansibleUser: "zuul"
2825
ansibleVars:
2926
edpm_fips_mode: "{{ 'enabled' if cifmw_fips_enabled|default(false)|bool else 'check' }}"
3027
timesync_ntp_servers:
3128
- hostname: "{{ cifmw_ci_gen_kustomize_values_ntp_srv | default('pool.ntp.org') }}"
32-
edpm_network_config_os_net_config_mappings:
33-
{% for instance in nodeset_one_instances %}
34-
edpm-{{ instance }}:
35-
{% if hostvars[instance] is defined %}
36-
nic1: "{{ hostvars[instance][_ipv.ansible_default_ipvX].macaddress }}"
37-
{% endif %}
38-
nic2: "{{ cifmw_networking_env_definition.instances[instance].networks.ctlplane.mac_addr }}"
39-
{% endfor %}
29+
edpm_bootstrap_command: |
30+
# root CA
31+
pushd /etc/pki/ca-trust/source/anchors/
32+
curl -LOk {{ cifmw_install_ca_url }}
33+
update-ca-trust
34+
popd
35+
36+
# install rhos-release repos
37+
dnf --nogpgcheck install -y {{ cifmw_repo_setup_rhos_release_rpm }}
38+
rhos-release {{ cifmw_repo_setup_rhos_release_args }}
39+
40+
# see https://access.redhat.com/solutions/253273
41+
dnf -y install conntrack-tools
4042
{% if cifmw_ci_gen_kustomize_values_sshd_ranges | default([]) | length > 0 %}
4143
edpm_sshd_allowed_ranges:
4244
{% for range in cifmw_ci_gen_kustomize_values_sshd_ranges %}
4345
- "{{ range }}"
4446
{% endfor %}
4547
{% endif %}
46-
nodes:
47-
{% for instance in nodeset_one_instances %}
48-
edpm-{{ instance }}:
49-
ansible:
50-
host: {{ cifmw_networking_env_definition.instances[instance].networks.ctlplane[_ipv.ip_vX] }}
51-
hostName: {{ instance }}
52-
networks:
53-
{% for net in cifmw_networking_env_definition.instances[instance].networks.keys() %}
54-
- name: {{ net }}
55-
subnetName: subnet1
56-
fixedIP: {{ cifmw_networking_env_definition.instances[instance].networks[net][_ipv.ip_vX] }}
57-
{% if net is match('ctlplane') %}
58-
defaultRoute: true
59-
{% endif %}
60-
{% endfor %}
61-
{% endfor %}
6248
{% if ('repo-setup' not in _original_services) and
6349
('repo-setup' in ci_gen_kustomize_edpm_nodeset_predeployed_services) %}
6450
services:
@@ -67,21 +53,43 @@ data:
6753
- "{{ svc }}"
6854
{% endfor %}
6955
{% endif %}
70-
{% for host in cifmw_networking_env_definition.instances.keys() if host is match('^compute.*') %}
71-
{% if cifmw_run_id is defined %}
72-
{% set _host = host | replace('-' + cifmw_run_id, '') %}
73-
{% else %}
74-
{% set _host = host %}
75-
{% endif %}
76-
{{ _host }}:
77-
bmc:
78-
address: {{ cifmw_baremetal_hosts[host].connection }}
79-
credentialsName: {{ _host }}-bmc-secret
80-
bootMACAddress: {{ cifmw_baremetal_hosts[host].nics[0].mac }}
81-
labels:
82-
app: openstack
83-
nodeset: {{ host | split('-') | first }}
84-
name: {{ host }}
85-
rootDeviceHints:
86-
deviceName: /dev/sda
87-
{% endfor %}
56+
57+
# source roles/deploy_bmh/template/bmh.yml.j2, but it patches kustomize built outputs
58+
baremetalhosts:
59+
{% for host, def in cifmw_baremetal_hosts.items() if 'compute' in host %}
60+
{% set _host = host | replace('-' + cifmw_run_id, '') if cifmw_run_id is defined else host %}
61+
{{ _host }}:
62+
bmc:
63+
address: {{ cifmw_baremetal_hosts[host].connection }}
64+
credentialsName: {{ _host }}-bmc-secret
65+
disableCertificateVerification: {{ cifmw_deploy_bmh_disable_certificate_validation | default(true) }}
66+
{% for nic in (cifmw_baremetal_hosts[host]['nics'] | default([])) if nic['network'] == cifmw_deploy_bmh_boot_interface | default('provision') %}
67+
bootMACAddress: {{ nic.mac }}
68+
{% endfor %}
69+
bootMode: {{ cifmw_baremetal_hosts[host].boot_mode }}
70+
online: {{ 'true' if cifmw_baremetal_hosts[host].status | default("") == "running" else 'false' }}
71+
labels:
72+
app: openstack
73+
nodeset: {{ host | split('-') | first }}
74+
name: {{ host }}
75+
{% if 'root_device_hint' in cifmw_baremetal_hosts[host] %}
76+
{# Ensure integer values are rendered as integers and not as strings #}
77+
{% set hint_value = cifmw_baremetal_hosts[host]['root_device_hint']
78+
if cifmw_baremetal_hosts[host]['root_device_hint'] | int != 0 else
79+
'"' + cifmw_baremetal_hosts[host]['root_device_hint'] + '"' %}
80+
{% set hint_field = cifmw_baremetal_hosts[host].root_device_hint_field | default(cifmw_deploy_bmh_root_device_hint_field | default('deviceName')) %}
81+
rootDeviceHints:
82+
{{ hint_field }}: {{ hint_value }}
83+
{% endif %}
84+
{% if 'nmstate' in cifmw_baremetal_hosts[host] %}
85+
preprovisioningNetworkDataName: {{ _host }}-nmstate-secret
86+
{% endif %}
87+
{% endfor %}
88+
89+
{% if 'compute' in _vm_type %}
90+
nova:
91+
migration:
92+
ssh_keys:
93+
private: {{ cifmw_ci_gen_kustomize_values_migration_priv_key | b64encode }}
94+
public: {{ cifmw_ci_gen_kustomize_values_migration_pub_key | b64encode }}
95+
{% endif %}

0 commit comments

Comments
 (0)