tlu/salt/states/rmt/init.sls

69 lines
1.5 KiB
Plaintext
Raw Normal View History

2021-09-25 12:09:55 +00:00
Install rmt:
pkg.installed:
- name: rmt-server
include:
- rmt.certs
Create rmt MariaDB user:
mysql.user:
- name: rmt
- host: localhost
2021-09-25 14:04:59 +00:00
- password: {{ pillar['rmt']['db_password'] }}
Create rmt database:
mysql.database:
- name: rmt
- users:
- "'rmt'@'localhost'"
Create rmt.conf:
file.managed:
- name: /etc/rmt.conf
- source: salt://rmt/files/rmt.conf.jinja
- template: jinja
- user: _rmt
- group: root
- mode: "0640"
Start rmt-server:
service.running:
- name: rmt-server
- enable: True
- watch:
- file: Create rmt.conf
{% for service in pillar['rmt']['stopped_services'] -%}
Stopp {{ service }}:
service.dead:
- name: {{ service }}
- enable: False
{% endfor %}
2021-10-14 16:00:49 +00:00
Remove rmt http as default site:
file.replace:
- name: /etc/nginx/vhosts.d/rmt-server-http.conf
- pattern: " listen 80 default;"
- repl: " listen 80;"
Set fqdn for rmt https:
file.replace:
- name: /etc/nginx/vhosts.d/rmt-server-https.conf
- pattern: " server_name rmt;"
- repl: " server_name rmt.{{ pillar['network']['domain'] }};"
Set fqdn for rmt http:
file.replace:
- name: /etc/nginx/vhosts.d/rmt-server-http.conf
- pattern: " server_name rmt;"
- repl: " server_name rmt.{{ pillar['network']['domain'] }};"
Restart nginx:
service.running:
- name: nginx
- enable: Trie
- watch:
- file: Remove rmt http as default site
- file: Set fqdn for rmt https
- file: Set fqdn for rmt http