How to Deploy Drupal 8 with Ansible Playbook

Create a new directory to add the roles in our Ansible playbook by running:

cd ~/drupal-ansible
mkdir roles

Installing MariaDB Role

Create a new directory for “mariadb” role and subdirectories for tasks, handlers, and templates.

mkdir -p roles/mariadb/{tasks,handlers,templates}
nano roles/mariadb/tasks/main.yaml
- 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'] }}
---
# mariadb role variables
mysql_root_pass: VeryStrongPassword
drupal_db_user: drupal-data
drupal_db_name: drupal-user
drupal_db_pass: StrongPass

Related Blog Posts

How to Create Ansible playbook for Deploying Drupal 8

  1. Install the PHP 7.2 on the instance “web-server”.
  2. Clone the Drupal 8 and Drush 9 Github repository and install Drupal on the instance “web-server”.
  3. Install the NGINX Web server to host the Drupal site with optional Let’s Encrypt SSL on the instance “web-server”.

Related Market Product

Drupal 8 powered by Miri Infotech(LAMP&UBUNTU 16)

Related Documentation

[Vulnerability notice] CVE-2017–6920: Remote code execution vulnerability in Drupal

Related Products

Elastic Compute Service

Related Course

ACT81002 Alibaba Cloud Technical Operations

Original Source

https://www.alibabacloud.com/blog/594886?spm=a2c41.13092868.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store