1、apache+php
前几章的LAMP: https://www.cnblogs.com/venicid/p/11276232.html#_label2
Php放在apache
1、目录结构
2、php安装配置
安装
[root@linux-node1 /srv/salt/prod/modules/apache]# cat php.sls
php-install: pkg.installed: - pkgs: - php - php-pdo - php-mysql php-config: file.managed: - name: /etc/php.ini - source: salt://modules/apache/files/php.ini - user: root - group: root - mode: 644
配置文件
[root@linux-node1 /srv/salt/prod/modules/apache]# cp /etc/php.ini files/
3、apache安装配置
安装
[root@linux-node1 /srv/salt/prod/modules/apache]# cat init.sls
include: - modules.apache.php apache-install: pkg.installed: - name: httpd apache-config: file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://modules/apache/files/httpd.conf - user: root - group: root - mode: 644 - template: jinja - defaults: IPADDR: {{ grains['fqdn_ip4'][0] }} PORT: 80 - watch_in: - service: apache-service apache-service: service.running: - name: httpd - enable: True - reload: True
配置文件
[root@linux-node1 files]# cp /etc/httpd/conf/httpd.conf .
[root@linux-node1 /srv/salt/prod/modules/apache]# vim files/httpd.conf
4、test
[root@# localhost ~]# salt 'linux-node1*' state.sls modules.apache.init saltenv=prod [root@# localhost ~]# salt 'linux-node2*' state.sls modules.apache.init saltenv=prod
5、问题
问题描述:grains获取minion的ip地址时,获取失败。
解决:
saltstack master端grains.item fqdn_ip4 获取不到fqdn_ip4 值原因以及解决办法
关于hostname和fqdn的区别和获取及设置
最后:
重启master、minion