Compare commits

...

3 commits

47 changed files with 286 additions and 354 deletions

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,4 +1,3 @@
grains:
roles:
roles:
- router
- ssh

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- nrpe
- saltminion

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,5 +1,4 @@
grains:
roles:
roles:
- server
- ssh
- nrpe

View file

@ -1,6 +1,6 @@
{%- 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 branch in branches %}
{{branch}}:
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
{%- for env in envs %}
{{env}}:
'*':
- roles
- servers

View file

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

View file

@ -1,14 +1,12 @@
{# ensure that grains pillar exists -#}
{%- if pillar['grains'] is defined -%}
{%- if pillar['grains']['roles'] is defined %}
{%- if pillar['roles'] is defined %}
set-roles:
grains.present:
- name: roles
- force: true
- value: [{% for role in pillar['grains']['roles'] %}{{role}},{% endfor %}]
{% else %}
- value: [{% for role in pillar['roles'] %}{{role}},{% endfor %}]
{% else %}
set-roles:
grains.absent:
- name: roles
{%- endif -%}
{%- endif -%}

View file

@ -1,7 +1,7 @@
{%- set os=grains['os'] -%}
{##check if server is portal##}
{%- if 'portal' in pillar['grains']['roles'] -%}
{%- if 'portal' in pillar['roles'] -%}
{%- set portal = "portal" -%}
{%- endif -%}
nginx:

View file

@ -7,10 +7,8 @@ object Host "{{server}}.actcur.com" {
import "generic-host"
address = "{{server}}.actcur.com"
{%- if role_data['grains'] is defined %}
{%- if role_data['grains']['roles'] is defined %}
vars.roles=[{%- for role in role_data['grains']['roles'] %}"{{role}}",{%- endfor -%}""];
{%- endif -%}
{%- if role_data['roles'] is defined %}
vars.roles=[{%- for role in role_data['roles'] %}"{{role}}",{%- endfor -%}""];
{%- endif %}
}

View file

@ -1,7 +1,7 @@
{%- set os=grains['os'] -%}
{##check if server is portal##}
{%- if 'portal' in pillar['grains']['roles'] -%}
{%- if 'portal' in pillar['roles'] -%}
{%- set portal = "portal" -%}
{%- endif -%}
nginx:

View file

@ -1,3 +1,4 @@
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
##### Primary configuration settings #####
##########################################
# This configuration file is used to manage the behavior of the Salt Master.
@ -422,14 +423,10 @@ state_output: terse
# - /srv/salt/prod/states
#
file_roots:
{%- if pillar['branches'] is defined -%}
{%- if pillar['branches']['saltmaster'] is defined -%}
{%- for branch in pillar['branches']['saltmaster'] %}
{{branch}}:
- /srv/salt/{{branch}}/states
{%- for env in envs %}
{{env}}:
- /srv/salt/{{env}}/states
{%- endfor %}
{%- endif %}
{%- endif %}
#
# When using multiple environments, each with their own top file, the
@ -441,15 +438,11 @@ file_roots:
# 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
# win.
{% if pillar['branches'] is defined -%}
{%- if pillar['branches']['saltmaster'] is defined -%}
env_order: [
{%- for branch in pillar['branches']['saltmaster'] -%}
'{{-branch}}',
{%- for env in envs -%}
'{{env}}',
{%- endfor -%}
'null']
{%- endif %}
{%- endif %}
# 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
@ -570,14 +563,10 @@ hash_type: sha256
# - /srv/pillar
#
pillar_roots:
{%- if pillar['branches'] is defined -%}
{%- if pillar['branches']['saltmaster'] is defined -%}
{%- for branch in pillar['branches']['saltmaster'] %}
{{branch}}:
- /srv/salt/{{branch}}/pillars
{%- for env in envs %}
{{env}}:
- /srv/salt/{{env}}/pillars
{%- endfor %}
{%- endif %}
{%- endif %}
#
#ext_pillar:
# - hiera: /etc/hiera.yaml

View file

@ -1,6 +1,6 @@
{%- if 'backup' in pillar['grains']['roles'] -%}
{%- if 'backup' in pillar['roles'] -%}
{%- else -%}
{##ensure that backup pillar exists##}
{%- if pillar['backup'] is defined -%}

View file

@ -1,18 +1,5 @@
{%- 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') -%}
branches:
saltmaster:
{%- for branch in branches %}
- {{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 %}
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
{% for env in envs %}
{{ env }}:
'os_family:RedHat':
{% endfor %}

View file

@ -1,10 +1,7 @@
{%- set states = salt['cp.list_states'](saltenv) -%}
{%- if pillar['branches'] is defined -%}
{%- if pillar['branches']['saltmaster'] is defined -%}
{%- set envs = pillar['branches']['saltmaster'] -%}
{%- endif -%}
{%- endif -%}
{%- 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') -%}
{%- set envs=salt.cmd.shell('ls /srv/salt/').split('\n') -%}
{% for env in envs %}
{{ env }}:
'os_family:RedHat':
@ -17,8 +14,8 @@
- systems.core.freeipa
'*':
{#- don't run update automatically on containers - updates will be triggered from their host -#}
{%- if pillar['grains']['roles'] is defined -%}
{%- if 'lxc_container' not in pillar['grains']['roles'] %}
{%- if pillar['roles'] is defined -%}
{%- if 'lxc_container' not in pillar['roles'] %}
- update
{%- endif -%}
{%- endif %}
@ -32,9 +29,9 @@
- systems.core.mount
- systems.core.git
- systems.core.backup
{%- if grains['roles'] is defined -%}
{%- if grains['roles'] is not none -%}
{%- for role in grains['roles'] %}
{%- if pillar['roles'] is defined -%}
{%- if pillar['roles'] is not none -%}
{%- for role in pillar['roles'] %}
{%- if 'roles.maintain.'+role in states %}
- roles.maintain.{{role}}
{%- endif -%}