Skip to content

Commit

Permalink
seapath_setup_network.yaml: move syslog in role
Browse files Browse the repository at this point in the history
The syslog-ng configuration of Debian is done inside the debian role.
This commit moves the Yocto configuration of syslog also in a role.

We should think of a way to have a common syslog-configuration, but I
will not do it now. I openned an issue for that :
#591

Signed-off-by: Erwann Roussy <[email protected]>
  • Loading branch information
eroussy committed Sep 4, 2024
1 parent 5b7607f commit a412cba
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
8 changes: 8 additions & 0 deletions playbooks/seapath_setup_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
roles:
- timemaster

- name: Configure syslog-ng
hosts:
- cluster_machines
- standalone_machine
become: true
roles:
- yocto/syslog

- import_playbook: cluster_setup_ceph.yaml
- import_playbook: cluster_setup_libvirt.yaml
- import_playbook: cluster_setup_add_livemigration_user.yaml
Expand Down
26 changes: 0 additions & 26 deletions playbooks/seapath_setup_network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,32 +201,6 @@
enabled: false
when: dns_servers is not defined

- name: Configure syslog-ng
hosts:
- cluster_machines
- standalone_machine
become: true
tasks:
- name: Set observer IP address in /etc/syslog-ng/syslog-ng.conf
lineinfile:
dest: /etc/syslog-ng/syslog-ng.conf
regexp: '(^\s*#?\s*(ip\()?)("[1-9][0-9]{2}(\.[0-9]{1,3}){3}")(\))?'
line: '\1"{{ syslog_server_ip }}"\5'
backrefs: true
state: present
notify:
- Restart systemd syslog-ng
when: syslog_server_ip is defined
handlers:
- name: Restart systemd syslog-ng
vars:
apply_config: "{{ apply_network_config | default(false) }}"
ansible.builtin.service:
name: syslog-ng@default
state: restarted
when:
apply_config or (need_reboot is defined and not need_reboot)

- name: Configure systemd-networkd-wait-online.service
hosts:
- cluster_machines
Expand Down
8 changes: 8 additions & 0 deletions roles/yocto/syslog/handlers/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

---
- name: Restart systemd syslog-ng
ansible.builtin.service:
name: syslog-ng@default
state: restarted
16 changes: 16 additions & 0 deletions roles/yocto/syslog/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0

# This role setup up syslog-ng on machine

---
- name: Set observer IP address in /etc/syslog-ng/syslog-ng.conf
lineinfile:
dest: /etc/syslog-ng/syslog-ng.conf
regexp: '(^\s*#?\s*(ip\()?)("[1-9][0-9]{2}(\.[0-9]{1,3}){3}")(\))?'
line: '\1"{{ syslog_server_ip }}"\5'
backrefs: true
state: present
notify:
- Restart systemd syslog-ng
when: syslog_server_ip is defined

0 comments on commit a412cba

Please sign in to comment.