diff --git a/playbooks/lxc-hosts-setup.yml b/playbooks/lxc-hosts-setup.yml index e7706d4afe..8cc0e857ee 100644 --- a/playbooks/lxc-hosts-setup.yml +++ b/playbooks/lxc-hosts-setup.yml @@ -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"