Deploying Drupal 8 using Ansible Playbook: Part 1


Getting Started with Ansible

aliyun@ubuntu:~$ ansible --version
ansible 2.5.4
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/aliyun/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
mkdir ~/drupal-ansible
cd ~/drupal-ansible
nano ansible.cfg
inventory = hosts
host_key_checking = false
private_key_file = ~/.ssh/aliyun.pem
nano hosts
web-server  ansible_ssh_host= ansible_ssh_user=root
db-server ansible_ssh_host= ansible_ssh_user=root
aliyun@ubuntu:~/drupal-ansible$ ansible all -m ping
db-server | SUCCESS => {
"changed": false,
"ping": "pong"
web-server | SUCCESS => {
"changed": false,
"ping": "pong"
cd ~/drupal-ansible
nano playbook.yaml
- hosts: all
gather_facts: true
- name: update and upgrade system packages
upgrade: yes
update_cache: yes
- hosts: db-server
- mariadb
- hosts: web-server
become: true
- php
- drupal
- nginx




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