Update wordpress to use service role

This commit is contained in:
uumas
2024-07-28 01:20:10 +03:00
parent 5921c7d5db
commit a773666715
6 changed files with 98 additions and 12 deletions

View File

@@ -0,0 +1,25 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include wordpress"
ansible.builtin.include_role:
name: "wordpress"
vars:
docker_additional_services:
- memcached
- redis
wordpress_php_extensions:
- pdo_mysql
wordpress_additional_volumes:
- www
- log
database_passwords:
wordpress: molecule
docker_vhost_domains:
wordpress:
- localhost
admin_email: molecule@example.com
ports:
wordpress:
http: 28001

View File

@@ -0,0 +1,15 @@
---
dependency:
name: galaxy
driver:
name: podman
platforms:
- name: bullseye
image: git.uumas.fi/uumas/molecule-testbed:bullseye-docker
command: /lib/systemd/systemd
pre_build_image: true
privileged: true
provisioner:
name: ansible
verifier:
name: ansible

View File

@@ -0,0 +1,44 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Ensure https://localhost responds appropriately
ansible.builtin.uri:
url: https://localhost
validate_certs: false
return_content: true
register: get_localhost
- name: "Assert caddy responded on https://localhost"
ansible.builtin.assert:
that: "(get_localhost.server | split(', '))[0] == 'Caddy'"
- name: "Assert apache responded on https://localhost"
ansible.builtin.assert:
that: "(get_localhost.server | split(', '))[1].startswith('Apache')"
- name: Assert there was a redirect
ansible.builtin.assert:
that: "get_localhost.redirected == true"
- name: Get docker host info
community.docker.docker_host_info:
volumes: true
register: docker_host_out
- name: Assert all containers are running
ansible.builtin.assert:
that: docker_host_out.host_info.Containers == docker_host_out.host_info.ContainersRunning
msg: There should have been {{ docker_host_out.host_info.Containers }} containers running but there were {{ docker_host_out.host_info.ContainersRunning }}
- name: Assert correct number of containers were created
ansible.builtin.assert:
that: docker_host_out.host_info.Containers == 4
msg: There should have been 4 containers created but there were {{ docker_host_out.host_info.Containers }}
- name: Assert correct number of images were pulled
ansible.builtin.assert:
that: docker_host_out.host_info.Images == 6
msg: There should have been 4 images present but there were {{ docker_host_out.host_info.Images }}
- name: Assert no volumes were created
ansible.builtin.assert:
that: docker_host_out.volumes | length == 0
msg: There should have been no volumes present but there were {{ docker_host_out.volumes | length }}