add ansible role journal-postfix (a log parser for Postfix) with playbook and doc
This commit is contained in:
parent
713372c850
commit
e5a8025064
14 changed files with 3570 additions and 0 deletions
90
journal-postfix/tasks/main.yml
Normal file
90
journal-postfix/tasks/main.yml
Normal file
|
@ -0,0 +1,90 @@
|
|||
- name: user journal-postfix
|
||||
user:
|
||||
name: journal-postfix
|
||||
group: systemd-journal
|
||||
state: present
|
||||
system: yes
|
||||
uid: 420
|
||||
create_home: no
|
||||
home: /srv/journal-postfix
|
||||
password: '!'
|
||||
password_lock: yes
|
||||
comment: created by ansible role journal-postfix
|
||||
|
||||
- name: directories /srv/journal-postfix, /etc/journal-postfix
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: journal-postfix
|
||||
group: systemd-journal
|
||||
mode: 0755
|
||||
loop:
|
||||
- /srv/journal-postfix
|
||||
- /etc/journal-postfix
|
||||
|
||||
- name: install dependencies
|
||||
apt:
|
||||
name: python3-psycopg2,python3-systemd,python3-yaml
|
||||
state: present
|
||||
update_cache: yes
|
||||
install_recommends: no
|
||||
|
||||
- name: files in /srv/journal-postfix
|
||||
copy:
|
||||
src: "srv/{{ item }}"
|
||||
dest: "/srv/journal-postfix/{{ item }}"
|
||||
owner: journal-postfix
|
||||
group: systemd-journal
|
||||
mode: 0644
|
||||
force: yes
|
||||
loop:
|
||||
- run.py
|
||||
- settings.py
|
||||
- sources.py
|
||||
- parser.py
|
||||
- storage.py
|
||||
- storage_setup.py
|
||||
- README.md
|
||||
- setup.cfg
|
||||
|
||||
- name: make some files executable
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
mode: 0755
|
||||
loop:
|
||||
- /srv/journal-postfix/run.py
|
||||
- /srv/journal-postfix/settings.py
|
||||
|
||||
- name: determine whether to startup
|
||||
set_fact:
|
||||
startup: "{{ mailserver.postgresql.host is defined and mailserver.postgresql.port is defined and mailserver.postgresql.dbname is defined and mailserver.postgresql.username is defined and mailserver.postgresql.password is defined }}"
|
||||
|
||||
- name: file /etc/journal-postfix/main.yml
|
||||
template:
|
||||
src: main.yml
|
||||
dest: /etc/journal-postfix/main.yml
|
||||
owner: journal-postfix
|
||||
group: systemd-journal
|
||||
mode: 0600
|
||||
force: no
|
||||
|
||||
- name: file journal-postfix.service
|
||||
copy:
|
||||
src: journal-postfix.service
|
||||
dest: /etc/systemd/system/journal-postfix.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
force: yes
|
||||
|
||||
- name: enable systemd unit journal-postfix.service
|
||||
systemd:
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
name: journal-postfix.service
|
||||
|
||||
- name: restart systemd unit journal-postfix.service
|
||||
systemd:
|
||||
state: restarted
|
||||
name: journal-postfix.service
|
||||
when: startup
|
Loading…
Add table
Add a link
Reference in a new issue