Files @ ef201fa5ec5f
Branch filter:

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

branko
MAR-128: Upgraded tests for backup_server role:

- Switch to new Molecule configuration.
- Updated set-up playbook to use become: yes.
- Moved some preparatory steps outside of the main playbook (eases
idempotence tests).
- Updated tests to reference the yml inventory file.
- Updated tests to use new fixture (host instead of individual ones).
- Switched to extracting IP address instead of hard-coding it in a
couple of tests.
- Moved test for checking available authentication mechanisms for
backup SSH server to be part of testing of parameters_optional only
for now (it was hard coded to that IP, and fails on
parameters-mandatory due to iptables not opening correct ports).
---

- hosts: all
  tasks:

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

- hosts: parameters-mandatory
  roles:
    - role: backup
      backup_patterns_filename: "test"
  vars:
    # Required for backup_client role which is part of meta dependencies.
    backup_encryption_key: "{{ lookup('file', 'tests/data/gnupg/parameters-mandatory.asc') }}"
    backup_server: 10.31.127.10
    backup_server_host_ssh_public_keys:
      - "{{ lookup('file', 'tests/data/ssh/server_dsa.pub') }}"
      - "{{ lookup('file', 'tests/data/ssh/server_rsa.pub') }}"
      - "{{ lookup('file', 'tests/data/ssh/server_ed25519.pub') }}"
      - "{{ lookup('file', 'tests/data/ssh/server_ecdsa.pub') }}"
    backup_ssh_key: "{{ lookup('file', 'tests/data/ssh/parameters-mandatory' ) }}"


- hosts: parameters-optional
  roles:
    - role: backup
      backup_patterns_filename: "test"
      backup_patterns:
        - /etc/hosts
        - /etc/ethers
        - /var/log
  vars:
    # Required for backup_client role which is part of meta dependencies.
    backup_encryption_key: "{{ lookup('file', 'tests/data/gnupg/parameters-optional.asc') }}"
    backup_server: 10.31.127.10
    backup_server_host_ssh_public_keys:
      - "{{ lookup('file', 'tests/data/ssh/server_dsa.pub') }}"
      - "{{ lookup('file', 'tests/data/ssh/server_rsa.pub') }}"
      - "{{ lookup('file', 'tests/data/ssh/server_ed25519.pub') }}"
      - "{{ lookup('file', 'tests/data/ssh/server_ecdsa.pub') }}"
    backup_ssh_key: "{{ lookup('file', 'tests/data/ssh/parameters-mandatory' ) }}"