├── modules └── config │ ├── README.md │ ├── .rspec │ ├── .gitignore │ ├── .fixtures.yml │ ├── spec │ ├── spec_helper.rb │ └── classes │ │ └── init_spec.rb │ ├── templates │ ├── consul.conf.erb │ ├── registrator.yml.erb │ └── named.conf.erb │ ├── Gemfile │ ├── Rakefile │ ├── manifests │ ├── init.pp │ ├── compose.pp │ ├── dns.pp │ ├── swarm.pp │ ├── run_containers.pp │ └── consul_config.pp │ ├── tests │ └── init.pp │ ├── Modulefile │ └── Gemfile.lock ├── .bundle └── config ├── .gitignore ├── Gemfile ├── hiera.yaml ├── manifests └── default.pp ├── hieradata └── global.yaml ├── Rakefile ├── Puppetfile ├── README.md ├── Vagrantfile └── servers.yaml /modules/config/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bundle/config: -------------------------------------------------------------------------------- 1 | --- 2 | BUNDLE_RETRY: 3 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.tmp 2 | /.vagrant/ 3 | /.DS_Store 4 | /.bundle -------------------------------------------------------------------------------- /modules/config/.rspec: -------------------------------------------------------------------------------- 1 | --require spec_helper 2 | --pattern spec/*/*_spec.rb 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "rake" 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /modules/config/.gitignore: -------------------------------------------------------------------------------- 1 | *.sw[op] 2 | /junit.xml 3 | /spec/fixtures 4 | /pkg 5 | -------------------------------------------------------------------------------- /modules/config/.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | symlinks: 3 | config: "#{source_dir}" 4 | -------------------------------------------------------------------------------- /hiera.yaml: -------------------------------------------------------------------------------- 1 | :backends: 2 | - yaml 3 | :hierarchy: 4 | - global 5 | 6 | :yaml: 7 | :datadir: /vagrant/hieradata -------------------------------------------------------------------------------- /modules/config/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | require 'yarjuf' 3 | require 'pry' 4 | 5 | 6 | -------------------------------------------------------------------------------- /modules/config/templates/consul.conf.erb: -------------------------------------------------------------------------------- 1 | zone "consul" IN { 2 | type forward; 3 | forward only; 4 | forwarders { 127.0.0.1 port 8600; }; 5 | }; -------------------------------------------------------------------------------- /modules/config/spec/classes/init_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | describe 'config' do 3 | 4 | context 'with defaults for all parameters' do 5 | it { should contain_class('config') } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /modules/config/templates/registrator.yml.erb: -------------------------------------------------------------------------------- 1 | registrator: 2 | image: gliderlabs/registrator:v6 3 | net: "host" 4 | volumes: 5 | - "/var/run/docker.sock:/tmp/docker.sock" 6 | command: consul://<%= @consul_ip %>:8500 7 | -------------------------------------------------------------------------------- /manifests/default.pp: -------------------------------------------------------------------------------- 1 | node 'swarm-101' { include config } 2 | 3 | node 'swarm-102' { include config } 4 | 5 | node 'swarm-103' { include config } 6 | 7 | node 'swarm-master-01' { include config } 8 | 9 | node 'swarm-master-02' { include config } 10 | -------------------------------------------------------------------------------- /hieradata/global.yaml: -------------------------------------------------------------------------------- 1 | docker_swarm::swarm_version: v1.1.3 2 | docker_swarm::backend: consul 3 | docker_swarm::backend_ip: 172.17.8.101 4 | docker_swarm::backend_port: 8500 5 | docker_swarm::advertise_int: enp0s8 6 | docker::version: 1.10.3-1.el7.centos 7 | consul::version: 0.6.3 -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "rake" 2 | require 'bundler' 3 | Bundler.require(:rake) 4 | require 'rake/clean' 5 | 6 | 7 | desc "Executes Vagrant up" 8 | task :build do 9 | def execute(command) 10 | puts command 11 | system command 12 | end 13 | execute "vagrant up" 14 | end 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /modules/config/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem 'rake', :group => [:development, :test] 4 | 5 | group :development do 6 | gem 'pry' 7 | gem 'puppet-lint' 8 | end 9 | 10 | group :test do 11 | gem 'puppet', "~> 3.4" 12 | gem 'puppetlabs_spec_helper' 13 | gem 'rspec', "< 2.99" 14 | gem 'rspec-puppet' 15 | gem 'yarjuf' #Rspec Junit formatter 16 | end 17 | -------------------------------------------------------------------------------- /modules/config/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | 3 | require 'rubygems' 4 | require 'puppetlabs_spec_helper/rake_tasks' 5 | require 'rspec/core/rake_task' 6 | require 'puppet-lint' 7 | 8 | PuppetLint.configuration.send('disable_autoloader_layout') 9 | 10 | RSpec::Core::RakeTask.new(:ci) do |task| 11 | task.rspec_opts = "--format JUnit --out junit.xml" 12 | end 13 | 14 | task :ci => :spec_prep 15 | -------------------------------------------------------------------------------- /modules/config/manifests/init.pp: -------------------------------------------------------------------------------- 1 | # == Class: config 2 | # 3 | # 4 | class config( 5 | 6 | $consul_ip = "$::ipaddress_enp0s8", 7 | 8 | ){ 9 | 10 | include config::consul_config 11 | contain config::swarm 12 | contain config::compose 13 | contain config::dns 14 | contain config::run_containers 15 | 16 | Class['config::swarm'] -> Class['config::compose'] -> Class['config::dns'] -> Class['config::run_containers'] 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /modules/config/manifests/compose.pp: -------------------------------------------------------------------------------- 1 | class config::compose { 2 | 3 | if $hostname =~ /^swarm-master*/ { 4 | 5 | notice ["This server is the Swarm Manager."] 6 | 7 | } 8 | 9 | else { 10 | 11 | class {'docker::compose':} -> 12 | 13 | file { '/root/docker-compose.yml': 14 | ensure => file, 15 | content => template("config/registrator.yml.erb"), 16 | } -> 17 | 18 | docker_compose {'/root/docker-compose.yml': 19 | ensure => present, 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Puppetfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby env 2 | 3 | require "socket" 4 | $hostname = Socket.gethostname 5 | 6 | forge 'http://forge.puppetlabs.com' 7 | 8 | 9 | mod 'puppetlabs/stdlib' 10 | mod 'puppetlabs/vcsrepo' 11 | mod 'puppet/archive', :git => 'https://github.com/voxpupuli/puppet-archive.git' 12 | mod 'nanliu/staging' 13 | mod 'KyleAnderson/consul', '1.0.5' 14 | mod 'scottyc/docker_swarm' 15 | mod 'scottyc/golang' 16 | mod 'garethr/docker', :git => 'https://github.com/garethr/garethr-docker.git' 17 | mod 'stankevich/python' 18 | mod 'stahnma/epel' 19 | mod 'maestrodev/wget' 20 | 21 | -------------------------------------------------------------------------------- /modules/config/tests/init.pp: -------------------------------------------------------------------------------- 1 | # The baseline for module testing used by Puppet Labs is that each manifest 2 | # should have a corresponding test manifest that declares that class or defined 3 | # type. 4 | # 5 | # Tests are then run by using puppet apply --noop (to check for compilation 6 | # errors and view a log of events) or by fully applying the test in a virtual 7 | # environment (to compare the resulting system state to the desired state). 8 | # 9 | # Learn more about module testing here: 10 | # http://docs.puppetlabs.com/guides/tests_smoke.html 11 | # 12 | include config 13 | -------------------------------------------------------------------------------- /modules/config/templates/named.conf.erb: -------------------------------------------------------------------------------- 1 | options { 2 | listen-on port 53 { 127.0.0.1; }; 3 | listen-on-v6 port 53 { ::1; }; 4 | directory "/var/named"; 5 | dump-file "/var/named/data/cache_dump.db"; 6 | statistics-file "/var/named/data/named_stats.txt"; 7 | memstatistics-file "/var/named/data/named_mem_stats.txt"; 8 | allow-query { localhost; }; 9 | recursion yes; 10 | 11 | dnssec-enable no; 12 | dnssec-validation no; 13 | 14 | /* Path to ISC DLV key */ 15 | bindkeys-file "/etc/named.iscdlv.key"; 16 | 17 | managed-keys-directory "/var/named/dynamic"; 18 | }; 19 | 20 | include "/etc/named/consul.conf"; -------------------------------------------------------------------------------- /modules/config/Modulefile: -------------------------------------------------------------------------------- 1 | name 'scottyc-config' 2 | version '0.1.0' 3 | 4 | author 'scottyc' 5 | summary 'config module' 6 | description 'config module' 7 | project_page 'https://stash.healthdirect.org.au/projects/puppet/repos/config' 8 | 9 | # Add dependencies here, if any (NB: Must be in the form 'author/modulename') 10 | 11 | dependency 'puppetlabs/stdlib' 12 | dependency 'puppetlabs/vcsrepo' 13 | dependency 'nanliu/staging' 14 | dependency 'KyleAnderson/consul' 15 | dependency 'scottyc/golang' 16 | dependency 'scottyc/docker_swarm' 17 | dependency 'garethr/docker' 18 | dependency 'scottc/config' 19 | dependency 'stankevich/python' 20 | dependency 'stahnma/epel' 21 | dependency 'tayzlor/weave' 22 | -------------------------------------------------------------------------------- /modules/config/manifests/dns.pp: -------------------------------------------------------------------------------- 1 | class config::dns { 2 | 3 | package { 'bind': 4 | ensure => present 5 | } -> 6 | 7 | file { '/etc/named.conf': 8 | ensure => present, 9 | content => template("config/named.conf.erb"), 10 | mode => '0644', 11 | owner => 'root', 12 | group => 'root', 13 | require => Package['bind'], 14 | } ~> 15 | 16 | file { '/etc/named/consul.conf': 17 | ensure => present, 18 | content => template("config/consul.conf.erb"), 19 | mode => '0644', 20 | owner => 'root', 21 | group => 'root', 22 | require => Package['bind'], 23 | } ~> 24 | 25 | service { 'named': 26 | ensure => running, 27 | enable => true, 28 | require => File['/etc/named.conf'], 29 | } 30 | } -------------------------------------------------------------------------------- /modules/config/manifests/swarm.pp: -------------------------------------------------------------------------------- 1 | class config::swarm { 2 | 3 | class { 'docker_swarm': 4 | require => Class['config::consul_config'] 5 | } 6 | 7 | docker_network { 'swarm-private': 8 | ensure => present, 9 | driver => 'overlay', 10 | require => Class['config::consul_config'] 11 | } 12 | 13 | if $hostname =~ /^swarm-master*/ { 14 | 15 | swarm_cluster {'cluster 1': 16 | ensure => present, 17 | backend => 'consul', 18 | cluster_type => 'manage', 19 | port => '8500', 20 | address => '172.17.8.101', 21 | advertise => $::ipaddress_enp0s8, 22 | path => 'swarm', 23 | } 24 | } 25 | 26 | else { 27 | 28 | swarm_cluster {'cluster 1': 29 | ensure => present, 30 | backend => 'consul', 31 | cluster_type => 'join', 32 | port => '8500', 33 | address => '172.17.8.101', 34 | path => 'swarm' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /modules/config/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (2.2.8) 5 | builder (3.2.2) 6 | coderay (1.1.0) 7 | diff-lcs (1.2.5) 8 | facter (2.0.2) 9 | CFPropertyList (~> 2.2.6) 10 | hiera (1.3.4) 11 | json_pure 12 | json_pure (1.8.1) 13 | metaclass (0.0.4) 14 | method_source (0.8.2) 15 | mocha (1.1.0) 16 | metaclass (~> 0.0.1) 17 | pry (0.10.0) 18 | coderay (~> 1.1.0) 19 | method_source (~> 0.8.1) 20 | slop (~> 3.4) 21 | puppet (3.6.2) 22 | facter (> 1.6, < 3) 23 | hiera (~> 1.0) 24 | json_pure 25 | rgen (~> 0.6.5) 26 | puppet-lint (0.3.2) 27 | puppetlabs_spec_helper (0.5.1) 28 | mocha 29 | puppet 30 | puppet-lint 31 | rake 32 | rspec 33 | rspec-puppet 34 | rake (10.3.2) 35 | rgen (0.6.6) 36 | rspec (2.14.1) 37 | rspec-core (~> 2.14.0) 38 | rspec-expectations (~> 2.14.0) 39 | rspec-mocks (~> 2.14.0) 40 | rspec-core (2.14.8) 41 | rspec-expectations (2.14.5) 42 | diff-lcs (>= 1.1.3, < 2.0) 43 | rspec-mocks (2.14.6) 44 | rspec-puppet (1.0.1) 45 | rspec 46 | slop (3.5.0) 47 | yarjuf (1.0.5) 48 | builder 49 | rspec (>= 2.0) 50 | 51 | PLATFORMS 52 | ruby 53 | 54 | DEPENDENCIES 55 | pry 56 | puppet (~> 3.4) 57 | puppet-lint 58 | puppetlabs_spec_helper 59 | rake 60 | rspec (< 2.99) 61 | rspec-puppet 62 | yarjuf 63 | -------------------------------------------------------------------------------- /modules/config/manifests/run_containers.pp: -------------------------------------------------------------------------------- 1 | class config::run_containers { 2 | 3 | if $hostname =~ /swarm-master-02/ { 4 | 5 | swarm_run {'logstash': 6 | ensure => present, 7 | image => 'scottyc/logstash', 8 | network => 'swarm-private', 9 | ports => ['9998:9998', '9999:9999/udp', '5000:5000', '5000:5000/udp'], 10 | env => ['ES_HOST=elasticsearch', 'ES_PORT=9200'], 11 | command => 'logstash -f /opt/logstash/conf.d/logstash.conf --debug', 12 | require => Class['config::swarm'] 13 | } 14 | 15 | swarm_run {'elasticsearch': 16 | ensure => present, 17 | image => 'elasticsearch:2.1.0', 18 | network => 'swarm-private', 19 | volumes => ['/etc/esdata:/usr/share/elasticsearch/data'], 20 | command => 'elasticsearch -Des.network.host=0.0.0.0', 21 | log_driver => 'syslog', 22 | log_opt => 'syslog-address=tcp://logstash-5000.service.consul:5000', 23 | depends => 'logstash', 24 | require => Class['config::swarm'] 25 | } 26 | 27 | swarm_run {'kibana': 28 | ensure => present, 29 | image => 'kibana:4.3.0', 30 | network => 'swarm-private', 31 | ports => ['80:5601'], 32 | env => ['ELASTICSEARCH_URL=http://elasticsearch:9200', 'reschedule:on-node-failure'], 33 | log_driver => 'syslog', 34 | log_opt => 'syslog-address=tcp://logstash-5000.service.consul:5000', 35 | depends => 'logstash', 36 | require => Class['config::swarm'] 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PuppetConf Demo 2 | ``` 3 | Prerequisites: 4 | - Vagrant 5 | - Ruby 6 | ``` 7 | ## This is a full re-write of the environment. 8 | 9 | # Install dependencies 10 | ``` 11 | git clone to a new directory 12 | cd that directory 13 | vagrant up 14 | ``` 15 | This will build a demo environment of 3 boxes in Docker Swarm cluster and 2 Swarm Masters. It also configurers Conul so we can monitor the cluster and contianers on the cluster. 16 | This is all automated and controlled with Puppet. The Swarm master will pick a node to deploy the contianers on. So you can check the consul gui, ping the service name from any of the 5 boxes or logon to one of the swarm masters and run ````docker -H tcp://172.17.8.114:2376 ps````. Once you have the ip of the box, you can access the app on the forwarded port from the ````server.yaml````. 17 | 18 | #Update 19 | The demo now builds a fuly operational ELK stack https://www.elastic.co/ You can find where all the containers are scheduled through the Consul ui 20 | It also adds enhanced checks to Consul to monitor the Swam-masters. 21 | 22 | # URL 23 | consul 24 | ```` 25 | 127.0.0.1:9501 26 | ```` 27 | 28 | # Commands 29 | Here are a few interesting commands to look at what is happening inside the swarm cluster. ````vagrant ssh master-01```` or ````vagrant ssh master-02```` 30 | 31 | 32 | Info 33 | ```` 34 | docker -H tcp://172.17.8.114:2376 info 35 | ````` 36 | 37 | Docker ps 38 | ```` 39 | docker -H tcp://172.17.8.114:2376 ps 40 | ```` 41 | 42 | On any of the other host run ````docker network ls```` to see the container networks 43 | 44 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # # vi: set ft=ruby : 3 | 4 | # Specify minimum Vagrant version and Vagrant API version 5 | Vagrant.require_version ">= 1.6.0" 6 | VAGRANTFILE_API_VERSION = "2" 7 | 8 | # Require YAML module 9 | require 'yaml' 10 | 11 | # Read YAML file with box details 12 | servers = YAML.load_file('servers.yaml') 13 | 14 | # Create boxes 15 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 16 | 17 | # Iterate through entries in YAML file 18 | servers.each do |servers| 19 | 20 | 21 | config.vm.define servers["name"] do |srv| 22 | 23 | srv.vm.hostname = servers["name"] 24 | 25 | srv.vm.box = servers["box"] 26 | 27 | srv.vm.network "private_network", ip: servers["ip"] 28 | 29 | 30 | servers["forward_ports"].each do |port| 31 | srv.vm.network :forwarded_port, guest: port["guest"], host: port["host"] 32 | end 33 | 34 | srv.vm.provider :virtualbox do |v| 35 | v.cpus = servers["cpu"] 36 | v.memory = servers["ram"] 37 | end 38 | 39 | srv.vm.synced_folder "./", "/home/vagrant/#{servers['name']}" 40 | 41 | servers["shell_commands"].each do |sh| 42 | srv.vm.provision "shell", inline: sh["shell"] 43 | end 44 | 45 | srv.vm.provision :puppet do |puppet| 46 | puppet.temp_dir = "/tmp" 47 | puppet.options = ['--pluginsync', '--modulepath=/tmp/modules', '--verbose'] 48 | puppet.hiera_config_path = "hiera.yaml" 49 | puppet.environment_path = './' 50 | puppet.environment = 'production' 51 | puppet.manifests_path = 'manifests' 52 | puppet.manifest_file = 'default.pp' 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /modules/config/manifests/consul_config.pp: -------------------------------------------------------------------------------- 1 | class config::consul_config { 2 | 3 | if $hostname =~ /^*101*$/ { 4 | 5 | class { 'consul': 6 | config_hash => { 7 | 'datacenter' => 'dev', 8 | 'data_dir' => '/opt/consul', 9 | 'ui_dir' => '/opt/consul/ui', 10 | 'bind_addr' => $::ipaddress_enp0s8, 11 | 'client_addr' => '0.0.0.0', 12 | 'node_name' => "$::hostname", 13 | 'advertise_addr' => '172.17.8.101', 14 | 'bootstrap_expect' => '1', 15 | 'server' => true 16 | } 17 | } 18 | } 19 | 20 | else { 21 | 22 | class { 'consul': 23 | config_hash => { 24 | 'bootstrap' => false, 25 | 'datacenter' => 'dev', 26 | 'data_dir' => '/opt/consul', 27 | 'ui_dir' => '/opt/consul/ui', 28 | 'bind_addr' => $::ipaddress_enp0s8, 29 | 'client_addr' => '0.0.0.0', 30 | 'node_name' => "$::hostname", 31 | 'advertise_addr' => $::ipaddress_enp0s8, 32 | 'start_join' => ['172.17.8.101','172.17.8.103','172.17.8.103'], 33 | 'server' => false 34 | } 35 | } 36 | } 37 | 38 | consul::service { 'docker-service': 39 | checks => [ 40 | { 41 | script => 'service docker status', 42 | interval => '10s', 43 | tags => ['docker-service'] 44 | } 45 | ], 46 | address => $::ipaddress_enp0s8, 47 | } 48 | 49 | 50 | # if $hostname =~ /^swarm-master*/ { 51 | # consul::check { 'kibana': 52 | # ensure => present, 53 | # tcp => 'kibana.service.consul:80', 54 | # interval => '10s', 55 | # } 56 | 57 | # consul::check { 'logstash-5000': 58 | # ensure => present, 59 | # tcp => 'logstash-5000.service.consul:5000', 60 | # interval => '10s', 61 | # } 62 | 63 | # consul::service { 'swarm-master-01': 64 | # checks => [ 65 | # { 66 | # script => 'docker -H tcp://172.17.8.114:4000 info', 67 | # interval => '10s', 68 | # tags => ['swarm-master-01'] 69 | # } 70 | # ], 71 | # address => $::ipaddress_enp0s8, 72 | # } 73 | 74 | # consul::service { 'swarm-master-02': 75 | # checks => [ 76 | # { 77 | # script => 'docker -H tcp://172.17.8.115:4000 info', 78 | # interval => '10s', 79 | # tags => ['swarm-master-02'] 80 | # } 81 | # ], 82 | # address => $::ipaddress_enp0s8, 83 | # } 84 | # } 85 | } 86 | -------------------------------------------------------------------------------- /servers.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - 3 | #box: scottyc/centos-7-puppet-kernel-4-4 4 | box: puppetlabs/centos-7.2-64-puppet 5 | cpu: 1 6 | ip: "172.17.8.101" 7 | name: swarm-101 8 | forward_ports: 9 | - { guest: 8500, host: 9501 } 10 | - { guest: 80, host: 8001 } 11 | - { guest: 443, host: 8441 } 12 | - { guest: 8080, host: 8081 } 13 | ram: 4096 14 | shell_commands: 15 | - { shell: 'yum install -y rubygems ruby-devel git wget curl lvm2 unzip device-mapper-libs && systemctl stop firewalld && systemctl disable firewalld' } 16 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s3 && systemctl restart network'} 17 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s8 && systemctl restart network'} 18 | - { shell: 'gem install puppet_forge -v 2.2.6 && gem install r10k'} 19 | - { shell: 'echo -e "172.17.8.101 swarm-101">/etc/hosts && echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc' } 20 | - { shell: 'cp /home/vagrant/swarm-101/Puppetfile /tmp && cd /tmp && r10k puppetfile install -v' } 21 | - { shell: 'cp /home/vagrant/swarm-101/modules/* -R /tmp/modules' } 22 | 23 | - 24 | box: puppetlabs/centos-7.2-64-puppet 25 | cpu: 1 26 | ip: "172.17.8.102" 27 | name: swarm-102 28 | forward_ports: 29 | - { guest: 8500, host: 9502 } 30 | - { guest: 80, host: 8002 } 31 | - { guest: 443, host: 8442 } 32 | - { guest: 8080, host: 8082 } 33 | ram: 4096 34 | shell_commands: 35 | - { shell: 'yum install -y rubygems ruby-devel git wget curl lvm2 device-mapper-libs unzip && systemctl stop firewalld && systemctl disable firewalld' } 36 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s3 && systemctl restart network'} 37 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s8 && systemctl restart network'} 38 | - { shell: 'gem install puppet_forge -v 2.2.6 && gem install r10k' } 39 | - { shell: 'echo -e "172.17.8.101 swarm-101\n172.17.8.102 swarm-102">/etc/hosts && echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc' } 40 | - { shell: 'cp /home/vagrant/swarm-102/Puppetfile /tmp && cd /tmp && r10k puppetfile install -v' } 41 | - { shell: 'cp /home/vagrant/swarm-102/modules/* -R /tmp/modules' } 42 | 43 | - 44 | box: puppetlabs/centos-7.2-64-puppet 45 | cpu: 1 46 | ip: "172.17.8.103" 47 | name: swarm-103 48 | forward_ports: 49 | - { guest: 8500, host: 9503 } 50 | - { guest: 80, host: 8003 } 51 | - { guest: 443, host: 8443 } 52 | - { guest: 8080, host: 8083 } 53 | ram: 4096 54 | shell_commands: 55 | - { shell: 'yum install -y rubygems ruby-devel git wget curl lvm2 unzip device-mapper-libs && systemctl stop firewalld && systemctl disable firewalld' } 56 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s3 && systemctl restart network'} 57 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s8 && systemctl restart network'} 58 | - { shell: 'gem install puppet_forge -v 2.2.6 && gem install r10k' } 59 | - { shell: 'echo -e "172.17.8.101 swarm-101\n172.17.8.103 swarm-103">/etc/hosts && echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc' } 60 | - { shell: 'cp /home/vagrant/swarm-103/Puppetfile /tmp && cd /tmp && r10k puppetfile install -v' } 61 | - { shell: 'cp /home/vagrant/swarm-103/modules/* -R /tmp/modules' } 62 | 63 | 64 | - 65 | box: puppetlabs/centos-7.2-64-puppet 66 | cpu: 1 67 | ip: "172.17.8.114" 68 | name: swarm-master-01 69 | forward_ports: 70 | - { guest: 8500, host: 9504 } 71 | ram: 2048 72 | shell_commands: 73 | - { shell: 'yum install -y rubygems ruby-devel git wget curl lvm2 unzip device-mapper-libs && systemctl stop firewalld && systemctl disable firewalld' } 74 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s3 && systemctl restart network'} 75 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s8 && systemctl restart network'} 76 | - { shell: 'gem install puppet_forge -v 2.2.6 && gem install r10k' } 77 | - { shell: 'echo -e "172.17.8.101 swarm-101\n172.17.8.114 swarm-master-01">/etc/hosts && echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc' } 78 | - { shell: 'cp /home/vagrant/swarm-master-01/Puppetfile /tmp && cd /tmp && r10k puppetfile install -v' } 79 | - { shell: 'cp /home/vagrant/swarm-master-01/modules/* -R /tmp/modules' } 80 | 81 | - 82 | box: puppetlabs/centos-7.2-64-puppet 83 | cpu: 1 84 | ip: "172.17.8.115" 85 | name: swarm-master-02 86 | forward_ports: 87 | - { guest: 8500, host: 9505 } 88 | ram: 2048 89 | shell_commands: 90 | - { shell: 'yum install -y rubygems ruby-devel git wget curl lvm2 unzip device-mapper-libs && systemctl stop firewalld && systemctl disable firewalld' } 91 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s3 && systemctl restart network'} 92 | - { shell: 'echo -e "PEERDNS=no\nDNS1=127.0.0.1\nDNS2=8.8.8.8">>/etc/sysconfig/network-scripts/ifcfg-enp0s8 && systemctl restart network'} 93 | - { shell: 'gem install puppet_forge -v 2.2.6 && gem install r10k' } 94 | - { shell: 'echo -e "172.17.8.101 swarm-101\n172.17.8.115 swarm-master-02">/etc/hosts && echo "PATH=\$PATH:/usr/local/bin" >> ~/.bashrc' } 95 | - { shell: 'cp /home/vagrant/swarm-master-02/Puppetfile /tmp && cd /tmp && r10k puppetfile install -v' } 96 | - { shell: 'cp /home/vagrant/swarm-master-02/modules/* -R /tmp/modules' } 97 | 98 | 99 | 100 | 101 | 102 | --------------------------------------------------------------------------------