Salman Rana 3ac15ffad8 Cloud-init based factory installation
This commit introduces a systematic approach for performing
standalone installations tailored for factory environments by:

1. Implementing a factory-install framework -
services with staged execution to facilitate the
operations necessary for installing, bootstrapping, and
deploying a site with factory defaults.

2. Leveraging cloud-init to stage necessary configurations
(using default cloud-init nocloud seed data) and to initiate
the factory installation process.

Overall, key features include:
- Configuration: Sets up factory default user and network
- Factory Staging: Sets up necessary services, configurations
  and scripts for factory installation
- Service Execution: Utilizes systemd service for
  executing various installation stages:
    - Bootstrap: Executes the Ansible bootstrap playbook
    - Config: Executes Ansible deployment manager playbook
    - Setup: System setup scripts are triggered post-
      deployment to ensure deployment is reconciled
    - Tests: Test scripts are executed post-deployment
      to validate system with health checks
- Localized Installation: Ensures factory installation
  processes are streamlined for autonomous running, focusing on
  local execution (no external dependencies) without site-specific
  configurations

Test Plan:
1. PASS: Verify successful end-to-end factory installation.
         Ensure the System in the unlocked-enabled-available state.
         Furthermore, ensure:
          1) No alarms raised
          2) System/host reconciled
          3) No errors reported in /var/log/factory-install
2. PASS: Verify cloud-int factory default user and network setup
         - Sysadmin user password and OAM Network configured
         - Ensure no errors reported in /var/log/cloud-init.log
           and /var/log/cloud-init-output.log
3. PASS: Verify factory install staging, ensure:
         1) /var/lib/factory-install created with
           setup, tests, scripts and config contents
         2) Config contents copied to HOME dir
         3) factory-install systemd path, service, target units
           copied to /etc/systemd/system/
         4) /var/lib/factory-install/enabled flag set at start
         5) factory-install.target service triggered
         6) /var/lib/factory-install/state/final flag set upon
            completion
4. PASS: Verify factory install services execution, ensure:
         1) Streamlined staged execution. At most 1
            factory install service unit must be active at a time,
            strictly in the following order:
            bootstrap, config, setup and test
         2) All 4 path units must be active at start, with each
            stage transition, the previous path+service
            unit must go inactive
         3) Intended service states pre/post host unlock
         4) Intended service state after forced system reboot
         5) /var/lib/factory-install/{stage,state}/ has all 4
            flags set upon completion, and no flags at the start
5. PASS: Validate standalone bootstrap and deployment
         (no network service dependencies)
6. PASS: Verify hardware check step
7. PASS: Verify test stage executed

Story: 2011100
Task: 49972

Depends-on: https://review.opendev.org/c/starlingx/metal/+/914995
Depends-on: https://review.opendev.org/c/starlingx/utilities/+/914993

Co-authored-by: Kyle MacLeod <kyle.macleod@windriver.com>
Change-Id: I63a5e62bcd119ccbefc35184afee4c102821995c
Signed-off-by: Salman Rana <salman.rana@windriver.com>
2024-05-13 18:31:45 -04:00
..