From 88f1e32aa997b2b8c3627cd4b2128402262fdef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Nasiadka?= Date: Tue, 7 Sep 2021 09:47:41 +0200 Subject: [PATCH] toolbox: Move custom Ansible config to global location In order to achieve logging to /var/log/kolla/ansible.log from different users than default ansible - the config needs to be moved to global location. Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/807679 Closes-Bug: #1942846 Change-Id: I4325fe031647a04766516afa528639d6ff0b5ae6 --- docker/kolla-toolbox/Dockerfile.j2 | 6 ++++-- docker/kolla-toolbox/extend_start.sh | 13 +++++++++++++ .../notes/bug-1942846-1216faacacba94be.yaml | 5 +++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 docker/kolla-toolbox/extend_start.sh create mode 100644 releasenotes/notes/bug-1942846-1216faacacba94be.yaml diff --git a/docker/kolla-toolbox/Dockerfile.j2 b/docker/kolla-toolbox/Dockerfile.j2 index fcee30cb3b..9261f5c0a2 100644 --- a/docker/kolla-toolbox/Dockerfile.j2 +++ b/docker/kolla-toolbox/Dockerfile.j2 @@ -103,13 +103,15 @@ RUN {{ macros.install_pip(kolla_toolbox_pip_packages | customizable("pip_package ENV ANSIBLE_LIBRARY /usr/share/ansible:$ANSIBLE_LIBRARY COPY find_disks.py /usr/share/ansible/ -COPY ansible.cfg /var/lib/ansible/.ansible.cfg +COPY ansible.cfg /etc/ansible/ansible.cfg RUN chmod 644 /usr/share/ansible/find_disks.py \ - /var/lib/ansible/.ansible.cfg + /etc/ansible/ansible.cfg COPY ansible_sudoers /etc/sudoers.d/kolla_ansible_sudoers RUN chmod 440 /etc/sudoers.d/kolla_ansible_sudoers +COPY extend_start.sh /usr/local/bin/kolla_extend_start + {% block kolla_toolbox_footer %}{% endblock %} {% block footer %}{% endblock %} diff --git a/docker/kolla-toolbox/extend_start.sh b/docker/kolla-toolbox/extend_start.sh new file mode 100644 index 0000000000..198587145a --- /dev/null +++ b/docker/kolla-toolbox/extend_start.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ ! -f "/var/log/kolla/ansible.log" ]]; then + touch /var/log/kolla/ansible.log +fi + +if [[ $(stat -c %U:%G /var/log/kolla/ansible.log) != "ansible:kolla" ]]; then + chown -R ansible:kolla /var/log/kolla/ansible.log +fi + +if [[ $(stat -c %a /var/log/kolla/ansible.log) != "664" ]]; then + chmod 664 /var/log/kolla/ansible.log +fi diff --git a/releasenotes/notes/bug-1942846-1216faacacba94be.yaml b/releasenotes/notes/bug-1942846-1216faacacba94be.yaml new file mode 100644 index 0000000000..588af50d55 --- /dev/null +++ b/releasenotes/notes/bug-1942846-1216faacacba94be.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes kolla-toolbox ansible.log logging for different users than ansible. + `LP#1942846 `__