salt-stack

How to communicate with salt-master

倾然丶 夕夏残阳落幕 提交于 2019-12-22 11:26:54
问题 I am trying to access salt master from salt-minion. But, I am unable to get the keys on salt-master. On my VM, I installed salt-master and on my Windows, I installed salt-minion . I have given master IP address on my minion vi salt\conf\minion master: master ip address I tried to run the command below: c:\salt\salt-minion.exe -l debug -c c:\salt\conf I am getting a message like below: [DEBUG ] Reading configuration from c:\salt\conf\minion [INFO ] Using cached minion ID from c:\salt\conf

Passing variables with include in salt-stack

ぐ巨炮叔叔 提交于 2019-12-22 10:22:09
问题 I have several states that are almost the same. All of them deploy project, create virtualenv and configure supervisor. Difference is only in repo, project name and some additional actions. A lot of code is duplicated. Is it possible to put the same parts into file and include it with additional variables? In Ansible it can be done this way: tasks: - include: wordpress.yml vars: wp_user: timmy ssh_keys: - keys/one.txt - keys/two.txt 回答1: This question looks similar to this one If I understood

Are conditionals in salt stack pillar templates secure?

无人久伴 提交于 2019-12-22 05:24:13
问题 I recently saw the following construction in a salt pillar in a thread here /srv/pillar/ssh.sls : ssh_certs: {% if grains['fqdn'] == 'server1.example.com' %} dsa: | -----BEGIN DSA PRIVATE KEY----- {# key text goes here with consistant indentation... #} -----END DSA PRIVATE KEY----- ecdsa: | -----BEGIN ECDSA PRIVATE KEY----- {# key text goes here with consistant indentation... #} -----END ECDSA PRIVATE KEY----- rsa: | -----BEGIN RSA PRIVATE KEY----- {# key text goes here with consistant

Check file exists and create a symlink

守給你的承諾、 提交于 2019-12-20 10:37:03
问题 I want to do something like that: if file A exists or there is no symlink B, I want to create a symlink B -> A. For now I have: B: file: - symlink: - target: A - exists: - name: A But this is bad it checks not the thing I want. How can I achive this simple thing in salt ? 回答1: We can use file.directory_exists {% if not salt['file.directory_exists' ]('/symlink/path/A') %} symlink: file.symlink: - name: /path/to/A - target: /symlink/path/A {% endif %} 回答2: You should use Dan Garthwaite's

How do I import data in one pillar file from another?

丶灬走出姿态 提交于 2019-12-13 15:26:40
问题 The situation: We have multiple salt formulas with certain pillar-configured options that, in our environment, are identical. For example, they use the same URL for an upstream service. We would like to avoid duplicating these values in multiple pillar locations (we want a single point of truth), but we don't want to write the formulas in such a manner that they share pillar keys (orthoganality is good for the soul). It seems to me that the right way to do this is to have one pillar file with

What's the best way for a formula to provide attribute defaults?

浪尽此生 提交于 2019-12-13 13:35:09
问题 Chef has a very elaborate (maybe too much so) scheme for cookbooks to provide default values of attributes. I think Puppet does something similar with class parameters where defaults usually go into params.pp . With Salt, I've seen: specifying default value in dictionary/pillar lookups. the grains.filter_by merging of default attribute values with user-provided pillar data (e.g., map.jinja in apache-formula) in a call to file.managed state, specifying default attribute values as the defaults

EC2ResponseError: 401 Unauthorized using Saltstack boto_vpc module

馋奶兔 提交于 2019-12-13 06:49:36
问题 I'm trying to create a vpc using Saltstack and boto_vpc module. This is my state: vpc_create: module.run: - name: boto_vpc.create - cidr_block: '10.0.0.0/24' - vpc_name: 'myVpc' - region: 'us-east-1' - key: 'ADJJDNEJFJGNFKFKFKIW' - keyid: 'SJDJNFNEJUWLLLCLCLENNRBFLGSLSLKEMFUHE' The keys that I'm using are correct but I got this error : [INFO ] Running state [boto_vpc.create] at time 14:25:35.839797 [INFO ] Executing state module.run for boto_vpc.create [ERROR ] EC2ResponseError: 401

expect script works while invoking individually but not as a salt state

≡放荡痞女 提交于 2019-12-13 03:02:06
问题 I'm trying to do scp as well as ssh through expect. Below script works if I invoke it directly from terminal like /usr/bin/expect myexpect.sh but when I ran it using salt, the first scp command works where the second ssh fails. myexpect.sh #!/usr/bin/expect -f set timeout 240 spawn scp apps.tar.gz /srv/salt/integration/serverclass_merged.conf foo@10.10.10.10:/home/foo expect "password:" send "password\n"; expect eof spawn ssh -o StrictHostKeyChecking=no foo@10.10.10.10 "cd /home/foo;tar -

SaltStack and GitFS - No Top file or external nodes data matches found

一世执手 提交于 2019-12-12 16:27:07
问题 Here is my /etc/salt/master config: #GitFS gitfs_provider: pygit2 gitfs_base: DEVELOPMENT gitfs_env_whitelist: - base fileserver_backend: - git gitfs_remotes: - ssh://git@github.com/myrepo/salt-states.git: - pubkey: /root/.ssh/my.pub - privkey: /root/.ssh/my - mountpoint: salt:///srv/salt/salt-states Here is my directory structure for the repo: . |-- README.md |-- formulas | `-- test | |-- test.sls `-- top.sls Here is my very basic top.sls: base: '*': - test If i try to run highstate on my

How to compared a nested pillar key value in an if statement in jinja2 for saltstack

泄露秘密 提交于 2019-12-12 04:43:29
问题 I am working on a saltstack state with some salt wrapped in jinja2. When I attempt to compare a value from a pillar using jinja2 it appears argument evaluates to nothing. If I query the value using salt cli, it returns the expected value. I expect I am referencing the value incorrectly in the if statement with jinja2. Here is all the needed info to understand and look at this problem: Salt Master id is salt-dev Salt Minion id is on same instance and is salt-dev Here is the pillar top file: