在 saltstack 中使用公式 [英] Using formulas with saltstack

查看:36
本文介绍了在 saltstack 中使用公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 saltstack 的新手,我想通过使用 saltstack 公式安装 postgres 或 apache 或其他任何东西.

I'm new on saltstack and I want to install postgres or apache or anyting else by using saltstack formulas.

我用

git clone https://github.com/saltstack-formulas/apache-formula.git

git 克隆 https://github.com/saltstack-formulas/postgres.git

到我的/srv/salt 目录.

to my /srv/salt directory.

之后我添加了行

file_roots:
base:
      - /srv/salt
      - /srv/formulas/apache-formula
      - /srv/formulas/postgres

在/etc/salt/master 文件中.

in /etc/salt/master file.

然后我在文件夹/srv/salt 中创建了一个文件 top.sls,内容如下:

Then i created a file top.sls in the folder /srv/salt with the content:

include:
   - apache

使用

salt '*' state.highstate

我得到的只是错误信息:

and all i get is the error message:

xxx.yyyyyyy.com:
----------
      ID: states
Function: no.None
  Result: False
 Comment: No Top file or external nodes data matches found
 Changes:   

Summary
------------
Succeeded: 0
Failed:    1
------------
Total:     1

我做错了什么?我阅读了 http://docs.saltstack.com/上的手册en/latest/topics/development/conventions/formulas.html 但本手册根本没有帮助!

What did i wrong? I read the manual on http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html but this manual doesn't help at all!

推荐答案

你必须在 top.sls 文件中告诉 salt 状态适用于谁:

You have to tell salt to whom the state applies in your top.sls file:

include:
  - apache

base:
   '*':
       - apache

更新:正如 Utah_Dave 指出的那样,我忽略了您将公式添加到 file_roots,您不需要包含指令.只需这样做:

Update: As Utah_Dave points out, I overlooked that you had the formula added to file_roots, you don't need the include directive. Just do this:

base:
   '*':
       - apache

这篇关于在 saltstack 中使用公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