32 lines
895 B
YAML+Jinja
32 lines
895 B
YAML+Jinja
{% set pmg_services = salt['pillar.get']('pmg:pmg_services', []) %}
|
|
{% set manage_hosts_file = salt['pillar.get']('pmg:manage_hosts_file', False) %}
|
|
{% set hosts_file_entries = salt['pillar.get']('pmg:hosts_file_entries', []) %}
|
|
|
|
{% for svc in pmg_services %}
|
|
pmg-service-{{ svc }}:
|
|
service.running:
|
|
- name: {{ svc }}
|
|
- enable: true
|
|
{% endfor %}
|
|
|
|
pmg-cluster-status:
|
|
cmd.run:
|
|
- name: pmgcm status
|
|
|
|
{% if manage_hosts_file %}
|
|
pmg-managed-hosts:
|
|
file.blockreplace:
|
|
- name: /etc/hosts
|
|
- marker_start: "#-- SALT PMG HOSTS START --"
|
|
- marker_end: "#-- SALT PMG HOSTS END --"
|
|
- append_if_not_found: true
|
|
- content: |
|
|
{% for host in hosts_file_entries %}
|
|
{% if host.get('aliases', []) %}
|
|
{{ host['ip'] }} {{ host['hostname'] }} {{ ' '.join(host['aliases']) }}
|
|
{% else %}
|
|
{{ host['ip'] }} {{ host['hostname'] }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|