Skip to content

Instantly share code, notes, and snippets.

==> minion1: Running provisioner: salt...
Copying salt minion config to vm.
Uploading minion keys.
Checking if salt-minion is installed
salt-minion was not found.
Checking if salt-call is installed
salt-call was not found.
Using Bootstrap Options: -P -c /tmp -F -c /tmp stable
Bootstrapping Salt... (this may take a while)
mesg:
root@saltmaster:/home/vagrant# salt -v --log-level=debug 'minion1' cp.push /etc/php/7.0/fpm/pool.d/www.conf
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Missing configuration file: /root/.saltrc
[DEBUG ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Missing configuration file: /root/.saltrc
[DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'saltmaster.local_master', 'tcp://127.0.0.1:4506', 'clear')
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
end
root@saltmaster:/home/vagrant# salt '*' test.ping
minion2:
True
minion1:
True
root@saltmaster:/home/vagrant# salt -v --log-level=debug 'minion1' cp.push /etc/php/7.0/fpm/pool.d/www.conf
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Missing configuration file: /root/.saltrc
[DEBUG ] Configuration file path: /etc/salt/master
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[INFO ] Running state [apache_packages] at time 02:18:30.457878
[INFO ] Executing state pkg.installed for apache_packages
[INFO ] Executing command ['dpkg-query', '--showformat', '${Status} ${Package} ${Version} ${Architecture}\n', '-W'] in directory '/root'
[INFO ] Executing command ['apt-get', '-q', '-y', '-o', 'DPkg::Options::=--force-confold', '-o', 'DPkg::Options::=--force-confdef', 'install', 'apache2-utils', 'apache2'] in directory '/root'
2016-07-27 02:18:39,668 [salt.utils.vt.Terminal.PID-18369.STDOUT][DEBUG ][18127] [INFO ] Executing command ['dpkg-query', '--showformat', '${Status} ${Package} ${Version} ${Architecture}\n', '-W']
in directory '/root'
[INFO ] Made the following changes:
'apache2-data' changed from 'absent' to '2.4.18-2ubuntu3.1'
'libapr1' changed from 'absent' to '1.5.2-3'
'apache2-utils' changed from 'absent' to '2.4.18-2ubuntu3.1'
apache_packages:
pkg.installed:
- pkgs:
- apache2
- apache2-utils
apache2:
service.running:
- watch:
- file: /etc/apache2/apache2.conf
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Wed 2016-07-27 22:29:24 EDT; 6min ago
Docs: man:systemd-sysv-generator(8)
Jul 27 22:29:24 web1 apache2[13819]: *
Jul 27 22:29:24 web1 apache2[13819]: * The apache2 configtest failed.
Jul 27 22:29:24 web1 apache2[13819]: Output of config test was:
# init.sls
apache-restart:
module.wait:
- name: service.restart
- m_name: {{ apache.service }}
# modules.sls
include:
# prod-profiles.conf
base:
provider: do
image: ubuntu-16-04-x64
size: 512mb
location: nyc1
private_networking: True
ipv6: True
backups_enabled: False
##
- A profile for both my Staging and Production servers (for now, just single webservers, but later optional H/A)
- Environment Map for my Staging server(s)
- Environment Map specifically for my Production servers that each host a "Site"
- Pillars that apply to all servers, but "Site" specific pillars as well, each in their own SLS file
- States that apply to their relevant servers (Web, Database, etc)
- Orchestration file that basically heads up the "Applying" of my entire infrastructure state when things change, like adding a new site, re-syncing my connection between Staging/Prod sites for Database migrations, etc
For now, I would write these SLS and Map files by hand, but when I finally write my own GUI for managing these "Sites", I can create the objects, use a YAML encoder and write the YAML files programmatically
The other option down the road would be to write my own connector that delivers Salt Pillar Data, etc in the same way "Reclass" does.