Skip to content

Commit 98acf07

Browse files
authored
Merge pull request #235 from gryf/registry
2 parents 9d4ee11 + ec4519d commit 98acf07

File tree

9 files changed

+77
-26
lines changed

9 files changed

+77
-26
lines changed

.ansible-lint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ mock_roles:
2727
skip_list:
2828
# Variables names from within roles should use role_name_ as a prefix
2929
- var-naming[no-role-prefix]
30+
- key-order[play]
31+
- fqcn[action-core]
32+
- var-naming[no-reserved]

.github/workflows/ansible-lint.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ name: Ansible Lint
22
on:
33
pull_request:
44
paths:
5-
- playbooks/**.yaml
5+
- playbooks/**.yaml
66
jobs:
77
build:
88
runs-on: ubuntu-latest
99
steps:
10-
- name: checks-out the repository under $GITHUB_WORKSPACE
11-
uses: actions/checkout@v3
12-
- name: run ansible-lint
13-
uses: ansible/ansible-lint-action@main
14-
with:
15-
path: playbooks/
10+
11+
- name: Checks-out the repository under $GITHUB_WORKSPACE
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Install ansible-lint
17+
run: python3 -m pip install ansible-dev-tools --user
18+
19+
- name: Install dependency
20+
run: ansible-galaxy collection install -r requirements.yaml
21+
22+
- name: Run lint
23+
run: ansible-lint playbooks/**

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ At present the deployment depends on a valid DHCP source for the external interf
3333

3434
All other requirements should be configured automatically by Ansible. Note that `dev-install` does require root access (or passwordless sudo) on the machine it is invoked from to install certificate management tools (simpleca) in addition to the remote host.
3535

36+
## Defining registry
37+
38+
Recently, there were changed way for accessing RedHat registry. Now it's mandatory to provide credentials to `local-override.yaml` file in a form of a list:
39+
40+
```yaml
41+
registers:
42+
- name: registry1.url
43+
username: joe
44+
password: secret
45+
- name: registry2.url
46+
username: alice
47+
password: supersecret
48+
```
49+
50+
RedHat registry, is expected to be the first one.
51+
3652
## Running dev-install
3753
3854
`dev-install` is invoked using its `Makefile`. The simplest invocation is:

playbooks/install_stack.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,20 @@
151151
become_user: root
152152
ansible.builtin.command: update-ca-trust extract
153153

154+
- name: Login into registries
155+
become: true
156+
become_user: root
157+
when:
158+
- registers is defined
159+
- (registers | length) > 0
160+
block:
161+
- name: Login to registry
162+
containers.podman.podman_login:
163+
username: "{{ item.username | ansible.builtin.mandatory }}"
164+
password: "{{ item.password | ansible.builtin.mandatory }}"
165+
registry: "{{ item.name }}"
166+
loop: "{{ registers }}"
167+
154168
- name: Install the tripleo client
155169
ansible.builtin.yum:
156170
name: python3-tripleoclient
@@ -535,7 +549,7 @@
535549
- sriov_interface is defined or dpdk_interface is defined or kernel_args is defined
536550
block:
537551
- name: Reboot the node
538-
become_user: root
552+
become: true
539553
ansible.builtin.reboot:
540554
- name: Pause for 2 minutes to let all containers to start and OpenStack to be ready
541555
ansible.builtin.pause:

playbooks/roles/ceph/tasks/main.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,6 @@
1616
containers_prep: "{{ ansible_env.HOME }}/containers-prepare-parameters.yaml"
1717
deployed_ceph: "{{ ansible_env.HOME }}/deployed_ceph.yaml"
1818

19-
- name: Login into registry.redhat.io
20-
become: true
21-
become_user: root
22-
when:
23-
- rhsm_enabled
24-
block:
25-
- name: Login to registry.redhat.io
26-
containers.podman.podman_login:
27-
username: "{{ redhat_registry_credentials.username | ansible.builtin.mandatory }}"
28-
password: "{{ redhat_registry_credentials.password | ansible.builtin.mandatory }}"
29-
registry: registry.redhat.io
30-
3119
- name: Configure Storage Network
3220
ansible.builtin.include_tasks: storage-network.yml
3321
vars:

playbooks/roles/operators/tasks/main.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
---
22
# Install tripleo-operator in current user environment
33
# and provide plugins and roles to local ansible env.
4+
- name: Ensure there are credentials for accessing registry
5+
tags:
6+
- always
7+
- lab
8+
ansible.builtin.assert:
9+
that:
10+
- registers is defined
11+
- (registers|length) > 0
12+
- registers.0.name is defined
13+
- registers.0.username is defined
14+
- registers.0.password is defined
15+
msg: "It is expected to have defined at least one registry"
16+
417
- name: Ensure we have ~/.ansible
518
tags:
619
- always

playbooks/templates/standalone_parameters.yaml.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ parameter_defaults:
144144
NtpServer: {{ ntp_server }}
145145
{% endif %}
146146
ContainerImageRegistryCredentials:
147-
registry.redhat.io:
148-
{{ redhat_registry_credentials.username | ansible.builtin.mandatory | ansible.builtin.quote }}: {{ redhat_registry_credentials.password | ansible.builtin.mandatory | ansible.builtin.quote }}
147+
# assume first registry
148+
{{ registers.0.name | ansible.builtin.mandatory}}:
149+
{{ registers.0.username | ansible.builtin.mandatory | ansible.builtin.quote }}: {{ registers.0.password | ansible.builtin.mandatory | ansible.builtin.quote }}
149150
ContainerImageRegistryLogin: true
150151
{% endif %}
151152
{% if ssl_enabled %}

playbooks/vars/defaults.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ rhsm_container_tools_version: '3.0'
229229
# Note: to install 16.1 on RHEL 8.2, you need virt_release set to "8.2"
230230
# For OSP 16.2 on RHEL 8.4, you need "av".
231231
virt_release: av
232-
# Red Hat Registry credentials have to be set when deploying OSP on RHEL
233-
# redhat_registry_credentials:
234-
# username: joe
235-
# password: secrete
232+
# Red Hat Registry credentials have to be set when deploying OSP on RHEL. Main
233+
# registry, and all additional one should be defined in a list:
234+
# registers:
235+
# - name: registry.url
236+
# username: joe
237+
# password: secret
236238

237239
# Edge parameters
238240
# The central site must be named "central", otherwise for other AZs it's up to the user.

requirements.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
collections:
2+
- ansible.posix
3+
- community.general
4+
- tripleo.operator
5+
- containers.podman
6+
- community.crypto

0 commit comments

Comments
 (0)