Skip to content

Commit eeb8838

Browse files
committed
merge conflicts
2 parents 4b0e36d + bf6f368 commit eeb8838

File tree

13 files changed

+78
-58
lines changed

13 files changed

+78
-58
lines changed

ansible/adhoc/deploy-pulp.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
become: yes
1212
hosts: _pulp_host
1313
tasks:
14-
1514
- name: Install pulp
1615
ansible.builtin.include_role:
1716
name: pulp_site

ansible/bootstrap.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@
110110
policy: "{{ selinux_policy }}"
111111
register: sestatus
112112

113+
- hosts: dnf_repos
114+
become: yes
115+
tasks:
116+
- name: Check that creds won't be leaked to users
117+
ansible.builtin.assert:
118+
that: dnf_repos_password is undefined
119+
fail_msg: Passwords should not be templated into repofiles during configure, unset 'dnf_repos_password'
120+
when: appliances_mode == 'configure'
121+
- name: Replace system repos with pulp repos
122+
ansible.builtin.include_role:
123+
name: dnf_repos
124+
tasks_from: set_repos.yml
125+
when: ansible_distribution_major_version == "9" #TODO update role once RL8 config decided
126+
113127
# --- tasks after here require access to package repos ---
114128
- hosts: squid
115129
tags: squid

ansible/disable-repos.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- hosts: dnf_repos
2+
become: yes
3+
tasks:
4+
- name: Disable pulp repos
5+
ansible.builtin.include_role:
6+
name: dnf_repos
7+
tasks_from: disable_repos.yml
8+
when: ansible_distribution_major_version == "9" #TODO update role once RL8 config decided

ansible/fatimage.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@
2727
delegate_to: localhost
2828
when: appliances_mode != 'configure'
2929

30-
- hosts: dnf_repos
31-
become: yes
32-
tasks:
33-
- name: Replace system repos with pulp repos
34-
ansible.builtin.include_role:
35-
name: dnf_repos
36-
tasks_from: set_repos.yml
37-
when: appliances_mode != 'configure' and ansible_distribution_major_version == "9" #TODO update role once RL8 config decided
38-
3930
- import_playbook: bootstrap.yml
4031

4132
- name: Run post-bootstrap.yml hook
@@ -229,14 +220,7 @@
229220
import_role:
230221
name: doca
231222

232-
- hosts: dnf_repos
233-
become: yes
234-
tasks:
235-
- name: Disable pulp repos
236-
ansible.builtin.include_role:
237-
name: dnf_repos
238-
tasks_from: disable_repos.yml
239-
when: appliances_mode != 'configure' and ansible_distribution_major_version == "9" #TODO update role once RL8 config decided
223+
- import_playbook: disable-repos.yml
240224

241225
- name: Run post.yml hook
242226
vars:

ansible/roles/dnf_repos/defaults/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ dnf_repos_password: "{{ omit }}"
88
dnf_repos_repolist:
99
- file: rocky
1010
name: baseos
11-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/BaseOS/{{ ansible_architecture }}/os/{{ appliances_repo_minor_timestamps[ansible_distribution_version].baseos }}"
11+
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/BaseOS/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.baseos[ansible_distribution_version] }}"
1212
- file: rocky
1313
name: appstream
14-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/AppStream/{{ ansible_architecture }}/os/{{ appliances_repo_minor_timestamps[ansible_distribution_version].appstream }}"
14+
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/AppStream/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.appstream[ansible_distribution_version] }}"
1515
- file: rocky
1616
name: crb
17-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/CRB/{{ ansible_architecture }}/os/{{ appliances_repo_minor_timestamps[ansible_distribution_version].crb }}"
17+
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/CRB/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.crb[ansible_distribution_version] }}"
1818
- file: rocky-extras
1919
name: extras
20-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/extras/{{ ansible_architecture }}/os/{{ appliances_repo_minor_timestamps[ansible_distribution_version].extras }}"
20+
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/extras/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.extras[ansible_distribution_version] }}"
2121

22-
dnf_repos_epel_baseurl: "{{ dnf_repos_pulp_content_url }}/epel/{{ ansible_distribution_major_version }}/Everything/{{ ansible_architecture }}/{{ appliances_repo_major_timestamps[ansible_distribution_major_version].epel }}"
22+
dnf_repos_epel_baseurl: "{{ dnf_repos_pulp_content_url }}/epel/{{ ansible_distribution_major_version }}/Everything/{{ ansible_architecture }}/{{ appliances_repo_timestamps.epel[ansible_distribution_major_version] }}"
2323
dnf_repos_epel_description: "epel"

ansible/roles/pulp_site/defaults/main.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
pulp_site_url: "{{ appliances_pulp_url }}"
22
pulp_site_port: 8080
33
pulp_site_username: admin # shouldn't be changed
4+
pulp_site_password: "{{ vault_pulp_admin_password }}"
45
pulp_site_upstream_content_url: https://ark.stackhpc.com/pulp/content
5-
pulp_site_upstream_username: slurm-app-ci
6-
pulp_site_upstream_password: "{{ lookup('ansible.builtin.env', 'ARK_PASSWORD') }}"
76
_pulp_site_rocky_prefix: "{{ pulp_site_target_distribution }}/{{ pulp_site_target_distribution_version }}"
87
pulp_site_default_upstream_suffix: "{{ pulp_site_target_arch }}/os"
9-
pulp_site_password: "{{ vault_pulp_admin_password }}"
108
pulp_site_validate_certs: false
119
pulp_site_install_dir: '/home/rocky/pulp'
1210
pulp_site_selinux_suffix: "{{ ':Z' if ansible_selinux.status == 'enabled' else '' }}"
@@ -15,20 +13,18 @@ pulp_site_target_arch: "{{ pulp_site_target_facts['architecture'] }}"
1513
pulp_site_target_distribution: "{{ pulp_site_target_facts['distribution'] | lower }}"
1614
pulp_site_target_distribution_version: "{{ pulp_site_target_facts['distribution_version'] }}"
1715
pulp_site_target_distribution_version_major: "{{ pulp_site_target_facts['distribution_major_version'] }}"
18-
pulp_site_version_timestamps: "{{ appliances_repo_minor_timestamps[pulp_site_target_distribution_version] }}"
19-
pulp_site_major_version_timestamps: "{{ appliances_repo_major_timestamps[pulp_site_target_distribution_version_major] }}"
2016

2117
pulp_site_rpm_info:
22-
- name: "baseos-{{ pulp_site_target_distribution_version }}-{{ pulp_site_version_timestamps.baseos }}"
23-
subpath: "{{ _pulp_site_rocky_prefix }}/BaseOS/{{ pulp_site_default_upstream_suffix }}/{{ pulp_site_version_timestamps.baseos }}"
24-
- name: "appstream-{{ pulp_site_target_distribution_version }}-{{ pulp_site_version_timestamps.appstream }}"
25-
subpath: "{{ _pulp_site_rocky_prefix }}/AppStream/{{ pulp_site_default_upstream_suffix }}/{{ pulp_site_version_timestamps.appstream }}"
26-
- name: "crb-{{ pulp_site_target_distribution_version }}-{{ pulp_site_version_timestamps.crb }}"
27-
subpath: "{{ _pulp_site_rocky_prefix }}/{{ 'PowerTools' if pulp_site_target_distribution_version_major == '8' else 'CRB' }}/{{ pulp_site_default_upstream_suffix }}/{{ pulp_site_version_timestamps.crb }}"
28-
- name: "extras-{{ pulp_site_target_distribution_version }}-{{ pulp_site_version_timestamps.extras }}"
29-
subpath: "{{ _pulp_site_rocky_prefix }}/extras/{{ pulp_site_default_upstream_suffix }}/{{ pulp_site_version_timestamps.extras }}"
30-
- name: "epel-{{ pulp_site_target_distribution_version_major }}-{{ pulp_site_major_version_timestamps.epel }}"
31-
subpath: "epel/{{ pulp_site_target_distribution_version_major }}/Everything/{{ pulp_site_target_arch }}/{{ pulp_site_major_version_timestamps.epel }}"
18+
- name: "baseos-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.baseos[pulp_site_target_distribution_version] }}"
19+
subpath: "{{ _pulp_site_rocky_prefix }}/BaseOS/{{ pulp_site_default_upstream_suffix }}/{{ appliances_repo_timestamps.baseos[pulp_site_target_distribution_version] }}"
20+
- name: "appstream-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.appstream[pulp_site_target_distribution_version] }}"
21+
subpath: "{{ _pulp_site_rocky_prefix }}/AppStream/{{ pulp_site_default_upstream_suffix }}/{{ appliances_repo_timestamps.appstream[pulp_site_target_distribution_version] }}"
22+
- name: "crb-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.crb[pulp_site_target_distribution_version] }}"
23+
subpath: "{{ _pulp_site_rocky_prefix }}/{{ 'PowerTools' if pulp_site_target_distribution_version_major == '8' else 'CRB' }}/{{ pulp_site_default_upstream_suffix }}/{{ appliances_repo_timestamps.crb[pulp_site_target_distribution_version] }}"
24+
- name: "extras-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.extras[pulp_site_target_distribution_version] }}"
25+
subpath: "{{ _pulp_site_rocky_prefix }}/extras/{{ pulp_site_default_upstream_suffix }}/{{ appliances_repo_timestamps.extras[pulp_site_target_distribution_version] }}"
26+
- name: "epel-{{ pulp_site_target_distribution_version_major }}-{{ appliances_repo_timestamps.epel[pulp_site_target_distribution_version_major] }}"
27+
subpath: "epel/{{ pulp_site_target_distribution_version_major }}/Everything/{{ pulp_site_target_arch }}/{{ appliances_repo_timestamps.epel[pulp_site_target_distribution_version_major] }}"
3228

