首页 > 其他分享 >SaltStack 四

SaltStack 四

时间:2022-11-25 12:00:49浏览次数:45  
标签:httpd name service conf file SaltStack php

# Apache监听本地IP地址  结合jinjia模板

变量使用Grains: {{ grains['fqdn_ip4'][0]}}
变量使用执行模块: {{salt['network.hw_addr']('eth0')}}
变量使用Pillar: {{pillar['apache']['PORT']}}

# lamp-jinjia.sls

lamp-install:
pkg.installed:
- pkgs:
- httpd
- php
- php-pdo
- php-mysql

apache-config:
file.managed:
- name: /etc/httpd/conf/httpd.conf
- source: salt://web/files/httpd.conf
- user: root
- group: root
- mode: 644
- template: jinja
- defaults:
PORT: 80
IPADDR: {{ grains['fqdn_ip4'][0] }}
- require:
- pkg: lamp-install

apache-auth:
pkg.installed:
- name: httpd-tools
- require_in:
- cmd: apache-auth
cmd.run:
- name: htpasswd -bc /etc/httpd/conf/htpasswd_file admin admin
- unless: test -f /etc/httpd/conf/htpasswd_file

apache-conf:
file.recurse:
- name: /etc/httpd/conf.d
- source: salt://web/files/apache-conf.d
- watch_in:
- service: lamp-service

/etc/php.ini:
file.managed:
- source: salt://web/files/php.ini
- user: root
- group: root
- mode: 644
- watch_in:
- service: lamp-service

lamp-service:
service.running:
- name: httpd
- enable: True
- reload: True
- watch:
- file: apache-config

标签:httpd,name,service,conf,file,SaltStack,php
From: https://blog.51cto.com/u_13940603/5886235

相关文章

  • SaltStack 三
    #salt数据系统:Grains&Pillar#Minion启动时收集(静态数据)#grains应用场景:grains可以再salt系统中用于配置管理模块Grains可以以target中使用,用来匹配Minion......
  • SaltStack 二
    #Tomcat安装管理1.vimtomcat.slsjdk-install:pkg.installed:-name:java-1.8.0-openjdktomcat-install:file.managed:-name:/usr/local/src/apache-tomc......
  • saltstack服务端与客户端通信问题处理
    jenkins发布报错:ERROR:NoreturnreceivedNominionsmatchedthetarget.Nocommandwassent,nojidwasassigned.saltstack分为服务端master与客户端minion配置文......