=====Overview===== In this section, we will build 3 servers. * 1 Ansible Central * 2 MySQL servers All that will be automated, so let's get going: =====Configuration===== Since all will be automated, we will use both: - Vagrant: For the Virtual Machines - Ansible: For the MySQL Replication That will allow us to automate the entire process :) Let's get firstly with the VM: ====VM Automation==== I have prepared some simple vagrant file, which when you run, you will have the following output: PS C:\Learning\Oracle Interview\VMs\MySQLSetup> vagrant up ****************************************************************** mysqlsrv2: PyYAML.x86_64 0:3.10-11.el7 mysqlsrv2: libyaml.x86_64 0:0.1.4-11.el7_0 mysqlsrv2: python-babel.noarch 0:0.9.6-8.el7 mysqlsrv2: python-backports.x86_64 0:1.0-8.el7 mysqlsrv2: python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 mysqlsrv2: python-cffi.x86_64 0:1.6.0-5.el7 mysqlsrv2: python-enum34.noarch 0:1.0.4-1.el7 mysqlsrv2: python-idna.noarch 0:2.4-1.el7 mysqlsrv2: python-ipaddress.noarch 0:1.0.16-2.el7 mysqlsrv2: python-jinja2.noarch 0:2.7.2-4.el7 mysqlsrv2: python-markupsafe.x86_64 0:0.11-10.el7 mysqlsrv2: python-paramiko.noarch 0:2.1.1-9.el7 mysqlsrv2: python-ply.noarch 0:3.4-11.el7 mysqlsrv2: python-pycparser.noarch 0:2.14-1.el7 mysqlsrv2: python-setuptools.noarch 0:0.9.8-7.el7 mysqlsrv2: python-six.noarch 0:1.9.0-2.el7 mysqlsrv2: python2-cryptography.x86_64 0:1.7.2-2.el7 mysqlsrv2: python2-httplib2.noarch 0:0.18.1-3.el7 mysqlsrv2: python2-jmespath.noarch 0:0.9.4-2.el7 mysqlsrv2: python2-pyasn1.noarch 0:0.1.9-7.el7 mysqlsrv2: sshpass.x86_64 0:1.06-2.el7 mysqlsrv2: mysqlsrv2: Complete! ==> mysqlsrv2: Running provisioner: shell... mysqlsrv2: Running: inline script You can see the vagrant file in the APPENDIX at the end of the section, alongside with the other automation files: Once we have the VMs, connect to the "ansiblecentral" using the following oriantation: 10.100.199.200 ansiblecentral 10.100.199.201 mysqlsrv1 10.100.199.202 mysqlsrv2 ====MySQL Replication Automation==== Using Ansible, I have created several files, which are all automated and deploy MySQL Replication in the matter of minutes: [root@ansiblecentral vagrant]# ./deployAllToRun.sh PLAY [install MySQL Servers] ********************************************************************************************************************************************************** TASK [Gathering Facts] **************************************************************************************************************************************************************** ok: [10.100.199.201] ok: [10.100.199.202] TASK [Install MySQL 5.7 repo] ********************************************************************************************************************************************************* ok: [10.100.199.201] ok: [10.100.199.202] *************************************************** PLAY RECAP **************************************************************************************************************************************************************************** 10.100.199.201 : ok=15 changed=11 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 10.100.199.202 : ok=14 changed=11 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [root@ansiblecentral vagrant]# Your OK and changed values, might differ. All that will deploy MySQL with Replication. =====Appendix===== ===Vagrant File=== $allow_shell = <