ansible编译httpd playbook示例
我写了更完善的Ansible专栏文章:一步到位玩儿透Ansible
以下是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
- 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
编译完成后,还有一系列操作,比如设置PATH环境变量、设置man路径、修改配置文件、启动httpd等。这些就懒得放进去了。
Linux系列文章:https://www.cnblogs.com/f-ck-need-u/p/7048359.html
Shell系列文章:https://www.cnblogs.com/f-ck-need-u/p/7048359.html
网站架构系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html
MySQL/MariaDB系列文章:https://www.cnblogs.com/f-ck-need-u/p/7586194.html
Perl系列:https://www.cnblogs.com/f-ck-need-u/p/9512185.html
Go系列:https://www.cnblogs.com/f-ck-need-u/p/9832538.html
Python系列:https://www.cnblogs.com/f-ck-need-u/p/9832640.html
Ruby系列:https://www.cnblogs.com/f-ck-need-u/p/10805545.html
操作系统系列:https://www.cnblogs.com/f-ck-need-u/p/10481466.html
精通awk系列:https://www.cnblogs.com/f-ck-need-u/p/12688355.html