|
|
|
|
|
|
|
|
- template: jinja |
|
|
- template: jinja |
|
|
- require: |
|
|
- require: |
|
|
- {{ minion.install_state }} |
|
|
- {{ minion.install_state }} |
|
|
{%- if not grains.get('noservices', False) %} |
|
|
|
|
|
- watch_in: |
|
|
- watch_in: |
|
|
- service: salt_minion_service |
|
|
- service: salt_minion_service |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
|
|
|
{%- for service_name, service in pillar.items() %} |
|
|
{%- for service_name, service in pillar.items() %} |
|
|
{%- set support_fragment_file = service_name+'/meta/salt.yml' %} |
|
|
{%- set support_fragment_file = service_name+'/meta/salt.yml' %} |
|
|
|
|
|
|
|
|
- name: /etc/salt/minion.d/_{{ name }}.conf |
|
|
- name: /etc/salt/minion.d/_{{ name }}.conf |
|
|
- contents: | |
|
|
- contents: | |
|
|
{{ conf|yaml(False)|indent(8) }} |
|
|
{{ conf|yaml(False)|indent(8) }} |
|
|
{%- if not grains.get('noservices', False) %} |
|
|
|
|
|
- watch_in: |
|
|
- watch_in: |
|
|
- cmd: salt_minion_service_restart |
|
|
- cmd: salt_minion_service_restart |
|
|
{%- endif %} |
|
|
|
|
|
- require: |
|
|
- require: |
|
|
- {{ minion.install_state }} |
|
|
- {{ minion.install_state }} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: python -c "import yaml; stream = file('/etc/salt/minion.d/_{{ name }}.conf', 'r'); yaml.load(stream); stream.close()" |
|
|
- name: python -c "import yaml; stream = file('/etc/salt/minion.d/_{{ name }}.conf', 'r'); yaml.load(stream); stream.close()" |
|
|
- watch: |
|
|
- watch: |
|
|
- file: salt_minion_config_{{ service_name }}_{{ name }} |
|
|
- file: salt_minion_config_{{ service_name }}_{{ name }} |
|
|
{%- if not grains.get('noservices', False) %} |
|
|
|
|
|
- require_in: |
|
|
- require_in: |
|
|
- cmd: salt_minion_service_restart |
|
|
- cmd: salt_minion_service_restart |
|
|
{%- endif %} |
|
|
|
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{%- if not grains.get('noservices', False) %} |
|
|
|
|
|
salt_minion_service: |
|
|
salt_minion_service: |
|
|
service.running: |
|
|
service.running: |
|
|
- name: {{ minion.service }} |
|
|
- name: {{ minion.service }} |
|
|
- enable: true |
|
|
- enable: true |
|
|
|
|
|
{%- if grains.get('noservices') %} |
|
|
|
|
|
- onlyif: /bin/false |
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{#- Restart salt-minion if needed but after all states are executed #} |
|
|
{#- Restart salt-minion if needed but after all states are executed #} |
|
|
salt_minion_service_restart: |
|
|
salt_minion_service_restart: |
|
|
|
|
|
|
|
|
- name: 'while true; do salt-call saltutil.running|grep fun: && continue; salt-call --local service.restart {{ minion.service }}; break; done' |
|
|
- name: 'while true; do salt-call saltutil.running|grep fun: && continue; salt-call --local service.restart {{ minion.service }}; break; done' |
|
|
- shell: /bin/bash |
|
|
- shell: /bin/bash |
|
|
- bg: true |
|
|
- bg: true |
|
|
|
|
|
{%- if grains.get('noservices') %} |
|
|
|
|
|
- onlyif: /bin/false |
|
|
|
|
|
{%- endif %} |
|
|
- require: |
|
|
- require: |
|
|
- service: salt_minion_service |
|
|
- service: salt_minion_service |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
|
|
|
salt_minion_sync_all: |
|
|
salt_minion_sync_all: |
|
|
module.run: |
|
|
module.run: |
|
|
- name: 'saltutil.sync_all' |
|
|
- name: 'saltutil.sync_all' |
|
|
{%- if not grains.get('noservices', False) %} |
|
|
|
|
|
- watch: |
|
|
- watch: |
|
|
- service: salt_minion_service |
|
|
- service: salt_minion_service |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
{%- endif %} |