diff --git a/defaults/main.yml b/defaults/main.yml index 9144206..e3eaaa7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/database.yml b/tasks/database.yml index 1c353cc..5e62beb 100644 --- a/tasks/database.yml +++ b/tasks/database.yml @@ -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 diff --git a/tasks/lstu.yml b/tasks/lstu.yml index e0c0672..a31a530 100644 --- a/tasks/lstu.yml +++ b/tasks/lstu.yml @@ -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 diff --git a/templates/lstu.conf b/templates/lstu.conf new file mode 100755 index 0000000..12638c8 --- /dev/null +++ b/templates/lstu.conf @@ -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 }}', + }, + }, +};