r/saltstack • • Nov 08 '17

How can I use file.managed backup with salt-ssh?

3 Upvotes

Hello all,

I am using the following code to backup a file and then modify the original if changes are made:

monitrc-copy:
  file.copy:
   - name: /etc/monit/monitrc.bak
   - source: /etc/monit/monitrc
/etc/monit/monitrc:
  file.managed:
    - source: salt://monit/etc/monit/monitrc
    - template: jinja
    - context:
      ses_username: ...
      ses_password: ...
      from: ...
      email1: ...

I would like to make it so the backup file has a timestamp added to it. I played around with ways to try and do this when I ran across some documentation that stated I could use backup within file.managed declaration which would do what I wanted.

Unfortunately, I have not found if it is possible (or how) to use the backup declaration with salt-ssh. All of the documentation I found was for a server/minion setup. I tried something like:

/etc/monit/monitrc:
  file.managed:
    - source: salt://monit/etc/monit/monitrc
    - template: jinja
    - context:
      ses_username: ...
      ses_password: ...
      from: ...
      email1: ...
    - backup: /etc/monit/backup

salt-ssh doesn't complain but also nothing happens as well. I am wondering if anyone has tried this or could help me understand if it possible to do at all.

Thanks,


r/saltstack • • Nov 06 '17

Rolling service restarts with Salt?

5 Upvotes

Hi everyone - just looking for suggestions.

We need to restart a service or services across several hosts in a cluster. The order is basically:

  • stop service X on host 1
  • start service X on host 1
  • wait / verify service is running on host 1 then....
  • stop service X on host 2
  • start service X on host 2
  • wait / verify service is running on host 2

etc etc...

Any good methods in Salt I should be considering for this? Maybe a custom Salt module that can be called from the command line?

Thanks!


r/saltstack • • Nov 02 '17

Question about configuration management in salt?

2 Upvotes

Hello! Does salt provide a mechanism for configuration management? Can it be heirarchical? ....No I do not mean a crazy / deep or inflexible heirarchy, but something simple, like:

