其他分享
首页 > 其他分享> > saltstack的jinja模块应用

saltstack的jinja模块应用

作者:互联网

 vim /srv/pillar/web/vars.sls
{% if grains['fqdn'] == 'server3' %}
webserver: httpd
state: master
ip: 172.25.60.3
port: 8080
{% elif grains['fqdn'] == 'server4' %}
webserver: nginx
state: backup
ip: 172.25.60.4
port: 80
{% endif %}

在这里插入图片描述

httpd-install:
  pkg.installed:
    - pkgs:
      - httpd:
      - php:
      - httpd-tools

  file.managed:
    - name: /etc/httpd/conf/httpd.conf
    - source: salt://apache/files/httpd.conf
    - user: root
    - group: root
    - mode: 644
    - template: jinja
    - context:
        port: {{pillar['port']}}
        host: {{pillar['ip']}}

在这里插入图片描述

标签:httpd,jinja,conf,ip,pillar,sls,模块,saltstack,port
来源: https://blog.csdn.net/qq_42311209/article/details/91803683