Compare commits
6 commits
e9e986080d
...
41125efa35
Author | SHA1 | Date | |
---|---|---|---|
|
41125efa35 | ||
|
bb2d2acbd6 | ||
|
0be94787b6 | ||
|
859ad41131 | ||
|
701b84dbac | ||
|
65df55c6e6 |
8 changed files with 38 additions and 76 deletions
|
@ -3,17 +3,17 @@ git fetch --all;
|
||||||
|
|
||||||
#copy dev to history to ensure we don't lose changes if something goes wrong
|
#copy dev to history to ensure we don't lose changes if something goes wrong
|
||||||
git checkout history;
|
git checkout history;
|
||||||
git reset --hard qual;
|
git reset --hard dev;
|
||||||
git push --force;
|
git push --force;
|
||||||
|
|
||||||
#merge to master
|
#merge to master
|
||||||
git checkout -B prod origin/master;
|
git checkout -B master origin/master;
|
||||||
git merge --squash qual;
|
git merge --squash dev;
|
||||||
git commit -am "$cm";
|
git commit -am "$cm";
|
||||||
git push;
|
git push;
|
||||||
|
|
||||||
#clean dev
|
#clean dev
|
||||||
git checkout qual;
|
git checkout dev;
|
||||||
git reset --hard prod;
|
git reset --hard master;
|
||||||
git push --force;
|
git push --force;
|
||||||
git reset --hard origin/qual;
|
git reset --hard origin/dev;
|
|
@ -1,18 +1,17 @@
|
||||||
{%- 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:
|
git:
|
||||||
{%- for branch in branches %}
|
salt:
|
||||||
salt_{{branch}}:
|
|
||||||
repo: "ssh://gitea@git.actcur.com:5022/actcur/salt.git"
|
repo: "ssh://gitea@git.actcur.com:5022/actcur/salt.git"
|
||||||
path: "/srv/salt/{{branch}}"
|
path: "/srv/salt/prod"
|
||||||
branch: "{{branch}}"
|
branch: "master"
|
||||||
key: "git_actcur"
|
key: "git_actcur"
|
||||||
force: {{ "True" if (branch == "prod" or branch == "qual") else "false" }}
|
force: true
|
||||||
|
email: "actcur@actcur.com"
|
||||||
|
name: "Actaeus Curabitur"
|
||||||
|
salt_dev:
|
||||||
|
repo: "ssh://gitea@git.actcur.com:5022/actcur/salt.git"
|
||||||
|
path: "/srv/salt/dev"
|
||||||
|
branch: "dev"
|
||||||
|
key: "git_actcur"
|
||||||
|
force: true
|
||||||
email: "actcur@actcur.com"
|
email: "actcur@actcur.com"
|
||||||
name: "Actaeus Curabitur"
|
name: "Actaeus Curabitur"
|
||||||
{%- endfor %}
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{%- 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') -%}
|
prod:
|
||||||
{%- for branch in branches %}
|
'*':
|
||||||
{{branch}}:
|
- roles
|
||||||
|
- servers
|
||||||
|
dev:
|
||||||
'*':
|
'*':
|
||||||
- roles
|
- roles
|
||||||
- servers
|
- servers
|
||||||
{%- endfor %}
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{%- set os=grains['os'] -%}
|
{%- set os=grains['os'] -%}
|
||||||
|
|
||||||
salt-master:
|
salt-master:
|
||||||
{%- if os=="CentOS" or os=="RedHat" %}
|
{%- if os=="CentOS" or os=="RedHat" %}
|
||||||
pkg.installed: []
|
pkg.installed: []
|
||||||
|
@ -18,7 +19,6 @@ salt-master:
|
||||||
- user: root
|
- user: root
|
||||||
- group: root
|
- group: root
|
||||||
- mode: 644
|
- mode: 644
|
||||||
- template: jinja
|
|
||||||
|
|
||||||
/srv/salt/prod/states/pillars:
|
/srv/salt/prod/states/pillars:
|
||||||
file.symlink:
|
file.symlink:
|
||||||
|
|
|
@ -422,14 +422,12 @@ state_output: terse
|
||||||
# - /srv/salt/prod/states
|
# - /srv/salt/prod/states
|
||||||
#
|
#
|
||||||
file_roots:
|
file_roots:
|
||||||
{%- if pillar['branches'] is defined -%}
|
base:
|
||||||
{%- if pillar['branches']['saltmaster'] is defined -%}
|
- /srv/salt/prod/states
|
||||||
{%- for branch in pillar['branches']['saltmaster'] %}
|
prod:
|
||||||
{{branch}}:
|
- /srv/salt/prod/states
|
||||||
- /srv/salt/{{branch}}/states
|
dev:
|
||||||
{%- endfor %}
|
- /srv/salt/dev/states
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
#
|
#
|
||||||
|
|
||||||
# When using multiple environments, each with their own top file, the
|
# When using multiple environments, each with their own top file, the
|
||||||
|
@ -441,15 +439,7 @@ 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 -%}
|
env_order: ['base', 'dev', 'prod']
|
||||||
{%- if pillar['branches']['saltmaster'] is defined -%}
|
|
||||||
env_order: [
|
|
||||||
{%- for branch in pillar['branches']['saltmaster'] -%}
|
|
||||||
'{{-branch}}',
|
|
||||||
{%- endfor -%}
|
|
||||||
'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
|
||||||
|
@ -570,14 +560,12 @@ hash_type: sha256
|
||||||
# - /srv/pillar
|
# - /srv/pillar
|
||||||
#
|
#
|
||||||
pillar_roots:
|
pillar_roots:
|
||||||
{%- if pillar['branches'] is defined -%}
|
base:
|
||||||
{%- if pillar['branches']['saltmaster'] is defined -%}
|
- /srv/salt/prod/pillars
|
||||||
{%- for branch in pillar['branches']['saltmaster'] %}
|
prod:
|
||||||
{{branch}}:
|
- /srv/salt/prod/pillars
|
||||||
- /srv/salt/{{branch}}/pillars
|
dev:
|
||||||
{%- endfor %}
|
- /srv/salt/dev/pillars
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
#
|
#
|
||||||
#ext_pillar:
|
#ext_pillar:
|
||||||
# - hiera: /etc/hiera.yaml
|
# - hiera: /etc/hiera.yaml
|
||||||
|
|
18
states/test
18
states/test
|
@ -1,18 +0,0 @@
|
||||||
{%- 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 %}
|
|
|
@ -1,4 +0,0 @@
|
||||||
/test:
|
|
||||||
file.managed:
|
|
||||||
- source: salt://test
|
|
||||||
- template: jinja
|
|
|
@ -1,10 +1,6 @@
|
||||||
|
|
||||||
{%- set states = salt['cp.list_states'](saltenv) -%}
|
{%- set states = salt['cp.list_states'](saltenv) -%}
|
||||||
{%- if pillar['branches'] is defined -%}
|
{%- set envs = ['prod','dev'] -%}
|
||||||
{%- 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':
|
||||||
|
|
Loading…
Add table
Reference in a new issue