云执行模块 - 配置文件未定义 Salt Stack

Cloud execution module - Profile is not defined Salt Stack

我正在尝试设置云执行模块,每次我尝试使用 "salt-cloud -p ec2_east_nano_prod saltcloud_nano_test" 启动测试实例时,我都会收到错误消息:

    [DEBUG   ] Reading configuration from /etc/salt/cloud
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Missing configuration file: /etc/salt/cloud.providers
[DEBUG   ] Including configuration from '/etc/salt/cloud.providers.d/abc.conf'
[DEBUG   ] Reading configuration from /etc/salt/cloud.providers.d/abc.conf
[INFO    ] There's at least one cloud driver under the '-east-2-public' cloud provider alias which does not have the required 'driver' setting. Removing it from the available providers listing.
[DEBUG   ] Missing configuration file: /etc/salt/cloud.profiles
[DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/ec2_us_west-2.conf'
[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/ec2_us_west-2.conf
[DEBUG   ] Configuration file path: /etc/salt/cloud
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[INFO    ] salt-cloud starting
[DEBUG   ] Could not LazyLoad parallels.avail_sizes: 'parallels' __virtual__ returned False
[DEBUG   ] LazyLoaded parallels.avail_locations
[DEBUG   ] LazyLoaded proxmox.avail_sizes
[DEBUG   ] Could not LazyLoad saltify.destroy: 'saltify.destroy' is not available.
[DEBUG   ] Could not LazyLoad saltify.avail_sizes: 'saltify.avail_sizes' is not available.
[DEBUG   ] Could not LazyLoad saltify.avail_images: 'saltify.avail_images' is not available.
[DEBUG   ] Could not LazyLoad saltify.avail_locations: 'saltify.avail_locations' is not available.
[DEBUG   ] Could not LazyLoad rackspace.reboot: 'rackspace.reboot' is not available.
[DEBUG   ] LazyLoaded openstack.list_locations
[DEBUG   ] Could not LazyLoad rackspace.list_locations: 'rackspace.list_locations' is not available.
[ERROR   ] Profile ec2 is not defined
[DEBUG   ] LazyLoaded nested.output
Error:
    Profile ec2 is not defined

设置

/etc/salt/cloud.profiles.d/ec2_us_west-2.conf

ec2:
  provider: ec2-us-east-2-public
  image: ami-41e7cb24
  size: t2.micro
  ssh_username: ubuntu
  tag: {'Environment': 'production'}
  sync_after_install: grains
  minion:
        master: 172.31.17.185

这是 provider.d 文件:

ec2-us-east-2-public:
  minion:
    master: master
  id: '**********'
  key: '******+******'
  private_key: /etc/salt/***.pem
  keyname: ***
  ssh_interface: public_ips
  securitygroup: default
  location: us-west-2
  availability_zone: us-west-2a
  provider: ec2
  del_root_vol_on_destroy: True
  del_all_vols_on_destroy: True
  rename_on_destroy: True

版本报告

盐版本:

           Salt: 2017.7.4

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Dec  4 2017, 14:50:18)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-1038-aws
         system: Linux
        version: Ubuntu 16.04 xenial

我不确定是否需要定义 "provider: pillar['cloud'][etc]"。

在您的 provider.d 文件中,尝试使用 "driver" 而不是 "provider",类似于 salt-cloud quick start.

This page notes that this field was changed some years ago.

Changed in version 2015.8.0.

The provider parameter in cloud provider definitions was renamed to driver. This change was made to avoid confusion with the provider parameter that is used in cloud profile definitions. Cloud provider definitions now use driver to refer to the Salt cloud module that provides the underlying functionality to connect to a cloud host, while cloud profiles continue to use provider to refer to provider configurations that you define.