--- # The Service Module
- hosts: apacheweb
user: test
sudo: yes
connection: ssh
tasks:
- name: Install Web Server
action: yum name=httpd state=installed
- name: Start the Web Server
service: name=httpd state=started
- name: Stop the Web Server
service: name=httpd state=stopped
- name: Enable HTTPD After Reboot
service: name=httpd enabled=yes
其中随开机启动的设置很实用 如果选择远程配置 就不要做二次加工的事情。
网友评论