1. 程式人生 > >ansible編譯httpd playbook示例

ansible編譯httpd playbook示例

arc .gz eve 它的 cal spa bsp evel ive

以下是playbook的內容。它的處理流程是:

1.先在本地下載apr,apr-util,httpd共3個.tar.gz文件。

2.解壓這3個文件。

3.安裝pcre和pcre-devel依賴包。

4.編譯安裝apr

5.編譯安裝apr-util

6.編譯安裝httpd

---
        - 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 - 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

編譯完成後,還有一系列操作,比如設置PATH環境變量、設置man路徑、修改配置文件、啟動httpd等。這些就懶得放進去了。

回到Linux系列文章大綱:http://www.cnblogs.com/f-ck-need-u/p/7048359.html

轉載請註明出處:http://www.cnblogs.com/f-ck-need-u/p/7604386.html

註:若您覺得這篇文章還不錯請點擊右下角推薦,您的支持能激發作者更大的寫作熱情,非常感謝!

ansible編譯httpd playbook示例