编写一个部署Apache服务的Ansible playbook的yaml格式
时间: 2023-04-04 18:03:26 浏览: 214
python ansible服务及剧本编写
好的,我可以回答这个问题。以下是一个部署Apache服务的Ansible playbook的yaml格式的示例:
---
- name: Install and configure Apache
hosts: webserver
become: true
tasks:
- name: Install Apache
yum:
name: httpd
state: present
- name: Start Apache service
service:
name: httpd
state: started
- name: Enable Apache service
service:
name: httpd
enabled: true
- name: Copy Apache config file
copy:
src: /path/to/httpd.conf
dest: /etc/httpd/conf/httpd.conf
notify:
- restart Apache
希望这可以帮助你!
阅读全文