This tutorial assumes that you have already created both the instance and configured SSH key-based authentication on the instances with the same key. Here are the goals which we will accomplish using Ansible:
By default, MariaDB listens to the localhost addresses only. In our scenario, we are using one server to host the database server and the other one will be used for installing Drupal. We will need to modify the MariaDB configuration so that it can listen to all address. In our case, the ECS server running Drupal will make queries to the database server instance. The below task will find the line starting with bind-address in the MySQL configuration file /etc/mysql/my.cnf. Upon matching, it will take the backup of the file and will replace the whole line with bind-address = 0.0.0.0. It will then notify the handler to run the job named with restart mariadb.
Finally, create the database for Drupal and also create a new database user having all the privileges over the database we have created.
- name: create a new database for Drupal
mysql_db: name={{ drupal_db_name }} state=present
- name: create a new database user for Drupal
mysql_user: name={{ drupal_db_user }} password={{ drupal_db_pass }}
priv="{{ drupal_db_name }}.*:ALL" state=present host={{ hostvars['web-server']['ansible_default_ipv4']['address'] }}
Notice the variable hostvars'web-server'['address'] in the last task. The variable will result in the private IP address of instance named "web-server" which is the instance on which we will install Drupal. This will make sure that our database can be used only from that instance.
In this article, you will get some information on the creation of Drupal role for further running of Ansible playbook.
Create a new directory for "drupal" role and subdirectories for tasks.
mkdir -p roles/drupal/tasks
Now, create a new YAML file to write the tasks of "drupal" role.
nano roles/drupal/tasks/main.yaml
The Composer is used to manage the dependencies of a php-based project. Since we will be cloning the Git repository onto the server, we will require Composer to install the dependencies. Notice the "creates" keyword in the arguments. It simply verifies if the said file is created or not. The next task installs the Git.
Now that Git is installed, clone the Drush repository using the "git" module of the Ansible. Drush is a command line tool to install Drupal.
Drupal is an open source content-management framework written in PHP and distributed under the GNU General Public License. Drupal supports from personal blogs to corporate, political, and government sites. Systems also use Drupal for knowledge management and for business collaboration.
Alibaba Cloud Elastic Compute Service (ECS) provides fast memory and the latest Intel CPUs to help you to power your cloud applications and achieve faster results with low latency. All ECS instances come with Anti-DDoS protection to safeguard your data and applications from DDoS and Trojan attacks.
Alibaba Cloud SSL Certificates Service allows customers to directly apply, purchase and manage SSL certificates on Alibaba Cloud. This service is offered in cooperation with qualified certificate authorities. From this platform, customers can select the expected certificate authority and its certificate products to enjoy full-site HTTPS security solutions.
How to construct a dynamic website that can actively update its content? In this Clouder lesson, you will learn how to build a WordPress website on Alibaba Cloud quickly using ECS marketplace image. The language of instruction in the video course is Cantonese. All presentation materials and exam questions are in English.
Alibaba Builds High-Speed RDMA Network for AI and Scientific Computing
2,599 posts | 762 followers
FollowAlibaba Clouder - May 29, 2019
Alibaba Clouder - July 12, 2018
Alibaba Clouder - July 12, 2018
Alibaba Clouder - May 31, 2019
Alibaba Clouder - July 12, 2018
Alibaba Clouder - May 31, 2019
2,599 posts | 762 followers
FollowIdentify vulnerabilities and improve security management of Alibaba Cloud WAF and Anti-DDoS and with a fully managed security service
Learn MoreMore Posts by Alibaba Clouder