Skip to content

Commit 88786d6

Browse files
committed
feat: add stack user for Pulp
The `stack` user is intended to be used for accessing `Pulp` from the `overcloud` hosts rather than using the `admin` user.
1 parent 5d5fac1 commit 88786d6

File tree

5 files changed

+47
-12
lines changed

5 files changed

+47
-12
lines changed

doc/source/configuration/release-train.rst

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,29 @@ The Pulp container is deployed on the seed by default, but may be disabled by
5252
setting ``seed_pulp_container_enabled`` to ``false`` in
5353
``etc/kayobe/seed.yml``.
5454

55-
The URL and credentials of the local Pulp server are configured in
56-
``etc/kayobe/pulp.yml`` via ``pulp_url``, ``pulp_username`` and
57-
``pulp_password``. In most cases, the default values should be sufficient.
58-
An admin password must be generated and set as the value of a
59-
``secrets_pulp_password`` variable, typically in an Ansible Vault encrypted
60-
``etc/kayobe/secrets.yml`` file. This password will be automatically set on
61-
Pulp startup.
62-
63-
If a proxy is required to access the Internet from the seed, ``pulp_proxy_url``
64-
may be used.
55+
The URL for the local Pulp server is configured by ``pulp_url`` within
56+
``etc/kayobe/pulp.yml``.
57+
58+
The Pulp service can be configured with two sets of credentials; one for
59+
administrator operations and another read-only for overcloud hosts
60+
to use.
61+
The administrator credentials can be configured ``pulp_username``,
62+
``pulp_password``
63+
The basic user account credentials can be configured with ``pulp_stack_username``
64+
and ``pulp_stack_password``.
65+
Both sets of credentials can be found within ``etc/kayobe/pulp.yml``.
66+
67+
Both the ``pulp_password`` and ``pulp_stack_password`` are intended to be
68+
configured via their ``secrets_*`` counterparts, i.e.
69+
``secrets_pulp_password`` and ``secrets_pulp_stack_password``. These variables
70+
are expected to be set in an Ansible Vault encrypted
71+
``etc/kayobe/secrets.yml`` file.
72+
73+
Passwords can be generated using ``OpenSSL``
74+
75+
.. code-block:: console
76+
77+
openssl rand -base64 32
6578
6679
Host images are not synchronised to the local Pulp server, since they should
6780
only be pulled to the seed node once. More information on host images can be

etc/kayobe/containers/pulp/post.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@
2828
- stackhpc_pulp_sync_for_local_container_build | bool
2929
- pulp_settings.changed
3030

31+
- name: Ensure Pulp stack user exists
32+
ansible.builtin.include_role:
33+
name: stackhpc.pulp.pulp_user
34+
vars:
35+
pulp_users:
36+
- username: "{{ pulp_stack_username }}"
37+
password: "{{ pulp_stack_password }}"
38+
is_staff: false
39+
when:
40+
- pulp_stack_username is defined and pulp_stack_username | length > 0
41+
- pulp_stack_password is defined and pulp_stack_password | length > 0
42+
3143
- name: Login to docker registry
3244
docker_login:
3345
registry_url: "{{ kolla_docker_registry or omit }}"

etc/kayobe/pulp.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ pulp_enable_tls: false
2626
pulp_username: admin
2727
pulp_password: "{{ secrets_pulp_password }}"
2828

29+
# Credentials for non-admin user within Pulp.
30+
pulp_stack_username: stack
31+
pulp_stack_password: "{{ secrets_pulp_stack_password | default('') }}"
32+
2933
# Proxy to use when adding remotes.
3034
pulp_proxy_url: "{{ omit }}"
3135

etc/kayobe/stackhpc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ stackhpc_kolla_ansible_source_version: stackhpc/18.6.0.10
178178
stackhpc_docker_registry: "{{ pulp_url | regex_replace('^https?://', '') }}"
179179

180180
# Username and password of container registry.
181-
stackhpc_docker_registry_username: "{{ pulp_username }}"
182-
stackhpc_docker_registry_password: "{{ pulp_password }}"
181+
stackhpc_docker_registry_username: "{{ pulp_stack_username if pulp_stack_password is defined and pulp_stack_password | length > 0 else pulp_username }}"
182+
stackhpc_docker_registry_password: "{{ pulp_stack_password if pulp_stack_password is defined and pulp_stack_password | length > 0 else pulp_password }}"
183183

184184
###############################################################################
185185
# Feature flags
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Add support for a basic user for Pulp operations instead of using
5+
the admin user for usage. Can be enabled by setting
6+
`pulp_stack_password`.

0 commit comments

Comments
 (0)