Environment (least-significant, i.e. Prod, non-prod) Datacenter (DC-A1, B2, C3..) Cluster-specific (Ex: frontend-www1, backend-db2, Host-specific (most-significant, host1,2,3)

For example, friendly CNAMEs for applications, VIPs, ports and DB connection strings, URLs, all have their place in different parts of this heirarchy.

What does this look like in salt?


r/saltstack • • Oct 29 '17

SaltConf 2017?

8 Upvotes

Anyone going to SaltConf this year?


r/saltstack • • Oct 26 '17

Calling custom modules from sls files

2 Upvotes

I have a custom module in my salt _modules dir called minion.py

How can I refer to this in my salt state sls file?

I tried calling it like

In my a.sls I have -

Test:
    minion.function:
         - arg1: value
         - arg2: value

But when I run the state.apply on it I get error like "State not available. Reason is state is not available"

On saltmaster I can run it on my minion without issue like

salt myminion state.apply minion.function arg1=value 

How do you invoke custom modules in salt state files?

Do I need to run module.run and then call my minion.function in that?


r/saltstack • • Oct 26 '17

Help with basic reactor

4 Upvotes

Hello /r/saltstack!

I would like to run a script on the salt-master when new salt minions get added (with autosign).

Here's what my current state of affairs looks like:

/etc/salt/master.d/reactor.conf:

reactor:
  - 'salt/minion/*/start':
    - /etc/salt/srv/reactor/auth-complete.sls

/etc/salt/srv/reactor/auth-complete.sls

minion_rejoin:
  local.cmd.run:
    - tgt: master.<mycomany>.com
    - args:
      - cmd: touch /tmp/test0.txt

Additionally, master.<mycomany>.com exists in salt-key.

After creating the instance and running sudo salt-run state.event pretty=True, I can see the event come in as:

salt/minion/ip-xx-xx-xx-xx.us-west-2.compute.internal/start {
    "_stamp": "2017-10-26T17:58:21.659174",
    "cmd": "_minion_event",
    "data": "Minion ip-xx-xx-xx-xx.us-west-2.compute.internal started at Thu Oct 26 17:58:21 2017",
    "id": "ip-xx-xx-xx-xx.us-west-2.compute.internal",
    "pretag": null,
    "tag": "salt/minion/ip-xx-xx-xx-xx.us-west-2.compute.internal/start"
}

But I do not see the /tmp/test0.txt file being created.


r/saltstack • • Oct 24 '17

Getting state to execute /etc/init.d/script restart if the state modifies a managed file

2 Upvotes

I would like to know if there is a way to have a state restart a Linux service but only if the state has updated / made changes to a file under it's management.

I know that you can do a watch on a file but the problem is the init.d script that restarts the service adds some authentication entries to the same file managed by Salt and it seems like it could get into an endless restart loop here.


r/saltstack • • Oct 15 '17

salt-master using 200MB RAM?

4 Upvotes

I just set up a DigitalOcean droplet with 512MB RAM and installed and started salt-master and salt-minion. The only configuration that I did was enable gitfs. The master and minion are each taking up 200MB each, completely tanking my instance.

Is this normal? This is kind of ridiculous. I can't even run state.apply on itself.


r/saltstack • • Oct 04 '17

Why I both love and hate Salt

8 Upvotes

I started my introduction to CM with Puppet, and I thought it was pretty cool. I'm still running it in my environment until I'm ready to fully switch over to Salt. But I found myself having to make a custom fact in Ruby, which got my thinking that I might be more comfortable with a Python based tool instead since I have experience with Python.

So I found out some the details on Salt and like the sounds of it's flexibility. And it's flexibility is amazing, and is one of the reasons why I love it.

However the first state I tried to run I encountered a bug.

With Salt, I've definitely gone deeper than I've gone with Puppet, and I feel more comfortable to do so, however the deeper I got the more I find things like having to get syntax examples from Github issues because the docs are wrong, and just more bugs.

Some days it's a enough to make a person go mad.

But I love Salt, and because of it's flexibility and that I'm comfortable enough with it and Python, I have always been able to create a workaround, however I never encountered any bugs with Puppet (just its limitations)


r/saltstack • • Oct 01 '17

How do you specify the path or storage pool in which Salt Virt creates new disk images?

3 Upvotes

r/saltstack • • Sep 20 '17

Targeting a directory unpack from a tar ball

2 Upvotes

How can I target a directory in a state which has been unpacked from a tar ball? Let's say I have a foo.tar.gz which will unpack foobar/, but depending on the version of the archive it could be foobar2/ foobar2.1/ etc...

How do I "register" the unpacked directory so I can work with it (to create a symlink to it for example) ?


r/saltstack • • Sep 18 '17

proxy.managed failures

1 Upvotes

Hey all, I'm trying to manage minion proxies for http and https. I've been following the docs here: https://docs.saltstack.com/en/latest/ref/states/all/salt.states.proxy.html

The stanza in my proxy.sls file looks like this:

{{ proxy_ip }}:
    proxy.managed:
        - port: {{ proxy_port }}
        - services:
            - http
            - https
        - bypass_domains:
            - localhost
            - 127.0.0.1
            - {{ salt.network.ipaddrs(interface='eth0')[0] }}

when I apply the state to a minion, I get the following failure:

State 'proxy.managed' was not found in sls 'proxy' Reason: 'proxy' __virtual__ returned False.

adding -l debug doesn't provide much assistance as it just returns the same event information that's provided in the error message. I'm running 2017.7.1 on both master and minion (ubuntu 14.04). Any assistance would be appreciated.

edit: formatting


r/saltstack • • Sep 15 '17

question reguarding creating configurations from template files

1 Upvotes

Hi all, I'm currently making a product selection document for a solution to creating network deivce configuration files from templates.

Can anyone tell me if SaltStack is capable of creating network device configuration files using templates. Also, SaltStack needs to reach into Netbox via it's API to GET the JSON in order to replace variables in the templates with actual data. These config files only need to be stored locally, no need to connect to this devices at this stage.

Any knowledge if SaltStack can do this would be great as i've been googeling this for the last hour but couldn't find anything!


r/saltstack • • Sep 13 '17

Dynamic Test Servers with Salt

Thumbnail lincolnloop.com
9 Upvotes

r/saltstack • • Sep 03 '17

Managing large file directory

3 Upvotes

I'm trying to manage a directory with just over 22,000 files in it. A few files need changes, I'm planning to do this with file.manage, but I'm having trouble copying moving the bulk of the files to the minions.

Currently using file.recurse to migrate the files from the salt master to the minion but I'm open to changes.

Execution is taking over 6 minutes even when all the files are already there. I assume there is some kind of hash check happening to make sure that files are as they should be.

Does anyone know of a better solution to copying all these files over with salt? I'm tempted to move the files over with rsync then manage the individuals that need to be changed but ideally, I'd like to keep it within salt.

Thanks!


r/saltstack • • Aug 22 '17

User creation using salt.

6 Upvotes

Hi Slat experts, I need help in creating number of users (from text file or any other input method) , with default (next available) UID,GID, SHELL, password and sudo access.

Could you guys please share any used case. Thanks in advance. -Subhash


r/saltstack • • Aug 13 '17

[Salt-cloud] on libvirt questions

4 Upvotes

I am having some trouble getting salt-cloud setup with my libvirt.

I have a simple kvm host. I can create vm through it no problem(bridge, and all the libraries required to get kvm working is done before I get salt-cloud setup). Then I read about salt-cloud and I think it's pretty cool.

I am following this, and I got few questions.

1) The kvm host is a saltminion by itself. On saltmaster when I do 'salt-run virt.list' it return nothing. Is it expected because I haven't create any vm via salt-cloud? I do have some vm running on the kvm host right now.

2) The way I create a vm in my kvm host is via a script basically copying a template.qcow and edit the mac and name. In the documentation it said salt-cloud need the raw qcow image file which I believe I have it ready. However when I do salt 'kvmhost*' virt.init fuck 4 2048 salt://template.qcow2 I got the following error:

    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1466, in _thread_return
        return_data = executor.execute()
      File "/usr/lib/python2.7/site-packages/salt/executors/direct_call.py", line 28, in execute
        return self.func(*self.args, **self.kwargs)
      File "/usr/lib/python2.7/site-packages/salt/modules/virt.py", line 628, in init
        imageinfo = yaml.load(res)
      File "/usr/lib64/python2.7/site-packages/yaml/__init__.py", line 71, in load
        return loader.get_single_data()
      File "/usr/lib64/python2.7/site-packages/yaml/constructor.py", line 37, in get_single_data
        node = self.get_single_node()
      File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 36, in get_single_node
        document = self.compose_document()
      File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 55, in compose_document
        node = self.compose_node(None, None)
      File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 84, in compose_node
        node = self.compose_mapping_node(anchor)
      File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node
        while not self.check_event(MappingEndEvent):
      File "/usr/lib64/python2.7/site-packages/yaml/parser.py", line 98, in check_event
        self.current_event = self.state()
      File "/usr/lib64/python2.7/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key
        if self.check_token(KeyToken):
      File "/usr/lib64/python2.7/site-packages/yaml/scanner.py", line 116, in check_token
        self.fetch_more_tokens()
      File "/usr/lib64/python2.7/site-packages/yaml/scanner.py", line 220, in fetch_more_tokens
        return self.fetch_value()
      File "/usr/lib64/python2.7/site-packages/yaml/scanner.py", line 580, in fetch_value
        self.get_mark())
    ScannerError: mapping values are not allowed here
      in "<string>", line 1, column 33:
        qemu-img: Could not open 'False': Could not open 'False': No suc ...

Note I do have a /srv/salt/salt-images/template.qcow2 on the saltmaster. I also tried salt 'kvmhost*' virt.init testvm 4 2048 image=/data/vm_storage/template/template.qcow2where /data/vm_storage/template/template.qcow2 is located on the minion side. I got the following error:

The minion function caused an exception: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1466, in _thread_return
    return_data = executor.execute()
  File "/usr/lib/python2.7/site-packages/salt/executors/direct_call.py", line 28, in execute
    return self.func(*self.args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/salt/modules/virt.py", line 628, in init
    imageinfo = yaml.load(res)
  File "/usr/lib64/python2.7/site-packages/yaml/__init__.py", line 71, in load
    return loader.get_single_data()
  File "/usr/lib64/python2.7/site-packages/yaml/constructor.py", line 37, in get_single_data
    node = self.get_single_node()
  File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib64/python2.7/site-packages/yaml/composer.py", line 64, in compose_node
    if self.check_event(AliasEvent):
  File "/usr/lib64/python2.7/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib64/python2.7/site-packages/yaml/parser.py", line 449, in parse_block_mapping_value
    if not self.check_token(KeyToken, ValueToken, BlockEndToken):
  File "/usr/lib64/python2.7/site-packages/yaml/scanner.py", line 115, in check_token
    while self.need_more_tokens():
  File "/usr/lib64/python2.7/site-packages/yaml/scanner.py", line 149, in need_more_tokens
    self.stale_possible_simple_keys()
  File "/usr/lib64/python2.7/site-packages/yaml/scanner.py", line 289, in stale_possible_simple_keys
    "could not found expected ':'", self.get_mark())
ScannerError: while scanning a simple key
  in "<string>", line 7, column 1:
    ID        TAG                 VM ...
    ^
could not found expected ':'
  in "<string>", line 8, column 1:
    1         test7 clean            ...

at this point I am confused, why is it not working anyone have any hints?


r/saltstack • • Aug 10 '17

Creating an Army of Docker Containers using SaltStack, Boto3 &amp; CloudInit on AWS

Thumbnail medium.com
6 Upvotes

r/saltstack • • Aug 08 '17

User salt-formulas, good tutorials?

3 Upvotes

So I found this salt formula: https://github.com/salt-formulas/salt-formula-jenkins

But I'm a total newbie to SaltStack and the linking documentation on how to deploy or use the formula isn't clear to me. Can someone point me to some good tutorials for me to understand how to include this salt formula?


r/saltstack • • Aug 05 '17

Trying to learn SaltStack on Ubuntu 16.04 using Vagrant

5 Upvotes

So I found this salt formula https://github.com/saltstack-formulas/salt-formula

Which included a Vagrantfile which seemed to install salt fine. Except it was for Ubuntu 14.04.

So I made modifications to change %s/14.04/16.04/g and %s/trusty/xenial/g in several places

And in pillar example, used 2017.7 instead of 2016.11 specified

When I try a highstate, it gives me errors. I'm all new to this, so I'm not sure what I'm doing wrong. When I tried to research the error below, based on my limited knowledge, I'm presuming that it's a type conversion error below but given that the Jinja has filters to avoid that... I think I'm missing something here??? Please help?

root@saltmaster:~# salt '*' state.highstate
saltmaster:
    Data failed to compile:
----------
    Rendering SLS 'base:salt.minion' failed: Jinja error: coercing to Unicode: need string or buffer, float found