3329
pulp_site_rpm_repo_defaults:
3430
remote_username: "{{ pulp_site_upstream_username }}"

ansible/site.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- import_playbook: slurm.yml
2828
- import_playbook: portal.yml
2929
- import_playbook: monitoring.yml
30+
- import_playbook: disable-repos.yml
3031

3132
- name: Run post.yml hook
3233
vars:

docs/experimental/pulp.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Pulp Server
22

3-
In order to ensure reproducible builds, the appliance can build images using repository mirrors from StackHPC's Ark Pulp server. The appliance will sync relevant repositories to local Pulp server which will be used for image builds. Using a local server can be enabled by adding `pulp` to the build groups and overriding `dnf_repos_repolist` to point at content hosted on the local server.
3+
In order to ensure reproducible builds, the appliance can build images using repository mirrors from StackHPC's "Ark" Pulp server. The appliance can sync relevant repositories to a local Pulp server which will then be used instead of Ark. Using a local Pulp can be enabled by adding `pulp` to the build groups and overriding `appliances_pulp_url` to point at the local Pulp's URL.
44

55
## Deploying/configuring Pulp Server
66

77
### Deploying a Pulp server
88
A playbook is provided to install and configure a Pulp server on a given host. Admin credentials for this server are automatically generated through the `ansible/adhoc/generate-passwords.yml' playbook. This can be run with
9-
`ansible-playbook ansible/adhoc/deploy-pulp.yml -e "pulp_server=<host_ip>"`
10-
This will print a Pulp endpoint which can be copied to your environments as appropriate. Ensure that the server is accessible on the specified port. Note that this server's content isn't authenticated so assumes the server is deployed behind a secure network.
9+
`ansible-playbook ansible/adhoc/deploy-pulp.yml -e "pulp_server=<target_host>"`
10+
where `target_host` is any resolvable host. This will print a Pulp URL which can be copied to your environments as appropriate. Ensure that the server is accessible on the specified port. Note access to this server's content isn't authenticated so assumes the server is deployed behind a secure network.
1111

1212
### Using an existing Pulp server
1313
An existing Pulp server can be used to host Ark repos by overriding `pulp_site_password` and `appliances_pulp_url` in the target environment. Note that this assumes the same configuration as the appliance deployed pulp i.e no content authentication.
1414

1515
## Syncing Pulp content with Ark
1616

17-
If the `pulp` group is added to the Packer build groups, the local Pulp server will be synced with Ark on build. You must supply your Ark credentials, either by overriding `pulp_site_upstream_password` or setting environment variable `ARK_PASSWORD`. Content can also be synced by running `ansible/adhoc/sync-pulp.yml`, optionally setting extravars for `pulp_site_target_arch`, `pulp_site_target_distribution`, `pulp_site_target_distribution_version` and `pulp_site_target_distribution_version`.
17+
If the `pulp` group is added to the Packer build groups, the local Pulp server will be synced with Ark on build. You must authenticate with Ark by overriding `pulp_site_upstream_username` and `pulp_site_upstream_password` with your vault encrypted Ark dev credentials. `dnf_repos_username` and `dnf_repos_password` must remain unset to access content from the local Pulp. Content can also be synced by running `ansible/adhoc/sync-pulp.yml`. By default this syncs repositories for Rocky 9.4 with x86_64 architecture, but can be overriden by setting extravars for `pulp_site_target_arch`, `pulp_site_target_distribution`, `pulp_site_target_distribution_version` and `pulp_site_target_distribution_version_major`.

docs/image-build.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ The fat images StackHPC builds and tests in CI are available from [GitHub releas
1717
To build either a site-specific fat image from scratch, or to extend an existing StackHPC fat image:
1818

1919
1. Ensure the current OpenStack credentials have sufficient authorisation to upload images (this may or may not require the `member` role for an application credential, depending on your OpenStack configuration).
20-
2. Create a Packer [variable definition file](https://developer.hashicorp.com/packer/docs/templates/hcl_templates/variables#assigning-values-to-input-variables) at e.g. `environments/<environment>/builder.pkrvars.hcl` containing at a minimum:
20+
2. The provided dev credentials for StackHPC's "Ark" Pulp server must be added to the target environments. This is done by overriding `dnf_repos_username` and `dnf_repos_password` with your vault encrypted credentials in `environments/<base_environment>/inventory/group_vars/all/pulp.yml`. See the [experimental docs](experimental/pulp.md) if you wish instead wish to use a local Pulp server.
21+
3. Create a Packer [variable definition file](https://developer.hashicorp.com/packer/docs/templates/hcl_templates/variables#assigning-values-to-input-variables) at e.g. `environments/<environment>/builder.pkrvars.hcl` containing at a minimum:
2122

2223
```hcl
2324
flavor = "general.v1.small" # VM flavor to use for builder VMs
@@ -35,9 +36,9 @@ To build either a site-specific fat image from scratch, or to extend an existing
3536
- `update,control,login,compute`: The resultant image has all packages in the source image updated, and then packages for all types of nodes in the cluster are added. When using a GenericCloud image for `source_image_name` this builds a site-specific fat image from scratch.
3637
- One or more specific groups which are not enabled in the appliance by default, e.g. `lustre`. When using a StackHPC fat image for `source_image_name` this extends the image with just this additional functionality.
3738
38-
3. Activate the venv and the relevant environment.
39+
4. Activate the venv and the relevant environment.
3940
40-
4. Build images using the relevant variable definition file, e.g.:
41+
5. Build images using the relevant variable definition file, e.g.:
4142
4243
cd packer/
4344
PACKER_LOG=1 /usr/bin/packer build -on-error=ask -var-file=$PKR_VAR_environment_root/builder.pkrvars.hcl openstack.pkr.hcl
@@ -52,7 +53,7 @@ To build either a site-specific fat image from scratch, or to extend an existing
5253
5354
then delete the failed volume, select cancelling the build when Packer queries, and then retry. This is [Openstack bug 1823445](https://bugs.launchpad.net/cinder/+bug/1823445).
5455
55-
5. The built image will be automatically uploaded to OpenStack with a name prefixed `openhpc` and including a timestamp and a shortened git hash.
56+
6. The built image will be automatically uploaded to OpenStack with a name prefixed `openhpc` and including a timestamp and a shortened git hash.
5657
5758
# Build Process
5859

environments/.stackhpc/inventory/group_vars/builder.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@
1010
# appliances_pulp_url: "{{ pulp_server_config[lookup('env','CI_CLOUD')].url }}"
1111
# pulp_site_password: "{{ pulp_server_config[lookup('env','CI_CLOUD')].password }}"
1212

13+
# Alternatively, configure to use ark directly:
1314
dnf_repos_username: slurm-app-ci
1415
dnf_repos_password: "{{ lookup('env','ARK_PASSWORD') }}"
16+
17+
# Can be set regardless of approach above:
18+
pulp_site_upstream_username: slurm-app-ci
19+
pulp_site_upstream_password: "{{ lookup('ansible.builtin.env', 'ARK_PASSWORD') }}"

environments/common/inventory/group_vars/all/defaults.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ appliances_local_users: "{{ appliances_local_users_default + appliances_local_us
8282

8383
###########################################################################################
8484

85-
appliances_repo_minor_timestamps:
86-
'9.4':
87-
baseos: 20241115T011711
88-
appstream: 20241112T003151
89-
crb: 20241115T003133
90-
extras: 20241118T002802
91-
92-
appliances_repo_major_timestamps:
93-
'9':
94-
epel: 20241213T010218
85+
appliances_repo_timestamps:
86+
baseos:
87+
'9.4': 20241115T011711
88+
appstream:
89+
'9.4': 20241112T003151
90+
crb:
91+
'9.4': 20241115T003133
92+
extras:
93+
'9.4': 20241118T002802
94+
epel:
95+
'9': 20241213T010218
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
pulp_site_port: 8080
2+
3+
# If using Ark directly (no local Pulp server), override the following with Ark creds
4+
5+
# dnf_repos_username:
6+
# dnf_repos_password:
7+
8+
# If instead using local Pulp server, override below with Ark creds
9+
10+
# pulp_site_upstream_username:
11+
# pulp_site_upstream_password:

environments/common/inventory/groups

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ freeipa_client
147147

148148
[dnf_repos:children]
149149
# Hosts to replace system repos with Pulp repos
150+
# Warning: when using Ark directly rather than a local Pulp server, adding hosts other than `builder` will leak Ark creds to users
150151
builder
151152

152-
[pulp:children]
153-
# Hosts used to run Pulp API commands
153+
[pulp]
154+
# Add builder to this group to enable automatically syncing of pulp during image build

0 commit comments

Comments
 (0)