Skip to content

Ansible Export - #10

Draft
mwindower wants to merge 8 commits into
mainfrom
ansible-export
Draft

mwindower wants to merge 8 commits into
mainfrom
ansible-export

Conversation

@mwindower

@mwindower mwindower commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Description

Exports a metal-stack plan to an ansible deployment repository containing variables, playbooks, pipeline configuration.
This can be a good starting point to customize initial deployments.

Used AI-Tools ✨

  • Claude Opus 5

mwindower and others added 6 commits September 18, 2026 16:38
A new Ansible tab generates an inventory, group and host variables and
playbooks for the metal-roles partition roles (sonic-config, metal-core,
mgmt-server, dhcp, metal-bmc, pixiecore, image-cache), laid out like a
metal-stack deployment repository, previewed per file and downloadable
as a zip.

- derive/devices.ts: named devices per partition, the single source of
  hostnames and ASNs (leaves unique, spines and exits shared, per the
  metal-stack network docs).
- derive/ip/deviceAddresses.ts: loopbacks, management addresses and
  gateways, per-leaf PXE networks (metal-core CIDRs), DHCP ranges for
  the BMCs and transfer network addresses from the infra subnets.
- IP plan: infra subnets carry a kind; L3 management networks get a
  management loopback pool; the PXE subnet is sized as one slice per
  leaf plus one for the exits, as every leaf routes its own PXE network.
- model/deployment.ts: Plan.deployment for the few settings the export
  needs (additive with defaults, no format bump).
- model/ansibleRoles.ts mirrors the role variables of metal-roles
  v0.17.26; tests fail on any generated variable not listed there.
- Values the plan cannot know are written as CHANGE_ME and listed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The export now adds pipelines that check and deploy the playbooks:
GitLab CI (.gitlab-ci.yml, the default) and GitHub Actions (check and
deploy workflows), either or both.

- Every push: inventory parse, --syntax-check of all playbooks, and a
  guard that fails while CHANGE_ME values are left in the inventory.
- Deploys run by hand from the deploy branch, per partition, in the
  order mgmt servers, mgmt network, prod network, on a runner tagged per
  partition (only a runner inside it reaches the management network),
  one resource group / concurrency group per partition. An optional dry
  run shows the changes with --check --diff.
- Credentials stay CI secrets; Ansible reads ANSIBLE_PRIVATE_KEY_FILE
  and ANSIBLE_VAULT_PASSWORD_FILE from the environment.

The settings card shows what differs for every installation (release,
metal-api address, name and NTP servers, pipeline platform) and keeps
everything with a default in a folded Advanced section. The YAML writer
gains literal blocks and YAML 1.1 quoting ("on", "yes"), as Ansible and
GitHub parse it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Name servers default to 1.1.1.1 and 8.8.8.8 (as in mini-lab), NTP
servers to the European NTP pool (as in metal-roles). Both, and the
CI/CD platform, move into the Advanced section of the deployment
settings, which now only shows the release and the metal-api address.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cuts the values left to fill in for the default plan from 27 to 17, of
which 14 are secrets:

- BGP ports per switch (sonic_config_bgp_ports, metal_core_spine_uplinks)
  come from derive/ports.ts: uplinks on the last ports, downlinks from
  the first, using SONiC port maps now in the catalog (AS7726-32X,
  AS7712-32X, AS4630-54TE, from sonic-buildimage's port_config.ini; the
  AS4625-54T has no public map and keeps a placeholder).
- One control plane domain setting replaces the metal-api address:
  metal-api at api.<domain>, NSQ at <domain>:4150, the control plane
  role defaults.
- pixiecore's API host is the mgmt server's router ID, the BMC superuser
  follows go-hal's per-vendor name, the mgmt server NIC is asked once.
- mgmt-server: drop mgmt_server_firewall_facing_interface, which the role
  never reads, and set mgmt_server_routerid, which its frr.conf reads
  (only mgmt_server_router_id was set, so FRR would have failed).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
YAML files show keys, strings, numbers, booleans, Jinja expressions,
comments and CHANGE_ME in color (block scalars stay plain script text),
ansible.cfg gets INI highlighting, and the README renders headings,
tables, lists and code blocks, with a toggle to its source.

The tokenizers (views/ansible/syntax.ts) cover what the export writes
and render as React elements, never as HTML strings, so names from the
plan cannot inject markup. Syntax colors are theme tokens.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The README now covers the current Ansible export (derived switch ports,
control plane domain, public server defaults, the file preview), the new
modules and the yaml and JSZip dependencies, and has an Ansible
screenshot and a fresh plan editor one. The export computes the rack ids
in one place in derive/devices.ts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mwindower and others added 2 commits September 18, 2026 22:02
Port plan (derive/ports.ts), shared by both NOS paths: 4x25G breakouts
for 2x25G server ports on the leaves' first 100G ports, uplinks on the
last ports of their speed, downlinks from the first, with speed, MTU
(9216 fabric, 9000 servers and management) and RS-FEC on server ports.
The catalog gains front-panel numbers and breakout lanes.

Switches follow their partition's NOS, grouped as edgecore_sonic and
broadcom_sonic in the inventory:
- Edgecore SONiC: metal-roles' sonic-config, now with
  sonic_config_breakouts and sonic_config_ports.
- Broadcom Enterprise SONiC: sonic-config only supports Edgecore, so the
  Dell collection from Ansible Galaxy configures these switches over
  httpapi, one generated task per module (breakouts, system, LLDP,
  interfaces, VLANs, L3, DHCP relay, route maps, BGP, VXLAN, NTP, mgmt
  VRF) with one sonic_<module> variable each, structured like an
  existing Enterprise SONiC deployment. An SSH play sets DNS and the
  leaves' split routing mode for metal-core.

PXE, missing so far: every leaf carries VLAN 4000 on its metal-core CIDR
with DHCP relayed to the mgmt servers, whose dhcp_subnets now lease each
leaf's PXE network. Leaves run without the mgmt VRF, as metal-stack
deployments do.

Checked: all 662 generated module configs pass the collection's own
argument specs, every playbook passes --syntax-check, sonic-config's
templates render with the generated variables, every BGP switch gets its
FRR from exactly one source and every leaf relays PXE DHCP (tests).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Broadcom SONiC plays list the dellemc.enterprise_sonic module calls
themselves instead of importing generated task files; each call keeps
its topic as a tag, so single topics still run with --tags. The SSH
tasks for DNS and the leaves' routing mode sit in their play the same
way. No tasks/ directory is generated any more.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant