If /var/log/lxc exists, move it to the log aggregation parent
In https://review.openstack.org/344721 the log aggregation link was added for lxc logs to ensure that the logs are collected in a central place. This patch ensures that any pre-existing folder (which may exist due to the playbook being run when upgrading) is moved to the right place. This ensures that previous logs are kept and that upgrades execute without failure. Change-Id: I35a9b3176a79caf9cee177442fa6b3d79e057ea9
This commit is contained in:
parent
5a8ce375c7
commit
b8b149130c
@ -19,16 +19,24 @@
|
||||
max_fail_percentage: 20
|
||||
user: root
|
||||
pre_tasks:
|
||||
- name: Create log dir
|
||||
- name: Check the state of the default LXC service log directory
|
||||
stat:
|
||||
path: "/var/log/lxc"
|
||||
register: _lxc_log_dir
|
||||
- name: Move the existing folder to the log aggregation parent
|
||||
command: "mv /var/log/lxc /openstack/log/{{ inventory_hostname }}-lxc"
|
||||
when:
|
||||
- _lxc_log_dir.stat.isdir is defined
|
||||
- _lxc_log_dir.stat.isdir | bool
|
||||
- name: Create the new LXC service log directory
|
||||
file:
|
||||
path: "/openstack/log/{{ inventory_hostname }}-lxc"
|
||||
state: directory
|
||||
- name: Create log aggregation links
|
||||
- name: Create the LXC service log aggregation link
|
||||
file:
|
||||
src: "/openstack/log/{{ inventory_hostname }}-lxc"
|
||||
dest: "/var/log/lxc"
|
||||
state: "link"
|
||||
force: "yes"
|
||||
roles:
|
||||
- { role: "lxc_hosts", tags: [ "lxc-host", "host-setup" ] }
|
||||
- role: "rsyslog_client"
|
||||
|
Loading…
Reference in New Issue
Block a user