网站建设罗贤伟,网站营销外包公司简介,网站链接推广,乾县网站建设准备环境#xff1a;
1.需要三台服务器#xff1a;主机服务器#xff08;(10.36.192.129#xff09;、db服务器(10.36.192.131)#xff0c;web服务器(10.36.192.130)#xff0c;剧本都是写在主机服务器上。
2.主机服务器需要做ansible解析
vim /etc/ansible/hosts[web…准备环境
1.需要三台服务器主机服务器(10.36.192.129、db服务器(10.36.192.131)web服务器(10.36.192.130)剧本都是写在主机服务器上。
2.主机服务器需要做ansible解析
vim /etc/ansible/hosts[web]
10.36.192.130
[db]
10.36.192.131
3.这里的yum源需要自己配置我这里是有一个yum源的服务器 一剧本安装数据库 ---
- hosts: dbremote_user: rootvars:- db_passwd: QianFeng123- db_name: wordpresstasks:- name: 下载yum源shell: curl -o /opt/yum-server.sh http://10.36.192.100/yum-server.sh- name: 安装yum源shell: sh /opt/yum-server.sh- name: 安装数据库yum: namemariadb-server,mariadb statepresent disablerepomysql-5.7-community- name: 启动数据库service: namemariadb statestarted enabledtrue- name: 配置数据库shell: mysql -e create database {{ db_name }}; grant all on wordpress.* to wordpress% identified by {{ db_passwd }}; flush privileges 二.剧本安装nginx,php,及上线wordpress
hosts: web
remote_user: root
vars:- nginx_user: nginx- nginx_forks: auto- nginx_port: 80tasks:- name: 下载yum源shell: curl -o /opt/yum-server.sh http://10.36.192.100/yum-server.sh- name: 安装yum源shell: sh /opt/yum-server.sh- name: 安装nginxyum: namenginx statepresent- name: nginx配置文件template: src/root/nginx.conf dest/etc/nginx/- name: 启动Nginxservice: namenginx statestarted enabledtrue- name: 安装PHPyum: namephp80-php-xsl,php80-php,php80-php-cli,php80-php-devel,php80-php-gd,php80-php-pdo,php80-php-mysql,php80-php-fpm statepresent- name: 启动PHPservice: namephp80-php-fpm statestarted enabledtrue- name: 拷贝wordpress源代码unarchive: src/root/wordpress-6.4.1-zh_CN.tar.gz dest/usr/share/nginx/html