Compare commits

..

No commits in common. "ea5d583ae0b70c56c5d738d1e37d1bd8fe95590c" and "0b2cc91921b35ca946ece90fb088b293a4f017ab" have entirely different histories.

5 changed files with 47 additions and 20 deletions

View file

@ -1,6 +1,6 @@
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%} {%- set branches=salt.cmd.shell('git ls-remote https://git.actcur.com/actcur/salt.git | grep -o -P "(?<=refs/heads/).*" | grep -Pv "(^temp$)|(^history$)"').split('\n') -%}
{%- for env in envs %} {%- for branch in branches %}
{{env}}: {{branch}}:
'*': '*':
- roles - roles
- servers - servers

View file

@ -7,7 +7,7 @@ git reset --hard qual;
git push --force; git push --force;
#merge to master #merge to master
git checkout -B prod origin/prod; git checkout -B prod origin/master;
git merge --squash qual; git merge --squash qual;
git commit -am "$cm"; git commit -am "$cm";
git push; git push;

View file

@ -1,4 +1,3 @@
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
##### Primary configuration settings ##### ##### Primary configuration settings #####
########################################## ##########################################
# This configuration file is used to manage the behavior of the Salt Master. # This configuration file is used to manage the behavior of the Salt Master.
@ -423,10 +422,14 @@ state_output: terse
# - /srv/salt/prod/states # - /srv/salt/prod/states
# #
file_roots: file_roots:
{%- for env in envs %} {%- if pillar['branches'] is defined -%}
{{env}}: {%- if pillar['branches']['saltmaster'] is defined -%}
- /srv/salt/{{env}}/states {%- for branch in pillar['branches']['saltmaster'] %}
{{branch}}:
- /srv/salt/{{branch}}/states
{%- endfor %} {%- endfor %}
{%- endif %}
{%- endif %}
# #
# When using multiple environments, each with their own top file, the # When using multiple environments, each with their own top file, the
@ -438,11 +441,15 @@ file_roots:
# To specify the order in which environments are merged, set the ordering # To specify the order in which environments are merged, set the ordering
# in the env_order option. Given a conflict, the last matching value will # in the env_order option. Given a conflict, the last matching value will
# win. # win.
{% if pillar['branches'] is defined -%}
{%- if pillar['branches']['saltmaster'] is defined -%}
env_order: [ env_order: [
{%- for env in envs -%} {%- for branch in pillar['branches']['saltmaster'] -%}
'{{env}}', '{{-branch}}',
{%- endfor -%} {%- endfor -%}
'null'] 'null']
{%- endif %}
{%- endif %}
# If top_file_merging_strategy is set to 'same' and an environment does not # If top_file_merging_strategy is set to 'same' and an environment does not
# contain a top file, the top file in the environment specified by default_top # contain a top file, the top file in the environment specified by default_top
@ -563,10 +570,14 @@ hash_type: sha256
# - /srv/pillar # - /srv/pillar
# #
pillar_roots: pillar_roots:
{%- for env in envs %} {%- if pillar['branches'] is defined -%}
{{env}}: {%- if pillar['branches']['saltmaster'] is defined -%}
- /srv/salt/{{env}}/pillars {%- for branch in pillar['branches']['saltmaster'] %}
{{branch}}:
- /srv/salt/{{branch}}/pillars
{%- endfor %} {%- endfor %}
{%- endif %}
{%- endif %}
# #
#ext_pillar: #ext_pillar:
# - hiera: /etc/hiera.yaml # - hiera: /etc/hiera.yaml

View file

@ -1,5 +1,18 @@
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%} {%- set branches=salt.cmd.shell('git ls-remote https://git.actcur.com/actcur/salt.git | grep -o -P "(?<=refs/heads/).*" | grep -Pv "(^temp$)|(^history$)"').split('\n') -%}
{% for env in envs %} branches:
{{ env }}: saltmaster:
'os_family:RedHat': {%- for branch in branches %}
{% endfor %} - {{branch}}
{%- endfor %}
git:
{%- for branch in branches %}
salt_{{branch}}:
repo: "ssh://gitea@git.actcur.com:5022/actcur/salt.git"
path: "/srv/salt/{{branch}}"
branch: "{{branch}}"
key: "git_actcur"
force: {{ "True" if branch == "prod" else "false" }}
email: "actcur@actcur.com"
name: "Actaeus Curabitur"
{%- endfor %}

View file

@ -1,7 +1,10 @@
{%- set states = salt['cp.list_states'](saltenv) -%} {%- set states = salt['cp.list_states'](saltenv) -%}
{%- set envs=salt.cmd.shell('git ls-remote https://git.actcur.com/actcur/salt.git | grep -o -P "(?<=refs/heads/).*" | grep -Pv "(^temp$)|(^history$)"').split('\n') -%} {%- if pillar['branches'] is defined -%}
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%} {%- if pillar['branches']['saltmaster'] is defined -%}
{%- set envs = pillar['branches']['saltmaster'] -%}
{%- endif -%}
{%- endif -%}
{% for env in envs %} {% for env in envs %}
{{ env }}: {{ env }}:
'os_family:RedHat': 'os_family:RedHat':