nginx
代码语言:javascript复制- hosts: dbserver
remote_user: root
tasks:
- name: add user nginx
user: name=nginx shell=/sbin/nologin create_home=no
- name: resolve dependent packages
yum: name=pcre-devel,gcc,gcc-c ,openssl-devel,zlib-devel
- name: unarchive tar file
unarchive: src=/root/nginx-1.15.4.tar.gz dest=/usr/src
- name: install nginx
shell: ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module && make && make install
args:
chdir: /usr/src/nginx-1.15.4
- name: make soft link
file: src=/usr/local/nginx/sbin/nginx dest=/usr/sbin/nginx state=link
- name: start nginx
shell: nginx
mysql
代码语言:javascript复制- hosts: dbserver
remote_user: root
tasks:
- name: resolve dependency
yum: name=gcc,gcc-c ,ncurses-devel,cmake,bison
- name: add user
user: name=mysql create_home=no shell=/sbin/nologin
- name: unarchive mysql
unarchive: src=/root/mysql-5.5.22.tar.gz dest=/usr/src
- name: install mysql
shell: cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DSYSCONFDIR=/etc && make && make install
args:
chdir: /usr/src/mysql-5.5.22
- name: soft link of libmysqlclient
file: src=/usr/local/mysql/lib/libmysqlclient.so.18 dest=/usr/lib/libmysqlclient.so.18 state=link
- name: soft link of command
file: src=/usr/local/mysql/bin/mysql dest=/usr/bin/mysql state=link
- name: mysqldump link
file: src=/usr/local/mysql/bin/mysqldump dest=/usr/bin/mysqldump state=link
- name: copy my.cnf
copy: src=/usr/src/mysql-5.5.22/support-files/my-large.cnf dest=/etc/my.cnf remote_src=yes
- name: copy mysql script
copy: src=/usr/src/mysql-5.5.22/support-files/mysql.server dest=/etc/init.d/mysqld remote_src=yes
- name: set user and group for mysql dir
file: path=/usr/local/mysql owner=mysql group=mysql recurse=yes
- name: give executable privileges
file: path=/etc/init.d/mysqld mode=0755
- name: initialize mysql process
shell: /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --defaults-file=/etc/my.cnf
- name: start mysql server
shell: /etc/init.d/mysqld start
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/101884.html原文链接: