天天看点

salt stack Demo Environments Demo Environments

Demo Environments

You can download one of the following

Vagrant

projects to quickly set up a Salt demo environment:

[17:59 t ~/vagrant/salt-vagrant-demo (master)]$ sudo dnf install -y vagrant-libvirt vagrant

[18:21 t ~]$ cd vagrant/

[18:21 t ~/vagrant]$ git clone https://github.com/UtahDave/salt-vagrant-demo.git

[18:22 t ~/vagrant]$ ls

salt-vagrant-demo

[18:22 t ~/vagrant]$ cd salt-vagrant-demo/

[18:22 t ~/vagrant/salt-vagrant-demo (master)]$

[18:17 t ~/vagrant/salt-vagrant-demo (master)]$ vagrant up    根据提示应该是libvirt的问题,开启libvirt服务

Bringing machine 'master' up with 'libvirt' provider...

Bringing machine 'minion1' up with 'libvirt' provider...

Bringing machine 'minion2' up with 'libvirt' provider...

==> master: An error occurred. The error will be shown after all tasks complete.

==> minion1: An error occurred. The error will be shown after all tasks complete.

==> minion2: An error occurred. The error will be shown after all tasks complete.

An error occurred while executing multiple actions in parallel.

Any errors that occurred are shown below.

An error occurred while executing the action on the 'master'

machine. Please handle this error then try again:

Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/t/.ssh/id_rsa:

Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

An error occurred while executing the action on the 'minion1'

An error occurred while executing the action on the 'minion2'

[18:17 t ~/vagrant/salt-vagrant-demo (master)]$

[18:22 t ~/vagrant/salt-vagrant-demo (master)]$ systemctl -a |grep libvirt

  libvirt-guests.service                                                                                         loaded    inactive dead      Suspend Active Libvirt Guests

  libvirtd.service                                                                                               loaded    active   dead      Virtualization daemon

[18:20 t ~/vagrant/salt-vagrant-demo (master)]$ systemctl start libvirtd.service

[18:20 t ~/vagrant/salt-vagrant-demo (master)]$ vagrant up    #provider问题,进入链接查看是使用virtualbox

==> minion2: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...

    minion2: Box Provider: libvirt

    minion2: Box Version: >= 0

==> minion2: Loading metadata for box 'ubuntu/trusty64'

    minion2: URL: https://atlas.hashicorp.com/ubuntu/trusty64

==> master: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...

    master: Box Provider: libvirt

    master: Box Version: >= 0

==> master: Loading metadata for box 'ubuntu/trusty64'

    master: URL: https://atlas.hashicorp.com/ubuntu/trusty64

==> minion1: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...

    minion1: Box Provider: libvirt

    minion1: Box Version: >= 0

==> minion1: Loading metadata for box 'ubuntu/trusty64'

    minion1: URL: https://atlas.hashicorp.com/ubuntu/trusty64

The box you're attempting to add doesn't support the provider

you requested. Please find an alternate box or use an alternate

provider. Double-check your requested provider to verify you didn't

simply misspell it.

If you're adding a box from HashiCorp's Atlas, make sure the box is

released.

Name: ubuntu/trusty64

Address: https://atlas.hashicorp.com/ubuntu/trusty64

Requested provider: [:libvirt]

[18:21 t ~/vagrant/salt-vagrant-demo (master)]$

[18:30 t ~/vagrant/salt-vagrant-demo (master)]$ vagrant up --provider virtualbox

...省略过程...

[09:46 t ~/vagrant/salt-vagrant-demo (master)]$ vagrant ssh --help     #使用vagrant ssh 登陆每一台机器

Usage: vagrant ssh [options] [name] [-- extra ssh args]

Options:

    -c, --command COMMAND            Execute an SSH command directly

    -p, --plain                      Plain mode, leaves authentication up to user

    -h, --help                       Print this help

[09:46 t ~/vagrant/salt-vagrant-demo (master)]$ vagrant ssh master

Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-85-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Thu Apr 21 01:29:24 UTC 2016

  System load:  0.35              Processes:           81

  Usage of /:   3.5% of 39.34GB   Users logged in:     0

  Memory usage: 25%               IP address for eth0: 10.0.2.15

  Swap usage:   0%

  Graph this data and manage this system at:

    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:

    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.

0 updates are security updates.

vagrant@saltmaster:~$

继续阅读