Erzeuge Konfiguraton aus Template
This commit is contained in:
parent
33110fa482
commit
2949f0b548
4 changed files with 43 additions and 39 deletions
|
@ -9,9 +9,7 @@ lstu_monit_name: lstu
|
|||
lstu_service: lstu.service
|
||||
lstu_theme: default
|
||||
lstu_cookie_secret: "zibuadoinckyg"
|
||||
lstu:
|
||||
path: /var/www/lstu
|
||||
contact: 'admin[at]systemausfall.org'
|
||||
lstu_contact: 'support@systemausfall.org'
|
||||
|
||||
minion_service: lstu-minion
|
||||
minion_workers: 1
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
password: "{{ item.password }}"
|
||||
host: "{{ inventory_hostname }}"
|
||||
priv: "{{ item.database }}.*:ALL"
|
||||
update_password: on_create
|
||||
state: present
|
||||
login_unix_socket: "{{ mysql_socket }}"
|
||||
login_user: root
|
||||
|
|
|
@ -37,6 +37,15 @@
|
|||
chdir: "{{ lstu.path }}"
|
||||
when: configuration.changed
|
||||
|
||||
- name: "lstu | Kopiere Konfiguration"
|
||||
ansible.builtin.template:
|
||||
src: lstu.conf
|
||||
dest: "{{ lstu.path }}"
|
||||
mode: 0640
|
||||
owner: "{{ lstu_user }}"
|
||||
group: "{{ lstu_user }}"
|
||||
notify: restart lstu
|
||||
|
||||
- name: "lstu | set ownership"
|
||||
ansible.builtin.file:
|
||||
path: "{{ lstu.path }}"
|
||||
|
@ -44,41 +53,6 @@
|
|||
group: "{{ lstu_user }}"
|
||||
recurse: true
|
||||
|
||||
- name: "lstu | edit config"
|
||||
ansible.builtin.lineinfile:
|
||||
path="{{ lstu.path }}/lstu.conf"
|
||||
regexp="{{ item.regexp }}"
|
||||
line="{{ item.line }}"
|
||||
state=present
|
||||
backup=no
|
||||
backrefs=no
|
||||
loop:
|
||||
- { regexp: '^\s*#contact.*$', line: " contact => '{{ lstu.contact }}'," }
|
||||
- { regexp: '^\s*#dbtype.*$', line: " dbtype => 'mysql'," }
|
||||
- { regexp: '^\s*listen\s*=>.*$', line: " listen => ['http://0.0.0.0:8080']," }
|
||||
- { regexp: '^\s*#proxy\s*=>.*$', line: " proxy => 1," }
|
||||
- { regexp: '^\s*#really_delete_urls\s*=>.*$', line: " really_delete_urls => 1," }
|
||||
- { regexp: '^\s*#secret\s*=>.*$', line: " secret => ['{{ lstu_cookie_secret }}']," }
|
||||
- { regexp: '^\s*#adminpwd\s*=>.*$', line: " adminpwd => '{{ lstu.admin_passwd }}'," }
|
||||
tags: lstu_conf
|
||||
|
||||
- name: "lstu | edit config (db)"
|
||||
ansible.builtin.blockinfile:
|
||||
path: "{{ lstu.path }}/lstu.conf"
|
||||
insertbefore: '^\s*#mysqldb.*$'
|
||||
block: |
|
||||
mysqldb => {
|
||||
database => '{{ lstu_db }}',
|
||||
host => '{{ database_host }}',
|
||||
# optional, default is 3306
|
||||
#port => 3306,
|
||||
user => '{{ lstu_db_user }}',
|
||||
pwd => '{{ lstu_db_password }}',
|
||||
# optional, default is 5 (set to 0 to disable persistent connections)
|
||||
#max_connections => 5,
|
||||
},
|
||||
|
||||
|
||||
- name: "lstu | Kopiere systemd-Unit"
|
||||
ansible.builtin.template:
|
||||
src: lstu.service.j2
|
||||
|
|
33
templates/lstu.conf
Executable file
33
templates/lstu.conf
Executable file
|
@ -0,0 +1,33 @@
|
|||
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab:
|
||||
{
|
||||
hypnotoad => {
|
||||
listen => ['http://0.0.0.0:8080'],
|
||||
proxy => 1,
|
||||
},
|
||||
|
||||
contact => '{{ lstu_contact }}',
|
||||
secret => ['lstu_cookie_secret'],
|
||||
hashed_adminpwd => 'f85cf20922bf5000f38c0ef9832396c53afb17aeab51979c26940bc8fdf0ecc7',
|
||||
|
||||
really_delete_urls => 1,
|
||||
theme => 'milligram',
|
||||
disable_api => 1,
|
||||
|
||||
dbtype => 'mysql',
|
||||
mysqldb => {
|
||||
database => '{{ lstu_db }}',
|
||||
host => '{{ database_host }}',
|
||||
user => '{{ lstu_db_user }}',
|
||||
pwd => '{{ lstu_db_password }}',
|
||||
},
|
||||
|
||||
minion => {
|
||||
enabled => 1,
|
||||
mysqldb => {
|
||||
database => '{{ minion_db }}',
|
||||
host => '{{ database_host }}',
|
||||
user => '{{ minion_db_user }}',
|
||||
pwd => '{{ minion_db_password }}',
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue