kolla/docker/kolla-toolbox/Dockerfile.j2
Xing Zhang 92ef9274e3 Fix kolla_toolbox_pip_virtualenv_packages override
backport: train, stein, rocky

Override in filter needs to follow the rule:
<image_name>_<call_type>_<override/append/remove>
`call_type` for `kolla_toolbox_pip_virtualenv_packages` should be
`pip_virtualenv_packages`, and `pip_packages` can't match with
`kolla_toolbox_pip_virtualenv_packages`, this makes
the value can't be overrode in template override.

Change-Id: I1dbe2dfd4bce73ce2285f45f997d45b5dcc95f4c
Closes-bug: #1865119
(cherry picked from commit 74d5a66e6b)
2020-02-28 17:23:44 +00:00

124 lines
4.1 KiB
Django/Jinja

FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block kolla_toolbox_header %}{% endblock %}
{% set virtualenv_path='/opt/ansible' %}
{% set os_client_config= virtualenv_path + '/lib/python' + distro_python_version + '/site-packages/os_client_config/defaults.json' %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='ansible') }}
{{ macros.configure_user(name='rabbitmq') }}
# NOTE(mandre) Remove rabbitmq-server pinning once package dependencies are met
# https://bugs.launchpad.net/kolla/+bug/1814233
{% if base_package_type == 'rpm' %}
{% set kolla_toolbox_packages = [
'crudini',
'gcc',
'gdisk',
'git',
'jq',
'libffi-devel',
'libxml2-devel',
'libxslt-devel',
'make',
'mariadb',
'mariadb-devel',
'openssh-clients',
'openssl-devel',
] %}
{% if distro_package_manager == 'dnf' %}
{% set kolla_toolbox_packages = kolla_toolbox_packages + [
'python3-devel',
'rabbitmq-server-3.7.*'
] %}
{% else %}
# NOTE(mandre) Remove rabbitmq-server pinning once package dependencies are met
# https://bugs.launchpad.net/kolla/+bug/1814233
{% set kolla_toolbox_packages = kolla_toolbox_packages + [
'python-devel',
'rabbitmq-server-3.7.10'
] %}
{% endif %}
{% elif base_package_type == 'deb' %}
{% set kolla_toolbox_packages = [
'build-essential',
'ca-certificates',
'crudini',
'gdisk',
'git',
'jq',
'libffi-dev',
'libmariadb-dev-compat',
'libssl-dev',
'libxslt1-dev',
'mariadb-client',
'python3-dev'
] %}
{% if base_distro == 'debian' %}
{% set kolla_toolbox_packages = kolla_toolbox_packages + [
'rabbitmq-server',
] %}
{% else %}
{% set kolla_toolbox_packages = kolla_toolbox_packages + [
'rabbitmq-server=3.7.10-1',
] %}
{% endif %}
{% endif %}
{{ macros.install_packages(kolla_toolbox_packages | customizable("packages")) }}
{% block kolla_toolbox_source_install_python_pip %}
{{ macros.get_pip() }}
{% endblock %}
{% set kolla_toolbox_pip_virtualenv_packages = [
'virtualenv'
] %}
RUN {{ macros.install_pip(kolla_toolbox_pip_virtualenv_packages | customizable("pip_virtualenv_packages"), constraints=false) }} \
&& virtualenv --system-site-packages {{ virtualenv_path }}
ENV PATH {{ virtualenv_path }}/bin:$PATH
{% set kolla_toolbox_pip_packages = [
'ansible==2.8.*',
'cmd2',
'influxdb',
'mysqlclient',
'os-client-config',
'pbr',
'pymongo',
'python-openstackclient',
'pytz',
'pyudev',
'shade'
] %}
RUN mkdir -p /requirements \
&& curl -sSL -o /requirements/upper-constraints.txt https://releases.openstack.org/constraints/upper/{{ openstack_release }} \
&& {{ macros.install_pip(kolla_toolbox_pip_packages | customizable("pip_packages")) }} \
&& mkdir -p /etc/ansible /usr/share/ansible \
&& echo 'localhost ansible_connection=local ansible_python_interpreter={{ virtualenv_path }}/bin/python' > /etc/ansible/hosts \
&& sed -i 's| "identity_api_version": "2.0",| "identity_api_version": "3",|' {{ os_client_config }}
ENV ANSIBLE_LIBRARY /usr/share/ansible:$ANSIBLE_LIBRARY
COPY find_disks.py kolla_keystone_service.py kolla_keystone_user.py kolla_sanity.py /usr/share/ansible/
COPY ansible.cfg /var/lib/ansible/.ansible.cfg
RUN chmod 644 /usr/share/ansible/find_disks.py \
/usr/share/ansible/kolla_keystone_service.py \
/usr/share/ansible/kolla_keystone_user.py \
/usr/share/ansible/kolla_sanity.py \
/var/lib/ansible/.ansible.cfg
COPY ansible_sudoers /etc/sudoers.d/kolla_ansible_sudoers
RUN chmod 440 /etc/sudoers.d/kolla_ansible_sudoers
{% block kolla_toolbox_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER ansible