【问题标题】:Using formulas with saltstack使用带有盐堆的公式
【发布时间】:2014-08-20 13:00:31
【问题描述】:

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

我用 git 从 git 下载了 repo

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

git clone https://github.com/saltstack-formulas/postgres.git

到我的 /srv/salt 目录。

然后我添加了行

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

在 /etc/salt/master 文件中。

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

include:
   - apache

使用

运行此即时消息

salt '*' state.highstate

我得到的只是错误消息:

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 上阅读了手册,但是这本手册一点帮助都没有!

【问题讨论】:

    标签: salt-stack


    【解决方案1】:

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

    include:
      - apache
    
    base:
       '*':
           - apache
    

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

    base:
       '*':
           - apache
    

    【讨论】:

    • 您不需要也不想要 top.sls 中的“include”部分
    【解决方案2】:

    这可能对您的特定情况没有用,但我发现我遇到的问题是我将gitfs_root 定义为一个子文件夹。这使我们能够构建一个内部存储库,为状态和支柱提供不同的子文件夹。

    当我设置我的第一个公式时,gitfs_root 表示所有公式都不起作用,因为它正在查找每个公式的子文件夹。

    我将配置移到了特定的仓库。

    之前:

    gitfs_root: salt
    
    gitfs_remotes:
        - https://github.com/this-is/saltstack-formula
        - https://github.com/internal/salt-repo
    

    之后:

    # gitfs_root:
    
    gitfs_remotes:
        - https://github.com/this-is/saltstack-formula
        - https://github.com/internal/salt-repo
            - root: salt
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-16
      • 1970-01-01
      • 2017-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多