|
| 1 | +# Migrating from foreman-installer to foremanctl |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +When upgrading from foreman-installer to foremanctl, the `foremanctl migrate` command helps convert your existing configuration to the new format. |
| 6 | + |
| 7 | +This guide explains how to migrate your foreman-installer answer files to foremanctl configuration files. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +Before migrating, ensure the following: |
| 12 | + |
| 13 | +1. **Foreman deployment using foreman-installer** - You should have an existing Foreman deployment has been installed using foreman-installer and has an answers file to migrate from. |
| 14 | + |
| 15 | +2. **foremanctl is installed** on the system: |
| 16 | + ```bash |
| 17 | + # Enable the foremanctl repository |
| 18 | + dnf copr enable @theforeman/foremanctl rhel-9-x86_64 |
| 19 | + |
| 20 | + # Install foremanctl |
| 21 | + dnf install foremanctl |
| 22 | + ``` |
| 23 | + |
| 24 | + For more installation options, see the main [README](../README.md#packages). |
| 25 | + |
| 26 | +## Migration Workflow |
| 27 | + |
| 28 | +1. **Generate the migrated configuration**: |
| 29 | + ```bash |
| 30 | + foremanctl migrate --output /var/lib/foremanctl/parameters.yaml |
| 31 | + ``` |
| 32 | + |
| 33 | +2. **Review the output** for any warnings about unmapped parameters |
| 34 | + |
| 35 | +3. **Use the migrated configuration** with foremanctl: |
| 36 | + ```bash |
| 37 | + foremanctl deploy |
| 38 | + ``` |
| 39 | + (foremanctl automatically loads configuration from `/var/lib/foremanctl/parameters.yaml`) |
| 40 | + |
| 41 | +## Command Usage |
| 42 | + |
| 43 | +### Basic Migration |
| 44 | + |
| 45 | +Migrate from the default location (reads the currently active scenario): |
| 46 | +```bash |
| 47 | +foremanctl migrate --output /var/lib/foremanctl/parameters.yaml |
| 48 | +``` |
| 49 | + |
| 50 | +### Custom Answer File |
| 51 | + |
| 52 | +Migrate from a specific answer file: |
| 53 | +```bash |
| 54 | +foremanctl migrate --answer-file /path/to/custom-answers.yaml --output /var/lib/foremanctl/parameters.yaml |
| 55 | +``` |
| 56 | + |
| 57 | +### Output to stdout |
| 58 | + |
| 59 | +Preview the migrated configuration without writing a file: |
| 60 | +```bash |
| 61 | +foremanctl migrate |
| 62 | +``` |
| 63 | + |
| 64 | +## Command Options |
| 65 | + |
| 66 | +- `--answer-file PATH` - Path to the foreman-installer answer file. If not specified, reads the currently active scenario and extracts the answer file path from it. |
| 67 | +- `--output PATH` - Path for the migrated configuration (default: stdout) |
| 68 | + |
| 69 | +> [!NOTE] |
| 70 | +> Unlike other `foremanctl` commands, migrate does not persist parameters between runs. Each migration is independent. |
| 71 | +
|
| 72 | +## Parameter Mappings |
| 73 | + |
| 74 | +The migrate command automatically maps foreman-installer parameters to foremanctl parameters. For a complete list of all parameter mappings, see the [Parameters documentation](parameters.md#mapping). |
| 75 | + |
| 76 | +## Example |
| 77 | + |
| 78 | +Below is an example showing how the transformation works: |
| 79 | + |
| 80 | +### Input (foreman-installer format) |
| 81 | + |
| 82 | +```yaml |
| 83 | +foreman: |
| 84 | + db_host: database.example.com |
| 85 | + db_port: 5432 |
| 86 | + db_database: foreman |
| 87 | + db_username: foreman_user |
| 88 | + db_password: secret123 |
| 89 | + db_manage: true |
| 90 | + initial_admin_username: admin |
| 91 | + initial_admin_password: changeme |
| 92 | +``` |
| 93 | +
|
| 94 | +### Output (foremanctl format) |
| 95 | +
|
| 96 | +```yaml |
| 97 | +database_host: database.example.com |
| 98 | +database_port: 5432 |
| 99 | +database_mode: external |
| 100 | +foreman_database_name: foreman |
| 101 | +foreman_database_password: secret123 |
| 102 | +foreman_database_user: foreman_user |
| 103 | +foreman_initial_admin_password: changeme |
| 104 | +foreman_initial_admin_username: admin |
| 105 | +``` |
| 106 | +
|
| 107 | +## Handling Unmapped Parameters |
| 108 | +
|
| 109 | +When the migration completes, you may see warnings like: |
| 110 | +
|
| 111 | +> [!WARNING] |
| 112 | +> The following parameters could not be mapped: |
| 113 | +> - katello::enable_ostree |
| 114 | +> - foreman::some_other_param |
| 115 | +
|
| 116 | +These parameters need to be manually reviewed and added to the new configuration if needed. Check the [parameters documentation](parameters.md) for equivalent foremanctl parameters. |
| 117 | +
|
| 118 | +## Using the Migrated Configuration |
| 119 | +
|
| 120 | +Once you've generated and reviewed the migrated configuration: |
| 121 | +
|
| 122 | +1. **Save it to the foremanctl parameters file**: |
| 123 | + ```bash |
| 124 | + # Either generate directly to the parameters file |
| 125 | + foremanctl migrate --output /var/lib/foremanctl/parameters.yaml |
| 126 | + |
| 127 | + # Or copy after review |
| 128 | + foremanctl migrate --output /tmp/migrated.yaml |
| 129 | + # Review /tmp/migrated.yaml |
| 130 | + cp /tmp/migrated.yaml /var/lib/foremanctl/parameters.yaml |
| 131 | + ``` |
| 132 | + |
| 133 | +2. **Deploy using foremanctl**: |
| 134 | + ```bash |
| 135 | + foremanctl deploy |
| 136 | + ``` |
| 137 | + |
| 138 | + The `foremanctl deploy` command automatically loads configuration from `/var/lib/foremanctl/parameters.yaml`. |
0 commit comments