ansible-playbook方式安装mysql5.7(centos7)

ansible-playbook工程目录

[root@localhost roles]# tree -L 2 #角色目录
.
├── mysql_install
│   ├── defaults
│   │   └── main.yml
│   ├── files
│   │   ├── my.cnf
│   │   ├── mysql80-community-release-el7-1.noarch.rpm
│   │   └── mysql_user.sh
│   ├── handlers
│   │   └── main.yml
│   ├── meta
│   │   └── main.yml
│   ├── tasks
│   │   ├── copy.yml
│   │   ├── install.yml
│   │   └── main.yml
│   ├── templates
│   │   └── mysql_install.sh
│   └── vars
│       └── main.yml
├── mysql.yml

整个工程托管在github

https://github.com/huangmeng4520/palybook_mysql5.7.git

执行ansible过程演示

root@afb8d4a179be:/# ansible-playbook /opt/playbook/roles/mysql.yml -vv
Using /etc/ansible/ansible.cfg as config file
statically included: /opt/playbook/roles/mysql_install/tasks/copy.yml
statically included: /opt/playbook/roles/mysql_install/tasks/install.yml

PLAYBOOK: mysql.yml ************************************************************
1 plays in /opt/playbook/roles/mysql.yml

PLAY [ansible-playbook] ********************************************************
META: ran handlers

TASK [mysql_install : copy mysql source code to client] ************************
task path: /opt/playbook/roles/mysql_install/tasks/copy.yml:2
changed: [10.217.20.108] => {"changed": true, "checksum": "150324bdd046de55a6219b8a7cea3376bf16880e", "dest": "/home/mysql80-community-release-el7-1.noarch.rpm", "gid": 0, "group": "root", "md5sum": "739dc44566d739c5d7b893de96ee6848", "mode": "0644", "owner": "root", "secontext": "unconfined_u:object_r:user_home_dir_t:s0", "size": 25820, "src": "/root/.ansible/tmp/ansible-tmp-1534386783.28-28197510907837/source", "state": "file", "uid": 0}

