在CentOS6上使用saltstack配置Apache ssh模块
首先先备份:# cp -a pack.sls pack.sls.bak
# pwd
/srv/salt/base/httpd
#
如下是渲染配置文件的状态,需要注意YMAL格式不要错误,在如下的案例中其中调用了GRAINS模板;
# cat /srv/salt/base/httpd/pack.sls
apache:
pkg.installed:
{%if grains['os'] == 'CentOS'%}
- name: httpd
{% endif %}
service.running:
{% if grains['os'] == 'CentOS'%}
- name: httpd
{% endif %}
- watch:
- pkg: apache
# - file: /etc/httpd/conf/httpd.conf
- user: apache
user.present:
- uid: 48
- gid: 48
- shell: /sbin/nologin
- require:
- group: apache
group.present:
- gid: 48
- require:
- pkg: apache
/etc/httpd/conf/httpd.conf:
file.managed:
# - source: salt://httpd/httpd.conf
- user: root
- group: root
- mode: 644
- backup: minion
#
测试是否正常“
# salt 'salt_client1' state.highstate test=True
如果报错可以在客户端minion上如下debug
# salt-call state.highstate -l debug
minion也可以以前台调试模式启动:salt-minion -l debug
页:
[1]