The following is the content of playbook. Its processing flow is:
1. First download APR,APR-UTIL,HTTPD a total of 3. tar.gz files locally.
2. Unzip the 3 files.
3. Install the Pcre and Pcre-devel dependent packages.
4. Compile and install Apr
5. Compile and install Apr-util
6. Compile and install 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. -.Tar. GZ-apr-1.6.2.Tar. GZ-apr-util-1.6.0.Tar. GZ tags:unarchive-Name:InstallPcre and pcre-develYum: 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. - ./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
After compiling, there are a series of actions, such as setting the PATH environment variable, setting the man path, modifying the configuration file, starting httpd, and so on. These are too lazy to put in.
back to Linux series article outline: http://www.cnblogs.com/f-ck-need-u/p/7048359.htmlReprint Please specify Source: http://www.cnblogs.com/f-ck-need-u/p/7604386.htmlNote: If you think this article is not bad please click on the lower right corner of the recommendation, your support can inspire the author more enthusiasm for writing, thank you very much!
Ansible Compiling httpd Playbook Example