Yaguang Tang | 4e18cd0 | 2024-07-31 21:54:44 +0800 | [diff] [blame] | 1 | # Copyright (c) 2022 VEXXHOST, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | - name: Create bare metal network |
| 16 | when: ironic_bare_metal_network_manage | bool |
| 17 | ansible.builtin.import_tasks: network/create.yml |
| 18 | |
| 19 | - name: Lookup existing bare metal network |
| 20 | when: not (ironic_bare_metal_network_manage | bool) |
| 21 | ansible.builtin.import_tasks: network/lookup.yml |
| 22 | |
| 23 | # - name: Create bare metal network ports |
| 24 | # # noqa: args[module] |
| 25 | # openstack.cloud.port: |
| 26 | # cloud: atmosphere |
| 27 | # name: "ironic-{{ inventory_hostname_short }}" |
| 28 | # device_owner: ironic:conductor |
| 29 | # network: "{{ ironic_bare_metal_network.id }}" |
| 30 | # fixed_ips: >- |
| 31 | # {{ |
| 32 | # [ |
| 33 | # { |
| 34 | # "ip_address": ironic_bare_metal_network_ip |
| 35 | # } |
| 36 | # ] |
| 37 | # if ironic_bare_metal_network_ip is defined else omit |
| 38 | # }} |
| 39 | |
| 40 | # - name: Set binding for ports |
| 41 | # changed_when: false |
| 42 | # ansible.builtin.shell: | |
| 43 | # openstack port set \ |
| 44 | # --host {{ ansible_fqdn }} \ |
| 45 | # ironic-{{ inventory_hostname_short }} |
| 46 | # environment: |
| 47 | # OS_CLOUD: atmosphere |
| 48 | |
| 49 | - name: Upload images |
| 50 | ansible.builtin.include_role: |
| 51 | name: glance_image |
| 52 | loop: |
| 53 | - name: "{{ ironic_python_agent_deploy_kernel_name }}" |
| 54 | url: "{{ ironic_python_agent_deploy_kernel_url }}" |
| 55 | format: aki |
| 56 | - name: "{{ ironic_python_agent_deploy_ramdisk_name }}" |
| 57 | url: "{{ ironic_python_agent_deploy_ramdisk_url }}" |
| 58 | format: ari |
| 59 | vars: |
| 60 | glance_image_name: "{{ item.name }}" |
| 61 | glance_image_url: "{{ item.url }}" |
| 62 | glance_image_container_format: "{{ item.format }}" |
| 63 | glance_image_disk_format: "{{ item.format }}" |
| 64 | |
| 65 | - name: Get details on the kernel image |
| 66 | run_once: true |
| 67 | openstack.cloud.image_info: |
| 68 | cloud: atmosphere |
| 69 | image: "{{ ironic_python_agent_deploy_kernel_name }}" |
| 70 | register: ironic_python_agent_deploy_kernel |
| 71 | |
| 72 | - name: Get details on the ramdisk image |
| 73 | run_once: true |
| 74 | openstack.cloud.image_info: |
| 75 | cloud: atmosphere |
| 76 | image: "{{ ironic_python_agent_deploy_ramdisk_name }}" |
| 77 | register: ironic_python_agent_deploy_ramdisk |
| 78 | |
| 79 | - name: Deploy Helm chart |
| 80 | run_once: true |
| 81 | kubernetes.core.helm: |
| 82 | name: "{{ ironic_helm_release_name }}" |
| 83 | chart_ref: "{{ ironic_helm_chart_ref }}" |
| 84 | release_namespace: "{{ ironic_helm_release_namespace }}" |
| 85 | create_namespace: true |
| 86 | kubeconfig: /etc/kubernetes/admin.conf |
| 87 | values: "{{ _ironic_helm_values | combine(ironic_helm_values, recursive=True) }}" |
| 88 | |
| 89 | - name: Create Ingress |
| 90 | ansible.builtin.include_role: |
| 91 | name: openstack_helm_ingress |
| 92 | vars: |
| 93 | openstack_helm_ingress_endpoint: baremetal |
| 94 | openstack_helm_ingress_service_name: ironic-api |
| 95 | openstack_helm_ingress_service_port: 6385 |
| 96 | openstack_helm_ingress_annotations: "{{ ironic_ingress_annotations }}" |