Skip to content

Commit befa9b2

Browse files
authored
Merge branch 'master' into SAT-44059-pulp-import-export-support
2 parents 6083eea + 0541cc9 commit befa9b2

32 files changed

Lines changed: 756 additions & 57 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
./foremanctl pull-images
111111
- name: Run deployment
112112
run: |
113-
./foremanctl deploy --certificate-source=${{ matrix.certificate_source }} ${{ matrix.database == 'external' && '--database-mode=external --database-host=database.example.com --database-ssl-ca $(pwd)/.var/lib/foremanctl/db-ca.crt --database-ssl-mode verify-full' || '' }} --foreman-initial-admin-password=changeme --tuning development
113+
./foremanctl deploy --certificate-source=${{ matrix.certificate_source }} ${{ matrix.database == 'external' && '--database-mode=external --database-host=database.example.com --database-ssl-ca $(pwd)/.var/lib/foremanctl/db-ca.crt --database-ssl-mode verify-full' || '' }} --foreman-initial-admin-password=changeme --initial-organization "Foreman CI" --initial-location "Internet" --tuning development
114114
- name: Add optional feature - hammer
115115
run: |
116116
./foremanctl deploy --add-feature hammer
@@ -174,7 +174,7 @@ jobs:
174174
./forge setup-repositories
175175
- name: Run deployment
176176
run: |
177-
./forge deploy-dev --foreman-development-enabled-plugin foreman_ansible
177+
./forge deploy-dev --foreman-development-enabled-plugin foreman_ansible --add-feature foreman-proxy --add-feature hammer
178178
- name: Setup upterm session
179179
if: ${{ failure() }}
180180
uses: owenthereal/action-upterm@v1
@@ -219,7 +219,7 @@ jobs:
219219
./foremanctl pull-images
220220
- name: Run deployment
221221
run: |
222-
./foremanctl deploy --foreman-initial-admin-password=changeme --tuning development
222+
./foremanctl deploy --foreman-initial-admin-password=changeme --initial-organization "Foreman CI" --initial-location "Internet" --tuning development
223223
- name: Add optional feature - hammer
224224
run: |
225225
./foremanctl deploy --add-feature hammer

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This setup uses Vagrant to create a basic VM for running the deployment on:
3636
./setup-environment
3737
source .venv/bin/activate
3838
./forge vms start
39-
./foremanctl deploy --foreman-initial-admin-password=changeme --tuning development
39+
./foremanctl deploy --foreman-initial-admin-password=changeme --tuning development --initial-organization "Foreman CI" --initial-location "Internet"
4040
```
4141

4242
### Deploy hammer (optional)

development/playbooks/deploy-dev/deploy-dev.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
- role: httpd
4040
- role: pulp
4141
- role: foreman_development
42+
vars:
43+
foreman_development_oauth_consumer_key: "{{ foreman_oauth_consumer_key }}"
44+
foreman_development_oauth_consumer_secret: "{{ foreman_oauth_consumer_secret }}"
45+
foreman_development_candlepin_oauth_secret: "{{ candlepin_oauth_secret }}"
4246
post_tasks:
4347
- name: Display development environment information
4448
ansible.builtin.debug:

development/requirements.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ collections:
99
- name: https://github.com/theforeman/forklift
1010
type: git
1111
- name: theforeman.foreman
12+
version: ">=5.11.0"
1213
- name: theforeman.operations

development/roles/foreman_development/defaults/main.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ foreman_development_client_key: "{{ foreman_client_key }}"
1414
foreman_development_admin_user: "admin"
1515
foreman_development_admin_password: "changeme"
1616

17+
foreman_development_candlepin_url: "https://localhost:23443/candlepin"
18+
1719
foreman_development_git_repo: "https://github.com/theforeman/foreman.git"
1820
foreman_development_git_revision: "develop"
1921
foreman_development_github_username: ""

development/roles/foreman_development/tasks/main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
- name: Wait for Foreman development server to be accessible
222222
ansible.builtin.uri:
223223
url: '{{ foreman_development_url }}/api/v2/ping'
224-
validate_certs: false
224+
ca_path: '{{ foreman_development_ca_certificate }}'
225225
until: foreman_development_status.status == 200
226226
retries: 30
227227
delay: 5
@@ -234,7 +234,7 @@
234234
server_url: "{{ foreman_development_url }}"
235235
username: "{{ foreman_development_admin_user }}"
236236
password: "{{ foreman_development_admin_password }}"
237-
validate_certs: false
237+
ca_path: "{{ foreman_development_ca_certificate }}"
238238

239239
- name: Stop Foreman development service after smart proxy registration
240240
ansible.builtin.systemd:

development/roles/foreman_development/tasks/smart-proxy/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@
114114

115115
- name: Wait for smart-proxy development server to be accessible
116116
ansible.builtin.uri:
117-
url: "http://{{ ansible_facts['fqdn'] }}:8000/features"
118-
validate_certs: false
117+
url: "https://{{ ansible_facts['fqdn'] }}:8443/features"
118+
ca_path: "{{ foreman_development_ca_certificate }}"
119119
until: foreman_development_smart_proxy_status.status == 200
120120
retries: 30
121121
delay: 5
@@ -130,7 +130,7 @@
130130
- name: Wait for Foreman development server to be accessible
131131
ansible.builtin.uri:
132132
url: '{{ foreman_development_url }}/api/v2/ping'
133-
validate_certs: false
133+
ca_path: '{{ foreman_development_ca_certificate }}'
134134
until: foreman_development_status.status == 200
135135
retries: 30
136136
delay: 5
@@ -141,9 +141,9 @@
141141
name: "{{ ansible_facts['fqdn'] }}-dev"
142142
url: "https://{{ ansible_facts['fqdn'] }}:8443"
143143
server_url: "{{ foreman_development_url }}"
144-
username: "{{ foreman_development_admin_user }}"
145-
password: "{{ foreman_development_admin_password }}"
146-
validate_certs: false
144+
oauth1_consumer_key: "{{ foreman_development_oauth_consumer_key }}"
145+
oauth1_consumer_secret: "{{ foreman_development_oauth_consumer_secret }}"
146+
ca_path: "{{ foreman_development_ca_certificate }}"
147147

148148
- name: Stop development services after smart proxy registration
149149
ansible.builtin.systemd:

development/roles/foreman_development/templates/katello.yaml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
:katello_applicability: true
77

88
:candlepin:
9-
:url: {{ candlepin_url | default('https://localhost:23443/candlepin') }}
9+
:url: {{ foreman_development_candlepin_url }}
1010
:oauth_key: katello
11-
:oauth_secret: {{ candlepin_oauth_secret }}
11+
:oauth_secret: {{ foreman_development_candlepin_oauth_secret }}
1212
:ca_cert_file: {{ foreman_development_cert_dir }}/proxy_ca.pem
1313

1414
:candlepin_events:

development/roles/foreman_development/templates/settings.yaml.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
# The following values are used for providing default settings during db migrate
1111
:oauth_active: true
12-
:oauth_map_users: true
13-
:oauth_consumer_key: {{ candlepin_oauth_key | default('katello') }}
14-
:oauth_consumer_secret: {{ candlepin_oauth_secret }}
12+
:oauth_map_users: false
13+
:oauth_consumer_key: {{ foreman_development_oauth_consumer_key }}
14+
:oauth_consumer_secret: {{ foreman_development_oauth_consumer_secret }}
1515

1616
# SSL settings
1717
:ssl_ca_file: {{ foreman_development_cert_dir }}/proxy_ca.pem

docs/migration-guide.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
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

Comments
 (0)