Files @ 1b6495e2ba42
Branch filter:

Location: majic-ansible-roles/roles/php_website/playbook.yml

branko
MAR-29: Added scaffolding for testing the php_website role:

- Added molecule configuration with a single instance.
- Added playbook that sets-up the test instances.
- Fixed issues related to incorrect mode syntax when deploying files (missing
leading zero).
- Added test data.
- Added dummy tests.
---

- hosts: all
  tasks:

    - name: Update all caches to avoid errors due to missing remote archives
      apt:
        update_cache: yes

    - name: Set-up /etc/hosts entries
      lineinfile:
        dest: /etc/hosts
        line: "{{ ansible_eth0.ipv4.address }} parameters-mandatory parameters-optional.local php-website"

    - name: Install curl for testing redirects and webpage content
      apt:
        name: curl
        state: installed

    - name: Set-up group for an additional user
      group:
        name: user
        state: present

    - name: Set-up additional user for testing mail delivery
      user:
        name: user
        group: user
        shell: /bin/bash

- hosts: all
  vars:
    # common
    ca_certificates:
      testca: "{{ lookup('file', 'tests/data/x509/ca.cert.pem') }}"

    # web_server
    default_https_tls_certificate: "{{ lookup('file', 'tests/data/x509/php-website_https.cert.pem') }}"
    default_https_tls_key: "{{ lookup('file', 'tests/data/x509/php-website_https.key.pem') }}"

    # Common parameters (general, not role).
    tls_certificate_dir: tests/data/x509/
    tls_private_key_dir: tests/data/x509/

  roles:
    - role: php_website
      fqdn: parameters-mandatory

    - role: php_website
      additional_fpm_config:
        "env[PATH]": "\"/usr/local/bin:/usr/bin:/bin\""
      additional_nginx_config:
        - comment: Custom missing page.
          value: error_page 404 /404.php;
      admin_uid: 5000
      deny_files_regex:
        - '^/secretfile.txt'
      enforce_https: no
      environment_indicator:
        background_colour: "#ff0000"
        text_colour: "#00ff00"
        text: "parameters-optional"
      fqdn: parameters-optional.local
      index: myindex.php
      https_tls_certificate: "{{ lookup('file', 'tests/data/x509/parameters-optional.local_https.cert.pem') }}"
      https_tls_key: "{{ lookup('file', 'tests/data/x509/parameters-optional.local_https.key.pem') }}"
      php_file_regex: "\\.myphp$"
      php_rewrite_urls:
        - ^(.*)$ /index.php?url=$1 last
      rewrites:
        - '^/rewrite_to_index/(.*) /myindex.php last'
      packages:
        - php5-ldap
        - php5-json
      uid: 5001
      website_mail_recipients: user