diff --git a/CHANGES/7841.misc b/CHANGES/7841.misc new file mode 100644 index 000000000..81a9aaa4b --- /dev/null +++ b/CHANGES/7841.misc @@ -0,0 +1,2 @@ +Honor the version specified for pulpcore and plugins installation when one is using OS provided +packages. diff --git a/roles/pulp_common/README.md b/roles/pulp_common/README.md index eb50e7c2a..4f7c6b3c4 100644 --- a/roles/pulp_common/README.md +++ b/roles/pulp_common/README.md @@ -123,6 +123,7 @@ If it is set to "packages", the following variables are used, or behave *differe * `pkg_name`: If this is left undefined, each Linux distro package will be installed by the name `pulp_pkg_name_prefix` with the Dictionary Key appended to it. `pulp_pkg_name_prefix` defaults to "python3-", so if the Dictionary key is "pulp-file", the package `python3-pulp-file` will be installed. This variable overrides the entire package name. + * `version`: Like with pip, a user can specify a specific version of a package one wants installed. * **Example**: ```yaml pulp_install_source: packages @@ -132,6 +133,7 @@ If it is set to "packages", the following variables are used, or behave *differe pkg_name: python3-pulp-one-ng pulp-two: pkg_name: pulp_two_underscores + version: 2.2.0 ``` * `pulp_install_dir`: Location of the filesystem prefix where package installed python programs (gunicorn & rq) are looked for on the filesystem. Defaults to "/usr" (such as for "/usr/bin/gunicorn"). @@ -152,6 +154,13 @@ If it is set to "packages", the following variables are used, or behave *differe installer will fix it.) Defaults to `false`. +Role Variables for advanced usage +--------------------------------- + +* `pulpcore_version`: Specify a specific version of pulpcore one would like to install or upgrade to. + By default the installer will do the right thing by using the version of pulpcore it is designed + for and tested with. It is strongly advised against setting. + Shared Variables ---------------- diff --git a/roles/pulp_common/defaults/main.yml b/roles/pulp_common/defaults/main.yml index 8c967b89c..db02125b1 100644 --- a/roles/pulp_common/defaults/main.yml +++ b/roles/pulp_common/defaults/main.yml @@ -11,11 +11,6 @@ __pulp_daemons_dir: '{{ (pulp_install_source == "packages") | ternary("/usr/libe pulp_install_api_service: true # Deprecated unused. Variables for dependency upgrades are TBD pulp_upgrade: false -# Intentionally not advertised to users. They should not set this unless -# they are confident that this version of pulp_installer is compatible with -# pulp_version. -# Ignored if pulp_source_dir is set -pulp_version: "3.9.0" pulp_user: pulp pulp_user_id: pulp_group: pulp diff --git a/roles/pulp_common/tasks/install_packages.yml b/roles/pulp_common/tasks/install_packages.yml index f0b996884..f7461d180 100644 --- a/roles/pulp_common/tasks/install_packages.yml +++ b/roles/pulp_common/tasks/install_packages.yml @@ -41,7 +41,11 @@ - name: "Install pulpcore via {{ ansible_facts.pkg_mgr }} packages" package: - name: "{{ pulp_pkg_pulpcore_name }}" + name: >- + {{ pulp_pkg_pulpcore_name }} + {% if pulpcore_version | default('') | length -%} + = {{ pulpcore_version }} + {%- endif -%} state: "{{ pulp_pkg_upgrade_all | ternary('latest','present') }}" notify: - Collect static content @@ -49,7 +53,11 @@ - name: "Install Pulp plugins via {{ ansible_facts.pkg_mgr }} packages" package: - name: '{{ pulp_pkg_name_prefix }}{{ __pulp_common_package.key }}' + name: >- + {{ pulp_pkg_name_prefix }}{{ __pulp_common_package.key }} + {% if __pulp_common_package.value.version | default('') | length -%} + = {{ __pulp_common_package.value.version }} + {%- endif -%} state: "{{ pulp_pkg_upgrade_all | ternary('latest','present') }}" # We use pulp_install_plugins rather than pulp_install_plugins_normalized # so that users can specify package names with underscores if distros @@ -65,7 +73,11 @@ - name: "Install Pulp plugins (with overriden names) via {{ ansible_facts.pkg_mgr }}" package: - name: '{{ __pulp_common_package.value.pkg_name }}' + name: >- + {{ __pulp_common_package.value.pkg_name }} + {% if __pulp_common_package.value.version | default('') | length -%} + = {{ __pulp_common_package.value.version }} + {%- endif -%} state: "{{ pulp_pkg_upgrade_all | ternary('latest','present') }}" loop: '{{ pulp_install_plugins | dict2items }}' loop_control: diff --git a/roles/pulp_common/tasks/install_pip.yml b/roles/pulp_common/tasks/install_pip.yml index 96f779c3a..7baff4693 100644 --- a/roles/pulp_common/tasks/install_pip.yml +++ b/roles/pulp_common/tasks/install_pip.yml @@ -212,7 +212,7 @@ # "version is incompatible with state=latest" # But we still need to handle upgrading dependencies. # state: "{{ pulp_upgrade | ternary('latest','present') }}" - version: '{{ pulp_version }}' + version: '{{ __pulp_version }}' virtualenv: '{{ pulp_install_dir }}' virtualenv_command: '{{ pulp_python_interpreter }} -m venv' when: pulp_source_dir is undefined diff --git a/roles/pulp_common/templates/requirements.in.j2 b/roles/pulp_common/templates/requirements.in.j2 index f28fbea83..f1c56f09c 100644 --- a/roles/pulp_common/templates/requirements.in.j2 +++ b/roles/pulp_common/templates/requirements.in.j2 @@ -1,4 +1,4 @@ -pulpcore=={{ pulp_version }} +pulpcore=={{ __pulp_version }} {% for plugin, value in pulp_install_plugins_normalized.items() %} {% if value['source_dir'] is defined -%} -e {{ value['source_dir'] }} diff --git a/roles/pulp_common/vars/main.yml b/roles/pulp_common/vars/main.yml index 25c48908c..db63cd176 100644 --- a/roles/pulp_common/vars/main.yml +++ b/roles/pulp_common/vars/main.yml @@ -42,5 +42,7 @@ __pulp_common_pulp_settings_fips_defaults: - sha512 __pulp_common_merged_pulp_settings: "{{ __pulp_common_pulp_settings_defaults | combine(ansible_fips | ternary(__pulp_common_pulp_settings_fips_defaults, {}), pulp_settings, recursive=True) }}" +__pulp_version: '{{ pulpcore_version | default("3.9.0") }}' + # Pulps own replacement for django-admin setup in the proper environment pulp_django_admin_path: "{{ pulp_install_dir }}/bin/pulpcore-manager"