Skip to content

Commit

Permalink
feat(init): allow no-pillar init state & pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Sep 11, 2019
1 parent 55220ba commit e3be427
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Available states
----------------

.. contents::
:local:
:local:

``salt``
^^^^^^^^
Expand Down
10 changes: 6 additions & 4 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,12 @@ salt:
- test.ping
- saltutil.find_job

# customize init.sls behaviour (run api and/or syndic too)
extra_init_states:
- api
- syndic
# include these in init.sls metastate (default no)
api:
part_of_init_metastate: true
syndic:
part_of_init_metastate: true


# salt cloud config
cloud:
Expand Down
7 changes: 3 additions & 4 deletions salt/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ salt:
minion:
master_type: True

## init state helpers
pkgrepo: None #via map jinja
ssh_roster: None #via pillar data
extra_init_states: [] #via pillar data
## init.sls helpers
pkgrepo: None #see osfamilymap
ssh_roster: None #see pillar data

gitfs:
dulwich:
Expand Down
44 changes: 21 additions & 23 deletions salt/init.sls
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{%- if salt.pillar.get('salt') %}
include:
- salt.pkgrepo
{%- if salt.pillar.get('salt_formulas:list') %}
- salt.formulas
{%- endif %}
{%- if salt.pillar.get('salt:master')|length > 1 %}
- salt.master
{%- endif %}
{%- if salt.pillar.get('salt:cloud')|length > 1 %}
- salt.cloud
{%- endif %}
{%- if salt.pillar.get('salt:ssh_roster') %}
- salt.ssh
{%- endif %}
- salt.standalone
- salt.minion
{%- if salt.pillar.get('salt:extra_init_states:api') %}
- salt.api
{%- endif %}
{%- if salt.pillar.get('salt:extra_init_states:syndic') %}
- salt.syndic
{%- endif %}
{%- endif %}
- salt.pkgrepo
{%- if salt.config.get('salt_formulas:list') %}
- salt.formulas
{%- endif %}
{%- if salt.config.get('salt:master')|length > 1 %}
- salt.master
{%- endif %}
{%- if salt.config.get('salt:cloud')|length > 1 %}
- salt.cloud
{%- endif %}
{%- if salt.config.get('salt:ssh_roster') %}
- salt.ssh
{%- endif %}
- salt.standalone
- salt.minion
{%- if salt.config.get('salt:api') %}
- salt.api
{%- endif %}
{%- if salt.config.get('salt:syndic') %}
- salt.syndic
{%- endif %}
4 changes: 2 additions & 2 deletions salt/pkgrepo/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# vim: ft=sls
{% from "salt/map.jinja" import salt_settings with context %}
{%- if salt_settings.pkgrepo %}
{%- if salt_settings.pkgrepo %}
include:
- .{{ grains['os_family']|lower }}
{%- endif %}
{%- endif %}
6 changes: 3 additions & 3 deletions salt/standalone.sls
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% from "salt/map.jinja" import salt_settings with context %}
salt-minion:
salt-minion-standalone:
{% if salt_settings.install_packages %}
pkg.installed:
- name: {{ salt_settings.salt_minion }}
Expand All @@ -27,9 +27,9 @@ salt-minion:
- name: {{ salt_settings.minion_service }}
- require:
{% if salt_settings.install_packages %}
- pkg: salt-minion
- pkg: salt-minion-standalone
{% endif %}
- file: salt-minion
- file: salt-minion-standalone
# clean up old _defaults.conf file if they have it around
remove-old-standalone-conf-file:
Expand Down

0 comments on commit e3be427

Please sign in to comment.