This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split the pulp_database role into 2 roles:
pulp_database vs pulp_database_config Includes removing the variable pulp_install_db. Necessitates a new role list for those not using `pulp_all_services` fixes: #7037 Split the pulp_database role into 2 roles: database vs config https://pulp.plan.io/issues/7037
- Loading branch information
1 parent
9e6f262
commit 0c59913
Showing
21 changed files
with
147 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Split the pulp_database role into pulp_database (installs postgres database) | ||
and pulp_database_config (configures Pulp database) for the sake of proper | ||
design. pulp_database no longer depends on pulp_common, so it can now be run | ||
against a separate database server without Pulp installed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
`pulp_database`, which is now separate from `pulp_database_config`, no longer | ||
understands the variable `pulp_install_db`. Installing the postgres database | ||
server is now controlled by whether or not `pulp_database` is in the role list, | ||
and `pulp_database_config` must be in the list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../roles/pulp_database_config/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
pulp_database_config | ||
==================== | ||
|
||
Configure the database for Pulp 3 | ||
|
||
More specifically, this role does the following via `django-admin`: | ||
|
||
1. Create and run migrations. | ||
2. Set the Pulp admin user's password. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
`pulp_default_admin_password`: Initial password for the Pulp admin. **Required**. | ||
|
||
Shared Variables | ||
---------------- | ||
|
||
* `ansible_python_interpreter`: **Required**. Path to the Python interpreter. | ||
This role sets the default to "auto", which is now more robust than | ||
"auto_legacy" on Ansible 2.8. | ||
|
||
This role **is tightly coupled** with the required the `pulp_common` role and uses some of | ||
variables which are documented in that role: | ||
|
||
* `pulp_django_admin_paths` | ||
* `pulp_settings_file` | ||
* `pulp_user` | ||
|
||
This role understands how to talk to the database server via `pulp_settings_file`, | ||
which is written to disk in the `pulp_common` role, and whose relevant | ||
values are set via the following variables: | ||
|
||
* `pulp_settings_db_defaults`: See pulp_database README. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
# Auto is more robust for us than auto_legacy (still the default as of 2.8) | ||
# because the geerlingguy.postgresql role, with RPM weak deps, installs | ||
# /usr/bin/python pointing to python2, on Fedora 30. This in turn breaks | ||
# running pulp_installer a 2nd time, because F30 lacks python2-dnf. | ||
ansible_python_interpreter: auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
galaxy_info: | ||
author: Pulp Team | ||
description: A role to configure the database for Pulp 3 | ||
issue_tracker_url: https://pulp.plan.io/projects/pulp/issues/new | ||
license: GPL-2.0-or-later | ||
company: Red Hat | ||
min_ansible_version: 2.8 | ||
platforms: | ||
- name: Debian | ||
versions: | ||
- buster | ||
- name: Fedora | ||
versions: | ||
- 30 | ||
- 31 | ||
- name: EL | ||
versions: | ||
- 7 | ||
- 8 | ||
galaxy_tags: | ||
- pulp | ||
- pulpcore | ||
dependencies: | ||
- pulp_common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
- name: Check if required variables are set | ||
assert: | ||
that: | ||
# This check runs it through jinja2 templating twice: built-in | ||
# "that:" (like when:), and then the {{ }} | ||
# It converts from item, to the string like pulp_default_admin_password , | ||
# to the value of pulp_default_admin_password . | ||
- "{{ item }} | default('', true) | length > 0" | ||
fail_msg: > | ||
{{ item }} is undefined, null, or an empty string. Please | ||
set it in your variables | ||
(e.g. pulp_installer/playbooks/example-use/group_vars/all) | ||
and run pulp_installer again. | ||
See https://pulp-installer.readthedocs.io/en/latest/ or | ||
pulp_installer/roles/pulp/README.md for more info. | ||
loop: | ||
- pulp_default_admin_password | ||
|
||
- meta: flush_handlers | ||
|
||
- block: | ||
|
||
- name: Run database auth migrations | ||
command: '{{ pulp_django_admin_path }} migrate auth --no-input' | ||
register: migrate_auth | ||
changed_when: "'No migrations to apply' not in migrate_auth.stdout" | ||
|
||
- name: Run database migrations | ||
command: '{{ pulp_django_admin_path }} migrate --no-input' | ||
register: result | ||
changed_when: "'No migrations to apply' not in result.stdout" | ||
|
||
- name: Set the Pulp admin user's password | ||
command: '{{ pulp_django_admin_path }} reset-admin-password --password {{ pulp_default_admin_password }}' | ||
no_log: true | ||
when: pulp_default_admin_password is defined and migrate_auth.changed | ||
|
||
run_once: true | ||
become: true | ||
become_user: '{{ pulp_user }}' | ||
environment: | ||
PULP_SETTINGS: "{{ pulp_settings_file }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters