Skip to content

Latest commit

 

History

History
 
 

ansible-bm-install

Creating, Mounting and Booting your Discovery ISO

The purpose of this playbook is to provided an automated fashion to create, mount, and boot your OpenShift cluster nodes with the Discovery ISO image. Once the image is mounted, refer to your Assisted Installer UI to provide the API VIP and Ingress VIP prior to deployment.

Prerequisites

  • Assisted Installer UI exists and is reachable via http://REMOTE_SERVICE_URL:6008

  • The assisted_installer node used by the playbook must be able to ping the OpenShift cluster nodes

Supports

  • DELL servers with iDRAC9 using redfish

  • DELL servers with iDRAC8 and below using racadm

  • HPE servers

  • VMs

  • Systems with an existing OS with ssh access

Caveats

  • This uses Ansible collections which represents the new standard of distributing, maintaining and consuming automation. It is recommended to run Ansible version 2.9.9 or higher when running the playbook.

Tree View of the Ansible Playbook

  • inventory - contains the file hosts.sample that:

    • contains all the modifiable variables, their default values, and their definition.

    • the setting up of your provision node, master nodes, and worker nodes. Each section will require additional details (i.e. Management credentials).

  • collections - contains the Ansible collection hosting the multiple roles (setup_repository, create_iso , host_iso, boot_iso)

    • setup_repository - sets up this existing repository on the system where the ISO be created

    • create_iso - creates the discovery ISO image

    • host_iso - creates a podman container running a webserver to host the ISO image

    • boot_iso - boots the ISO on the physical nodes via virtual media (no OS on system)

    • boot_iso_existing_os - boots the ISO on physical or virtual nodes via kexec using ssh access to the existing operating system

.
├── ansible.cfg
├── collections
│   └── ansible_collections
│       └── okd
│           └── assisted_installer
│               ├── docs
│               ├── galaxy.yml
│               ├── plugins
│               │   └── README.md
│               ├── README.md
│               └── roles
│                   ├── boot_iso
│                   │   ├── defaults
│                   │   │   └── main.yml
│                   │   ├── files
│                   │   ├── handlers
│                   │   │   └── main.yml
│                   │   ├── meta
│                   │   │   └── main.yml
│                   │   ├── README.md
│                   │   ├── tasks
│                   │   │   ├── boot_iso.yml
│                   │   │   ├── boot_iso.yml.orig
│                   │   │   └── main.yml
│                   │   ├── templates
│                   │   ├── tests
│                   │   │   ├── inventory
│                   │   │   └── test.yml
│                   │   └── vars
│                   │       └── main.yml
│                   ├── boot_iso_existing_os
│                   │   ├── defaults
│                   │   │   └── main.yml
│                   │   ├── files
│                   │   ├── handlers
│                   │   │   └── main.yml
│                   │   ├── meta
│                   │   │   └── main.yml
│                   │   ├── README.md
│                   │   ├── tasks
│                   │   │   ├── main.yml
│                   │   ├── templates
│                   │   ├── tests
│                   │   │   ├── inventory
│                   │   │   └── test.yml
│                   │   └── vars
│                   │       └── main.yml
│                   ├── create_iso
│                   │   ├── defaults
│                   │   │   └── main.yml
│                   │   ├── files
│                   │   ├── handlers
│                   │   │   └── main.yml
│                   │   ├── meta
│                   │   │   └── main.yml
│                   │   ├── README.md
│                   │   ├── tasks
│                   │   │   └── main.yml
│                   │   ├── templates
│                   │   ├── tests
│                   │   │   ├── inventory
│                   │   │   └── test.yml
│                   │   └── vars
│                   │       └── main.yml
│                   ├── host_iso
│                   │   ├── defaults
│                   │   │   └── main.yml
│                   │   ├── files
│                   │   ├── handlers
│                   │   │   └── main.yml
│                   │   ├── library
│                   │   │   └── podman_container.py
│                   │   ├── meta
│                   │   │   └── main.yml
│                   │   ├── README.md
│                   │   ├── tasks
│                   │   │   └── main.yml
│                   │   ├── templates
│                   │   ├── tests
│                   │   │   ├── inventory
│                   │   │   └── test.yml
│                   │   └── vars
│                   │       └── main.yml
│                   ├── setup_repository
│                   │   ├── defaults
│                   │   │   └── main.yml
│                   │   ├── files
│                   │   ├── handlers
│                   │   │   └── main.yml
│                   │   ├── meta
│                   │   │   └── main.yml
│                   │   ├── README.md
│                   │   ├── tasks
│                   │   │   └── main.yml
│                   │   ├── templates
│                   │   ├── tests
│                   │   │   ├── inventory
│                   │   │   └── test.yml
│                   │   └── vars
│                   │       └── main.yml
│                   └── validations
│                       ├── defaults
│                       │   └── main.yml
│                       ├── files
│                       ├── handlers
│                       │   └── main.yml
│                       ├── meta
│                       │   └── main.yml
│                       ├── README.md
│                       ├── tasks
│                       │   └── main.yml
│                       ├── templates
│                       ├── tests
│                       │   ├── inventory
│                       │   └── test.yml
│                       └── vars
│                           └── main.yml
├── inventory
│   ├── hosts_with_os.sample
│   └── hosts_without_os.sample
├── playbook_assisted_installer_with_os.yml
├── playbook_assisted_installer_without_os.yml
├── pull_secret.txt
├── README.adoc
└── requirements.yml

