--- - hosts: webservers vars: - ROOT: /opt/html - PORT: 80 tasks: - name : ‘配置班级源‘ script: repo.sh - name : ‘安装httpd和lamp的相关组件‘ yum: name=httpd,php,php-gd,php-mysql state=latest - name: ‘分发配置文件支持php‘ template: src=httpd.conf dest=/etc/httpd/conf/httpd.conf - name: ‘创建目录‘ file: path={{ROOT}} state=directory owner=apache group=apache - name: ‘分发主界面‘ template: src=info.php dest={{ROOT}}/info.php - name: ‘关闭防火墙‘ service: name=iptables state=stopped - name: ‘关闭selinux‘ shell: setenforce 0 - name: ‘启动httpd‘ service: name=httpd state=restarted enabled=yes ~
<h1>{{ansible_hostname}}</h1> <h1>{{ansible_all_ipv4_addresses}}</h1> <?php phpinfo(); ?>
AddType application/x-httpd-php .php
原文:https://www.cnblogs.com/gaiting/p/12084068.html