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
(cherry picked from commit 88f1e32aa9)
This commit is contained in:
Michał Nasiadka 2021-09-07 09:47:41 +02:00 committed by Michal Nasiadka
parent c978baf143
commit 22a003276c
3 changed files with 22 additions and 2 deletions

View File

@ -104,13 +104,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 %}

View File

@ -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

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes kolla-toolbox ansible.log logging for different users than ansible.
`LP#1942846 <https://launchpad.net/bugs/1942846>`__