Skip to content

Instantly share code, notes, and snippets.

@c4t3l
Last active December 10, 2021 16:46
Show Gist options
  • Save c4t3l/94076e90cc796a7d93a9b63a64330978 to your computer and use it in GitHub Desktop.
Save c4t3l/94076e90cc796a7d93a9b63a64330978 to your computer and use it in GitHub Desktop.
Local Salt development environment
[CentOS 7]
Required Packages
vagrant >= 1.9.5
qemu-system-x86 >= 2.0.0
ruby >= 2.0.0
ruby-devel >= 2.0.0
pytest >= 2.7.0
python-pip >= 7.1.0
testinfra >= 1.6.3
groupinstall Development
# Gemfile
source 'https://rubygems.org'
gem "test-kitchen", '>=1.2.1'
gem "kitchen-vagrant"
gem "kitchen-qemu"
gem "unf"
gem "kitchen-salt", ">=0.0.11"
#Install steps
yum groupinstall Development
yum install install https://releases.hashicorp.com/vagrant/1.9.5/vagrant_1.9.5_x86_64.rpm
yum install ruby ruby-devel pytest python-pip qemu-system-x86
cd </path/of/Gemfile>
bundle install
# qcow image setup
[kitchen-salt setup]
---
driver:
name: qemu
platforms:
- name: rhel7_test
driver:
image: <path/to/qcow2_image>
provisioner:
name: salt_solo
formula: dummy
state_top:
base:
'*':
- dummy
pillars:
top.sls:
base:
'*':
- dummy
dummy.sls:
role: dummy
suites:
- name: default
- name: non-target
provisioner:
pillars:
top.sls:
base:
'*':
- fidget
fidget.sls:
role: fidget_spinner
verifier:
name: shell
command: testinfra -vvv test/integration/$KITCHEN_SUITE
# Workflow
# write/refactor
kitchen converge
<update states, write testinfra integration tests>
kitchen verify
#Full test
kitchen test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment