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

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