|
| 1 | +# Devstack Installer Role |
| 2 | + |
| 3 | +This role installs and configures DevStack. The actual devstack configuration is provided by a `local.conf.j2` template from the scenario directory, making each scenario self-contained and customizable. |
| 4 | + |
| 5 | +## Requirements |
| 6 | + |
| 7 | +- Ubuntu 24.04 (Noble) target system |
| 8 | +- User `stack` with sudo privileges and home directory at `/opt/stack` |
| 9 | +- Accessible via SSH (potentially through a jump host) |
| 10 | +- Network interface configured (typically via heat template cloud-init) |
| 11 | +- A `local.conf.j2` template in the scenario directory |
| 12 | + |
| 13 | +## Execution Flow |
| 14 | + |
| 15 | +The role performs the following steps: |
| 16 | + |
| 17 | +1. **System Update**: Updates all packages to latest versions |
| 18 | +2. **Reboot if needed**: Checks for `/var/run/reboot-required` and reboots if kernel/core packages were updated |
| 19 | +3. **Wait for system**: Waits for system to come back online (up to 5 minutes) |
| 20 | +4. **Install dependencies**: Installs git, python3, and python3-pip |
| 21 | +5. **Verify network**: Checks that the trunk interface is UP |
| 22 | +6. **Clone devstack**: Clones the devstack repository |
| 23 | +7. **Generate config**: Creates local.conf from the scenario template |
| 24 | +8. **Run stack.sh**: Executes devstack installation |
| 25 | +9. **Mark complete**: Creates completion marker for idempotency |
| 26 | + |
| 27 | +## Role Variables |
| 28 | + |
| 29 | +Available variables are listed below, along with default values (see `defaults/main.yml`): |
| 30 | + |
| 31 | +### Required Variables |
| 32 | +```yaml |
| 33 | +# Path to the local.conf.j2 template (must be provided by the playbook) |
| 34 | +devstack_local_conf_template: "{{ scenario_dir }}/local.conf.j2" |
| 35 | +``` |
| 36 | +
|
| 37 | +### Optional Variables |
| 38 | +```yaml |
| 39 | +# DevStack repository configuration |
| 40 | +devstack_repo_url: https://opendev.org/openstack/devstack |
| 41 | +devstack_repo_dest: /opt/stack/devstack |
| 42 | +devstack_branch: master |
| 43 | + |
| 44 | +# Network interface for physical bridge (should match heat template netplan config) |
| 45 | +# The heat template uses MAC matching to create a predictable name |
| 46 | +devstack_public_interface: trunk0 |
| 47 | + |
| 48 | +# System updates (set to false to skip for faster iterations during development) |
| 49 | +devstack_update_packages: true |
| 50 | +``` |
| 51 | +
|
| 52 | +## Dependencies |
| 53 | +
|
| 54 | +None. |
| 55 | +
|
| 56 | +## Example Playbook |
| 57 | +
|
| 58 | +```yaml |
| 59 | +- name: Install Devstack |
| 60 | + hosts: devstack |
| 61 | + gather_facts: true |
| 62 | + vars: |
| 63 | + scenario_dir: "{{ playbook_dir }}/scenarios/networking-lab/devstack-nxsw-vxlan" |
| 64 | + roles: |
| 65 | + - role: devstack_installer |
| 66 | + vars: |
| 67 | + devstack_local_conf_template: "{{ scenario_dir }}/local.conf.j2" |
| 68 | +``` |
| 69 | +
|
| 70 | +## Scenario Structure |
| 71 | +
|
| 72 | +Each scenario should provide its own `local.conf.j2` template: |
| 73 | + |
| 74 | +``` |
| 75 | +scenarios/ |
| 76 | + networking-lab/ |
| 77 | + devstack-nxsw-vxlan/ |
| 78 | + heat_template.yaml |
| 79 | + local.conf.j2 # Devstack configuration template |
| 80 | + bootstrap_vars.yml |
| 81 | +``` |
| 82 | +
|
| 83 | +The `local.conf.j2` template can use Jinja2 variables and can be as simple or complex as needed. For a minimal configuration, it can be a static file without any template variables. |
| 84 | +
|
| 85 | +## Features |
| 86 | +
|
| 87 | +- Scenario-specific configuration via local.conf.j2 templates |
| 88 | +- Network configuration handled by heat template (cloud-init) |
| 89 | +- Updates all packages before installation (dist-upgrade) |
| 90 | +- Automatic reboot if kernel or core packages are updated |
| 91 | +- Waits for system to be fully available after reboot |
| 92 | +- Idempotent - can be re-run safely (checks for .stack.sh.complete marker) |
| 93 | +- SSH access via jump host through controller |
| 94 | +
|
| 95 | +## License |
| 96 | +
|
| 97 | +Apache 2.0 |
| 98 | +
|
| 99 | +## Author Information |
| 100 | +
|
| 101 | +This role was created as part of the HotStack project. |
0 commit comments