Skip to content

Commit

Permalink
Dev: Use salt for provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
krig committed Aug 25, 2017
1 parent 3994077 commit d6a97c1
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@ def configure_machine(machine, idx, roles, memory, cpus)
machine.vm.network :private_network, ip: "10.13.37.#{10 + idx}"
#machine.vm.network "public_network", use_dhcp_assigned_default_route: true

machine.vm.provision "shell", path: "chef/suse-prepare.sh"
machine.vm.provision :chef_solo do |chef|
chef.version = "12.21.4"
chef.cookbooks_path = ["chef/cookbooks"]
chef.roles_path = ["chef/roles"]
chef.custom_config_path = "chef/solo.rb"
#chef.synced_folder_type = "rsync"
roles.each do |role|
chef.add_role role
end
machine.vm.provision :salt do |salt|
salt.minion_config = "salt/etc/minion"
salt.run_highstate = true
salt.install_type = "git"
salt.install_args = "v2017.7"
salt.verbose = true
end

machine.vm.provider :virtualbox do |provider, override|
Expand Down
7 changes: 7 additions & 0 deletions salt/etc/minion
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file_client: local
file_roots:
base:
- /vagrant/salt/salt
pillar_roots:
base:
- /vagrant/salt/pillar
11 changes: 11 additions & 0 deletions salt/salt/common/hosts.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
webui:
host.present:
- ip: 10.13.37.10

node1:
host.present:
- ip: 10.13.37.11

node2:
host.present:
- ip: 10.13.37.12
6 changes: 6 additions & 0 deletions salt/salt/common/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include:
- common.packages
- common.ntp
- common.watchdog
- common.hosts
- common.ssh
11 changes: 11 additions & 0 deletions salt/salt/common/ntp.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ntp_package:
pkg.installed:
- names:
- ntp

ntpd:
service.running:
- enable: True
- require:
- pkg: ntp_package

46 changes: 46 additions & 0 deletions salt/salt/common/packages.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
rubyext:
pkgrepo.managed:
- humanname: devel:languages:ruby:extensions
- baseurl: http://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/openSUSE_Leap_42.3/
- refresh: True
- gpgautoimport: True

darix:
pkgrepo.managed:
- humanname: home:darix:apps
- baseurl: http://download.opensuse.org/repositories/home:/darix:/apps/openSUSE_Leap_42.3/
- refresh: True
- gpgautoimport: True

common_packages:
pkg.installed:
- names:
- ha-cluster-bootstrap
- fence-agents
- apache2
- haproxy
- libglue-devel
- drbd
- drbd-utils
- nodejs8
- ruby2.4-rubygem-rails-5.1
- ruby2.4-rubygem-puma
- ruby2.4-rubygem-sass-rails-5_0
- ruby2.4-rubygem-virtus
- ruby2.4-rubygem-js-routes
- ruby2.4-rubygem-tilt
- ruby2.4-rubygem-fast_gettext
- ruby2.4-rubygem-gettext_i18n_rails
- ruby2.4-rubygem-gettext_i18n_rails_js
- ruby2.4-rubygem-sprockets
- ruby2.4-rubygem-kramdown
- ruby2.4-rubygem-web-console
- ruby2.4-rubygem-spring
- ruby2.4-rubygem-uglifier
- ruby2.4-rubygem-gettext
- require:
- pkgrepo: darix
- pkgrepo: rubyext



23 changes: 23 additions & 0 deletions salt/salt/common/ssh.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
vagrant_root:
ssh_auth.present:
- user: root
- source: salt://sshkeys/vagrant.pub
- config: '%h/.ssh/authorized_keys'

vagrant_vagrant:
ssh_auth.present:
- user: vagrant
- source: salt://sshkeys/vagrant.pub
- config: '%h/.ssh/authorized_keys'

krig_root:
ssh_auth.present:
- user: root
- source: salt://sshkeys/krig.pub
- config: '%h/.ssh/authorized_keys'

krig_vagrant:
ssh_auth.present:
- user: vagrant
- source: salt://sshkeys/krig.pub
- config: '%h/.ssh/authorized_keys'
4 changes: 4 additions & 0 deletions salt/salt/common/watchdog.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
setup_watchdog:
kmod.present:
- name: softdog
- persist: True
1 change: 1 addition & 0 deletions salt/salt/sshkeys/krig.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzma1vLqNyJneb/AwLdvcJr9SeXaE3zPU7V9uVsAMcV9U0uCdWKBiyB8+0amd8kcfdqs0Wm5qh5hdCLTsJ+xL5N/DmnOK1cNkg5jwBbgfxJpb1DY617YuDJ6bWouwQfZCF/Kc2lhYpaq0POr+bdIQX5UpQH2bWuykarjlxUIG7GQSd8xs0FB9Uvmx/DM4tMoG8Vd8stT5tMFqWQ8af/yqPuAr9LfB98F3Rucr3rrPQpvEwCay95RoruNJcn19ZWhpi2tUSIrwnmxZHot7RpAg8EN+d/U0jWNiXeNEET3c5BrlcCXkSqzfjPaQNrIiuFNiy6gh9/XJpuU041tGuCJ/4Q== krig@fenris
1 change: 1 addition & 0 deletions salt/salt/sshkeys/vagrant.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
3 changes: 3 additions & 0 deletions salt/salt/top.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
base:
'*':
- common

0 comments on commit d6a97c1

Please sign in to comment.