Compare commits

...

4 commits

Author SHA1 Message Date
ca95b34514
Document adding the port number
References 
2021-03-16 09:05:18 +00:00
6a12b176e7
Allow for configuring the MySQL port number
Fixes 
2021-03-16 09:04:14 +00:00
c21e012c47 Start updating the README
https://github.com/opdavies/ansible-role-drupal-settings/issues/1
2020-02-19 02:49:08 +00:00
2cf2b919e2 Copy molecule tests from next branch
Add more tests in follow-up PRs.

Fixes 
2020-02-19 02:48:24 +00:00
9 changed files with 100 additions and 0 deletions

11
.yamllint Normal file
View file

@ -0,0 +1,11 @@
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy: disable

View file

@ -1,5 +1,9 @@
# Ansible Role: Drupal settings
A role for automatically generating `settings.php` files for Drupal 7 and 8 applications.
## Example
```yaml
drupal_settings:
- drupal_root: /var/www/web
@ -14,6 +18,7 @@ drupal_settings:
default: # The database target
driver: mysql # Optional, defaults to 'mysql'
host: localhost # Optional, defaults to 'localhost'
port: 3306 # Optional
database: mydatabase
username: user
password: secret

View file

@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View file

@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******
Requirements
============
* Docker Engine
Install
=======
Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
.. code-block:: bash
$ pip install 'molecule[docker]'

View file

@ -0,0 +1,18 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: instance
image: centos:7
provisioner:
name: ansible
lint:
name: ansible-lint
verifier:
name: testinfra
lint:
name: flake8

View file

@ -0,0 +1,11 @@
---
- name: Converge
hosts: all
vars:
drupal_settings:
- root: /var/www/test
sites:
- name: default
filename: settings.test.php
roles:
- role: opdavies.drupal-settings

View file

@ -0,0 +1,18 @@
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_drupal_site_directory_exists(host):
directory = host.file('/var/www/test/sites/default')
assert directory.exists
assert directory.is_directory
def test_drupal_settings_file_exists(host):
file = host.file('/var/www/test/sites/default/settings.test.php')
assert file.exists
assert file.is_file

Binary file not shown.

View file

@ -7,6 +7,7 @@
$databases['{{ key }}']['{{ target }}'] = array(
'driver' => '{{ values.driver|default('mysql') }}',
'host' => '{{ values.host|default('localhost') }}',
'port' => '{{ values.port|default('3306') }}',
'database' => '{{ values.database }}',
'username' => '{{ values.username }}',
'password' => '{{ values.password }}',