写个playbook单机部署lamp
cat lamp.yml
---
- hosts: host_ip
tasks:
- name: install lamp packges
yum:
name=httpd,mariadb-server,php,php-mysql
state=present
- name: delete index.html
file:
path=/var/www/html/index.html
state=absent
- name: create index.php
copy:
content="<?php\nphpinfo();\n?>"
dest=/var/www/html/index.php
- name: start httpd
service:
name=httpd
state=started
ansible-playbook lamy.yml
浏览器访问host_ip可以看到php网页