zoukankan      html  css  js  c++  java
  • Saltstack module defaults 详解

    defaults.update

    defaults.update
        Allows to set defaults for group of data set e.g. group for nodes.
    
        This function is a combination of defaults.merge
        and defaults.deepcopy to avoid redundant in jinja.
    
        Example:
    
            group01:
              defaults:
                enabled: True
                extra:
                  - test
                  - stage
              nodes:
                host01:
                  index: foo
                  upstream: bar
                host02:
                  index: foo2
                  upstream: bar2
    
            {% do salt['defaults.update'](group01.nodes, group01.defaults) %}
    
        Each node will look like the following:
    
            host01:
              enabled: True
              index: foo
              upstream: bar
              extra:
                - test
                - stage
    
    merge_lists : True
        If True, it will also merge lists instead of replace their items.
    
    in_place : True
        If True, it will merge into dest dict.
        if not it will make a new copy from that dict and return it.
    
    It is more typical to use this in a templating language in formulas,
    instead of directly on the command-line.
    

    defaults.get

    defaults.get is used much like pillar.get except that it will read
    a default value for a pillar from defaults.json or defaults.yaml
    files that are stored in the root of a salt formula.
    
    CLI Example:
    
        salt '*' defaults.get core:users:root
    
    The defaults is computed from pillar key. The first entry is considered as
    the formula namespace.
    
    For example, querying ``core:users:root`` will try to load
    ``salt://core/defaults.yaml`` and ``salt://core/defaults.json``.
    

    defaults.deepcopy

    defaults.deepcopy
        Allows deep copy of objects in formulas.
    
        By default, Python does not copy objects,
        it creates bindings between a target and an object.
    
    It is more typical to use this in a templating language in formulas,
    instead of directly on the command-line.
    

    defaults.merge

    defaults.merge
        Allows deep merging of dicts in formulas.
    
    merge_lists : False
        If True, it will also merge lists instead of replace their items.
    
    in_place : True
        If True, it will merge into dest dict,
        if not it will make a new copy from that dict and return it.
    
        CLI Example:
        salt '*' default.merge a=b d=e
    
    It is more typical to use this in a templating language in formulas,
    instead of directly on the command-line.
  • 相关阅读:
    SpringBoot自动装配源码
    对称加密、非对称加密、数字签名
    k8s部署mysql数据持久化
    docker部署 springboot 多模块项目+vue
    ES入门及安装软件
    prometheus入门介绍及相关组件、原理讲解
    流水线 Sonar 代码扫描
    postgresql数据库 查询表名、备注及字段、长度、是否可控、是否主键等信息
    Helm中Tiller镜像下载失败的解决办法
    程序员孔乙己
  • 原文地址:https://www.cnblogs.com/randomlee/p/Saltstack_module_defaults.html
Copyright © 2011-2022 走看看