Forced Saltboot image redeployment

Systems provisioned by Saltboot are usually redeployed or repartitioned automatically when a new image is available, or Saltboot partitioning changes.

Occasionally, however, it is needed to force Saltboot to redeploy an image or repartition disk, even when automation would not do so. For these situations, Saltboot offers three ways to force redeployment or repartitioning:

Repartitioning of a terminal removes all data stored on the terminal hard disk, including any persistent partitions.

1. Force Saltboot redeployment using Salt grains

Saltboot redeployment grains have no side effects, and do not require any further configuration. The limitation is that terminal must be accessible by salt.

Procedure: Forcing Saltboot to redeploy image
  1. On the Uyuni Server, as root, apply this Salt state at the command prompt:

    salt $terminal_minion_id state.apply saltboot.force_redeploy
  2. Restart the terminal to pick up the changes.

Procedure: Forcing a Saltboot to repartition the hard disk
  1. On the Uyuni Server, as root, apply this Salt state at the command prompt:

    salt $terminal_minion_id state.apply saltboot.force_repartition
  2. Restart the terminal to pick up the changes.

2. Force Saltboot redeployment using custom info values

Saltboot custom values remove the limitation on terminal being reachable by salt, however there are configuration steps.

Custom info keys and values can be also managed using API or spacecmd command. For more information, see custominfo.

Procedure: Create custom info key for image redeployment
  1. In the Uyuni Web UI, navigate to Systems  Custom System Info.

  2. Click Create Key to create new Custom Info Key.

  3. As Key Label fill in saltboot_force_redeploy.

  4. As Description fill in Force redeploy Saltboot image.

  5. Click Create Key.

    Creating saltboot_force_redeploy custom key is a one time operation. When created, it is available for repeated use.

Procedure: Assign custom value for image redeployment
  1. Navigate to the Overview page of the system you want to redeploy.

  2. Select tab Custom Info.

  3. Click on Create Value.

  4. From the list of available keys click saltboot_force_redeploy.

  5. As Value type True.

  6. Click Update Key.

  7. Reboot the terminal to pick up the changes.

After terminal finishes booting, Saltboot redeployment custom info setting is automatically reset to prevent repeated redeployment.

Procedure: Create custom info key for disk repartitioning
  1. Navigate to menu::Systems[Custom System Info] page.

  2. Click Create Key to create new Custom Info Key.

  3. As Key Label fill in saltboot_force_repartition.

  4. As Description fill in Force terminal disk repartition.

  5. Click Create Key.

    Creating saltboot_force_repartition custom key is one time operation. Once created, it is available for repeated use.

Procedure: Assign custom value for disk repartitioning
  1. Navigate to the Overview page of the system you want to redeploy.

  2. Select tab Custom Info.

  3. Click on Create Value.

  4. From the list of available keys click saltboot_force_repartition.

  5. As Value type True.

  6. Click Update Key.

  7. Reboot the terminal to pick up the changes.

3. Force Saltboot redeployment using Saltboot API call

After terminal finishes booting, Saltboot redeployment setting is automatically reset to prevent repeated redeployment.

An API call system.setPillar can be used to set specific Saltboot options through Salt pillar data. Uyuni Saltboot integration is using tuning-saltboot pillar category to manage Saltboot tuning, including forced redeployment or disk repartition. Using this pillar category allows Uyuni to reset Saltboot flag once the terminal is booted up.

Procedure: Forcing Saltboot to redeploy image using API call using spacecmd command
  1. In the console run following the command, and replace $terminal_minion_id with the actual terminal minion id:

    spacecmd api -- -A '$terminal_minion_id,tuning-saltboot,{"saltboot": {"force_redeployment": "True"}}' system.setPillar
Procedure: Forcing Saltboot to repartition disk using API call using spacecmd command
  1. In the console run the following command, replace $terminal_minion_id with the actual terminal minion id:

    spacecmd api -- -A '$terminal_minion_id,tuning-saltboot,{"saltboot": {"force_repartition": "True"}}' system.setPillar
Procedure: Check Saltboot tuning options
  1. In the console run the following command, and replace $terminal_minion_id with the actual terminal minion id:

    spacecmd api -- -A '$terminal_minion_id,tuning-saltboot' system.getPillar

Make sure to use tuning-saltboot as pillar category in the API call.

4. Force Saltboot redeployment by custom pillar

Pillars specified outside of Uyuni database cannot be reset automatically. Without manual intervention, the terminal will download a new image on each reboot.

Procedure: Force a Saltboot to redeploy image using Saltboot pillar
  1. Create new file /srv/salt/pillar/force_redeploy.sls with content:

    saltboot:
      force_redeploy: True
  2. Create new file or update existing file named /srv/salt/pillar/top.sls with content:

    base:
      '$terminal_minion_id':
        - force_redeploy
  3. Reboot the terminal to pick up the changes.

  4. After the terminal finishes booting, remove modifications made in /srv/salt/pillar/top.sls file.

If your terminal encounters a problem with the file system or the partition table, you might need to remove the partition table and reformat the terminal.

Procedure: Force Saltboot to repartition disk using Saltboot pillar
  1. Create new file /srv/salt/pillar/force_repartition.sls with content:

    saltboot:
      force_repartition: True
  2. Create new file or update existing file named /srv/salt/pillar/top.sls with content:

    base:
      '$terminal_minion_id':
        - force_repartition
  3. Reboot the terminal to pick up the changes.

  4. After the terminal finishes booting, remove modifications made in /srv/salt/pillar/top.sls file.