TASK [mysql_install : install yum-utils] ***************************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:2
changed: [10.217.20.108] => {"changed": true, "msg": "", "rc": 0, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirrors.cqu.edu.cn\n * extras: centos.ustc.edu.cn\n * updates: mirrors.cqu.edu.cn\nResolving Dependencies\n--> Running transaction check\n---> Package yum-utils.noarch 0:1.1.31-46.el7_5 will be installed\n--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-46.el7_5.noarch\n--> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-46.el7_5.noarch\n--> Running transaction check\n---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed\n---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed\n--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch\n--> Running transaction check\n---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package              Arch         Version                  Repository     Size\n================================================================================\nInstalling:\n yum-utils            noarch       1.1.31-46.el7_5          updates       120 k\nInstalling for dependencies:\n libxml2-python       x86_64       2.9.1-6.el7_2.3          base          247 k\n python-chardet       noarch       2.2.1-1.el7_1            base          227 k\n python-kitchen       noarch       1.1.1-5.el7              base          267 k\n\nTransaction Summary\n================================================================================\nInstall  1 Package (+3 Dependent packages)\n\nTotal download size: 860 k\nInstalled size: 4.3 M\nDownloading packages:\n--------------------------------------------------------------------------------\nTotal                                               67 kB/s | 860 kB  00:12     \nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n  Installing : python-chardet-2.2.1-1.el7_1.noarch                          1/4 \n  Installing : python-kitchen-1.1.1-5.el7.noarch                            2/4 \n  Installing : libxml2-python-2.9.1-6.el7_2.3.x86_64                        3/4 \n  Installing : yum-utils-1.1.31-46.el7_5.noarch                             4/4 \n  Verifying  : libxml2-python-2.9.1-6.el7_2.3.x86_64                        1/4 \n  Verifying  : python-kitchen-1.1.1-5.el7.noarch                            2/4 \n  Verifying  : yum-utils-1.1.31-46.el7_5.noarch                             3/4 \n  Verifying  : python-chardet-2.2.1-1.el7_1.noarch                          4/4 \n\nInstalled:\n  yum-utils.noarch 0:1.1.31-46.el7_5                                            \n\nDependency Installed:\n  libxml2-python.x86_64 0:2.9.1-6.el7_2.3 python-chardet.noarch 0:2.2.1-1.el7_1\n  python-kitchen.noarch 0:1.1.1-5.el7    \n\nComplete!\n"]}

TASK [mysql_install : install mysql yum reepo] *********************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:4
 [WARNING]: Consider using yum module rather than running yum

changed: [10.217.20.108] => {"changed": true, "cmd": "yum localinstall -y mysql80-community-release-el7-1.noarch.rpm", "delta": "0:00:00.652655", "end": "2018-08-16 10:33:56.182972", "rc": 0, "start": "2018-08-16 10:33:55.530317", "stderr": "", "stderr_lines": [], "stdout": "已加载插件:fastestmirror\n正在检查 mysql80-community-release-el7-1.noarch.rpm: mysql80-community-release-el7-1.noarch\nmysql80-community-release-el7-1.noarch.rpm 将被安装\n正在解决依赖关系\n--> 正在检查事务\n---> 软件包 mysql80-community-release.noarch.0.el7-1 将被 安装\n--> 解决依赖关系完成\n\n依赖关系解决\n\n================================================================================\n Package             架构   版本  源                                       大小\n================================================================================\n正在安装:\n mysql80-community-release\n                     noarch el7-1 /mysql80-community-release-el7-1.noarch  31 k\n\n事务概要\n================================================================================\n安装  1 软件包\n\n总计:31 k\n安装大小:31 k\nDownloading packages:\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n  正在安装    : mysql80-community-release-el7-1.noarch                      1/1 \n  验证中      : mysql80-community-release-el7-1.noarch                      1/1 \n\n已安装:\n  mysql80-community-release.noarch 0:el7-1                                      \n\n完毕!", "stdout_lines": ["已加载插件:fastestmirror", "正在检查 mysql80-community-release-el7-1.noarch.rpm: mysql80-community-release-el7-1.noarch", "mysql80-community-release-el7-1.noarch.rpm 将被安装", "正在解决依赖关系", "--> 正在检查事务", "---> 软件包 mysql80-community-release.noarch.0.el7-1 将被 安装", "--> 解决依赖关系完成", "", "依赖关系解决", "", "================================================================================", " Package             架构   版本  源                                       大小", "================================================================================", "正在安装:", " mysql80-community-release", "                     noarch el7-1 /mysql80-community-release-el7-1.noarch  31 k", "", "事务概要", "================================================================================", "安装  1 软件包", "", "总计:31 k", "安装大小:31 k", "Downloading packages:", "Running transaction check", "Running transaction test", "Transaction test succeeded", "Running transaction", "  正在安装    : mysql80-community-release-el7-1.noarch                      1/1 ", "  验证中      : mysql80-community-release-el7-1.noarch                      1/1 ", "", "已安装:", "  mysql80-community-release.noarch 0:el7-1                                      ", "", "完毕!"]}

TASK [mysql_install : 禁用mysql80 yum源] ******************************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:8
changed: [10.217.20.108] => {"changed": true, "cmd": "yum-config-manager --disable mysql80-community", "delta": "0:00:00.196106", "end": "2018-08-16 10:33:56.621335", "rc": 0, "start": "2018-08-16 10:33:56.425229", "stderr": "", "stderr_lines": [], "stdout": "已加载插件:fastestmirror\n=========================== repo: mysql80-community ============================\n[mysql80-community]\nasync = True\nbandwidth = 0\nbase_persistdir = /var/lib/yum/repos/x86_64/7\nbaseurl = http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/\ncache = 0\ncachedir = /var/cache/yum/x86_64/7/mysql80-community\ncheck_config_file_age = True\ncompare_providers_priority = 80\ncost = 1000\ndeltarpm_metadata_percentage = 100\ndeltarpm_percentage = \nenabled = 0\nenablegroups = True\nexclude = \nfailovermethod = priority\nftp_disable_epsv = False\ngpgcadir = /var/lib/yum/repos/x86_64/7/mysql80-community/gpgcadir\ngpgcakey = \ngpgcheck = True\ngpgdir = /var/lib/yum/repos/x86_64/7/mysql80-community/gpgdir\ngpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql\nhdrdir = /var/cache/yum/x86_64/7/mysql80-community/headers\nhttp_caching = all\nincludepkgs = \nip_resolve = \nkeepalive = True\nkeepcache = False\nmddownloadpolicy = sqlite\nmdpolicy = group:small\nmediaid = \nmetadata_expire = 21600\nmetadata_expire_filter = read-only:present\nmetalink = \nminrate = 0\nmirrorlist = \nmirrorlist_expire = 86400\nname = MySQL 8.0 Community Server\nold_base_cache_dir = \npassword = \npersistdir = /var/lib/yum/repos/x86_64/7/mysql80-community\npkgdir = /var/cache/yum/x86_64/7/mysql80-community/packages\nproxy = False\nproxy_dict = \nproxy_password = \nproxy_username = \nrepo_gpgcheck = False\nretries = 10\nskip_if_unavailable = False\nssl_check_cert_permissions = True\nsslcacert = \nsslclientcert = \nsslclientkey = \nsslverify = True\nthrottle = 0\ntimeout = 30.0\nui_id = mysql80-community/x86_64\nui_repoid_vars = releasever,\n   basearch\nusername = ", "stdout_lines": ["已加载插件:fastestmirror", "=========================== repo: mysql80-community ============================", "[mysql80-community]", "async = True", "bandwidth = 0", "base_persistdir = /var/lib/yum/repos/x86_64/7", "baseurl = http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/", "cache = 0", "cachedir = /var/cache/yum/x86_64/7/mysql80-community", "check_config_file_age = True", "compare_providers_priority = 80", "cost = 1000", "deltarpm_metadata_percentage = 100", "deltarpm_percentage = ", "enabled = 0", "enablegroups = True", "exclude = ", "failovermethod = priority", "ftp_disable_epsv = False", "gpgcadir = /var/lib/yum/repos/x86_64/7/mysql80-community/gpgcadir", "gpgcakey = ", "gpgcheck = True", "gpgdir = /var/lib/yum/repos/x86_64/7/mysql80-community/gpgdir", "gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql", "hdrdir = /var/cache/yum/x86_64/7/mysql80-community/headers", "http_caching = all", "includepkgs = ", "ip_resolve = ", "keepalive = True", "keepcache = False", "mddownloadpolicy = sqlite", "mdpolicy = group:small", "mediaid = ", "metadata_expire = 21600", "metadata_expire_filter = read-only:present", "metalink = ", "minrate = 0", "mirrorlist = ", "mirrorlist_expire = 86400", "name = MySQL 8.0 Community Server", "old_base_cache_dir = ", "password = ", "persistdir = /var/lib/yum/repos/x86_64/7/mysql80-community", "pkgdir = /var/cache/yum/x86_64/7/mysql80-community/packages", "proxy = False", "proxy_dict = ", "proxy_password = ", "proxy_username = ", "repo_gpgcheck = False", "retries = 10", "skip_if_unavailable = False", "ssl_check_cert_permissions = True", "sslcacert = ", "sslclientcert = ", "sslclientkey = ", "sslverify = True", "throttle = 0", "timeout = 30.0", "ui_id = mysql80-community/x86_64", "ui_repoid_vars = releasever,", "   basearch", "username = "]}

TASK [mysql_install : 开启mysql70 yum源] ******************************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:12
changed: [10.217.20.108] => {"changed": true, "cmd": "yum-config-manager --enable mysql57-community", "delta": "0:00:00.198004", "end": "2018-08-16 10:33:57.059969", "rc": 0, "start": "2018-08-16 10:33:56.861965", "stderr": "", "stderr_lines": [], "stdout": "已加载插件:fastestmirror\n=========================== repo: mysql57-community ============================\n[mysql57-community]\nasync = True\nbandwidth = 0\nbase_persistdir = /var/lib/yum/repos/x86_64/7\nbaseurl = http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/\ncache = 0\ncachedir = /var/cache/yum/x86_64/7/mysql57-community\ncheck_config_file_age = True\ncompare_providers_priority = 80\ncost = 1000\ndeltarpm_metadata_percentage = 100\ndeltarpm_percentage = \nenabled = 1\nenablegroups = True\nexclude = \nfailovermethod = priority\nftp_disable_epsv = False\ngpgcadir = /var/lib/yum/repos/x86_64/7/mysql57-community/gpgcadir\ngpgcakey = \ngpgcheck = True\ngpgdir = /var/lib/yum/repos/x86_64/7/mysql57-community/gpgdir\ngpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql\nhdrdir = /var/cache/yum/x86_64/7/mysql57-community/headers\nhttp_caching = all\nincludepkgs = \nip_resolve = \nkeepalive = True\nkeepcache = False\nmddownloadpolicy = sqlite\nmdpolicy = group:small\nmediaid = \nmetadata_expire = 21600\nmetadata_expire_filter = read-only:present\nmetalink = \nminrate = 0\nmirrorlist = \nmirrorlist_expire = 86400\nname = MySQL 5.7 Community Server\nold_base_cache_dir = \npassword = \npersistdir = /var/lib/yum/repos/x86_64/7/mysql57-community\npkgdir = /var/cache/yum/x86_64/7/mysql57-community/packages\nproxy = False\nproxy_dict = \nproxy_password = \nproxy_username = \nrepo_gpgcheck = False\nretries = 10\nskip_if_unavailable = False\nssl_check_cert_permissions = True\nsslcacert = \nsslclientcert = \nsslclientkey = \nsslverify = True\nthrottle = 0\ntimeout = 30.0\nui_id = mysql57-community/x86_64\nui_repoid_vars = releasever,\n   basearch\nusername = ", "stdout_lines": ["已加载插件:fastestmirror", "=========================== repo: mysql57-community ============================", "[mysql57-community]", "async = True", "bandwidth = 0", "base_persistdir = /var/lib/yum/repos/x86_64/7", "baseurl = http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/", "cache = 0", "cachedir = /var/cache/yum/x86_64/7/mysql57-community", "check_config_file_age = True", "compare_providers_priority = 80", "cost = 1000", "deltarpm_metadata_percentage = 100", "deltarpm_percentage = ", "enabled = 1", "enablegroups = True", "exclude = ", "failovermethod = priority", "ftp_disable_epsv = False", "gpgcadir = /var/lib/yum/repos/x86_64/7/mysql57-community/gpgcadir", "gpgcakey = ", "gpgcheck = True", "gpgdir = /var/lib/yum/repos/x86_64/7/mysql57-community/gpgdir", "gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql", "hdrdir = /var/cache/yum/x86_64/7/mysql57-community/headers", "http_caching = all", "includepkgs = ", "ip_resolve = ", "keepalive = True", "keepcache = False", "mddownloadpolicy = sqlite", "mdpolicy = group:small", "mediaid = ", "metadata_expire = 21600", "metadata_expire_filter = read-only:present", "metalink = ", "minrate = 0", "mirrorlist = ", "mirrorlist_expire = 86400", "name = MySQL 5.7 Community Server", "old_base_cache_dir = ", "password = ", "persistdir = /var/lib/yum/repos/x86_64/7/mysql57-community", "pkgdir = /var/cache/yum/x86_64/7/mysql57-community/packages", "proxy = False", "proxy_dict = ", "proxy_password = ", "proxy_username = ", "repo_gpgcheck = False", "retries = 10", "skip_if_unavailable = False", "ssl_check_cert_permissions = True", "sslcacert = ", "sslclientcert = ", "sslclientkey = ", "sslverify = True", "throttle = 0", "timeout = 30.0", "ui_id = mysql57-community/x86_64", "ui_repoid_vars = releasever,", "   basearch", "username = "]}

TASK [mysql_install : install mysql7] ******************************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:16
changed: [10.217.20.108] => {"changed": true, "msg": "warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.23-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY\nImporting GPG key 0x5072E1F5:\n Userid     : \"MySQL Release Engineering \"\n Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5\n Package    : mysql80-community-release-el7-1.noarch (installed)\n From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql\n", "rc": 0, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirrors.cqu.edu.cn\n * extras: centos.ustc.edu.cn\n * updates: mirrors.cqu.edu.cn\nResolving Dependencies\n--> Running transaction check\n---> Package mysql-community-server.x86_64 0:5.7.23-1.el7 will be installed\n--> Processing Dependency: mysql-community-common(x86-64) = 5.7.23-1.el7 for package: mysql-community-server-5.7.23-1.el7.x86_64\n--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.23-1.el7.x86_64\n--> Processing Dependency: perl(strict) for package: mysql-community-server-5.7.23-1.el7.x86_64\n--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-5.7.23-1.el7.x86_64\n--> Processing Dependency: net-tools for package: mysql-community-server-5.7.23-1.el7.x86_64\n--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.7.23-1.el7.x86_64\n--> Running transaction check\n---> Package mysql-community-client.x86_64 0:5.7.23-1.el7 will be installed\n--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.23-1.el7.x86_64\n---> Package mysql-community-common.x86_64 0:5.7.23-1.el7 will be installed\n---> Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed\n---> Package perl.x86_64 4:5.16.3-292.el7 will be installed\n--> Processing Dependency: perl-libs = 4:5.16.3-292.el7 for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl-libs for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-292.el7.x86_64\n--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-292.el7.x86_64\n---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed\n--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch\n--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch\n--> Running transaction check\n---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be obsoleted\n--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64\n--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64\n---> Package mysql-community-libs.x86_64 0:5.7.23-1.el7 will be obsoleting\n---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed\n---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed\n---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed\n---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed\n---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed\n---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed\n---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed\n--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch\n--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch\n---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed\n--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch\n--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch\n---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed\n---> Package perl-Socket.x86_64 0:2.010-4.el7 will be installed\n---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed\n---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed\n---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed\n---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed\n---> Package perl-constant.noarch 0:1.27-2.el7 will be installed\n---> Package perl-libs.x86_64 4:5.16.3-292.el7 will be installed\n---> Package perl-macros.x86_64 4:5.16.3-292.el7 will be installed\n---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed\n---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed\n--> Running transaction check\n---> Package mysql-community-libs-compat.x86_64 0:5.7.23-1.el7 will be obsoleting\n---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed\n---> Package perl-Pod-Escapes.noarch 1:1.04-292.el7 will be installed\n---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed\n--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch\n--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch\n---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed\n--> Running transaction check\n---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed\n---> Package perl-parent.noarch 1:0.225-244.el7 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package                Arch   Version                  Repository         Size\n================================================================================\nInstalling:\n mysql-community-libs   x86_64 5.7.23-1.el7             mysql57-community 2.2 M\n     replacing  mariadb-libs.x86_64 1:5.5.56-2.el7\n mysql-community-libs-compat\n                        x86_64 5.7.23-1.el7             mysql57-community 2.0 M\n     replacing  mariadb-libs.x86_64 1:5.5.56-2.el7\n mysql-community-server x86_64 5.7.23-1.el7             mysql57-community 165 M\nInstalling for dependencies:\n mysql-community-client x86_64 5.7.23-1.el7             mysql57-community  24 M\n mysql-community-common x86_64 5.7.23-1.el7             mysql57-community 274 k\n net-tools              x86_64 2.0-0.22.20131004git.el7 base              305 k\n perl                   x86_64 4:5.16.3-292.el7         base              8.0 M\n perl-Carp              noarch 1.26-244.el7             base               19 k\n perl-Encode            x86_64 2.51-7.el7               base              1.5 M\n perl-Exporter          noarch 5.68-3.el7               base               28 k\n perl-File-Path         noarch 2.09-2.el7               base               26 k\n perl-File-Temp         noarch 0.23.01-3.el7            base               56 k\n perl-Filter            x86_64 1.49-3.el7               base               76 k\n perl-Getopt-Long       noarch 2.40-3.el7               base               56 k\n perl-HTTP-Tiny         noarch 0.033-3.el7              base               38 k\n perl-PathTools         x86_64 3.40-5.el7               base               82 k\n perl-Pod-Escapes       noarch 1:1.04-292.el7           base               51 k\n perl-Pod-Perldoc       noarch 3.20-4.el7               base               87 k\n perl-Pod-Simple        noarch 1:3.28-4.el7             base              216 k\n perl-Pod-Usage         noarch 1.63-3.el7               base               27 k\n perl-Scalar-List-Utils x86_64 1.27-248.el7             base               36 k\n perl-Socket            x86_64 2.010-4.el7              base               49 k\n perl-Storable          x86_64 2.45-3.el7               base               77 k\n perl-Text-ParseWords   noarch 3.29-4.el7               base               14 k\n perl-Time-HiRes        x86_64 4:1.9725-3.el7           base               45 k\n perl-Time-Local        noarch 1.2300-2.el7             base               24 k\n perl-constant          noarch 1.27-2.el7               base               19 k\n perl-libs              x86_64 4:5.16.3-292.el7         base              688 k\n perl-macros            x86_64 4:5.16.3-292.el7         base               43 k\n perl-parent            noarch 1:0.225-244.el7          base               12 k\n perl-podlators         noarch 2.5.1-3.el7              base              112 k\n perl-threads           x86_64 1.87-4.el7               base               49 k\n perl-threads-shared    x86_64 1.43-6.el7               base               39 k\n\nTransaction Summary\n================================================================================\nInstall  3 Packages (+30 Dependent packages)\n\nTotal download size: 205 M\nDownloading packages:\nPublic key for mysql-community-common-5.7.23-1.el7.x86_64.rpm is not installed\n--------------------------------------------------------------------------------\nTotal                                               15 MB/s | 205 MB  00:13     \nRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n  Installing : mysql-community-common-5.7.23-1.el7.x86_64                  1/34 \n  Installing : mysql-community-libs-5.7.23-1.el7.x86_64                    2/34 \n  Installing : mysql-community-client-5.7.23-1.el7.x86_64                  3/34 \n  Installing : 1:perl-parent-0.225-244.el7.noarch                          4/34 \n  Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                           5/34 \n  Installing : perl-podlators-2.5.1-3.el7.noarch                           6/34 \n  Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                          7/34 \n  Installing : 1:perl-Pod-Escapes-1.04-292.el7.noarch                      8/34 \n  Installing : perl-Text-ParseWords-3.29-4.el7.noarch                      9/34 \n  Installing : perl-Encode-2.51-7.el7.x86_64                              10/34 \n  Installing : perl-Pod-Usage-1.63-3.el7.noarch                           11/34 \n  Installing : 4:perl-macros-5.16.3-292.el7.x86_64                        12/34 \n  Installing : 4:perl-libs-5.16.3-292.el7.x86_64                          13/34 \n  Installing : perl-Storable-2.45-3.el7.x86_64                            14/34 \n  Installing : perl-Exporter-5.68-3.el7.noarch                            15/34 \n  Installing : perl-constant-1.27-2.el7.noarch                            16/34 \n  Installing : perl-Time-Local-1.2300-2.el7.noarch                        17/34 \n  Installing : perl-Socket-2.010-4.el7.x86_64                             18/34 \n  Installing : perl-Carp-1.26-244.el7.noarch                              19/34 \n  Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                      20/34 \n  Installing : perl-PathTools-3.40-5.el7.x86_64                           21/34 \n  Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                 22/34 \n  Installing : perl-File-Temp-0.23.01-3.el7.noarch                        23/34 \n  Installing : perl-File-Path-2.09-2.el7.noarch                           24/34 \n  Installing : perl-threads-shared-1.43-6.el7.x86_64                      25/34 \n  Installing : perl-threads-1.87-4.el7.x86_64                             26/34 \n  Installing : perl-Filter-1.49-3.el7.x86_64                              27/34 \n  Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                        28/34 \n  Installing : perl-Getopt-Long-2.40-3.el7.noarch                         29/34 \n  Installing : 4:perl-5.16.3-292.el7.x86_64                               30/34 \n  Installing : net-tools-2.0-0.22.20131004git.el7.x86_64                  31/34 \n  Installing : mysql-community-server-5.7.23-1.el7.x86_64                 32/34 \n  Installing : mysql-community-libs-compat-5.7.23-1.el7.x86_64            33/34 \n  Erasing    : 1:mariadb-libs-5.5.56-2.el7.x86_64                         34/34 \n  Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                           1/34 \n  Verifying  : net-tools-2.0-0.22.20131004git.el7.x86_64                   2/34 \n  Verifying  : perl-threads-shared-1.43-6.el7.x86_64                       3/34 \n  Verifying  : perl-Storable-2.45-3.el7.x86_64                             4/34 \n  Verifying  : perl-Exporter-5.68-3.el7.noarch                             5/34 \n  Verifying  : perl-constant-1.27-2.el7.noarch                             6/34 \n  Verifying  : perl-PathTools-3.40-5.el7.x86_64                            7/34 \n  Verifying  : 4:perl-macros-5.16.3-292.el7.x86_64                         8/34 \n  Verifying  : mysql-community-server-5.7.23-1.el7.x86_64                  9/34 \n  Verifying  : 1:perl-parent-0.225-244.el7.noarch                         10/34 \n  Verifying  : 4:perl-5.16.3-292.el7.x86_64                               11/34 \n  Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                        12/34 \n  Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                        13/34 \n  Verifying  : perl-Time-Local-1.2300-2.el7.noarch                        14/34 \n  Verifying  : mysql-community-common-5.7.23-1.el7.x86_64                 15/34 \n  Verifying  : 4:perl-libs-5.16.3-292.el7.x86_64                          16/34 \n  Verifying  : perl-Socket-2.010-4.el7.x86_64                             17/34 \n  Verifying  : perl-Carp-1.26-244.el7.noarch                              18/34 \n  Verifying  : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                      19/34 \n  Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                 20/34 \n  Verifying  : 1:perl-Pod-Escapes-1.04-292.el7.noarch                     21/34 \n  Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                           22/34 \n  Verifying  : perl-Encode-2.51-7.el7.x86_64                              23/34 \n  Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                         24/34 \n  Verifying  : perl-podlators-2.5.1-3.el7.noarch                          25/34 \n  Verifying  : mysql-community-libs-5.7.23-1.el7.x86_64                   26/34 \n  Verifying  : mysql-community-libs-compat-5.7.23-1.el7.x86_64            27/34 \n  Verifying  : perl-File-Path-2.09-2.el7.noarch                           28/34 \n  Verifying  : mysql-community-client-5.7.23-1.el7.x86_64                 29/34 \n  Verifying  : perl-threads-1.87-4.el7.x86_64                             30/34 \n  Verifying  : perl-Filter-1.49-3.el7.x86_64                              31/34 \n  Verifying  : perl-Getopt-Long-2.40-3.el7.noarch                         32/34 \n  Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                     33/34 \n  Verifying  : 1:mariadb-libs-5.5.56-2.el7.x86_64                         34/34 \n\nInstalled:\n  mysql-community-libs.x86_64 0:5.7.23-1.el7                                    \n  mysql-community-libs-compat.x86_64 0:5.7.23-1.el7                             \n  mysql-community-server.x86_64 0:5.7.23-1.el7                                  \n\nDependency Installed:\n  mysql-community-client.x86_64 0:5.7.23-1.el7                                  \n  mysql-community-common.x86_64 0:5.7.23-1.el7                                  \n  net-tools.x86_64 0:2.0-0.22.20131004git.el7                                   \n  perl.x86_64 4:5.16.3-292.el7                                                  \n  perl-Carp.noarch 0:1.26-244.el7                                               \n  perl-Encode.x86_64 0:2.51-7.el7                                               \n  perl-Exporter.noarch 0:5.68-3.el7                                             \n  perl-File-Path.noarch 0:2.09-2.el7                                            \n  perl-File-Temp.noarch 0:0.23.01-3.el7                                         \n  perl-Filter.x86_64 0:1.49-3.el7                                               \n  perl-Getopt-Long.noarch 0:2.40-3.el7                                          \n  perl-HTTP-Tiny.noarch 0:0.033-3.el7                                           \n  perl-PathTools.x86_64 0:3.40-5.el7                                            \n  perl-Pod-Escapes.noarch 1:1.04-292.el7                                        \n  perl-Pod-Perldoc.noarch 0:3.20-4.el7                                          \n  perl-Pod-Simple.noarch 1:3.28-4.el7                                           \n  perl-Pod-Usage.noarch 0:1.63-3.el7                                            \n  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7                                  \n  perl-Socket.x86_64 0:2.010-4.el7                                              \n  perl-Storable.x86_64 0:2.45-3.el7                                             \n  perl-Text-ParseWords.noarch 0:3.29-4.el7                                      \n  perl-Time-HiRes.x86_64 4:1.9725-3.el7                                         \n  perl-Time-Local.noarch 0:1.2300-2.el7                                         \n  perl-constant.noarch 0:1.27-2.el7                                             \n  perl-libs.x86_64 4:5.16.3-292.el7                                             \n  perl-macros.x86_64 4:5.16.3-292.el7                                           \n  perl-parent.noarch 1:0.225-244.el7                                            \n  perl-podlators.noarch 0:2.5.1-3.el7                                           \n  perl-threads.x86_64 0:1.87-4.el7                                              \n  perl-threads-shared.x86_64 0:1.43-6.el7                                       \n\nReplaced:\n  mariadb-libs.x86_64 1:5.5.56-2.el7                                            \n\nComplete!\n"]}

TASK [mysql_install : 复制配置文件到mysql服务] ******************************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:18
NOTIFIED HANDLER restart mysql
changed: [10.217.20.108] => {"changed": true, "checksum": "e9b27776029a1d2900a75549e3ae797c1c5cd0d5", "dest": "/etc/my.cnf", "gid": 0, "group": "root", "md5sum": "f9fea832dadf9c2dc336b46c9f9a8ad2", "mode": "0644", "owner": "root", "secontext": "system_u:object_r:mysqld_etc_t:s0", "size": 1140, "src": "/root/.ansible/tmp/ansible-tmp-1534386908.08-261749000307592/source", "state": "file", "uid": 0}

TASK [mysql_install : 设置开启自启动并启动mysql] *****************************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:21
changed: [10.217.20.108] => {"changed": true, "enabled": true, "name": "mysqld.service", "state": "started", "status": {"ActiveEnterTimestampMonotonic": "0", "ActiveExitTimestampMonotonic": "0", "ActiveState": "inactive", "After": "network.target systemd-journald.socket system.slice basic.target syslog.target", "AllowIsolate": "no", "AmbientCapabilities": "0", "AssertResult": "no", "AssertTimestampMonotonic": "0", "Before": "shutdown.target multi-user.target", "BlockIOAccounting": "no", "BlockIOWeight": "18446744073709551615", "CPUAccounting": "no", "CPUQuotaPerSecUSec": "infinity", "CPUSchedulingPolicy": "0", "CPUSchedulingPriority": "0", "CPUSchedulingResetOnFork": "no", "CPUShares": "18446744073709551615", "CanIsolate": "no", "CanReload": "no", "CanStart": "yes", "CanStop": "yes", "CapabilityBoundingSet": "18446744073709551615", "ConditionResult": "no", "ConditionTimestampMonotonic": "0", "Conflicts": "shutdown.target", "ControlPID": "0", "DefaultDependencies": "yes", "Delegate": "no", "Description": "MySQL Server", "DevicePolicy": "auto", "Documentation": "man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html", "EnvironmentFile": "/etc/sysconfig/mysql (ignore_errors=yes)", "ExecMainCode": "0", "ExecMainExitTimestampMonotonic": "0", "ExecMainPID": "0", "ExecMainStartTimestampMonotonic": "0", "ExecMainStatus": "0", "ExecStart": "{ path=/usr/sbin/mysqld ; argv[]=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }", "ExecStartPre": "{ path=/usr/bin/mysqld_pre_systemd ; argv[]=/usr/bin/mysqld_pre_systemd ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }", "FailureAction": "none", "FileDescriptorStoreMax": "0", "FragmentPath": "/usr/lib/systemd/system/mysqld.service", "Group": "mysql", "GuessMainPID": "yes", "IOScheduling": "0", "Id": "mysqld.service", "IgnoreOnIsolate": "no", "IgnoreOnSnapshot": "no", "IgnoreSIGPIPE": "yes", "InactiveEnterTimestampMonotonic": "0", "InactiveExitTimestampMonotonic": "0", "JobTimeoutAction": "none", "JobTimeoutUSec": "0", "KillMode": "control-group", "KillSignal": "15", "LimitAS": "18446744073709551615", "LimitCORE": "18446744073709551615", "LimitCPU": "18446744073709551615", "LimitDATA": "18446744073709551615", "LimitFSIZE": "18446744073709551615", "LimitLOCKS": "18446744073709551615", "LimitMEMLOCK": "65536", "LimitMSGQUEUE": "819200", "LimitNICE": "0", "LimitNOFILE": "5000", "LimitNPROC": "95619", "LimitRSS": "18446744073709551615", "LimitRTPRIO": "0", "LimitRTTIME": "18446744073709551615", "LimitSIGPENDING": "95619", "LimitSTACK": "18446744073709551615", "LoadState": "loaded", "MainPID": "0", "MemoryAccounting": "no", "MemoryCurrent": "18446744073709551615", "MemoryLimit": "18446744073709551615", "MountFlags": "0", "Names": "mysqld.service", "NeedDaemonReload": "no", "Nice": "0", "NoNewPrivileges": "no", "NonBlocking": "no", "NotifyAccess": "none", "OOMScoreAdjust": "0", "OnFailureJobMode": "replace", "PIDFile": "/var/run/mysqld/mysqld.pid", "PermissionsStartOnly": "yes", "PrivateDevices": "no", "PrivateNetwork": "no", "PrivateTmp": "no", "ProtectHome": "no", "ProtectSystem": "no", "RefuseManualStart": "no", "RefuseManualStop": "no", "RemainAfterExit": "no", "Requires": "basic.target", "Restart": "on-failure", "RestartUSec": "100ms", "Result": "success", "RootDirectoryStartOnly": "no", "RuntimeDirectoryMode": "0755", "SameProcessGroup": "no", "SecureBits": "0", "SendSIGHUP": "no", "SendSIGKILL": "yes", "Slice": "system.slice", "StandardError": "inherit", "StandardInput": "null", "StandardOutput": "journal", "StartLimitAction": "none", "StartLimitBurst": "5", "StartLimitInterval": "10000000", "StartupBlockIOWeight": "18446744073709551615", "StartupCPUShares": "18446744073709551615", "StatusErrno": "0", "StopWhenUnneeded": "no", "SubState": "dead", "SyslogLevelPrefix": "yes", "SyslogPriority": "30", "SystemCallErrorNumber": "0", "TTYReset": "no", "TTYVHangup": "no", "TTYVTDisallocate": "no", "TasksAccounting": "no", "TasksCurrent": "18446744073709551615", "TasksMax": "18446744073709551615", "TimeoutStartUSec": "0", "TimeoutStopUSec": "0", "TimerSlackNSec": "50000", "Transient": "no", "Type": "forking", "UMask": "0022", "UnitFilePreset": "disabled", "UnitFileState": "enabled", "User": "mysql", "WantedBy": "multi-user.target", "Wants": "system.slice", "WatchdogTimestampMonotonic": "0", "WatchdogUSec": "0"}}

TASK [mysql_install : install expect] ******************************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:23
changed: [10.217.20.108] => {"changed": true, "msg": "", "rc": 0, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirrors.cqu.edu.cn\n * extras: centos.ustc.edu.cn\n * updates: mirrors.cqu.edu.cn\nResolving Dependencies\n--> Running transaction check\n---> Package expect.x86_64 0:5.45-14.el7_1 will be installed\n--> Processing Dependency: libtcl8.5.so()(64bit) for package: expect-5.45-14.el7_1.x86_64\n--> Running transaction check\n---> Package tcl.x86_64 1:8.5.13-8.el7 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package         Arch            Version                    Repository     Size\n================================================================================\nInstalling:\n expect          x86_64          5.45-14.el7_1              base          262 k\nInstalling for dependencies:\n tcl             x86_64          1:8.5.13-8.el7             base          1.9 M\n\nTransaction Summary\n================================================================================\nInstall  1 Package (+1 Dependent package)\n\nTotal download size: 2.1 M\nInstalled size: 4.9 M\nDownloading packages:\n--------------------------------------------------------------------------------\nTotal                                              369 kB/s | 2.1 MB  00:05     \nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n  Installing : 1:tcl-8.5.13-8.el7.x86_64                                    1/2 \n  Installing : expect-5.45-14.el7_1.x86_64                                  2/2 \n  Verifying  : 1:tcl-8.5.13-8.el7.x86_64                                    1/2 \n  Verifying  : expect-5.45-14.el7_1.x86_64                                  2/2 \n\nInstalled:\n  expect.x86_64 0:5.45-14.el7_1                                                 \n\nDependency Installed:\n  tcl.x86_64 1:8.5.13-8.el7                                                     \n\nComplete!\n"]}

TASK [mysql_install : 修改mysql默认密码并开启root远程登录] **********************************
task path: /opt/playbook/roles/mysql_install/tasks/install.yml:25
changed: [10.217.20.108] => {"changed": true, "rc": 0, "stderr": "Shared connection to 10.217.20.108 closed.\r\n", "stdout": "spawn mysql -uroot -p\r\r\r\nEnter password: \r\r\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\r\r\nYour MySQL connection id is 2\r\r\nServer version: 5.7.23\r\r\n\r\r\nCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.\r\r\n\r\r\nOracle is a registered trademark of Oracle Corporation and/or its\r\r\naffiliates. Other names may be trademarks of their respective\r\r\nowners.\r\r\n\r\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\r\n\r\r\nmysql> ALTER USER 'root'@'localhost' IDENTIFIED BY \"MyNewPass4!\";\r\r\nQuery OK, 0 rows affected (0.01 sec)\r\r\n\r\r\nmysql> use mysql;\r\r\nReading table information for completion of table and column names\r\r\nYou can turn off this feature to get a quicker startup with -A\r\r\n\r\r\nDatabase changed\r\r\nmysql> update user set host='%' where user='root' and host='localhost';\r\r\nQuery OK, 1 row affected (0.00 sec)\r\r\nRows matched: 1  Changed: 1  Warnings: 0\r\r\n\r\r\nmysql> flush privileges;\r\r\nQuery OK, 0 rows affected (0.00 sec)\r\r\n\r\r\nmysql> ", "stdout_lines": ["spawn mysql -uroot -p", "", "", "Enter password: ", "", "Welcome to the MySQL monitor.  Commands end with ; or \\g.", "", "Your MySQL connection id is 2", "", "Server version: 5.7.23", "", "", "", "Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.", "", "", "", "Oracle is a registered trademark of Oracle Corporation and/or its", "", "affiliates. Other names may be trademarks of their respective", "", "owners.", "", "", "", "Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.", "", "", "", "mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY \"MyNewPass4!\";", "", "Query OK, 0 rows affected (0.01 sec)", "", "", "", "mysql> use mysql;", "", "Reading table information for completion of table and column names", "", "You can turn off this feature to get a quicker startup with -A", "", "", "", "Database changed", "", "mysql> update user set host='%' where user='root' and host='localhost';", "", "Query OK, 1 row affected (0.00 sec)", "", "Rows matched: 1  Changed: 1  Warnings: 0", "", "", "", "mysql> flush privileges;", "", "Query OK, 0 rows affected (0.00 sec)", "", "", "", "mysql> "]}

RUNNING HANDLER [mysql_install : restart mysql] ********************************
changed: [10.217.20.108] => {"changed": true, "enabled": true, "name": "mysqld", "state": "started", "status": {"ActiveEnterTimestamp": "四 2018-08-16 10:35:15 CST", "ActiveEnterTimestampMonotonic": "165927353", "ActiveExitTimestampMonotonic": "0", "ActiveState": "active", "After": "network.target systemd-journald.socket system.slice basic.target syslog.target", "AllowIsolate": "no", "AmbientCapabilities": "0", "AssertResult": "yes", "AssertTimestamp": "四 2018-08-16 10:35:09 CST", "AssertTimestampMonotonic": "159527102", "Before": "shutdown.target multi-user.target", "BlockIOAccounting": "no", "BlockIOWeight": "18446744073709551615", "CPUAccounting": "no", "CPUQuotaPerSecUSec": "infinity", "CPUSchedulingPolicy": "0", "CPUSchedulingPriority": "0", "CPUSchedulingResetOnFork": "no", "CPUShares": "18446744073709551615", "CanIsolate": "no", "CanReload": "no", "CanStart": "yes", "CanStop": "yes", "CapabilityBoundingSet": "18446744073709551615", "ConditionResult": "yes", "ConditionTimestamp": "四 2018-08-16 10:35:09 CST", "ConditionTimestampMonotonic": "159527101", "Conflicts": "shutdown.target", "ControlGroup": "/system.slice/mysqld.service", "ControlPID": "0", "DefaultDependencies": "yes", "Delegate": "no", "Description": "MySQL Server", "DevicePolicy": "auto", "Documentation": "man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html", "EnvironmentFile": "/etc/sysconfig/mysql (ignore_errors=yes)", "ExecMainCode": "0", "ExecMainExitTimestampMonotonic": "0", "ExecMainPID": "2182", "ExecMainStartTimestamp": "四 2018-08-16 10:35:15 CST", "ExecMainStartTimestampMonotonic": "165927298", "ExecMainStatus": "0", "ExecStart": "{ path=/usr/sbin/mysqld ; argv[]=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS ; ignore_errors=no ; start_time=[四 2018-08-16 10:35:15 CST] ; stop_time=[四 2018-08-16 10:35:15 CST] ; pid=2179 ; code=exited ; status=0 }", "ExecStartPre": "{ path=/usr/bin/mysqld_pre_systemd ; argv[]=/usr/bin/mysqld_pre_systemd ; ignore_errors=no ; start_time=[四 2018-08-16 10:35:09 CST] ; stop_time=[四 2018-08-16 10:35:15 CST] ; pid=2100 ; code=exited ; status=0 }", "FailureAction": "none", "FileDescriptorStoreMax": "0", "FragmentPath": "/usr/lib/systemd/system/mysqld.service", "Group": "mysql", "GuessMainPID": "yes", "IOScheduling": "0", "Id": "mysqld.service", "IgnoreOnIsolate": "no", "IgnoreOnSnapshot": "no", "IgnoreSIGPIPE": "yes", "InactiveEnterTimestampMonotonic": "0", "InactiveExitTimestamp": "四 2018-08-16 10:35:09 CST", "InactiveExitTimestampMonotonic": "159529697", "JobTimeoutAction": "none", "JobTimeoutUSec": "0", "KillMode": "control-group", "KillSignal": "15", "LimitAS": "18446744073709551615", "LimitCORE": "18446744073709551615", "LimitCPU": "18446744073709551615", "LimitDATA": "18446744073709551615", "LimitFSIZE": "18446744073709551615", "LimitLOCKS": "18446744073709551615", "LimitMEMLOCK": "65536", "LimitMSGQUEUE": "819200", "LimitNICE": "0", "LimitNOFILE": "5000", "LimitNPROC": "95619", "LimitRSS": "18446744073709551615", "LimitRTPRIO": "0", "LimitRTTIME": "18446744073709551615", "LimitSIGPENDING": "95619", "LimitSTACK": "18446744073709551615", "LoadState": "loaded", "MainPID": "2182", "MemoryAccounting": "no", "MemoryCurrent": "18446744073709551615", "MemoryLimit": "18446744073709551615", "MountFlags": "0", "Names": "mysqld.service", "NeedDaemonReload": "no", "Nice": "0", "NoNewPrivileges": "no", "NonBlocking": "no", "NotifyAccess": "none", "OOMScoreAdjust": "0", "OnFailureJobMode": "replace", "PIDFile": "/var/run/mysqld/mysqld.pid", "PermissionsStartOnly": "yes", "PrivateDevices": "no", "PrivateNetwork": "no", "PrivateTmp": "no", "ProtectHome": "no", "ProtectSystem": "no", "RefuseManualStart": "no", "RefuseManualStop": "no", "RemainAfterExit": "no", "Requires": "basic.target", "Restart": "on-failure", "RestartUSec": "100ms", "Result": "success", "RootDirectoryStartOnly": "no", "RuntimeDirectoryMode": "0755", "SameProcessGroup": "no", "SecureBits": "0", "SendSIGHUP": "no", "SendSIGKILL": "yes", "Slice": "system.slice", "StandardError": "inherit", "StandardInput": "null", "StandardOutput": "journal", "StartLimitAction": "none", "StartLimitBurst": "5", "StartLimitInterval": "10000000", "StartupBlockIOWeight": "18446744073709551615", "StartupCPUShares": "18446744073709551615", "StatusErrno": "0", "StopWhenUnneeded": "no", "SubState": "running", "SyslogLevelPrefix": "yes", "SyslogPriority": "30", "SystemCallErrorNumber": "0", "TTYReset": "no", "TTYVHangup": "no", "TTYVTDisallocate": "no", "TasksAccounting": "no", "TasksCurrent": "18446744073709551615", "TasksMax": "18446744073709551615", "TimeoutStartUSec": "0", "TimeoutStopUSec": "0", "TimerSlackNSec": "50000", "Transient": "no", "Type": "forking", "UMask": "0022", "UnitFilePreset": "disabled", "UnitFileState": "enabled", "User": "mysql", "WantedBy": "multi-user.target", "Wants": "system.slice", "WatchdogTimestamp": "四 2018-08-16 10:35:15 CST", "WatchdogTimestampMonotonic": "165927321", "WatchdogUSec": "0"}}
META: ran handlers
META: ran handlers

PLAY RECAP *********************************************************************
10.217.20.108              : ok=11   changed=11   unreachable=0    failed=0   

root@afb8d4a179be:/# 

你可能感兴趣的:(ansible-playbook方式安装mysql5.7(centos7))