Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
40d9e1f
replaces system repos with ark repos during ci
wtripp180901 Nov 22, 2024
9ef7d69
now uses lookup instead of packer args
wtripp180901 Nov 25, 2024
a6e1243
only applies to RL9 for now
wtripp180901 Nov 25, 2024
6faf919
refactored ark role, disabled repos at end of build and modified site…
wtripp180901 Nov 29, 2024
0bc473c
fixed ood install with disbaled repos + fixed ark CRB typo
wtripp180901 Dec 3, 2024
364ec79
fixed eessi install and slurm not loading appliances_mode
wtripp180901 Dec 3, 2024
b0558b9
variables renames + more ansible facts in dnf_repos
wtripp180901 Dec 3, 2024
3131bd6
bump images
wtripp180901 Dec 3, 2024
1be9c6b
added review comment
wtripp180901 Dec 4, 2024
b7670e9
moved config into builder and .stackhpc
wtripp180901 Dec 4, 2024
3de36cf
pull
wtripp180901 Dec 4, 2024
2230bb8
overriding openhpc extra repos in common
wtripp180901 Dec 4, 2024
9723782
testing builds with leafcloud pulp
wtripp180901 Dec 6, 2024
127b792
pulp integration
wtripp180901 Dec 6, 2024
5b60770
merge conflicts
wtripp180901 Dec 6, 2024
0d8a440
typos
wtripp180901 Dec 6, 2024
90a33fa
missed merge conflict
wtripp180901 Dec 6, 2024
eaa3680
moved pulp port into url
wtripp180901 Dec 6, 2024
9a75656
fixed port not getting added in adhoc
wtripp180901 Dec 6, 2024
741872a
bump
wtripp180901 Dec 6, 2024
39cf556
cleaned up disabling repos + now optional
wtripp180901 Dec 6, 2024
25644c3
typo
wtripp180901 Dec 9, 2024
fef3d56
repos now timestamped + synced at bootstrap
wtripp180901 Dec 11, 2024
1c4a511
refactored pulp_site list
wtripp180901 Dec 11, 2024
187bc40
added pulp sync adhoc and temporarily moved out of ci
wtripp180901 Dec 12, 2024
580b0b3
fixed disabling for ci
wtripp180901 Dec 12, 2024
2ed6674
made dnf epel repo more configurable
wtripp180901 Dec 12, 2024
d12083a
moved repo enable/disable into fatimage
wtripp180901 Dec 12, 2024
59dd169
merge conflicts
wtripp180901 Dec 12, 2024
07dc9b7
fixed disable repos task
wtripp180901 Dec 12, 2024
3088f83
reverted disable repos task
wtripp180901 Dec 12, 2024
c74360b
fatimage with test latest (REVERT LATER)
wtripp180901 Dec 12, 2024
67ce24b
refactored pulp deploy and added pulp docs
wtripp180901 Dec 12, 2024
c433605
testing image using site pulp
wtripp180901 Dec 12, 2024
bda3f7e
Pointed dnf repos back at ark for now + refactor
wtripp180901 Dec 13, 2024
d6eabe6
unused var
wtripp180901 Dec 13, 2024
f0e48b9
pulp sync now mirrors upstream subpaths
wtripp180901 Dec 13, 2024
309bd0b
removed intermediate var
wtripp180901 Dec 13, 2024
a2a705c
Merge branch 'main' into feat/pulp-builds
wtripp180901 Dec 13, 2024
7d7bc73
bump images
wtripp180901 Dec 13, 2024
c162e18
Refactored common repolist
wtripp180901 Dec 16, 2024
bda3f0d
Code review doc/comment suggestions
wtripp180901 Dec 16, 2024
bc5e26e
docs/groups corrections
wtripp180901 Dec 16, 2024
18b220e
moved defaults to CI and updated docs
wtripp180901 Dec 16, 2024
9c41725
bump images
wtripp180901 Dec 16, 2024
6c74a1e
repos now controlled by groups + possible during configure + guarded …
wtripp180901 Dec 16, 2024
2357a73
typo
wtripp180901 Dec 16, 2024
bf6f368
bump
wtripp180901 Dec 16, 2024
7fe3ca5
docs suggestions
wtripp180901 Dec 17, 2024
a3e1258
Merge branch 'main' into feat/pulp-builds
wtripp180901 Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/fatimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
OS_CLOUD: openstack
CI_CLOUD: ${{ github.event.inputs.ci_cloud }}
ARK_PASSWORD: ${{ secrets.ARK_PASSWORD }}
LEAFCLOUD_PULP_PASSWORD: ${{ secrets.LEAFCLOUD_PULP_PASSWORD }}

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
OS_CLOUD: openstack
CI_CLOUD: ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
ARK_PASSWORD: ${{ secrets.ARK_PASSWORD }}
LEAFCLOUD_PULP_PASSWORD: ${{ secrets.LEAFCLOUD_PULP_PASSWORD }}

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ It requires an OpenStack cloud, and an Ansible "deploy host" with access to that
Before starting ensure that:
- You have root access on the deploy host.
- You can create instances using a Rocky 9 GenericCloud image (or an image based on that).
- **NB**: In general it is recommended to use the [latest released image](https://github.com/stackhpc/ansible-slurm-appliance/releases) which already contains the required packages. This is built and tested in StackHPC's CI. However the appliance will install the necessary packages if a GenericCloud image is used.
- **NB**: In general it is recommended to use the [latest released image](https://github.com/stackhpc/ansible-slurm-appliance/releases) which already contains the required packages. This is built and tested in StackHPC's CI.
- You have a SSH keypair defined in OpenStack, with the private key available on the deploy host.
- Created instances have access to internet (note proxies can be setup through the appliance if necessary).
- Created instances have accurate/synchronised time (for VM instances this is usually provided by the hypervisor; if not or for bare metal instances it may be necessary to configure a time service via the appliance).
Expand Down
2 changes: 2 additions & 0 deletions ansible/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ roles/*
!roles/lustre/**
!roles/dnf_repos/
!roles/dnf_repos/**
!roles/pulp_site/
!roles/pulp_site/**
!roles/doca/
!roles/doca/**
26 changes: 26 additions & 0 deletions ansible/adhoc/deploy-pulp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Usage: ansible-playbook ansible/adhoc/deploy-pulp.yml -e "pulp_server=<pulp server hostname>"

- name: Add temporary pulp server host
hosts: localhost
tasks:
- ansible.builtin.add_host:
name: "{{ pulp_server }}"
group: "_pulp_host"

- name: Install pulp on server and add to config
become: yes
hosts: _pulp_host
tasks:
- name: Install pulp
ansible.builtin.include_role:
name: pulp_site
tasks_from: install.yml
public: true

- name: Print Pulp endpoint
become: no
debug:
msg: |
Server configured, override 'appliances_pulp_url' with
appliances_pulp_url: "http://{{ pulp_server }}:{{ pulp_site_port }}"
in your environments
10 changes: 10 additions & 0 deletions ansible/adhoc/sync-pulp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- hosts: localhost
tasks:
- ansible.builtin.include_role:
name: pulp_site
tasks_from: sync.yml
vars:
pulp_site_target_arch: "x86_64"
pulp_site_target_distribution: "rocky"
pulp_site_target_distribution_version: "9.4"
pulp_site_target_distribution_version_major: "9"
14 changes: 14 additions & 0 deletions ansible/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@
policy: "{{ selinux_policy }}"
register: sestatus

- hosts: dnf_repos
become: yes
tasks:
- name: Check that creds won't be leaked to users
ansible.builtin.assert:
that: dnf_repos_password is undefined
fail_msg: Passwords should not be templated into repofiles during configure, unset 'dnf_repos_password'
when: appliances_mode == 'configure'
- name: Replace system repos with pulp repos
ansible.builtin.include_role:
name: dnf_repos
tasks_from: set_repos.yml
when: ansible_distribution_major_version == "9" #TODO update role once RL8 config decided

# --- tasks after here require access to package repos ---
- hosts: squid
tags: squid
Expand Down
8 changes: 8 additions & 0 deletions ansible/disable-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- hosts: dnf_repos
become: yes
tasks:
- name: Disable pulp repos
ansible.builtin.include_role:
name: dnf_repos
tasks_from: disable_repos.yml
when: ansible_distribution_major_version == "9" #TODO update role once RL8 config decided
12 changes: 12 additions & 0 deletions ansible/fatimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
import_playbook: "{{ hook_path if hook_path | exists else 'noop.yml' }}"
when: hook_path | exists

- name: Sync pulp repos with upstream
hosts: pulp
tasks:
- ansible.builtin.include_role:
name: pulp_site
tasks_from: sync.yml
apply:
delegate_to: localhost
when: appliances_mode != 'configure'

- import_playbook: bootstrap.yml

- name: Run post-bootstrap.yml hook
Expand Down Expand Up @@ -210,6 +220,8 @@
import_role:
name: doca

- import_playbook: disable-repos.yml

- name: Run post.yml hook
vars:
appliances_environment_root: "{{ lookup('env', 'APPLIANCES_ENVIRONMENT_ROOT') }}"
Expand Down
24 changes: 11 additions & 13 deletions ansible/roles/dnf_repos/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
dnf_repos_rocky_ark_prefix: https://ark.stackhpc.com/pulp/content/{{ ansible_distribution | lower }}/{{ ansible_distribution_version }}
dnf_repos_rocky_ark_suffix: "{{ ansible_architecture }}/os/{{ dnf_repos_rocky_ark_timestamp }}/"
# most stable from https://github.com/stackhpc/stackhpc-kayobe-config/blob/stackhpc/2024.1/etc/kayobe/pulp-repo-versions.yml
# note that some timestamps can't be used because not all repos have snapshots for them
dnf_repos_rocky_ark_timestamp: 20240816T002610
dnf_repos_username: slurm-app-ci
dnf_repos_password: "{{ lookup('ansible.builtin.env', 'ARK_PASSWORD') }}"
dnf_repos_pulp_content_url: "{{ appliances_pulp_url }}/pulp/content"
dnf_repos_rocky_prefix: "{{ ansible_distribution | lower }}/{{ ansible_distribution_version }}"
dnf_repos_epel_prefix: "epel/{{ ansible_distribution_major_version }}"
dnf_repos_username: "{{ omit }}"
dnf_repos_password: "{{ omit }}"

# epel installed separately
dnf_repos_repolist:
- file: rocky
name: baseos
base_url: "{{ dnf_repos_rocky_ark_prefix }}/BaseOS/{{ dnf_repos_rocky_ark_suffix }}"
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/BaseOS/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.baseos[ansible_distribution_version] }}"
- file: rocky
name: appstream
base_url: "{{ dnf_repos_rocky_ark_prefix }}/AppStream/{{ dnf_repos_rocky_ark_suffix }}"
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/AppStream/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.appstream[ansible_distribution_version] }}"
- file: rocky
name: crb
base_url: "{{ dnf_repos_rocky_ark_prefix }}/CRB/{{ dnf_repos_rocky_ark_suffix }}"
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/CRB/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.crb[ansible_distribution_version] }}"
- file: rocky-extras
name: extras
base_url: "{{ dnf_repos_rocky_ark_prefix }}/extras/{{ dnf_repos_rocky_ark_suffix }}"
base_url: "{{ dnf_repos_pulp_content_url }}/{{ dnf_repos_rocky_prefix }}/extras/{{ ansible_architecture }}/os/{{ appliances_repo_timestamps.extras[ansible_distribution_version] }}"

dnf_repos_epel_timestamp: 20240902T080424
dnf_repos_epel_baseurl: "https://ark.stackhpc.com/pulp/content/epel/{{ ansible_distribution_major_version }}/Everything/{{ ansible_architecture }}/{{ dnf_repos_epel_timestamp }}"
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] }}"
dnf_repos_epel_description: "epel"
6 changes: 3 additions & 3 deletions ansible/roles/dnf_repos/tasks/disable_repos.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Disable Pulp repos and remove creds
- name: Disable Pulp repos
ansible.builtin.yum_repository:
file: "{{ item.file }}"
name: "{{ item.name }}"
Expand All @@ -8,11 +8,11 @@
enabled: false
loop: "{{ dnf_repos_repolist }}"

- name: Disable EPEL repo and remove creds
- name: Disable EPEL repo
ansible.builtin.yum_repository:
name: epel
file: epel
description: epel
description: "{{ dnf_repos_epel_description }}"
baseurl: "{{ dnf_repos_epel_baseurl }}"
gpgcheck: false
enabled: false
4 changes: 2 additions & 2 deletions ansible/roles/dnf_repos/tasks/set_repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
ansible.builtin.yum_repository:
name: epel
file: epel
description: epel
description: "{{ dnf_repos_epel_description }}"
gpgcheck: false
baseurl: "{{ dnf_repos_epel_baseurl }}"
username: "{{ dnf_repos_username }}"
password: "{{ dnf_repos_password }}"
baseurl: "{{ dnf_repos_epel_baseurl }}"
1 change: 1 addition & 0 deletions ansible/roles/passwords/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ slurm_appliance_secrets:
vault_freeipa_ds_password: "{{ vault_freeipa_ds_password | default(lookup('password', '/dev/null')) }}"
vault_freeipa_admin_password: "{{ vault_freeipa_admin_password | default(lookup('password', '/dev/null')) }}"
vault_k3s_token: "{{ vault_k3s_token | default(lookup('ansible.builtin.password', '/dev/null', length=64)) }}"
vault_pulp_admin_password: "{{ vault_pulp_admin_password | default(lookup('password', '/dev/null', chars=['ascii_letters', 'digits'])) }}"

secrets_openhpc_mungekey_default:
content: "{{ lookup('pipe', 'dd if=/dev/urandom bs=1 count=1024 2>/dev/null | base64') }}"
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/pulp_site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
filter_plugins/__pycache__
39 changes: 39 additions & 0 deletions ansible/roles/pulp_site/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
pulp_site_url: "{{ appliances_pulp_url }}"
pulp_site_port: 8080
pulp_site_username: admin # shouldn't be changed
pulp_site_password: "{{ vault_pulp_admin_password }}"
pulp_site_upstream_content_url: https://ark.stackhpc.com/pulp/content
_pulp_site_rocky_prefix: "{{ pulp_site_target_distribution }}/{{ pulp_site_target_distribution_version }}"
pulp_site_default_upstream_suffix: "{{ pulp_site_target_arch }}/os"
pulp_site_validate_certs: false
pulp_site_install_dir: '/home/rocky/pulp'
pulp_site_selinux_suffix: "{{ ':Z' if ansible_selinux.status == 'enabled' else '' }}"
pulp_site_target_facts: "{{ hostvars[groups['builder'][0]]['ansible_facts'] }}"
pulp_site_target_arch: "{{ pulp_site_target_facts['architecture'] }}"
pulp_site_target_distribution: "{{ pulp_site_target_facts['distribution'] | lower }}"
pulp_site_target_distribution_version: "{{ pulp_site_target_facts['distribution_version'] }}"
pulp_site_target_distribution_version_major: "{{ pulp_site_target_facts['distribution_major_version'] }}"

pulp_site_rpm_info:
- name: "baseos-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.baseos[pulp_site_target_distribution_version] }}"
subpath: "{{ _pulp_site_rocky_prefix }}/BaseOS/{{ pulp_site_default_upstream_suffix }}/{{ appliances_repo_timestamps.baseos[pulp_site_target_distribution_version] }}"
- name: "appstream-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.appstream[pulp_site_target_distribution_version] }}"
subpath: "{{ _pulp_site_rocky_prefix }}/AppStream/{{ pulp_site_default_upstream_suffix }}/{{ appliances_repo_timestamps.appstream[pulp_site_target_distribution_version] }}"
- name: "crb-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.crb[pulp_site_target_distribution_version] }}"
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] }}"
- name: "extras-{{ pulp_site_target_distribution_version }}-{{ appliances_repo_timestamps.extras[pulp_site_target_distribution_version] }}"
subpath: "{{ _pulp_site_rocky_prefix }}/extras/{{ pulp_site_default_upstream_suffix }}/{{ appliances_repo_timestamps.extras[pulp_site_target_distribution_version] }}"
- name: "epel-{{ pulp_site_target_distribution_version_major }}-{{ appliances_repo_timestamps.epel[pulp_site_target_distribution_version_major] }}"
subpath: "epel/{{ pulp_site_target_distribution_version_major }}/Everything/{{ pulp_site_target_arch }}/{{ appliances_repo_timestamps.epel[pulp_site_target_distribution_version_major] }}"

pulp_site_rpm_repo_defaults:
remote_username: "{{ pulp_site_upstream_username }}"
remote_password: "{{ pulp_site_upstream_password }}"
policy: on_demand
state: present

_pulp_site_rpm_info_all: "{{ pulp_site_rpm_info | map('combine', pulp_site_rpm_repo_defaults) }}"

pulp_site_rpm_repos: "{{ _pulp_site_rpm_info_all | to_rpm_repos(pulp_site_upstream_content_url) }}"
pulp_site_rpm_publications: "{{ _pulp_site_rpm_info_all | to_rpm_pubs }}"
pulp_site_rpm_distributions: "{{ _pulp_site_rpm_info_all | to_rpm_distros }}"
31 changes: 31 additions & 0 deletions ansible/roles/pulp_site/filter_plugins/pulp-list-filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class FilterModule(object):
def filters(self):
return {
'to_rpm_repos': self.to_rpm_repos,
'to_rpm_pubs': self.to_rpm_pubs,
'to_rpm_distros': self.to_rpm_distros
}

def to_rpm_repos(self, list, pulp_url):
repo_list = map(lambda x: {
'name': x['name'],
'url': pulp_url+'/'+x['subpath'],
'remote_username': x['remote_username'],
'remote_password': x['remote_password'],
'policy': x['policy'],
'state': x['state'] }, list)
return repo_list

def to_rpm_pubs(self, list):
pub_list = map(lambda x: {
'repository': x['name'],
'state': x['state'] }, list)
return pub_list

def to_rpm_distros(self, list):
distro_list = map(lambda x: {
'name': x['name'],
'repository': x['name'],
'base_path': x['subpath'],
'state': x['state'] }, list)
return distro_list
43 changes: 43 additions & 0 deletions ansible/roles/pulp_site/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---

- name: Install packages
dnf:
name:
- podman

- name: Create install directories
ansible.builtin.file:
state: directory
path: "{{ pulp_site_install_dir }}/{{ item }}"
loop:
- settings/certs
- pulp_storage
- pgsql
- containers

- name: Template settings file
ansible.builtin.template:
src: settings.py.j2
dest: "{{ pulp_site_install_dir }}/settings/settings.py"

- name: Install pulp podman container
containers.podman.podman_container:
name: pulp
publish:
- "{{ pulp_site_port }}:80"
volume:
- "{{ pulp_site_install_dir }}/settings:/etc/pulp{{ pulp_site_selinux_suffix }}"
- "{{ pulp_site_install_dir }}/pulp_storage:/var/lib/pulp{{ pulp_site_selinux_suffix }}"
- "{{ pulp_site_install_dir }}/pgsql:/var/lib/pgsql{{ pulp_site_selinux_suffix }}"
- "{{ pulp_site_install_dir }}/containers:/var/lib/containers{{ pulp_site_selinux_suffix }}"
device: /dev/fuse
image: docker.io/pulp/pulp:3.68.1

- name: Reset admin password once container has initialised
no_log: true
ansible.builtin.shell:
cmd: "podman exec pulp bash -c 'pulpcore-manager reset-admin-password -p {{ pulp_site_password }}'"
register: _admin_reset_output
until: 0 == _admin_reset_output.rc
retries: 6
delay: 30
Loading
Loading