目录
1. 整体测试
1.1 运行playbook
playbook的整体运行过程如下(因为之前都运行过因此很多都显示ok,未运行):
[root@xuzhichao cluster-roles]# ansible-playbook wordpress_site.yml
PLAY [all] *************************************************************************************************************************************************
******************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************
ok: [192.168.20.31]
ok: [192.168.20.30]
ok: [192.168.20.32]
ok: [192.168.20.61]
ok: [192.168.20.70]
TASK [base-module : Configuer Base Repo] *******************************************************************************************************************
ok: [192.168.20.31]
ok: [192.168.20.32]
ok: [192.168.20.61]
ok: [192.168.20.23]
ok: [192.168.20.22]
ok: [192.168.20.19]
ok: [192.168.20.30]
ok: [192.168.20.70]
ok: [192.168.20.20]
ok: [192.168.20.50]
TASK [base-module : Configuer Eepl Repo] *******************************************************************************************************************
ok: [192.168.20.31]
ok: [192.168.20.32]
ok: [192.168.20.23]
ok: [192.168.20.61]
ok: [192.168.20.22]
ok: [192.168.20.19]
ok: [192.168.20.20]
ok: [192.168.20.70]
ok: [192.168.20.30]
ok: [192.168.20.50]
TASK [base-module : Configuer PHP Repo] ********************************************************************************************************************
skipping: [192.168.20.31]
skipping: [192.168.20.32]
skipping: [192.168.20.61]
skipping: [192.168.20.19]
skipping: [192.168.20.20]
skipping: [192.168.20.30]
skipping: [192.168.20.70]
skipping: [192.168.20.50]
changed: [192.168.20.22]
changed: [192.168.20.23]
TASK [base-module : Install Base SoftWare] *****************************************************************************************************************
ok: [192.168.20.61] => (item=wget)
ok: [192.168.20.23] => (item=wget)
ok: [192.168.20.22] => (item=wget)
ok: [192.168.20.31] => (item=wget)
ok: [192.168.20.32] => (item=wget)
ok: [192.168.20.61] => (item=httpd-tools)
ok: [192.168.20.31] => (item=httpd-tools)
ok: [192.168.20.23] => (item=httpd-tools)
ok: [192.168.20.32] => (item=httpd-tools)
ok: [192.168.20.22] => (item=httpd-tools)
ok: [192.168.20.61] => (item=lrzsz)
ok: [192.168.20.31] => (item=lrzsz)
ok: [192.168.20.22] => (item=lrzsz)
ok: [192.168.20.32] => (item=lrzsz)
ok: [192.168.20.23] => (item=lrzsz)
ok: [192.168.20.61] => (item=nfs-utils)
ok: [192.168.20.31] => (item=nfs-utils)
ok: [192.168.20.61] => (item=bind-utils)
ok: [192.168.20.32] => (item=nfs-utils)
ok: [192.168.20.23] => (item=nfs-utils)
ok: [192.168.20.22] => (item=nfs-utils)
ok: [192.168.20.31] => (item=bind-utils)
ok: [192.168.20.61] => (item=net-tools)
ok: [192.168.20.22] => (item=bind-utils)
ok: [192.168.20.23] => (item=bind-utils)
ok: [192.168.20.32] => (item=bind-utils)
ok: [192.168.20.31] => (item=net-tools)
ok: [192.168.20.61] => (item=unzip)
ok: [192.168.20.22] => (item=net-tools)
ok: [192.168.20.32] => (item=net-tools)
ok: [192.168.20.23] => (item=net-tools)
ok: [192.168.20.31] => (item=unzip)
ok: [192.168.20.22] => (item=unzip)
ok: [192.168.20.32] => (item=unzip)
ok: [192.168.20.23] => (item=unzip)
ok: [192.168.20.61] => (item=vim)
ok: [192.168.20.61] => (item=gcc)
ok: [192.168.20.61] => (item=mariadb)
ok: [192.168.20.61] => (item=MySQL-python)
ok: [192.168.20.23] => (item=vim)
ok: [192.168.20.61] => (item=git)
ok: [192.168.20.22] => (item=vim)
ok: [192.168.20.23] => (item=gcc)
ok: [192.168.20.61] => (item=autofs)
ok: [192.168.20.22] => (item=gcc)
ok: [192.168.20.23] => (item=mariadb)
ok: [192.168.20.61] => (item=bash-completion.noarch)
ok: [192.168.20.23] => (item=MySQL-python)
ok: [192.168.20.22] => (item=mariadb)
ok: [192.168.20.61] => (item=expect)
ok: [192.168.20.22] => (item=MySQL-python)
ok: [192.168.20.23] => (item=git)
ok: [192.168.20.19] => (item=wget)
ok: [192.168.20.22] => (item=git)
ok: [192.168.20.23] => (item=autofs)
ok: [192.168.20.19] => (item=httpd-tools)
ok: [192.168.20.22] => (item=autofs)
ok: [192.168.20.23] => (item=bash-completion.noarch)
ok: [192.168.20.19] => (item=lrzsz)
ok: [192.168.20.23] => (item=expect)
ok: [192.168.20.22] => (item=bash-completion.noarch)
ok: [192.168.20.32] => (item=vim)
ok: [192.168.20.19] => (item=nfs-utils)
ok: [192.168.20.22] => (item=expect)
ok: [192.168.20.19] => (item=bind-utils)
ok: [192.168.20.20] => (item=wget)
ok: [192.168.20.32] => (item=gcc)
ok: [192.168.20.19] => (item=net-tools)
ok: [192.168.20.32] => (item=mariadb)
ok: [192.168.20.20] => (item=httpd-tools)
ok: [192.168.20.30] => (item=wget)
ok: [192.168.20.19] => (item=unzip)
ok: [192.168.20.32] => (item=MySQL-python)
ok: [192.168.20.20] => (item=lrzsz)
ok: [192.168.20.30] => (item=httpd-tools)
ok: [192.168.20.30] => (item=lrzsz)
ok: [192.168.20.20] => (item=nfs-utils)
ok: [192.168.20.32] => (item=git)
ok: [192.168.20.19] => (item=vim)
ok: [192.168.20.30] => (item=nfs-utils)
ok: [192.168.20.20] => (item=bind-utils)
ok: [192.168.20.32] => (item=autofs)
ok: [192.168.20.19] => (item=gcc)
ok: [192.168.20.30] => (item=bind-utils)
ok: [192.168.20.20] => (item=net-tools)
ok: [192.168.20.19] => (item=mariadb)
ok: [192.168.20.30] => (item=net-tools)
ok: [192.168.20.32] => (item=bash-completion.noarch)
ok: [192.168.20.20] => (item=unzip)
ok: [192.168.20.19] => (item=MySQL-python)
ok: [192.168.20.30] => (item=unzip)
ok: [192.168.20.32] => (item=expect)
ok: [192.168.20.31] => (item=vim)
ok: [192.168.20.19] => (item=git)
ok: [192.168.20.20] => (item=vim)
ok: [192.168.20.70] => (item=wget)
ok: [192.168.20.31] => (item=gcc)
ok: [192.168.20.19] => (item=autofs)
ok: [192.168.20.20] => (item=gcc)
ok: [192.168.20.70] => (item=httpd-tools)
ok: [192.168.20.31] => (item=mariadb)
ok: [192.168.20.20] => (item=mariadb)
ok: [192.168.20.19] => (item=bash-completion.noarch)
ok: [192.168.20.70] => (item=lrzsz)
ok: [192.168.20.31] => (item=MySQL-python)
ok: [192.168.20.19] => (item=expect)
ok: [192.168.20.20] => (item=MySQL-python)
ok: [192.168.20.70] => (item=nfs-utils)
ok: [192.168.20.31] => (item=git)
ok: [192.168.20.20] => (item=git)
ok: [192.168.20.70] => (item=bind-utils)
ok: [192.168.20.50] => (item=wget)
ok: [192.168.20.31] => (item=autofs)
ok: [192.168.20.20] => (item=autofs)
ok: [192.168.20.70] => (item=net-tools)
ok: [192.168.20.50] => (item=httpd-tools)
ok: [192.168.20.20] => (item=bash-completion.noarch)
ok: [192.168.20.70] => (item=unzip)
ok: [192.168.20.31] => (item=bash-completion.noarch)
ok: [192.168.20.50] => (item=lrzsz)
ok: [192.168.20.20] => (item=expect)
ok: [192.168.20.31] => (item=expect)
ok: [192.168.20.50] => (item=nfs-utils)
ok: [192.168.20.50] => (item=bind-utils)
ok: [192.168.20.50] => (item=net-tools)
ok: [192.168.20.50] => (item=unzip)
ok: [192.168.20.30] => (item=vim)
ok: [192.168.20.30] => (item=gcc)
ok: [192.168.20.30] => (item=mariadb)
ok: [192.168.20.30] => (item=MySQL-python)
ok: [192.168.20.30] => (item=git)
ok: [192.168.20.30] => (item=autofs)
ok: [192.168.20.30] => (item=bash-completion.noarch)
ok: [192.168.20.30] => (item=expect)
ok: [192.168.20.70] => (item=vim)
ok: [192.168.20.70] => (item=gcc)
ok: [192.168.20.70] => (item=mariadb)
ok: [192.168.20.70] => (item=MySQL-python)
ok: [192.168.20.70] => (item=git)
ok: [192.168.20.50] => (item=vim)
ok: [192.168.20.70] => (item=autofs)
ok: [192.168.20.50] => (item=gcc)
ok: [192.168.20.70] => (item=bash-completion.noarch)
ok: [192.168.20.50] => (item=mariadb)
ok: [192.168.20.70] => (item=expect)
ok: [192.168.20.50] => (item=MySQL-python)
ok: [192.168.20.50] => (item=git)
ok: [192.168.20.50] => (item=autofs)
ok: [192.168.20.50] => (item=bash-completion.noarch)
ok: [192.168.20.50] => (item=expect)
TASK [base-module : Create Process Group] ******************************************************************************************************************
ok: [192.168.20.31]
ok: [192.168.20.23]
ok: [192.168.20.22]
ok: [192.168.20.32]
ok: [192.168.20.61]
ok: [192.168.20.19]
ok: [192.168.20.70]
ok: [192.168.20.30]
ok: [192.168.20.50]
ok: [192.168.20.20]
TASK [base-module : Create Process Group] ******************************************************************************************************************
ok: [192.168.20.31]
ok: [192.168.20.61]
ok: [192.168.20.32]
ok: [192.168.20.23]
ok: [192.168.20.22]
ok: [192.168.20.19]
ok: [192.168.20.30]
ok: [192.168.20.70]
ok: [192.168.20.20]
ok: [192.168.20.50]
TASK [base-module : Disable Firewalld] *********************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
ok: [192.168.20.61]
changed: [192.168.20.31]
changed: [192.168.20.32]
ok: [192.168.20.30]
changed: [192.168.20.19]
changed: [192.168.20.70]
changed: [192.168.20.20]
changed: [192.168.20.50]
TASK [base-module : Disable Selinux] ***********************************************************************************************************************
ok: [192.168.20.31]
ok: [192.168.20.22]
ok: [192.168.20.61]
ok: [192.168.20.32]
ok: [192.168.20.23]
ok: [192.168.20.19]
ok: [192.168.20.30]
ok: [192.168.20.20]
ok: [192.168.20.70]
ok: [192.168.20.50]
TASK [wordpress-base : Modify Gateway And Dns] *************************************************************************************************************
changed: [192.168.20.23]
changed: [192.168.20.61]
changed: [192.168.20.31]
changed: [192.168.20.22]
changed: [192.168.20.32]
changed: [192.168.20.19]
changed: [192.168.20.20]
changed: [192.168.20.30]
changed: [192.168.20.70]
changed: [192.168.20.50]
TASK [wordpress-base : Restart Network] ********************************************************************************************************************
changed: [192.168.20.31]
changed: [192.168.20.22]
changed: [192.168.20.32]
changed: [192.168.20.23]
changed: [192.168.20.61]
changed: [192.168.20.20]
changed: [192.168.20.19]
changed: [192.168.20.30]
changed: [192.168.20.50]
changed: [192.168.20.70]
PLAY [webservers] ******************************************************************************************************************************************
TASK [nginx : Create Nginx Install Path] *******************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [nginx : Unarchive Nginx Packages] ********************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [nginx : Install Dependencies For Building Nginx] *****************************************************************************************************
ok: [192.168.20.22] => (item=pcre-devel)
ok: [192.168.20.23] => (item=pcre-devel)
ok: [192.168.20.23] => (item=openssl-devel)
ok: [192.168.20.22] => (item=openssl-devel)
ok: [192.168.20.22] => (item=zlib-devel)
ok: [192.168.20.23] => (item=zlib-devel)
ok: [192.168.20.22] => (item=pcre)
ok: [192.168.20.23] => (item=pcre)
ok: [192.168.20.22] => (item=openssl)
ok: [192.168.20.23] => (item=openssl)
ok: [192.168.20.23] => (item=zlib)
ok: [192.168.20.22] => (item=zlib)
ok: [192.168.20.22] => (item=@Development tools)
ok: [192.168.20.23] => (item=@Development tools)
TASK [nginx : Configure Nginx] *****************************************************************************************************************************
skipping: [192.168.20.22]
skipping: [192.168.20.23]
TASK [nginx : Build Nginx] *********************************************************************************************************************************
skipping: [192.168.20.22]
skipping: [192.168.20.23]
TASK [nginx : Copy Nginx Unit File] ************************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [nginx : Reload Systemd] ******************************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [nginx : Copy Nginx Main Configure File] **************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [nginx : Check Nginx Configure File] ******************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [nginx : Create Confihure Directory] ******************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [nginx : Start Nginx] *********************************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [php-fpm : Create PHP Install Path] *******************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [php-fpm : Unarchive PHP Packages] ********************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [php-fpm : Install Dependencies For Building PHP] *****************************************************************************************************
ok: [192.168.20.22] => (item=libxml2)
ok: [192.168.20.23] => (item=libxml2)
ok: [192.168.20.22] => (item=libxml2-devel)
ok: [192.168.20.23] => (item=libxml2-devel)
ok: [192.168.20.22] => (item=openssl)
ok: [192.168.20.23] => (item=openssl)
ok: [192.168.20.22] => (item=openssl-devel)
ok: [192.168.20.23] => (item=openssl-devel)
ok: [192.168.20.22] => (item=curl)
ok: [192.168.20.23] => (item=curl)
ok: [192.168.20.22] => (item=curl-devel)
ok: [192.168.20.23] => (item=curl-devel)
ok: [192.168.20.23] => (item=libpng)
ok: [192.168.20.22] => (item=libpng)
ok: [192.168.20.23] => (item=libpng-devel)
ok: [192.168.20.22] => (item=libpng-devel)
ok: [192.168.20.23] => (item=freetype)
ok: [192.168.20.22] => (item=freetype)
ok: [192.168.20.23] => (item=freetype-devel)
ok: [192.168.20.22] => (item=freetype-devel)
ok: [192.168.20.23] => (item=libmcrypt-devel)
ok: [192.168.20.22] => (item=libmcrypt-devel)
ok: [192.168.20.23] => (item=libzip-devel)
ok: [192.168.20.22] => (item=libzip-devel)
ok: [192.168.20.23] => (item=pcre)
ok: [192.168.20.22] => (item=pcre)
ok: [192.168.20.23] => (item=pcre-devel)
ok: [192.168.20.22] => (item=pcre-devel)
ok: [192.168.20.23] => (item=bzip2-devel)
ok: [192.168.20.22] => (item=bzip2-devel)
ok: [192.168.20.23] => (item=libicu-devel)
ok: [192.168.20.22] => (item=libicu-devel)
ok: [192.168.20.23] => (item=gcc)
ok: [192.168.20.22] => (item=gcc)
ok: [192.168.20.23] => (item=gcc-c++)
ok: [192.168.20.22] => (item=gcc-c++)
ok: [192.168.20.23] => (item=autoconf)
ok: [192.168.20.22] => (item=autoconf)
ok: [192.168.20.22] => (item=libjpeg)
ok: [192.168.20.23] => (item=libjpeg)
ok: [192.168.20.22] => (item=libjpeg-devel)
ok: [192.168.20.23] => (item=libjpeg-devel)
ok: [192.168.20.22] => (item=zlib)
ok: [192.168.20.23] => (item=zlib)
ok: [192.168.20.22] => (item=zlib-devel)
ok: [192.168.20.23] => (item=zlib-devel)
ok: [192.168.20.22] => (item=glibc)
ok: [192.168.20.23] => (item=glibc)
ok: [192.168.20.22] => (item=glibc-devel)
ok: [192.168.20.23] => (item=glibc-devel)
ok: [192.168.20.22] => (item=glib2)
ok: [192.168.20.23] => (item=glib2)
ok: [192.168.20.22] => (item=glib2-devel)
ok: [192.168.20.23] => (item=glib2-devel)
ok: [192.168.20.22] => (item=ncurses)
ok: [192.168.20.23] => (item=ncurses)
ok: [192.168.20.22] => (item=ncurses-devel)
ok: [192.168.20.23] => (item=ncurses-devel)
ok: [192.168.20.22] => (item=krb5-devel)
ok: [192.168.20.23] => (item=krb5-devel)
ok: [192.168.20.22] => (item=libidn)
ok: [192.168.20.23] => (item=libidn)
ok: [192.168.20.22] => (item=libidn-devel)
ok: [192.168.20.23] => (item=libidn-devel)
ok: [192.168.20.22] => (item=openldap)
ok: [192.168.20.23] => (item=openldap)
ok: [192.168.20.22] => (item=openldap-devel)
ok: [192.168.20.23] => (item=openldap-devel)
ok: [192.168.20.22] => (item=nss_ldap)
ok: [192.168.20.23] => (item=nss_ldap)
ok: [192.168.20.22] => (item=jemalloc-devel)
ok: [192.168.20.23] => (item=jemalloc-devel)
ok: [192.168.20.22] => (item=cmake)
ok: [192.168.20.23] => (item=cmake)
ok: [192.168.20.22] => (item=boost-devel)
ok: [192.168.20.23] => (item=boost-devel)
ok: [192.168.20.22] => (item=bison)
ok: [192.168.20.23] => (item=bison)
ok: [192.168.20.22] => (item=automake)
ok: [192.168.20.23] => (item=automake)
ok: [192.168.20.22] => (item=libevent)
ok: [192.168.20.23] => (item=libevent)
ok: [192.168.20.22] => (item=libevent-devel)
ok: [192.168.20.23] => (item=libevent-devel)
ok: [192.168.20.22] => (item=gd)
ok: [192.168.20.23] => (item=gd)
ok: [192.168.20.22] => (item=gd-devel)
ok: [192.168.20.23] => (item=gd-devel)
ok: [192.168.20.23] => (item=libtool*)
ok: [192.168.20.22] => (item=libtool*)
ok: [192.168.20.23] => (item=mcrypt)
ok: [192.168.20.22] => (item=mcrypt)
ok: [192.168.20.23] => (item=mhash)
ok: [192.168.20.22] => (item=mhash)
ok: [192.168.20.23] => (item=libxslt)
ok: [192.168.20.22] => (item=libxslt)
ok: [192.168.20.23] => (item=libxslt-devel)
ok: [192.168.20.22] => (item=libxslt-devel)
ok: [192.168.20.23] => (item=readline)
ok: [192.168.20.22] => (item=readline)
ok: [192.168.20.23] => (item=readline-devel)
ok: [192.168.20.22] => (item=readline-devel)
ok: [192.168.20.22] => (item=gmp)
ok: [192.168.20.23] => (item=gmp)
ok: [192.168.20.22] => (item=gmp-devel)
ok: [192.168.20.23] => (item=gmp-devel)
ok: [192.168.20.22] => (item=libcurl)
ok: [192.168.20.23] => (item=libcurl)
ok: [192.168.20.22] => (item=libcurl-devel)
ok: [192.168.20.23] => (item=libcurl-devel)
ok: [192.168.20.22] => (item=openjpeg-devel)
ok: [192.168.20.23] => (item=openjpeg-devel)
TASK [php-fpm : Configure PHP] *****************************************************************************************************************************
skipping: [192.168.20.22]
skipping: [192.168.20.23]
TASK [php-fpm : Build PHP] *********************************************************************************************************************************
skipping: [192.168.20.22]
skipping: [192.168.20.23]
TASK [php-fpm : Copy PHP-FPM Unit File] ********************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [php-fpm : Reload Systemd] ****************************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [php-fpm : Create Log Path] ***************************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [php-fpm : Copy PHP and PHP-FPM Configure File] *******************************************************************************************************
ok: [192.168.20.22] => (item={u'dest': u'/soft/php/etc/php.ini', u'src': u'php.ini.j2'})
ok: [192.168.20.23] => (item={u'dest': u'/soft/php/etc/php.ini', u'src': u'php.ini.j2'})
ok: [192.168.20.22] => (item={u'dest': u'/soft/php/etc/php-fpm.d/www.conf', u'src': u'www.conf.j2'})
ok: [192.168.20.23] => (item={u'dest': u'/soft/php/etc/php-fpm.d/www.conf', u'src': u'www.conf.j2'})
ok: [192.168.20.22] => (item={u'dest': u'/soft/php/etc/php-fpm.conf', u'src': u'php-fpm.conf.j2'})
ok: [192.168.20.23] => (item={u'dest': u'/soft/php/etc/php-fpm.conf', u'src': u'php-fpm.conf.j2'})
TASK [php-fpm : Check PHP Configure File] ******************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [php-fpm : Start PHP-FPM] *****************************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [wordpress-web : Unarchive Wordpress Code] ************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [wordpress-web : Create wp-content/uploads directory] *************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [wordpress-web : Mount NFS Point] *********************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [wordpress-web : Copy Nginx Vhosts Configure File] ****************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [wordpress-web : Check Nginx Configure File] **********************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [wordpress-web : Install php-pecl-redis] **************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [wordpress-web : Unarchive php-Redis] *****************************************************************************************************************
ok: [192.168.20.23]
ok: [192.168.20.22]
TASK [wordpress-web : phpize] ******************************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [wordpress-web : Configure] ***************************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
TASK [wordpress-web : Make And Make Install] ***************************************************************************************************************
ok: [192.168.20.22]
ok: [192.168.20.23]
PLAY [lbservers] *******************************************************************************************************************************************
TASK [nginx : Create Nginx Install Path] *******************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [nginx : Unarchive Nginx Packages] ********************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [nginx : Install Dependencies For Building Nginx] *****************************************************************************************************
ok: [192.168.20.19] => (item=pcre-devel)
ok: [192.168.20.20] => (item=pcre-devel)
ok: [192.168.20.19] => (item=openssl-devel)
ok: [192.168.20.20] => (item=openssl-devel)
ok: [192.168.20.19] => (item=zlib-devel)
ok: [192.168.20.20] => (item=zlib-devel)
ok: [192.168.20.19] => (item=pcre)
ok: [192.168.20.20] => (item=pcre)
ok: [192.168.20.19] => (item=openssl)
ok: [192.168.20.20] => (item=openssl)
ok: [192.168.20.19] => (item=zlib)
ok: [192.168.20.20] => (item=zlib)
ok: [192.168.20.19] => (item=@Development tools)
ok: [192.168.20.20] => (item=@Development tools)
TASK [nginx : Configure Nginx] *****************************************************************************************************************************
skipping: [192.168.20.19]
skipping: [192.168.20.20]
TASK [nginx : Build Nginx] *********************************************************************************************************************************
skipping: [192.168.20.19]
skipping: [192.168.20.20]
TASK [nginx : Copy Nginx Unit File] ************************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [nginx : Reload Systemd] ******************************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [nginx : Copy Nginx Main Configure File] **************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [nginx : Check Nginx Configure File] ******************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [nginx : Create Confihure Directory] ******************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [nginx : Start Nginx] *********************************************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [wordpress-proxy : Create Cert directory] *************************************************************************************************************
ok: [192.168.20.20]
ok: [192.168.20.19]
TASK [wordpress-proxy : Copy SSL Cer File] *****************************************************************************************************************
ok: [192.168.20.19] => (item={u'dest': u'/soft/nginx/certs/xuzhichao.key', u'src': u'xuzhichao.key'})
ok: [192.168.20.20] => (item={u'dest': u'/soft/nginx/certs/xuzhichao.key', u'src': u'xuzhichao.key'})
ok: [192.168.20.19] => (item={u'dest': u'/soft/nginx/certs/xuzhichao.crt', u'src': u'xuzhichao.crt'})
ok: [192.168.20.20] => (item={u'dest': u'/soft/nginx/certs/xuzhichao.crt', u'src': u'xuzhichao.crt'})
TASK [wordpress-proxy : Copy Nginx-LB Vhosts Configure] ****************************************************************************************************
ok: [192.168.20.19] => (item={u'dest': u'/soft/nginx/conf/conf.d/wordpress.conf', u'src': u'wordpress.conf.j2'})
ok: [192.168.20.20] => (item={u'dest': u'/soft/nginx/conf/conf.d/wordpress.conf', u'src': u'wordpress.conf.j2'})
ok: [192.168.20.19] => (item={u'dest': u'/soft/nginx/conf/proxy_params', u'src': u'proxy_params.j2'})
ok: [192.168.20.20] => (item={u'dest': u'/soft/nginx/conf/proxy_params', u'src': u'proxy_params.j2'})
TASK [wordpress-proxy : Check Nginx Configure File] ********************************************************************************************************
ok: [192.168.20.19]
ok: [192.168.20.20]
TASK [wordpress-proxy : LVS DR RS Scripts] *****************************************************************************************************************
changed: [192.168.20.19]
changed: [192.168.20.20]
PLAY [mysql] ***********************************************************************************************************************************************
TASK [mariadb : Create Mysql Group] ************************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Create Mysql User] *************************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Create Mysql Work Directory] ***************************************************************************************************************
ok: [192.168.20.50] => (item=/var/lib/mysql/)
ok: [192.168.20.50] => (item=/data/mysql)
TASK [mariadb : Unarchive Mariadb Package] *****************************************************************************************************************
changed: [192.168.20.50]
TASK [mariadb : Create Mariadb Link File] ******************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Init Mysql Database] ***********************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Copy Mariadb Service File] *****************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Copy Mariadb Configure File] ***************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Start Mariadb Server] **********************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Create Mysql.sock Link File] ***************************************************************************************************************
ok: [192.168.20.50]
TASK [mariadb : Grant Database User] ***********************************************************************************************************************
[WARNING]: The value ******** (type int) in a string field was converted to u'********' (type string). If this does not look like what you expect, quote
the entire value to ensure it does not change.
[WARNING]: Module did not set no_log for update_password
ok: [192.168.20.50]
TASK [wordpress-mysql : Create Wordpress Database] *********************************************************************************************************
ok: [192.168.20.50]
TASK [wordpress-mysql : Grant Wordpress Database User] *****************************************************************************************************
ok: [192.168.20.50]
PLAY [redis] ***********************************************************************************************************************************************
TASK [redis : Install Redis] *******************************************************************************************************************************
ok: [192.168.20.61]
TASK [redis : Copy Configure File] *************************************************************************************************************************
ok: [192.168.20.61]
TASK [redis : Start Redis] *********************************************************************************************************************************
ok: [192.168.20.61]
PLAY [nfs] *************************************************************************************************************************************************
TASK [nfs : Install NFS Server] ****************************************************************************************************************************
ok: [192.168.20.30]
TASK [nfs : Configure NFS Server] **************************************************************************************************************************
ok: [192.168.20.30]
TASK [nfs : Init NFS Server] *******************************************************************************************************************************
changed: [192.168.20.30]
TASK [nfs : Start NFS service] *****************************************************************************************************************************
ok: [192.168.20.30]
PLAY [lvs] *************************************************************************************************************************************************
TASK [keepalived : Install Keepalived] *********************************************************************************************************************
ok: [192.168.20.31]
ok: [192.168.20.32]
TASK [keepalived : Copy Notify Script] *********************************************************************************************************************
ok: [192.168.20.32]
ok: [192.168.20.31]
TASK [keepalived : Copy Configure File] ********************************************************************************************************************
ok: [192.168.20.32]
ok: [192.168.20.31]
TASK [keepalived : Start Keepalived] ***********************************************************************************************************************
ok: [192.168.20.32]
ok: [192.168.20.31]
PLAY [dns] *************************************************************************************************************************************************
TASK [dns : Install Dns Server] ****************************************************************************************************************************
ok: [192.168.20.70]
TASK [dns : Copy Configure File And Zone File] *************************************************************************************************************
ok: [192.168.20.70] => (item={u'dest': u'/etc/named.conf', u'src': u'named.conf.j2'})
ok: [192.168.20.70] => (item={u'dest': u'/var/named/xuzhichao.com.zone', u'src': u'xuzhichao.com.zone.j2'})
ok: [192.168.20.70] => (item={u'dest': u'/etc/named.xuzhichao.com.zone', u'src': u'named.xuzhichao.com.zone.j2'})
ok: [192.168.20.70] => (item={u'dest': u'/var/named/20.168.192.in-addr.arpa.zone', u'src': u'20.168.192.in-addr.arpa.zone.j2'})
TASK [dns : Start Dns Server] ******************************************************************************************************************************
ok: [192.168.20.70]
PLAY RECAP *************************************************************************************************************************************************
192.168.20.19 : ok=23 changed=4 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
192.168.20.20 : ok=23 changed=4 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
192.168.20.22 : ok=38 changed=3 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0
192.168.20.23 : ok=38 changed=3 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0
192.168.20.30 : ok=14 changed=3 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
192.168.20.31 : ok=14 changed=3 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
192.168.20.32 : ok=14 changed=3 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
192.168.20.50 : ok=22 changed=4 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
192.168.20.61 : ok=13 changed=2 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
192.168.20.70 : ok=13 changed=3 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
1.2 出口路由器防火墙规则设置
-
设置出接口IP地址:
[root@xuzhichao ~]# ip add add 192.168.50.200/24 dev eth2 [root@xuzhichao ~]# ip add add 192.168.50.201/24 dev eth2 [root@xuzhichao ~]# ip add show eth2 4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:2f:d0:e4 brd ff:ff:ff:ff:ff:ff inet 192.168.50.17/24 brd 192.168.50.255 scope global noprefixroute eth2 valid_lft forever preferred_lft forever inet 192.168.50.200/24 scope global secondary eth2 valid_lft forever preferred_lft forever inet 192.168.50.201/24 scope global secondary eth2 valid_lft forever preferred_lft forever
-
设置防火墙DNAT规则:
[root@xuzhichao ~]# iptables -t nat -I PREROUTING -d 192.168.50.200 -j DNAT --to 192.168.20.200 [root@xuzhichao ~]# iptables -t nat -I PREROUTING -d 192.168.50.201 -j DNAT --to 192.168.20.201 . [root@xuzhichao ~]# iptables -t nat -vnL Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 DNAT all -- * * 0.0.0.0/0 192.168.50.201 to:192.168.20.201 0 0 DNAT all -- * * 0.0.0.0/0 192.168.50.200 to:192.168.20.200
-
开启ip_forward转发:
[root@xuzhichao cluster-roles]# echo "1" > /proc/sys/net/ipv4/ip_forward
1.3 访问测试
- 把客户端主机的DNS设置成192.168.50.70
- 客户端访问http://wordpress.xuzhichao.com