| --- |
| {% raw %} |
| - hosts: target |
| name: "Install Ironic on the target host." |
| become: yes |
| gather_facts: yes |
| vars: |
| {% endraw %} |
| multinode_testing: true |
| enabled_hardware_types: ipmi |
| enable_keystone: false |
| cleaning: true |
| cleaning_disk_erase: true |
| testing: false |
| create_image_via_dib: {{ use_prebuilt_deployment_image | bool != true }} |
| download_ipa: {{ download_ipa }} |
| create_ipa_image: {{ create_ipa_image }} |
| ipa_dib_os_element: "{{ ipa_dib_os_element }}" |
| ironic_git_branch: "{{ ironic_version }}" |
| ironicclient_source_install: false |
| ironicinspector_source_install: false |
| ironicinspectorclient_source_install: false |
| network_interface: "{{ engine.pxe_interface }}" |
| inventory_dhcp: true |
| inventory_dhcp_static_ip: true |
| {% raw %} |
| roles: |
| - { role: bifrost-prep-for-install, when: skip_install is not defined } |
| - role: bifrost-keystone-install |
| - role: bifrost-ironic-install |
| - role: bifrost-keystone-client-config |
| user: "{{ ansible_env.SUDO_USER | default(ansible_user_id) }}" |
| clouds: |
| bifrost: |
| config_username: "{{ ironic.keystone.default_username }}" |
| config_password: "{{ ironic.keystone.default_password }}" |
| config_project_name: "baremetal" |
| config_region_name: "{{ keystone.bootstrap.region_name }}" |
| config_auth_url: "{{ keystone.bootstrap.public_url }}" |
| bifrost-admin: |
| config_username: "{{ keystone.bootstrap.username }}" |
| config_password: "{{ keystone.bootstrap.password }}" |
| config_project_name: "{{ keystone.bootstrap.project_name }}" |
| config_region_name: "{{ keystone.bootstrap.region_name }}" |
| config_auth_url: "{{ keystone.bootstrap.public_url }}" |
| - role: bifrost-create-dib-image |
| dib_imagename: "{{ http_boot_folder }}/ipa" |
| build_ramdisk: false |
| dib_os_element: "{{ ipa_dib_os_element }}" |
| dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}" |
| when: create_ipa_image | bool == true |
| - role: bifrost-create-dib-image |
| dib_imagetype: "qcow2" |
| dib_imagename: "{{deploy_image}}" |
| dib_env_vars: |
| DIB_PYTHON_VERSION: 3 |
| DIB_UBUNTU_KERNEL: linux-image-hwe |
| {% endraw %} |
| dib_os_element: "{{ dib_os_element }}" |
| dib_os_release: "{{ dib_os_release }}" |
| dib_packages: "{{ dib_os_packages }}" |
| {% raw %} |
| extra_dib_elements: "{{ lookup('env', 'EXTRA_DIB_ELEMENTS') | default('') }}" |
| dib_elements: "vm enable-serial-console simple-init devuser growroot openssh-server pip-and-virtualenv {{ extra_dib_elements }}" |
| dib_notmpfs: true |
| when: |
| - create_image_via_dib | bool == true |
| - transform_boot_image | bool == false |
| environment: |
| http_proxy: "{{ lookup('env','http_proxy') }}" |
| https_proxy: "{{ lookup('env','https_proxy') }}" |
| no_proxy: "{{ lookup('env', 'no_proxy') }}" |
| |
| - hosts: localhost |
| connection: local |
| become: yes |
| gather_facts: no |
| tasks: |
| - name: Set engine_verbosity |
| set_fact: |
| engine_verbosity: "{{ lookup('env', 'VERBOSITY') }}" |
| |
| - name: Add deploy_logs_collect field into Ironic configuration file |
| blockinfile: |
| dest: /etc/ironic/ironic.conf |
| marker: "# {mark} SET IRONIC TROUBLESHOTTING PARAMETER" |
| block: | |
| [agent] |
| deploy_logs_collect = always |
| when: engine_verbosity |
| |
| - name: Restart Ironic service |
| service: |
| name: "{{ item }}" |
| state: restarted |
| with_items: |
| - ironic-api |
| - ironic-conductor |
| - ironic-inspector |
| when: engine_verbosity |
| |
| - hosts: localhost |
| connection: local |
| become: no |
| gather_facts: no |
| tasks: |
| - name: Wait for ironic-api to come up |
| wait_for: |
| port: 6385 |
| - name: Get nodes from Ironic |
| command: openstack --os-cloud bifrost baremetal node list |
| register: ironic_nodes |
| - name: List Ironic nodes |
| debug: |
| msg: "{{ ironic_nodes.stdout_lines }}" |
| {% endraw %} |