diff --git a/group_vars/all.yml b/group_vars/all.yml index 12e16b83..eaa0c107 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -18,6 +18,9 @@ controller_count: 3 #compute_count: 1 ceph_node_count: 0 set_boot_order: true +#specify undercloud hostname and password when using scaleout.yml +#undercloud_hostname: +#undercloud_password: alias: #lab specific vars lab_url: "http://quads.alias.bos.scalelab.redhat.com" diff --git a/scaleout.yml b/scaleout.yml new file mode 100644 index 00000000..86039bf0 --- /dev/null +++ b/scaleout.yml @@ -0,0 +1,363 @@ +--- +- hosts: localhost + tasks: + #Make sure public key of ansible controller node is copied on to undercloud host + - name: add undercloud + add_host: + name: "undercloud" + ansible_host: "{{ undercloud_hostname }}" + ansible_user: "stack" + ansible_connection: "ssh" + ansible_ssh_pass: "{{ undercloud_password }}" + +- hosts: undercloud + vars: + new_instack: /home/stack/newnodes.json + tasks: + - name: get the new nodes file + copy: + src: "{{ new_nodes_instack }}" + dest: "{{ new_instack }}" + force: yes + + - name: get tn10rt machines list + shell: curl http://wiki.scalelab.redhat.com/1029u/ > ~/tn10rt.html + + - name: load tn10rt machines list + slurp: + src: /home/stack/tn10rt.html + register: tn10rt + + - block: + - name: load instack data + slurp: + src: /home/stack/newnodes.json + register: stack_data + + - name: load new instackenv + set_fact: + stack_data: "{{ stack_data['content'] | b64decode | from_json }}" + + - name: get machine types + set_fact: + machine_types: "{{ machine_types|default([]) + [ (type != '1029u') | ternary(type, (item.pm_addr.replace('mgmt-', '') in tn10rt['content'] | b64decode) | ternary('1029utn10rt', '1029utrtp')) ] }}" + vars: + type: "{{ (lab_name == 'scale') | ternary(item.pm_addr.split('.')[0].split('-')[4], item.pm_addr.split('.')[0].split('-')[3]) }}" + loop: "{{ stack_data.nodes|flatten(levels=1) }}" + + - name: set vendors of overcloud nodes + set_fact: + vendors: "{{ vendors|default([])+ [(item in lab_vars['machine_types']['supermicro']) | ternary('supermicro', 'dell')] }}" + with_items: + - "{{ machine_types }}" + + - name: list stack_data + shell: | + echo "{{ (stack_data.nodes[item | int].pm_addr | replace('mgmt-','') | replace('-drac', '')) }}" + with_sequence: 0-{{ (stack_data.nodes|length - 1) }} + register: host_list + vars: + lab_vars: "{{ (lab_name == 'scale') | ternary(scale, alias) }}" + when: lab_name in ['scale', 'alias'] + + - block: + - name: clear existing dell-hosts file + shell: echo "" > {{ playbook_dir }}/badfish/dell-hosts + + - name: prepare dell hosts for badfish + shell: echo "mgmt-{{ item[1].stdout }}" >> {{ playbook_dir }}/badfish/dell-hosts + when: vendors is defined and item[0] == "dell" + with_together: + - "{{ vendors }}" + - "{{ host_list.results }}" + + - name: set boot order to director + include_tasks: tasks/set_boot_order_director.yml + vars: + chassis_password: "{{ stack_data.nodes[0].pm_password }}" + when: lab_name in ['scale', 'alias'] and set_boot_order == true + delegate_to: localhost + + - name: set machine count + set_fact: + total_machine_count: {} + + - name: set machine count for each machine type + set_fact: + total_machine_count: "{{ total_machine_count | combine({item: (item in total_machine_count)|ternary(total_machine_count[item], 0)|int + 1 }, recursive=True) }}" + with_items: + "{{ machine_types }}" + + - name: register new nodes + shell: | + source /home/stack/stackrc + openstack overcloud node import {{ new_instack }} + + - name: wait for nodes to move From enroll, Verifying and to manageable state + wait_for: + timeout: 15 + delegate_to: localhost + + - name: get the new nodes detail + shell: | + source /home/stack/stackrc + openstack baremetal node list -f yaml + register: new_nodes_detail + + - name: set new nodes fact + set_fact: + new_nodes_list: "{{ new_nodes_detail.stdout | from_yaml }}" + + - name: filter manageable/available nodes + set_fact: + new_nodes: "{{ (new_nodes | default([])) + [ item['UUID'] ] }}" + with_items: "{{ new_nodes_list | default([]) }}" + when: + item.get('Provisioning State') == 'manageable' or item.get('Provisioning State') == 'available' + + - name: introspect new nodes + shell: | + source /home/stack/stackrc + openstack overcloud node introspect --all-manageable + ignore_errors: true + + - name: delete instrospect failed nodes + include_tasks: tasks/delete_introspection_failed_nodes.yml + + # when automated cleaning is enabled, this check is needed + - name: wait for nodes to reach available state + shell: | + source /home/stack/stackrc + openstack baremetal node show {{ item }} -f value -c provision_state + register: node_state + until: node_state.stdout == "available" + retries: 15 + delay: 120 + loop: "{{ manageable_nodes.stdout_lines | default([]) }}" + + # keep track of count for each machine type after + # deleting introspect failed nodes. + - block: + - name: reduce machine count for introspect failed machine type + set_fact: + total_machine_count: "{{ total_machine_count | combine(update_item, recursive=true) }}" + vars: + update_item: "{ '{{ item.key }}': {{ total_machine_count[item.key]|int - failed_nodes_machine_count[item.key]|int }} }" + with_dict: "{{ failed_nodes_machine_count }}" + + - name: remove introspect failed machine types that have count of zero + set_fact: + total_machine_count: "{{ total_machine_count | combine({ item: (total_machine_count[item]|int > 0) | ternary(total_machine_count[item], omit) }) }}" + with_items: "{{ total_machine_count.keys() }}" + + - name: delete introspect failed node UUID's + set_fact: + new_nodes: "{{ new_nodes | difference(failed_nodes_uuids) }}" + when: failed_nodes_machine_type is defined + + - name: set command for getting overcloud host list + set_fact: + overcloud_host_list: "metalsmith -c Hostname -f value list" + when: osp_release|int >= 17 + + - name: set command for getting overcloud host list + set_fact: + overcloud_host_list: "openstack server list -c Name -f value" + when: osp_release|int < 17 + + # figure out existing machine types and newly added machine types + - block: + - name: get existing machine types + shell: | + source /home/stack/stackrc + {{ overcloud_host_list }} | grep compute | cut -d'-' -f 1 | sed 's/compute/''/gI' | sort | uniq + register: existing_machine_types + + - name: get new machine types that are newly being added + set_fact: + new_machine_types: "{{ total_machine_count.keys()|list | difference(existing_machine_types.stdout_lines|list) }}" + when: composable_roles == true + + - name: Configure the image properties + shell: | + source /home/stack/stackrc + openstack overcloud node configure {{ item }} + with_items: "{{ new_nodes | default([]) }}" + ignore_errors: true + changed_when: false + + # set root hints + - block: + # workaround for using existing root hint tasks + - block: + - name: remove existing total nodes file + shell: | + rm -f /home/stack/total_nodes.txt + + - name: get all nodes + shell: | + echo {{ item }} >> /home/stack/total_nodes.txt + with_items: "{{ new_nodes | default([]) }}" + + - name: register the output of total new nodes + shell: | + cat /home/stack/total_nodes.txt + register: total_nodes + + - name: set root hints + include_tasks: tasks/set_root_hints.yml + when: lab_name in ['scale', 'alias'] + + - name: create flavors + shell: | + source ~/stackrc + openstack flavor create --id auto --ram 4096 --disk 40 --vcpus 1 baremetal{{ item }} + openstack flavor set --property "capabilities:boot_option"="local" --property "capabilities:profile"="baremetal{{ item }}" baremetal{{ item }} + openstack flavor set baremetal{{ item }} --property "resources:VCPU"="0" + openstack flavor set baremetal{{ item }} --property "resources:MEMORY_MB"="0" + openstack flavor set baremetal{{ item }} --property "resources:DISK_GB"="0" + openstack flavor set baremetal{{ item }} --property "resources:CUSTOM_BAREMETAL"="1" + with_items: "{{ new_machine_types | default([]) }} " + when: osp_release|int < 17 and composable_roles == true + + - name: setting node capabilities (boot_mode bios) + vars: + boot_mode: bios + include_tasks: tasks/set_boot_mode.yml + when: osp_release|int >= 17 or composable_roles + + - name: set fact for defining list of hosts for which the deployment should be limited + set_fact: + deploy_limit_str: "" + + - block: + - name: copy roles definition for new machine types + command: | + cp -r ~/roles/Compute.yaml ~/roles/Compute{{ item }}.yaml + with_items: "{{ new_machine_types | default([]) }}" + + - name: Edit role name + lineinfile: + path: "/home/stack/roles/Compute{{ item }}.yaml" + regexp: '- name:' + line: "- name: Compute{{ item }}" + with_items: "{{ new_machine_types | default([]) }}" + + - name: Edit hostname format + lineinfile: + path: "/home/stack/roles/Compute{{ item }}.yaml" + regexp: ' HostnameFormatDefault:' + line: " HostnameFormatDefault: 'compute{{ item }}-%index%'" + with_items: "{{ new_machine_types | default([]) }}" + + - name: write entries for new roles + include_tasks: tasks/new_roles_for_scaleout.yml + vars: + check_type: "{{ item }}" + loop: "{{ new_machine_types | default([]) }}" + + - name: prepare nic configs + include_tasks: tasks/composable_prepare_nic_configs_for_scaleout.yml + + - name: write entries for new roles in baremetal_deployment.yaml + include_tasks: tasks/baremetal_deployment_prepare_for_scaleout.yaml + vars: + node_type: "{{ item }}" + loop: "{{ total_machine_count.keys()|list }}" + when: osp_release|int >= 17 + + - name: update nodes_data.yaml + include_tasks: tasks/update_nodes_data_for_scaleout.yaml + vars: + node_type: "{{ item }}" + loop: "{{ total_machine_count.keys()|list }}" + + - name: update network-environment.yaml + include_tasks: tasks/update_network_environment_for_scaleout.yaml + vars: + node_type: "{{ item }}" + loop: "{{ new_machine_types | default([]) }}" + when: osp_release|int < 17 + + - name: prepare deploy_limit_str + include_tasks: tasks/prepare_deploy_limit_str_for_scaleout.yaml + vars: + node_type: "{{ item }}" + loop: "{{ total_machine_count.keys()|list }}" + when: composable_roles == true + + - block: + - name: get existing compute count + shell: | + source /home/stack/stackrc + {{ overcloud_host_list }} | grep compute | wc -l + register: compute_count + + - name: prepare deploy_limit_str + set_fact: + deploy_limit_str: "{{ deploy_limit_str + append_item }}" + vars: + append_item: "{{ (deploy_limit_str|length == 0) | ternary(item, (',' + item)) }}" + with_sequence: "start={{ compute_count.stdout|int }} end={{ compute_count.stdout|int + new_nodes|length - 1 }} format=compute-%1u" + + - name: set fact for compute count + set_fact: + compute_count: "{{ compute_count.stdout|int + new_nodes|length }}" + + - name: update count in baremetal_deployment.yaml with added computes + replace: + path: /home/stack/virt/network/baremetal_deployment.yaml + after: "- name: Compute" + before: " hostname_format: compute-%index%" + regexp: '.*count.*' + replace: " count: {{ compute_count }}" + when: osp_release|int >= 17 + + - name: update nodes_data.yaml + lineinfile: + regexp: ".*ComputeCount.*" + line: " ComputeCount: {{ compute_count }}" + path: /home/stack/virt/nodes_data.yaml + when: osp_release|int >= 17 + + - name: update compute count in nodes_data.yaml + lineinfile: + regexp: ".*ComputeCount.*" + line: " ComputeCount: {{ compute_count }}" + path: /home/stack/virt/nodes_data.yaml + when: osp_release|int < 17 + when: composable_roles == false + + - name: provision nodes + shell: | + source /home/stack/stackrc + set -o pipefail + openstack overcloud node provision \ + --network-config --stack overcloud \ + -o /home/stack/templates/overcloud-baremetal-deployed.yaml /home/stack/virt/network/baremetal_deployment.yaml -y | \ + tee -a /home/stack/overcloud_provision_nodes.log + when: osp_release|int >= 17 + + - block: + - name: format deploy_limit_str + set_fact: + deploy_limit_str: " --limit \"Undercloud,Controller,{{ deploy_limit_str }}\" \\" + + - name: copy overcloud_deploy.sh + shell: | + cp /home/stack/overcloud_deploy.sh /home/stack/overcloud_deploy_with_limit.sh + + - name: update overcloud deploy script + lineinfile: + regexp: ".*--limit.*" + line: "{{ deploy_limit_str }}" + insertafter: ".*openstack overcloud deploy.*" + path: /home/stack/overcloud_deploy_with_limit.sh + + - name: overcloud deploy + shell: | + source /home/stack/stackrc + set -o pipefail + ./overcloud_deploy_with_limit.sh &> /home/stack/overcloud_install.log + args: + chdir: /home/stack/ diff --git a/tasks/baremetal_deployment_prepare_for_scaleout.yaml b/tasks/baremetal_deployment_prepare_for_scaleout.yaml new file mode 100644 index 00000000..f4da3af7 --- /dev/null +++ b/tasks/baremetal_deployment_prepare_for_scaleout.yaml @@ -0,0 +1,38 @@ +- name: check for existence of a role + lineinfile: + line: "- name: Compute{{ node_type }}" + path: /home/stack/virt/network/baremetal_deployment.yaml + check_mode: true + register: line_check + +- block: + - name: prepare baremetal_deployment_for_scaleout.yaml + template: + src: baremetal_deployment_for_scaleout.yaml.j2 + dest: /home/stack/baremetal_deployment_for_scaleout.yaml + + - name: write entry for new role + shell: | + cat /home/stack/baremetal_deployment_for_scaleout.yaml >> /home/stack/virt/network/baremetal_deployment.yaml + when: line_check.changed + +- block: + - name: get existing compute count + shell: | + source /home/stack/stackrc + {{ overcloud_host_list }} | grep compute | grep {{ node_type }} | wc -l + register: compute_count + + - name: set fact for compute count + set_fact: + compute_count: "{{ compute_count.stdout|int + total_machine_count[node_type]|int }}" + + - name: update counts in baremetal_deployment.yaml with added computes + replace: + path: /home/stack/virt/network/baremetal_deployment.yaml + after: "- name: Compute{{ node_type }}" + before: " hostname_format: compute{{ node_type }}-%index%" + regexp: '.*count.*' + replace: " count: {{ compute_count }}" + when: not line_check.changed + diff --git a/tasks/composable_prepare_nic_configs_for_scaleout.yml b/tasks/composable_prepare_nic_configs_for_scaleout.yml new file mode 100644 index 00000000..7564d654 --- /dev/null +++ b/tasks/composable_prepare_nic_configs_for_scaleout.yml @@ -0,0 +1,149 @@ +- block: + - name: set fact rhel8_interfaces + set_fact: + rhel8_interfaces: "{{ rhel8_interfaces|default([]) + [ (item.1 == 'r640' and item.0.stdout.split('-')[0] == 'f04') | ternary('rhel8_interfaces_f04', 'rhel8_interfaces') ] }}" + with_together: + - "{{ host_list.results }}" + - "{{ machine_types }}" + + - name: set fact rhel7_interfaces + set_fact: + rhel7_interfaces: "{{ rhel7_interfaces|default([]) + [ (item.1 == 'r640' and item.0.stdout.split('-')[0] == 'f04') | ternary('rhel7_interfaces_f04', 'rhel7_interfaces') ] }}" + with_together: + - "{{ host_list.results }}" + - "{{ machine_types }}" + + - name: set fact for iface_rhel_version + set_fact: + iface_rhel_version: "{{ iface_rhel_version|default([]) + [(osp_release|int > 14)| ternary( item.0, item.1)] }}" + with_together: + - "{{ rhel8_interfaces }}" + - "{{ rhel7_interfaces }}" + + - name: set machine_ifaces + set_fact: + machine_ifaces: "{{ machine_ifaces|default({}) | combine({ item[1]: lab_vars['machine_types'][item[0]][item[1]][item[2]] }) }}" + with_together: + - "{{ vendors }}" + - "{{ machine_types }}" + - "{{ iface_rhel_version }}" + vars: + lab_vars: "{{ (lab_name == 'scale') | ternary(scale, alias) }}" + when: lab_name in ['scale', 'alias'] and osp_release|int < 17 + +- block: + - name: set fact for rhel 9 interfaces + set_fact: + rhel9_interfaces: "{{ rhel9_interfaces|default([]) + [ (item.1 == 'r640' and item.0.stdout.split('-')[0] == 'f04') | ternary('rhel9_interfaces_f04', 'rhel9_interfaces') ] }}" + with_together: + - "{{ host_list.results }}" + - "{{ machine_types }}" + + - name: set machine_ifaces + set_fact: + machine_ifaces: "{{ machine_ifaces|default({}) | combine({ item[1]: lab_vars['machine_types'][item[0]][item[1]][item[2]] }) }}" + with_together: + - "{{ vendors }}" + - "{{ machine_types }}" + - "{{ rhel9_interfaces }}" + vars: + lab_vars: "{{ (lab_name == 'scale') | ternary(scale, alias) }}" + when: lab_name in ['scale', 'alias'] and osp_release|int >= 17 + +- name: set interfaces + set_fact: + ifaces: "{{ ifaces|default([]) + [ machine_ifaces[item]] }}" + with_items: + - "{{ machine_types|unique }}" + when: lab_name in ['scale', 'alias'] + +- name: set control interfaces for custom roles + set_fact: + ctlplane_interfaces: "{{ ctlplane_interfaces|default([]) +[(item|length > 1)| ternary(item[1], item[0])] }}" + with_items: + - "{{ ifaces }}" + +- name: set external interface for custom roles + set_fact: + external_interfaces: "{{ external_interfaces|default([]) + [(item|length > 3) | ternary(item[3], item[1] )] }}" + when: item|length > 1 + with_items: + - "{{ ifaces }}" + +- name: set external interface for custom roles + set_fact: + external_interfaces: "{{ external_interfaces|default([]) + [(item|length > 3) | ternary(item[3], item[0] )] }}" + when: item|length == 1 + with_items: + - "{{ ifaces }}" + +- name: set tenant interface for custom roles + set_fact: + tenant_interfaces: "{{ tenant_interfaces|default([]) + [item[2]] }}" + when: item|length > 2 + with_items: + - "{{ ifaces }}" + +- name: set isolated interface for custom roles + set_fact: + isolated_interfaces: "{{ isolated_interfaces|default([])+ [item[0]] }}" + when: item|length > 1 + with_items: + - "{{ ifaces }}" + +- name: set storage interface for custom roles + set_fact: + storage_interfaces: "{{ isolated_interfaces }}" + when: ceph_enabled and isolated_interfaces is defined + +- name: set dedicated vlan based provider network + set_fact: + openshift_vlan_interfaces: "{{ openshift_vlan_interfaces|default([]) + [item[2]] }}" + when: item|length > 2 + with_items: + - "{{ ifaces }}" + +- name: remove duplicates from machine types + set_fact: + machine_types: "{{ machine_types | unique }}" + +- name: prepare compute.yaml.j2 + vars: + ctlplane_interface: "{{ item.1 }}" + external_interface: "{{ item.2 }}" + tenant_interface: "{{ item.3 }}" + isolated_interface: "{{ item.4 }}" + openshift_vlan_interface: "{{ item.5 }}" + template: + src: "{{ (osp_release|int > 10) | ternary('compute.yaml.j2', false) }}" + dest: "{{ nic_config_path }}/compute_{{ item.0 }}.yaml.j2" + force: yes + with_together: + - "{{ machine_types }}" + - "{{ ctlplane_interfaces }}" + - "{{ external_interfaces }}" + - "{{ tenant_interfaces }}" + - "{{ isolated_interfaces }}" + - "{{ openshift_vlan_interfaces }}" + when: osp_release|int < 17 + +- name: prepare compute.j2.j2 + vars: + ctlplane_interface: "{{ item.1 }}" + external_interface: "{{ item.2 }}" + tenant_interface: "{{ item.3 }}" + isolated_interface: "{{ item.4 }}" + openshift_vlan_interface: "{{ item.5 }}" + template: + src: compute.j2.j2 + dest: "~/virt/network/vlans//compute_{{ item.0 }}.j2" + force: yes + delegate_to: undercloud + with_together: + - "{{ machine_types }}" + - "{{ ctlplane_interfaces }}" + - "{{ external_interfaces }}" + - "{{ tenant_interfaces }}" + - "{{ isolated_interfaces }}" + - "{{ openshift_vlan_interfaces }}" + when: osp_release|int >= 17 diff --git a/tasks/new_roles_for_scaleout.yml b/tasks/new_roles_for_scaleout.yml new file mode 100644 index 00000000..22f1d508 --- /dev/null +++ b/tasks/new_roles_for_scaleout.yml @@ -0,0 +1,11 @@ +- name: check for existence of a role + lineinfile: + line: "- name: Compute{{ check_type }}" + path: /home/stack/roles_data.yaml + check_mode: true + register: line_check + +- name: write entry for new role + shell: | + cat /home/stack/roles/Compute{{ check_type }}.yaml >> /home/stack/roles_data.yaml + when: line_check.changed diff --git a/tasks/prepare_deploy_limit_str_for_scaleout.yaml b/tasks/prepare_deploy_limit_str_for_scaleout.yaml new file mode 100644 index 00000000..aafc297e --- /dev/null +++ b/tasks/prepare_deploy_limit_str_for_scaleout.yaml @@ -0,0 +1,12 @@ +- name: get existing compute count + shell: | + source /home/stack/stackrc + {{ overcloud_host_list }} | grep compute | grep {{ node_type }} | wc -l + register: compute_count + +- name: add hosts to deploy_limit_str of type {{ node_type }} + set_fact: + deploy_limit_str: "{{ deploy_limit_str + append_item }}" + vars: + append_item: "{{ (deploy_limit_str|length == 0) | ternary(item, (',' + item)) }}" + with_sequence: "start={{ compute_count.stdout|int }} end={{ compute_count.stdout|int + total_machine_count[node_type]|int - 1 }} format=compute{{ node_type }}-%1u" diff --git a/tasks/set_boot_mode.yml b/tasks/set_boot_mode.yml index 29ef54c5..f02a9f74 100644 --- a/tasks/set_boot_mode.yml +++ b/tasks/set_boot_mode.yml @@ -1,15 +1,9 @@ -- name: get node UUIDs - shell: | - source ~/stackrc - openstack baremetal node list --format value -c UUID - register: node_uuid - - name: get the node fqdn list shell: | source ~/stackrc openstack baremetal node show {{ item }} --fields driver_info -f json | jq '.driver_info.ipmi_address' register: node_fqdn - loop: "{{ node_uuid.stdout_lines|flatten(levels=1) }}" + loop: "{{ total_nodes.stdout_lines|flatten(levels=1) }}" - name: populate uuid type map set_fact: @@ -19,7 +13,7 @@ type1: "{{ (lab_name == 'scale') | ternary(item.1.stdout.split('.')[0].split('-')[4], item.1.stdout.split('.')[0].split('-')[3]) }}" type: "{{ (type1 != '1029u') | ternary(type1, (item.1.stdout.replace('mgmt-', '').replace('\"', '') in tn10rt) | ternary('1029utn10rt', '1029utrtp')) }}" with_together: - - "{{ node_uuid.stdout_lines }}" + - "{{ total_nodes.stdout_lines }}" - "{{ node_fqdn.results }}" - name: setting profile for node type (Composable Roles) diff --git a/tasks/update_network_environment_for_scaleout.yaml b/tasks/update_network_environment_for_scaleout.yaml new file mode 100644 index 00000000..7ffc3c62 --- /dev/null +++ b/tasks/update_network_environment_for_scaleout.yaml @@ -0,0 +1,5 @@ +- name: add nic config path for {{ node_type }} + lineinfile: + regexp: ".*OS::TripleO::Compute{{ node_type }}::Net::SoftwareConfig:.*" + line: " OS::TripleO::Compute{{ node_type }}::Net::SoftwareConfig: vlans//compute_{{ node_type }}.yaml" + path: /home/stack/virt/network/network-environment.yaml diff --git a/tasks/update_nodes_data_for_scaleout.yaml b/tasks/update_nodes_data_for_scaleout.yaml new file mode 100644 index 00000000..3e32641c --- /dev/null +++ b/tasks/update_nodes_data_for_scaleout.yaml @@ -0,0 +1,37 @@ +- name: get existing compute count + shell: | + source /home/stack/stackrc + {{ overcloud_host_list }} | grep compute | grep {{ node_type }} | wc -l + register: compute_count + +- name: set fact for compute count + set_fact: + compute_count: "{{ compute_count.stdout|int + total_machine_count[node_type]|int }}" + +- block: + - name: update compute count + lineinfile: + regexp: ".*Compute{{ node_type }}Count.*" + line: " Compute{{ node_type }}Count: {{ compute_count }}" + path: /home/stack/virt/nodes_data.yaml + + - name: update compute flavor + lineinfile: + regexp: ".*OvercloudCompute{{ node_type }}Flavor.*" + line: " OvercloudCompute{{ node_type }}Flavor: baremetal{{ node_type }}" + path: /home/stack/virt/nodes_data.yaml + when: osp_release|int >= 17 + +- block: + - name: update compute count + lineinfile: + regexp: ".*Compute{{ node_type }}Count.*" + line: " Compute{{ node_type }}Count: {{ compute_count }}" + path: /home/stack/virt/nodes_data.yaml + + - name: update compute flavor + lineinfile: + regexp: ".*OvercloudCompute{{ node_type }}Flavor.*" + line: " OvercloudCompute{{ node_type }}Flavor: baremetal{{ node_type }}" + path: /home/stack/virt/nodes_data.yaml + when: osp_release|int < 17 diff --git a/templates/baremetal_deployment_for_scaleout.yaml.j2 b/templates/baremetal_deployment_for_scaleout.yaml.j2 new file mode 100644 index 00000000..96633282 --- /dev/null +++ b/templates/baremetal_deployment_for_scaleout.yaml.j2 @@ -0,0 +1,14 @@ +- name: Compute{{ node_type }} + count: {{ total_machine_count[node_type] }} + hostname_format: compute{{ node_type }}-%index% + defaults: + profile: baremetal{{ node_type }} + network_config: + template: /home/stack/virt/network/vlans/compute_{{ node_type }}.j2 + networks: + - network: ctlplane + vif: true + - network: storage + - network: internal_api + - network: tenant + - network: external diff --git a/upscale.yml b/upscale.yml deleted file mode 100644 index 3e667d5b..00000000 --- a/upscale.yml +++ /dev/null @@ -1,98 +0,0 @@ ---- -- hosts: localhost - tasks: - - name: load instackenv - include_tasks: tasks/load_instackenv.yml - - - name: get intrepeter - include_tasks: tasks/get_interpreter.yml - vars: - hostname: "{{ undercloud_hostname }}" - user: "stack" - - - name: add undercloud - add_host: - name: "undercloud" - ansible_host: "{{ undercloud_hostname }}" - ansible_user: "stack" - ansible_python_interpreter: "{{ python_interpreter }}" - - -- hosts: undercloud - vars: - new_instack: /home/stack/newnodes.json - tasks: - - name: get the new nodes file - copy: - src: "{{ new_nodes_instack }}" - dest: "{{ new_instack }}" - force: yes - - - name: register new nodes - shell: | - source /home/stack/stackrc - openstack overcloud node import {{ new_instack }} - - - name: get the new nodes detail - shell: | - source /home/stack/stackrc - openstack baremetal node list -f yaml - register: new_nodes_detail - - - name: set new nodes fact - set_fact: - new_nodes_list: "{{ new_nodes_detail.stdout | from_yaml }}" - - - name: filter manageable nodes - set_fact: - new_nodes: "{{ (new_nodes | default([])) + [ item['UUID'] ] }}" - with_items: "{{ new_nodes_list | default([]) }}" - when: - item.get('Provisioning State') == 'manageable' - - - name: introspect new nodes - shell: | - source /home/stack/stackrc - openstack overcloud node introspect {{ item }} --provide - with_items: "{{ new_nodes | default([]) }}" - ignore_errors: true - changed_when: false - - - name: Configure the image properties - shell: | - source /home/stack/stackrc - openstack overcloud node configure {{ item }} - with_items: "{{ new_nodes | default([]) }}" - ignore_errors: true - changed_when: false - - - name: set profile - shell: | - source /home/stack/stackrc - openstack baremetal node set --property capabilities='profile:compute,boot_option:local' {{ item }} - with_items: "{{ new_nodes | default([]) }}" - ignore_errors: true - changed_when: false - - - name: get all nodes count - shell: | - source /home/stack/stackrc - openstack baremetal node list -c UUID -f value - register: all_nodes - - - name: set fact compute count - set_fact: - compute_node_count: "{{ all_nodes.stdout_lines|length - controller_count }}" - - - name: change compute count - lineinfile: - path: /home/stack/virt/nodes_data.yaml - regexp: 'ComputeCount:' - line: ' ComputeCount: {{ compute_node_count }}' - - - name: execute the overcloud deploy - shell: | - source /home/stack/stackrc - ./overcloud_deploy.sh - args: - chdir: /home/stack/