formula: salt | formula: salt | ||||
grains: | grains: | ||||
noservices: true | noservices: true | ||||
vendor_repo: | |||||
- type: apt | |||||
url: http://apt-mk.mirantis.com/trusty | |||||
key_url: http://apt-mk.mirantis.com/public.gpg | |||||
components: salt | |||||
distribution: testing | |||||
state_top: | state_top: | ||||
base: | base: | ||||
"*": | "*": | ||||
- master_ssh_key | - master_ssh_key | ||||
- master_ssh_password | - master_ssh_password | ||||
- master_ssh_root | - master_ssh_root | ||||
- master_handler | |||||
- minion_pki_cert | - minion_pki_cert | ||||
- master_formulas | |||||
pillars-from-files: | pillars-from-files: | ||||
minion_pki.sls: tests/pillar/minion_pki_ca.sls | minion_pki.sls: tests/pillar/minion_pki_ca.sls | ||||
minion_pki_cert.sls: tests/pillar/minion_pki_cert.sls | minion_pki_cert.sls: tests/pillar/minion_pki_cert.sls | ||||
master_ssh_key.sls: tests/pillar/master_ssh_minion_key.sls | master_ssh_key.sls: tests/pillar/master_ssh_minion_key.sls | ||||
master_ssh_password.sls: tests/pillar/master_ssh_minion_password.sls | master_ssh_password.sls: tests/pillar/master_ssh_minion_password.sls | ||||
master_ssh_root.sls: tests/pillar/master_ssh_minion_root.sls | master_ssh_root.sls: tests/pillar/master_ssh_minion_root.sls | ||||
master_handler.sls: tests/pillar/master_custom_handler.sls | |||||
master_formulas.sls: tests/pillar/master_formulas.sls | |||||
- name: control-default | - name: control-default | ||||
provisioner: | provisioner: |
script: | script: | ||||
- test ! -e .kitchen.yml || bundle exec kitchen converge || true | - test ! -e .kitchen.yml || bundle exec kitchen converge || true | ||||
- test ! -e .kitchen.yml || bundle exec kitchen verify | |||||
- test ! -e .kitchen.yml || bundle exec kitchen verify -t tests/integration | |||||
notifications: | notifications: | ||||
webhooks: | webhooks: |
... | ... | ||||
environment: | environment: | ||||
prd: | prd: | ||||
keysone: | |||||
keystone: | |||||
source: pkg | source: pkg | ||||
name: salt-formula-keystone | name: salt-formula-keystone | ||||
nova: | |||||
source: pkg | |||||
name: salt-formula-keystone | |||||
version: 0.1+0~20160818133412.24~1.gbp6e1ebb | |||||
postresql: | |||||
source: pkg | |||||
name: salt-formula-postgresql | |||||
version: purged | |||||
Formula keystone is installed latest version and the formulas without version are installed in one call to aptpkg module. | |||||
If the version attribute is present sls iterates over formulas and take action to install specific version or remove it. | |||||
The version attribute may have these values ``[latest|purged|removed|<VERSION>]``. | |||||
Clone master branch of keystone formula as local feature branch | Clone master branch of keystone formula as local feature branch | ||||
{%- endif %} | {%- endif %} | ||||
{%- set _formula_pkgs = [] %} | {%- set _formula_pkgs = [] %} | ||||
{%- set _formula_pkgs_with_version = [] %} | |||||
{%- for formula_name, formula in environment.get('formula', {}).iteritems() %} | {%- for formula_name, formula in environment.get('formula', {}).iteritems() %} | ||||
{%- if formula.source == 'pkg' %} | {%- if formula.source == 'pkg' %} | ||||
{%- if formula.version is defined %} | |||||
{%- do _formula_pkgs_with_version.append(formula) %} | |||||
{%- else %} | |||||
{%- do _formula_pkgs.append(formula.name) %} | {%- do _formula_pkgs.append(formula.name) %} | ||||
{%- endif %} | {%- endif %} | ||||
{%- endif %} | |||||
{%- endfor %} | {%- endfor %} | ||||
{% if _formula_pkgs|length > 1 %} | {% if _formula_pkgs|length > 1 %} | ||||
salt_master_{{ environment_name }}_pkg_formulas: | salt_master_{{ environment_name }}_pkg_formulas: | ||||
pkg.latest: | pkg.latest: | ||||
- pkgs: | - pkgs: | ||||
{%- for pkg in _formula_pkgs %} | {%- for pkg in _formula_pkgs %} | ||||
- {{ pkg }} | - {{ pkg }} | ||||
{%- endfor %} | {%- endfor %} | ||||
- refresh: True | |||||
- cache_valid_time: 300 | |||||
{% endif %} | |||||
{% if _formula_pkgs_with_version|length > 1 %} | |||||
{%- for formula in _formula_pkgs_with_version %} | |||||
salt_master_{{ environment_name }}_pkg_formula_{{ formula.name }}: | |||||
{%- if formula.version == 'latest' %} | |||||
pkg.latest: | |||||
- refresh: True | |||||
- cache_valid_time: 300 | |||||
{%- elif formula.version == 'purged' %} | |||||
pkg.purged: | |||||
{%- elif formula.version == 'removed' %} | |||||
pkg.removed: | |||||
{%- else %} | |||||
pkg.installed: | |||||
- version: {{ formula.version }} | |||||
- refresh: True | |||||
- cache_valid_time: 300 | |||||
{% endif %} | |||||
- name: {{ formula.name }} | |||||
{%- endfor %} | |||||
{% endif %} | {% endif %} | ||||
%w(keepalived haproxy libvirt ntp openssh).each do |f| | |||||
describe package("salt-formula-#{f}") do | |||||
it { should be_installed } | |||||
end | |||||
end | |||||
%w(mysql postgresql).each do |f| | |||||
describe package("salt-formula-#{f}") do | |||||
it { should_not be_installed } | |||||
end | |||||
end | |||||
git: | |||||
client: | |||||
enabled: true | |||||
linux: | |||||
system: | |||||
enabled: true | |||||
salt: | |||||
master: | |||||
enabled: true | |||||
pillar: | |||||
source: | |||||
engine: local | |||||
environment: | |||||
prd: | |||||
formula: | |||||
keepalived: | |||||
source: pkg | |||||
name: salt-formula-keepalived | |||||
haproxy: | |||||
source: pkg | |||||
name: salt-formula-haproxy | |||||
libvirt: | |||||
source: pkg | |||||
name: salt-formula-libvirt | |||||
version: latest | |||||
ntp: | |||||
source: pkg | |||||
name: salt-formula-ntp | |||||
version: latest | |||||
openssh: | |||||
source: pkg | |||||
name: salt-formula-openssh | |||||
version: latest | |||||
mysql: | |||||
source: pkg | |||||
name: salt-formula-mysql | |||||
version: purged | |||||
postgresql: | |||||
source: pkg | |||||
name: salt-formula-postgresql | |||||
version: removed | |||||
dev: | |||||
formula: | |||||
aptly: | |||||
source: git | |||||
address: 'https://github.com/salt-formulas/salt-formula-aptly.git' | |||||
revision: master | |||||
bind: | |||||
source: git | |||||
address: 'https://github.com/salt-formulas/salt-formula-bind.git' | |||||
revision: master |