ansible实现mariadb在多台服务器的自动安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ansible实现mariadb在多台服务器的自动安装相关的知识,希望对你有一定的参考价值。
#!/bin/bash
#ansible 命令
`ansible all -m user -a ‘name=mysql home=/home/app/dbdata group=mysql‘`
`ansible all -m group -a ‘name=mysql gid=306 system=yes‘`
#ansible all -m copy -a ‘src=/home/mariadb-10.2.8-linux-x86_64.tar.gz dest=/home/‘
`ansible all -m unarchive -a ‘src=/home/mariadb-10.2.8-linux-x86_64.tar.gz dest=/usr/local copy=yes‘`
`ansible all -m file -a ‘path=/uar/local/mysql src=/usr/local/mariadb-10.2.8-linux-x86_64/ state=link‘`
`ansible all -m file -a ‘path=/etc/mysql state=directory‘`
`ansible all -m copy -a ‘src=/usr/local/mysql/support-files/my-huge.cnf dest=/etc/mysql/my.cnf‘`
`ansible all -m lineinfile -a ‘dest=/etc/mysql/my.cnf line="datair = /home/app/dbdata\ninnodb_file_per_table = on\nskip_name_resolve =on"‘`
`ansible all -m shell -a ‘./scripts/mysql_install_db --datadir=/home/app/dbdata --user=mysql chdir=/usr/local/mysql/‘`
`ansible all -m file -a ‘path=/var/log/mariadb state=directory‘`
`ansible all -m file -a ‘name=/var/log/mariadb/mariadb.log owner=mysql group=mysql state=touch‘`
`ansible all -m copy -a ‘src=/usr/local/mysql/support-files/mysql.server dest=/etc/init.d/mysqld‘`
`ansible all -m shell -a ‘chkconfig --add mysqld‘`
以上是关于ansible实现mariadb在多台服务器的自动安装的主要内容,如果未能解决你的问题,请参考以下文章