playbook安装apache

playbook安装apache

   张吉吉     2019年11月23日 05:03     1785    

#使用playbook自动部署apache

---

- hosts: test

  vars:

    http_port: 80

    max_clients: 200

  remote_user: root

#通过yum进行安装apache

  tasks:

  - name: ensure apache is at the latest version

    yum: pkg=httpd state=latest

  - name: write the apache config file

    template: src=/srv/httpd.j2 dest=/etc/httpd.conf

    notify:

    - restart apache

#启动模块

  - name: ensure apache is running

    service: name=httpd state=started

#设置控制代码

  handlers:

    - name: restart apache

      service: name=httpd state=restarted

下图是过程:

image.png


文章评论

0

其他文章