Running the Ansible Playbook

The following are the steps to successfully run the Ansible playbook.

git clone the Ansible playbook

The first step to using the Ansible playbook is to clone the assisted-test-infra repository.

Note
This should be done on a system that can access the provision host
  1. Clone the git repository

    [user@laptop ~]$ git clone https://github.com/openshift/assisted-test-infra
    Note
    Ensure git is installed on your localhost
  2. Change to the ansible-bm-install directory

    [user@laptop ~]$ cd /path/to/git/repo/assisted-test-infra/ansible-bm-install

The ansible.cfg file

While the ansible.cfg may vary upon your environment a sample is provided in the repository.

[defaults]
inventory=./inventory
collections_paths=./collections
remote_user=root
callback_whitelist = profile_tasks

[privilege_escalation]
become_method=sudo
Note

Ensure to change the remote_user as deemed appropriate for your environment.

Modifying the inventory/hosts_without_os

Note
This example inventory is for systems with no operating system and require BMC credentials to boot into the ISO.

The hosts file provides all the definable variables and provides a description of each variable.

The hosts file ensures all your nodes that will be used to create, mount and boot the discovery ISO are setup. There are three groups: masters, workers, assisted_installer. The masters and workers group collects information about the host such as its name, role, user management (i.e. iDRAC) user, user management (i.e. iDRAC) password, bmc_address.

Below is a sample of the inventory/hosts file

[all:vars]

###############################################################################
# Required configuration variables for Assisted Install Installations         #
###############################################################################

# Base domain, i.e. example.com
domain="example.com"

# Name of the cluster, i.e. openshift
cluster_name="openshift"

# Contents of the pull-secret.txt file
pull_secret="{{ lookup('file', './pull_secret.txt') }}"

# Provide Remote Service URL and port
#e.g. remote_service_url="http://example.com:6000
remote_service_url=""

# Version of the openshift-installer, undefined or empty results in the playbook failing.
openshift_version="4.5"

[assisted_installer]
assisted-installer.example.com

#Options for vendor include: Dell, HPE
# Master nodes
[masters]
master-0 role=master bmc_user=admin bmc_password=password bmc_address=192.168.1.1 vendor=Dell
master-1 role=master bmc_user=admin bmc_password=password bmc_address=192.168.1.2 vendor=Dell
master-2 role=master bmc_user=admin bmc_password=password bmc_address=192.168.1.3 vendor=Dell


