1.3.21. コンピュートマシンの作成

コントロールプレーンの起動後、コンピュートマシンを作成します。

前提条件

  • 共通ディレクトリー内の inventory.yaml および common.yaml Ansible Playbook。

    • これらのファイルが必要な場合は、ネットワークリソースの作成からこれらのファイルをコピーします。
  • インストールプログラムが作成した metadata.json ファイルが Ansible Playbook と同じディレクトリーにあります。
  • コントロールプレーンがアクティブです。

手順

  1. コマンドラインで、作業ディレクトリーを inventory.yaml および common.yaml ファイルの場所に変更します。
  2. compute-nodes.yaml というローカルファイルに、以下のコンテンツを挿入します。

    例1.8 compute-nodes.yaml

    # Required Python packages:
    #
    # ansible
    # openstackclient
    # openstacksdk
    # netaddr
    
    - import_playbook: common.yaml
    
    - hosts: all
      gather_facts: no
    
      tasks:
      - 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_subnet_range | next_nth_usable(7) }}"
        with_indexed_items: "{{ [os_port_worker] * os_compute_nodes_number }}"
        register: ports
    
      - 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: 'Create the Compute servers'
        os_server:
          name: "{{ item.1 }}-{{ item.0 }}"
          image: "{{ os_image_rhcos }}"
          flavor: "{{ os_flavor_worker }}"
          auto_ip: no
          userdata: "{{ lookup('file', 'worker.ign') | string }}"
          nics:
          - port-name: "{{ os_port_worker }}-{{ item.0 }}"
        with_indexed_items: "{{ [os_compute_server_name] * os_compute_nodes_number }}"
  3. コマンドラインで Playbook を実行します。

    $ ansible-playbook -i inventory.yaml compute-nodes.yaml

次のステップ

  • マシンの証明書署名要求を承認します。