Initial molecule WIP
This commit is contained in:
parent
4475c07bc2
commit
3e1b0473cc
86 changed files with 1904 additions and 0 deletions
1
molecule/clients/Dockerfile.j2
Symbolic link
1
molecule/clients/Dockerfile.j2
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../generic_files/Dockerfile.j2
|
||||
26
molecule/clients/INSTALL.rst
Normal file
26
molecule/clients/INSTALL.rst
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
*******
|
||||
Docker driver installation guide
|
||||
*******
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html)
|
||||
* Docker Engine
|
||||
* docker-py
|
||||
* docker
|
||||
|
||||
Install
|
||||
=======
|
||||
|
||||
Ansible < 2.6
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo pip install docker-py
|
||||
|
||||
Ansible >= 2.6
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo pip install docker
|
||||
96
molecule/clients/molecule.yml
Normal file
96
molecule/clients/molecule.yml
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
---
|
||||
driver:
|
||||
name: docker
|
||||
lint:
|
||||
name: yamllint
|
||||
platforms:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cub
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cub
|
||||
image: ubuntu:bionic
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cux
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cux
|
||||
image: ubuntu:xenial
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cut
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cut
|
||||
image: ubuntu:trusty
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cds
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cds
|
||||
image: debian:stretch
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cdj
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cdj
|
||||
image: debian:jessie
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cdw
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cdw
|
||||
image: debian:wheezy
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cc7
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cc7
|
||||
image: centos:7
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-cc6
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-cc6
|
||||
image: centos:6
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-sds
|
||||
hostname: ${MOLECULE_SCENARIO_NAME}-sds
|
||||
image: debian:stretch
|
||||
networks:
|
||||
- name: ${MOLECULE_SCENARIO_NAME}-borg
|
||||
groups:
|
||||
- borgbackup_servers
|
||||
provisioner:
|
||||
name: ansible
|
||||
inventory:
|
||||
group_vars:
|
||||
all:
|
||||
borgbackup_appendonly: true
|
||||
borgbackup_servers:
|
||||
- fqdn: ${MOLECULE_SCENARIO_NAME}-sds
|
||||
user: borgds
|
||||
type: normal
|
||||
home: /var/backup/
|
||||
pool: repos
|
||||
options: ""
|
||||
borgbackup_include:
|
||||
- "/etc"
|
||||
- "/root"
|
||||
- "/var/log"
|
||||
- "/home"
|
||||
host_vars:
|
||||
${MOLECULE_SCENARIO_NAME}-cub:
|
||||
borgbackup_passphrase: soo6Uabiex
|
||||
${MOLECULE_SCENARIO_NAME}-cux:
|
||||
borgbackup_passphrase: ooFeila1ie
|
||||
${MOLECULE_SCENARIO_NAME}-cut:
|
||||
borgbackup_passphrase: oisjflqohu
|
||||
${MOLECULE_SCENARIO_NAME}-cds:
|
||||
borgbackup_passphrase: eewoo7paf6J
|
||||
${MOLECULE_SCENARIO_NAME}-cdj:
|
||||
borgbackup_passphrase: aef1Iekahpi
|
||||
${MOLECULE_SCENARIO_NAME}-cdw:
|
||||
borgbackup_passphrase: ReiTul4asei
|
||||
${MOLECULE_SCENARIO_NAME}-cc7:
|
||||
borgbackup_passphrase: ASFQiejwasd
|
||||
${MOLECULE_SCENARIO_NAME}-cc6:
|
||||
borgbackup_passphrase: Ansdkfqooia
|
||||
lint:
|
||||
name: ansible-lint
|
||||
scenario:
|
||||
name: clients
|
||||
verifier:
|
||||
name: goss
|
||||
lint:
|
||||
name: yamllint
|
||||
1
molecule/clients/playbook.yml
Symbolic link
1
molecule/clients/playbook.yml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../generic_files/playbook.yml
|
||||
1
molecule/clients/prepare.yml
Symbolic link
1
molecule/clients/prepare.yml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../generic_files/prepare.yml
|
||||
1
molecule/clients/restore.sh.j2
Symbolic link
1
molecule/clients/restore.sh.j2
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../generic_files/restore.sh.j2
|
||||
1
molecule/clients/side_effect.yml
Symbolic link
1
molecule/clients/side_effect.yml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../restore/side_effect.yml
|
||||
1
molecule/clients/tests/test_all.yml
Symbolic link
1
molecule/clients/tests/test_all.yml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../generic_files/tests/test_all.yml
|
||||
1
molecule/clients/tests/test_client.yml
Symbolic link
1
molecule/clients/tests/test_client.yml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../generic_files/tests/test_client.yml
|
||||
1
molecule/clients/tests/test_client_restore.yml
Symbolic link
1
molecule/clients/tests/test_client_restore.yml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../generic_files/tests/test_client_restore.yml
|
||||
1
molecule/clients/tests/test_server.yml
Symbolic link
1
molecule/clients/tests/test_server.yml
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../generic_files/tests/test_server.yml
|
||||
154
molecule/clients/verify.yml
Normal file
154
molecule/clients/verify.yml
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
---
|
||||
# This is an example playbook to execute goss tests.
|
||||
# Tests need distributed to the appropriate ansible host/groups
|
||||
# prior to execution by `goss validate`.
|
||||
|
||||
- name: Verify all
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
goss_version: v0.3.2
|
||||
goss_arch: amd64
|
||||
goss_dst: /usr/local/bin/goss
|
||||
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
|
||||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
|
||||
goss_test_directory: /tmp
|
||||
goss_format: documentation
|
||||
molecule_scenario_name: clients
|
||||
tasks:
|
||||
- name: Download and install Goss
|
||||
get_url:
|
||||
url: "{{ goss_url }}"
|
||||
dest: "{{ goss_dst }}"
|
||||
sha256sum: "{{ goss_sha256sum }}"
|
||||
mode: 0755
|
||||
register: download_goss
|
||||
until: download_goss is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Copy Goss tests to remote
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ goss_test_directory }}/{{ item | basename }}"
|
||||
with_fileglob:
|
||||
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_all.yml"
|
||||
|
||||
- name: Register test files
|
||||
shell: "ls {{ goss_test_directory }}/test_all.yml"
|
||||
register: test_files
|
||||
|
||||
- name: Execute Goss tests
|
||||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
|
||||
register: test_results
|
||||
with_items: "{{ test_files.stdout_lines }}"
|
||||
|
||||
- name: Display details about the Goss results
|
||||
debug:
|
||||
msg: "{{ item.stdout_lines }}"
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Fail when tests fail
|
||||
fail:
|
||||
msg: "Goss failed to validate"
|
||||
when: item.rc != 0
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Verify clients
|
||||
hosts: all:!borgbackup_servers
|
||||
become: true
|
||||
vars:
|
||||
goss_version: v0.3.2
|
||||
goss_arch: amd64
|
||||
goss_dst: /usr/local/bin/goss
|
||||
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
|
||||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
|
||||
goss_test_directory: /tmp
|
||||
goss_format: documentation
|
||||
molecule_scenario_name: clients
|
||||
tasks:
|
||||
- name: Download and install Goss
|
||||
get_url:
|
||||
url: "{{ goss_url }}"
|
||||
dest: "{{ goss_dst }}"
|
||||
sha256sum: "{{ goss_sha256sum }}"
|
||||
mode: 0755
|
||||
register: download_goss
|
||||
until: download_goss is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Copy Goss tests to remote
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ goss_test_directory }}/{{ item | basename }}"
|
||||
with_fileglob:
|
||||
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_client*.yml"
|
||||
|
||||
- name: Register test files
|
||||
shell: "ls {{ goss_test_directory }}/test_client*.yml"
|
||||
register: test_files
|
||||
|
||||
- name: Execute Goss tests
|
||||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
|
||||
register: test_results
|
||||
with_items: "{{ test_files.stdout_lines }}"
|
||||
|
||||
- name: Display details about the Goss results
|
||||
debug:
|
||||
msg: "{{ item.stdout_lines }}"
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Fail when tests fail
|
||||
fail:
|
||||
msg: "Goss failed to validate"
|
||||
when: item.rc != 0
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Verify backup servers
|
||||
hosts: borgbackup_servers
|
||||
become: true
|
||||
vars:
|
||||
goss_version: v0.3.2
|
||||
goss_arch: amd64
|
||||
goss_dst: /usr/local/bin/goss
|
||||
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
|
||||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
|
||||
goss_test_directory: /tmp
|
||||
goss_format: documentation
|
||||
molecule_scenario_name: clients
|
||||
tasks:
|
||||
- name: Download and install Goss
|
||||
get_url:
|
||||
url: "{{ goss_url }}"
|
||||
dest: "{{ goss_dst }}"
|
||||
sha256sum: "{{ goss_sha256sum }}"
|
||||
mode: 0755
|
||||
register: download_goss
|
||||
until: download_goss is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Copy Goss tests to remote
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ goss_test_directory }}/{{ item | basename }}"
|
||||
with_fileglob:
|
||||
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_server*.yml"
|
||||
|
||||
- name: Register test files
|
||||
shell: "ls {{ goss_test_directory }}/test_server*.yml"
|
||||
register: test_files
|
||||
|
||||
- name: Execute Goss tests
|
||||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
|
||||
register: test_results
|
||||
with_items: "{{ test_files.stdout_lines }}"
|
||||
|
||||
- name: Display details about the Goss results
|
||||
debug:
|
||||
msg: "{{ item.stdout_lines }}"
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Fail when tests fail
|
||||
fail:
|
||||
msg: "Goss failed to validate"
|
||||
when: item.rc != 0
|
||||
with_items: "{{ test_results.results }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue