designate/roles/bind-logs-conf/tasks/main.yaml
Michael Johnson 1fd240f81b Fix BIND9 log collection
Currently the bind logs are not viewable in the zuul logs page, they prompt
for download. The wrong systemd unit logs are being exported and they were being double gziped. This patch corrects both of those issues such that the BIND9 logs will be properly collected in the zuul jobs.

Change-Id: Ied091e7acd0cb2c837f8ee7335b7881225da0126
2022-05-11 20:23:15 +00:00

39 lines
994 B
YAML

- name: Ensure target directory exists
file:
path: "{{ stage_dir }}/etc/bind"
state: directory
- name: Find bind config files
find:
path: /etc/bind
file_type: any
register: bind_configs
- name: Dereference bind configs
stat:
path: "{{ item.path }}"
with_items: "{{ bind_configs.files }}"
register: bind_configs_deref
- name: Link configurations
file:
src: "{{ item.stat.lnk_source | default(item.stat.path) }}"
dest: "{{ stage_dir }}/etc/bind/{{ item.stat.path | basename }}"
state: hard
with_items: "{{ bind_configs_deref.results }}"
when: item.stat.isreg or item.stat.islnk
# NOTE(frickler) Copied from devstack role export-devstack-journal
- name: Ensure {{ stage_dir }}/logs exists
become: true
file:
path: "{{ stage_dir }}/logs"
state: directory
owner: "{{ ansible_user }}"
- name: Collect bind journal
become: true
shell:
cmd: |
journalctl -o short-precise --unit named > {{ stage_dir }}/logs/bind9.txt