12.5.23. SR-IOV 네트워크에서 실행되는 컴퓨팅 시스템 생성
컨트롤 플레인을 가동시킨 후 " 컴퓨팅 머신의 SR-IOV 네트워크 생성"에서 만든 SR-IOV 네트워크에서 실행되는 컴퓨팅 머신을 생성합니다.
사전 요구 사항
- "플레이북 종속 항목 다운로드"에서 모듈을 다운로드했습니다.
- "설치 플레이북 다운로드"에서 플레이북을 다운로드했습니다.
-
설치 프로그램에서 생성된
metadata.yaml
파일이 Ansible 플레이북과 동일한 디렉토리에 있습니다. - 컨트롤 플레인이 활성화되었습니다.
-
"컴퓨팅 머신의 SR-IOV 네트워크 생성"에 설명된 대로
radio
및uplink
SR-IOV 네트워크를 생성했습니다.
절차
-
명령줄에서 작업 디렉토리를
inventory.yaml
및common.yaml
파일의 위치로 변경합니다. additionalNetworks
매개변수를 사용하여inventory.yaml
파일의 끝에radio
및uplink
네트워크를 추가합니다..... # If this value is non-empty, the corresponding floating IP will be # attached to the bootstrap machine. This is needed for collecting logs # in case of install failure. os_bootstrap_fip: '203.0.113.20' additionalNetworks: - id: radio count: 4 1 type: direct port_security_enabled: no - id: uplink count: 4 2 type: direct port_security_enabled: no
compute-nodes.yaml
파일의 내용을 다음 텍스트로 바꿉니다.예 12.1.
compute-nodes.yaml
- import_playbook: common.yaml - hosts: all gather_facts: no vars: worker_list: [] port_name_list: [] nic_list: [] tasks: # Create the SDN/primary port for each worker node - name: 'Create the Compute ports' os_port: name: "{{ item.1 }}-{{ item.0 }}" network: "{{ os_network }}" security_groups: - "{{ os_sg_worker }}" allowed_address_pairs: - ip_address: "{{ os_ingressVIP }}" with_indexed_items: "{{ [os_port_worker] * os_compute_nodes_number }}" register: ports # Tag each SDN/primary port with cluster name - name: 'Set Compute ports tag' command: cmd: "openstack port set --tag {{ cluster_id_tag }} {{ item.1 }}-{{ item.0 }}" with_indexed_items: "{{ [os_port_worker] * os_compute_nodes_number }}" - name: 'List the Compute Trunks' command: cmd: "openstack network trunk list" when: os_networking_type == "Kuryr" register: compute_trunks - name: 'Create the Compute trunks' command: cmd: "openstack network trunk create --parent-port {{ item.1.id }} {{ os_compute_trunk_name }}-{{ item.0 }}" with_indexed_items: "{{ ports.results }}" when: - os_networking_type == "Kuryr" - "os_compute_trunk_name|string not in compute_trunks.stdout" - name: ‘Call additional-port processing’ include_tasks: additional-ports.yaml # Create additional ports in OpenStack - name: ‘Create additionalNetworks ports’ os_port: name: "{{ item.0 }}-{{ item.1.name }}" vnic_type: "{{ item.1.type }}" network: "{{ item.1.uuid }}" port_security_enabled: "{{ item.1.port_security_enabled|default(omit) }}" no_security_groups: "{{ 'true' if item.1.security_groups is not defined else omit }}" security_groups: "{{ item.1.security_groups | default(omit) }}" with_nested: - "{{ worker_list }}" - "{{ port_name_list }}" # Tag the ports with the cluster info - name: 'Set additionalNetworks ports tag' command: cmd: "openstack port set --tag {{ cluster_id_tag }} {{ item.0 }}-{{ item.1.name }}" with_nested: - "{{ worker_list }}" - "{{ port_name_list }}" # Build the nic list to use for server create - name: Build nic list set_fact: nic_list: "{{ nic_list | default([]) + [ item.name ] }}" with_items: "{{ port_name_list }}" # Create the servers - name: 'Create the Compute servers' vars: worker_nics: "{{ [ item.1 ] | product(nic_list) | map('join','-') | map('regex_replace', '(.*)', 'port-name=\\1') | list }}" os_server: name: "{{ item.1 }}" image: "{{ os_image_rhcos }}" flavor: "{{ os_flavor_worker }}" auto_ip: no userdata: "{{ lookup('file', 'worker.ign') | string }}" security_groups: [] nics: "{{ [ 'port-name=' + os_port_worker + '-' + item.0|string ] + worker_nics }}" config_drive: yes with_indexed_items: "{{ worker_list }}"
로컬 파일
additional-ports.yaml
에 다음 내용을 삽입합니다.예 12.2.
additional-ports.yaml
# Build a list of worker nodes with indexes - name: ‘Build worker list’ set_fact: worker_list: "{{ worker_list | default([]) + [ item.1 + '-' + item.0 | string ] }}" with_indexed_items: "{{ [ os_compute_server_name ] * os_compute_nodes_number }}" # Ensure that each network specified in additionalNetworks exists - name: ‘Verify additionalNetworks’ os_networks_info: name: "{{ item.id }}" with_items: "{{ additionalNetworks }}" register: network_info # Expand additionalNetworks by the count parameter in each network definition - name: ‘Build port and port index list for additionalNetworks’ set_fact: port_list: "{{ port_list | default([]) + [ { 'net_name' : item.1.id, 'uuid' : network_info.results[item.0].openstack_networks[0].id, 'type' : item.1.type|default('normal'), 'security_groups' : item.1.security_groups|default(omit), 'port_security_enabled' : item.1.port_security_enabled|default(omit) } ] * item.1.count|default(1) }}" index_list: "{{ index_list | default([]) + range(item.1.count|default(1)) | list }}" with_indexed_items: "{{ additionalNetworks }}" # Calculate and save the name of the port # The format of the name is cluster_name-worker-workerID-networkUUID(partial)-count # i.e. fdp-nz995-worker-1-99bcd111-1 - name: ‘Calculate port name’ set_fact: port_name_list: "{{ port_name_list | default([]) + [ item.1 | combine( {'name' : item.1.uuid | regex_search('([^-]+)') + '-' + index_list[item.0]|string } ) ] }}" with_indexed_items: "{{ port_list }}" when: port_list is defined
명령줄에서
compute-nodes.yaml
플레이북을 실행합니다.$ ansible-playbook -i inventory.yaml compute-nodes.yaml