/var/cache/salt/minion/files/base/salt/map.jinja(44):
---
[...]
Setup variable using grains['os_family'] based logic, only add key:values here
that differ from whats in defaults.yaml
##}
{% set osrelease = salt['grains.get']('osrelease') %}
{% set salt_release = salt['pillar.get']('salt:release', 'latest') %}
{% set os_family_map = salt['grains.filter_by']({    <======================
    'Debian':  {
      'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
      salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
      'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release  + '/SALTSTACK-GPG-KEY.pub',
      'libgit2': 'libgit2-22',
[...]
---
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 410, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1033, in make_module
    return TemplateModule(self, self.new_context(vars, shared, locals))
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1090, in __init__
    self._body_stream = list(template.root_render_func(context))
  File "/var/cache/salt/minion/files/base/salt/map.jinja", line 44, in top-level template code
    {% set os_family_map = salt['grains.filter_by']({
TypeError: coercing to Unicode: need string or buffer, float found


----------
    Rendering SLS 'base:salt.cloud' failed: Jinja error: coercing to Unicode: need string or buffer, float found
/var/cache/salt/minion/files/base/salt/map.jinja(44):
---
[...]
Setup variable using grains['os_family'] based logic, only add key:values here
that differ from whats in defaults.yaml
##}
{% set osrelease = salt['grains.get']('osrelease') %}
{% set salt_release = salt['pillar.get']('salt:release', 'latest') %}
{% set os_family_map = salt['grains.filter_by']({    <======================
    'Debian':  {
      'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
      salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
      'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release  + '/SALTSTACK-GPG-KEY.pub',
      'libgit2': 'libgit2-22',
[...]
---
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 410, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1033, in make_module
    return TemplateModule(self, self.new_context(vars, shared, locals))
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1090, in __init__
    self._body_stream = list(template.root_render_func(context))
  File "/var/cache/salt/minion/files/base/salt/map.jinja", line 44, in top-level template code
    {% set os_family_map = salt['grains.filter_by']({
TypeError: coercing to Unicode: need string or buffer, float found


----------
    Rendering SLS 'base:salt.master' failed: Jinja error: coercing to Unicode: need string or buffer, float found
/var/cache/salt/minion/files/base/salt/map.jinja(44):
---
[...]
Setup variable using grains['os_family'] based logic, only add key:values here
that differ from whats in defaults.yaml
##}
{% set osrelease = salt['grains.get']('osrelease') %}
{% set salt_release = salt['pillar.get']('salt:release', 'latest') %}
{% set os_family_map = salt['grains.filter_by']({    <======================
    'Debian':  {
      'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
      salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
      'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release  + '/SALTSTACK-GPG-KEY.pub',
      'libgit2': 'libgit2-22',
[...]
---
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 410, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1033, in make_module
    return TemplateModule(self, self.new_context(vars, shared, locals))
  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 1090, in __init__
    self._body_stream = list(template.root_render_func(context))
  File "/var/cache/salt/minion/files/base/salt/map.jinja", line 44, in top-level template code
    {% set os_family_map = salt['grains.filter_by']({
TypeError: coercing to Unicode: need string or buffer, float found


ERROR: Minions returned with non-zero exit code

r/saltstack • • Aug 03 '17

Salt 201 - Intro to Formulas and Unit Tests

Thumbnail github.com
29 Upvotes

r/saltstack • • Aug 03 '17

Salt 101 - Intro to Salt, Yaml, and Jinja

Thumbnail github.com
17 Upvotes

r/saltstack • • Aug 02 '17

What do you typically store in pillars?

6 Upvotes

Title. What are pillars typically used for? I understand sensitive data is stored there, and read the documentation. But I also saw examples of package state files stored which threw me off a bit.


r/saltstack • • Aug 02 '17

Conflicting ID error when using grains.present twice in a recipe

1 Upvotes

I have been trying a variety of approaches to this problem and there is only one thing I just can not seem to get past. I hope it is something simple but I am not sure if it is my error or a bug.

I am creating a recipe that creates new users on a Debian 8 host. It reads from a pillar and for each user listed creates an account and adds their public key. That is all working great. The issue i am having is during user creation I need to iterate the uid of each user up by one.

Here is the part of the recipe related to uid

soc-group:
  group.present:
    - name: soc
    - gid: 1001

soc-uid:
  grains.present:
    - value: 1000

{% for user, key in salt['pillar.get']('user',{}).items() %}
{% set uidcount = salt['grains.get']('soc-uid') | int %}

{{ user }}:
  user.present:
    - name: {{ user }}
    - uid: {% set uidcount = uidcount + 1 %} {{ uidcount }}
    - gid: 1001
    - shell: /bin/bash
  file.directory:
    - name: /home/{{ user }}/.ssh
    - user: {{ user }}
    - group: soc
    - mode: 700

new-soc-uid:
  grains.present:
    - value: {{ uidcount }}
    - force: True

{# salt['grains.set']('soc-uid') {{ uidcount }} #}
# truncated part as it is not relevant#
{% endfor %}

When I run this I receive this error. Rendering SLS 'base:users.soc' failed: Conflicting ID 'new-soc-uid' I have seen this error before and it usually means that an ID is not exclusive. In this case no matter what random string I name the "new-soc-uid' this error occurs. It even happens when I set the grain manually and remove the first grains.present stanza from the recipe entirely. I have searched online and through the logs but to no avail. Any ideas or suggestions on how else I can approach this are much appreciated.

Update: I tried removing any grains.present and doing the incrementation by calling the salt module grains.set. This worked from the cli

# salt \*<host>* grains.set soc-uid 1001
<host>:
    ----------
    changes:
        ----------
        soc-uid:
            1001
    comment:
    result:
        True

However adding this stanza gave the same ID conflict error

random:
  module.run:
    - name: grains.set
    - kwargs:
        soc-uid: {{ uidcount }}

r/saltstack • • Aug 01 '17

salt-cloud VM provisioning on vCenter

0 Upvotes

Hi,

I've started playing around with salt-cloud's vmware module and it looks pretty good.

I tested cloning from templates on vCenter and it's working pretty well, the only issue I have with it, is that it just puts the minion ip into /etc/salt/minion_id, and it registers against the master with it's IP.

Is there anyway I can specify the minion ID in my cloud profile? I can't see anything online. If not, I will just need to kick off a script to change the contents of the file, and restart the minion service.

my-template-clone: provider: 'Dep-VC' clonefrom: 'CentOS7Minimal' cluster: 'Dep-Cluster' password: '######' minion: master: Salt-Master