|
| 1 | +# MicroShift Installer Role |
| 2 | + |
| 3 | +This Ansible role installs and configures MicroShift on RHEL 9 systems. |
| 4 | +It handles subscription management, package installation, network |
| 5 | +configuration using nmstate, and initial cluster bootstrapping. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +- RHEL 9.x system |
| 10 | +- Valid Red Hat subscription with access to MicroShift repositories |
| 11 | +- Network connectivity to Red Hat repositories |
| 12 | +- Sufficient system resources (4GB RAM, 2 CPUs minimum recommended) |
| 13 | + |
| 14 | +## Role Variables |
| 15 | + |
| 16 | +### Required Variables |
| 17 | + |
| 18 | +```yaml |
| 19 | +# Subscription Manager credentials |
| 20 | +subscription_manager_org_id: "your-org-id" |
| 21 | +subscription_manager_activation_key: "your-activation-key" |
| 22 | + |
| 23 | +# MicroShift configuration from Heat stack output (raw YAML for /etc/microshift/config.yaml) |
| 24 | +microshift_config: |
| 25 | + dns: |
| 26 | + baseDomain: openstack.lab |
| 27 | + node: |
| 28 | + hostnameOverride: microshift-0 |
| 29 | + nodeIP: 192.168.32.10 |
| 30 | + |
| 31 | +# nmstate network configuration from Heat stack output |
| 32 | +microshift_nmstate_config: |
| 33 | + interfaces: [] # nmstate interface configuration |
| 34 | +``` |
| 35 | +
|
| 36 | +### Optional Variables |
| 37 | +
|
| 38 | +```yaml |
| 39 | +# MicroShift version (default: "4.18") |
| 40 | +microshift_installer_version: "4.18" |
| 41 | + |
| 42 | +# Service configuration |
| 43 | +microshift_installer_service_enable: true |
| 44 | +microshift_installer_service_state: started |
| 45 | + |
| 46 | +# Kubeconfig paths |
| 47 | +microshift_installer_kubeconfig_path: "/var/lib/microshift/resources/kubeadmin/kubeconfig" |
| 48 | + |
| 49 | +# Cluster ready timeout (seconds) |
| 50 | +microshift_installer_wait_timeout: 600 |
| 51 | + |
| 52 | +# Packages to install on MicroShift node |
| 53 | +microshift_installer_packages: |
| 54 | + - microshift |
| 55 | + - microshift-networking |
| 56 | + - microshift-selinux |
| 57 | + - nmstate |
| 58 | + - containernetworking-plugins |
| 59 | +``` |
| 60 | +
|
| 61 | +## Dependencies |
| 62 | +
|
| 63 | +This role has no external dependencies beyond the built-in Ansible modules. |
| 64 | +
|
| 65 | +## Example Playbook |
| 66 | +
|
| 67 | +```yaml |
| 68 | +- hosts: microshift_hosts |
| 69 | + vars: |
| 70 | + subscription_manager_org_id: "{{ lookup('env', 'RH_ORG_ID') }}" |
| 71 | + subscription_manager_activation_key: "{{ lookup('env', 'RH_ACTIVATION_KEY') }}" |
| 72 | + microshift_config: "{{ heat_stack_outputs.microshift_config }}" |
| 73 | + microshift_nmstate_config: "{{ heat_stack_outputs.microshift_nmstate_config }}" |
| 74 | + roles: |
| 75 | + - microshift_installer |
| 76 | +``` |
| 77 | +
|
| 78 | +**Note**: The role handles privilege escalation internally using |
| 79 | +`become: true` for tasks that require root access, so it's not |
| 80 | +necessary to set `become: true` at the play level. |
| 81 | + |
| 82 | +## Installation Process |
| 83 | + |
| 84 | +The role performs the following steps on the MicroShift node: |
| 85 | + |
| 86 | +1. **System Registration**: Registers the RHEL system with Red Hat |
| 87 | + Subscription Manager using the provided organization ID and activation |
| 88 | + key. |
| 89 | + |
| 90 | +2. **Repository Enablement**: Enables the required repositories: |
| 91 | + - `rhocp-<version>-for-rhel-9-x86_64-rpms` |
| 92 | + - `fast-datapath-for-rhel-9-x86_64-rpms` |
| 93 | + |
| 94 | +3. **Package Installation**: Installs MicroShift and dependencies: |
| 95 | + - microshift |
| 96 | + - microshift-networking |
| 97 | + - microshift-selinux |
| 98 | + - nmstate |
| 99 | + - containernetworking-plugins |
| 100 | + |
| 101 | +4. **Network Configuration**: Applies nmstate network configuration for: |
| 102 | + - Physical interfaces |
| 103 | + - VLAN interfaces |
| 104 | + - Linux bridges |
| 105 | + - IP addressing |
| 106 | + |
| 107 | +5. **MicroShift Configuration**: Creates `/etc/microshift/config.yaml` with: |
| 108 | + - Base domain |
| 109 | + - Hostname override |
| 110 | + - Node IP address |
| 111 | + |
| 112 | +6. **Service Management**: Starts and enables the MicroShift service. |
| 113 | + |
| 114 | +7. **Cluster Bootstrap**: Waits for the cluster to be ready and the |
| 115 | + kubeconfig to be available. |
| 116 | + |
| 117 | +The role also performs controller-specific tasks: |
| 118 | + |
| 119 | +1. **OC Client Installation**: Downloads and installs the `oc` CLI on the |
| 120 | + controller node. |
| 121 | + |
| 122 | +2. **Kubeconfig Setup**: Fetches the kubeconfig from the MicroShift node |
| 123 | + and sets it up on the controller at `~/.kube/config`. |
| 124 | + |
| 125 | +## Network Configuration |
| 126 | + |
| 127 | +The role uses nmstate to configure complex network topologies. The |
| 128 | +`microshift_nmstate_config` should contain nmstate-compatible |
| 129 | +configuration with interface definitions. This is typically generated from |
| 130 | +the Heat stack output. |
| 131 | + |
| 132 | +Example network configuration includes: |
| 133 | + |
| 134 | +- Physical Ethernet interfaces |
| 135 | +- VLAN-tagged interfaces for OpenStack networks |
| 136 | +- Linux bridges for OVN and Ironic |
| 137 | +- Static IP addressing |
| 138 | + |
| 139 | +## MicroShift Cluster Access |
| 140 | + |
| 141 | +After successful installation, the kubeconfig is available at: |
| 142 | + |
| 143 | +- System location: `/var/lib/microshift/resources/kubeadmin/kubeconfig` |
| 144 | +- User location: `~/.kube/config` (copied by the role) |
| 145 | + |
| 146 | +Access the cluster: |
| 147 | + |
| 148 | +```bash |
| 149 | +export KUBECONFIG=~/.kube/config |
| 150 | +oc get nodes |
| 151 | +oc get pods -A |
| 152 | +``` |
| 153 | + |
| 154 | +## Integration with Hotstack |
| 155 | + |
| 156 | +This role is designed to be used with the Hotstack automation framework |
| 157 | +as a replacement for `ocp_agent_installer` in MicroShift-based scenarios. |
| 158 | +It expects the `microshift_config` variable to be populated from Heat |
| 159 | +stack outputs. |
| 160 | + |
| 161 | +## Troubleshooting |
| 162 | + |
| 163 | +### Service Logs |
| 164 | + |
| 165 | +```bash |
| 166 | +journalctl -u microshift -f |
| 167 | +``` |
0 commit comments