# Worker nodes
[workers]
worker-0 role=worker bmc_user=admin bmc_password=password bmc_address=192.168.1.4 vendor=HPE
worker-1 role=worker bmc_user=admin bmc_password=password bmc_address=192.168.1.5 vendor=HPE
Note
=== vendor value of Dell or HPE is used to determine on the OpenShift node should be booted. ===

Modifying the inventory/hosts_with_os

Note
This example inventory is for systems with an operating system and requires IP addresses of the master and worker nodes.

The hosts file provides all the definable variables and provides a description of each variable.

The hosts file ensures all your nodes that will be used to create, mount and boot the discovery ISO are setup. There are three groups: masters, workers, assisted_installer.

Below is a sample of the inventory/hosts_with_os file

[all:vars]

###############################################################################
# Required configuration variables for Assisted Install Installations         #
###############################################################################

# Base domain, i.e. example.com
domain="example.com"

# Name of the cluster, i.e. openshift
cluster_name="openshift"

# Contents of the pull-secret.txt file
pull_secret="{{ lookup('file', './pull_secret.txt') }}"

# Provide Remote Service URL and port
#e.g. remote_service_url="http://example.com:6000
remote_service_url=""

# Version of the openshift-installer, undefined or empty results in the playbook failing.
openshift_version="4.5"

[assisted_installer]
assisted-installer.example.com

# Master nodes (<master-name>.<cluster-name>.<domain>)
[masters]
master-0.openshift.example.com
master-1.openshift.example.com
master-2.openshift.example.com

# Worker nodes (<worker-name>.<cluster-name>.<domain>)
[workers]
worker-0.openshift.example.com
worker-1.openshift.example.com
worker-2.openshift.example.com

Copy local SSH key to assisted installer node

With the ansible.cfg file in place, the next step is to ensure to copy your public ssh key to your assisted installer node using ssh-copy-id.

From the system that is to run the playbook,

$ ssh-copy-id <user>@assisted_installer.example.com

Copy local SSH key to master and worker nodes

Note
This step is only required if you are using the hosts_with_os inventory file.
$ ssh-copy-id <user>@master-X.openshift.example.com
Note
Replace X with the appropriate numerical value.

The Ansible playbook.yml

The Ansible playbook connects to your assisted installer host and runs through the roles. No modification is necessary. All modifications of variables may be done within the inventory/hosts_with_os or inventory/hosts_without_os file. A sample file is located in this repository under inventory/hosts_with_os.sample and inventory/hosts_without_os.sample. From the system that is to run the playbook,

Sample playbook_assisted_installer_without_os.yml
---
- name: Creating,Mounting,Booting the Assisted Installer Discovery ISO
  hosts: assisted_installer
  roles:
  - okd.assisted_installer.validations
  - okd.assisted_installer.setup_repository
  - okd.assisted_installer.create_iso
  - okd.assisted_installer.host_iso
  - okd.assisted_installer.boot_iso
Sample playbook_assisted_installer_with_os.yml
---
- name: Creating,Hosting the Assisted Installer Discovery ISO
  hosts: assisted_installer
  roles:
  - okd.assisted_installer.validations
  - okd.assisted_installer.setup_repository
  - okd.assisted_installer.create_iso
  - okd.assisted_installer.host_iso

- name: Mounting, Booting the Assited Installer Discovery ISO
  hosts: masters:workers
  roles:
  - okd.assisted_installer.boot_iso_existing_os

Running the playbook.yml

With each playbook in-place, install the required collections and run the appropriate playbook for your environment.

Sample Run using playbook_assisted_installer_without_os.yml
$ ansible-galaxy collection install -r requirements.yml
$ ansible-playbook -i inventory/hosts_without_os playbook_assisted_installer_without_os.yml
Sample Run using playbook_assisted_installer_with_os.yml
$ ansible-galaxy collection install -r requirements.yml
$ ansible-playbook -i inventory/hosts_with_os playbook_assisted_installer_with_os.yml