tangbinde 发表于 2018-1-3 13:05:32

ansible编译httpd playbook示例

---  
- hosts: all
  
tasks:
  
- name: download apr,apr-util,httpd
  
get_url: url="{{item}}" dest=/root/pkg/
  with_items:
  - https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.2.tar.gz
  - https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.0.tar.gz
  - https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.27.tar.gz
  delegate_to: localhost
  run_once: True
  
- unarchive: src="/root/pkg/{{item}}" dest=/root/
  
with_items:
  
- httpd-2.4.27.tar.gz
  
- apr-1.6.2.tar.gz
  
- apr-util-1.6.0.tar.gz
  
tags: unarchive
  

  
- name: install pcre and pcre-devel
  
yum: name="{{item}}" state=installed
  
with_items:
  
- pcre
  
- pcre-devel
  - expat-devel
  

  
- name: complie apr
  
shell: cd /root/apr-1.6.2 && ./configure --prefix=/usr/local/apr && make && make install
  

  
- name: complie apr-util
  
shell: |
  
cd /root/apr-util-1.6.0
  
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  
make && make install
  

  
- name: complie httpd
  
shell: |
  
cd /root/httpd-2.4.27
  
./configure --prefix=/usr/local/apache --sysconfdir=/etc/apache \
  
--enable-mpms-shared=all \
  
--with-z --with-pcre \
  
--with-apr=/usr/local/apr \
  
--with-apr-util=/usr/local/apr-util \
  
--with-mpm=event
  
make && make install
页: [1]
查看完整版本: ansible编译httpd playbook示例