Files @ a5f4c1ec6853
Branch filter:

Location: majic-ansible-roles/roles/php_website/molecule/default/prepare.yml

branko
MAR-129: Updated web_server role for Ansible 2.5.x and new Molecule:

- Fixed linting errors.
- Include global linting configuration file in the test configuration.
- Moved variables from the test playbook into group variables.
- Updated how hosts are referenced in tests.
- Fixed deprecation warnings.
---

- name: Prepare
  hosts: all
  gather_facts: False
  tasks:
    - name: Install python for Ansible
      raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
      become: True
      changed_when: False

- hosts: all
  become: yes
  tasks:

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

    - 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: Install swaks for testing mail forwarding
      apt:
        name: swaks
        state: installed

    - name: Install Postfix for testing mail forwarding (Exim4 not covered)
      apt:
        name: postfix
        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