diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..e40bfb0c8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +--- +language: python +services: docker + +install: + - pip install molecule docker + +script: + - cd roles/matrix-coturn && molecule test diff --git a/roles/matrix-coturn/.yamllint b/roles/matrix-coturn/.yamllint new file mode 100644 index 000000000..882767605 --- /dev/null +++ b/roles/matrix-coturn/.yamllint @@ -0,0 +1,33 @@ +--- +# Based on ansible-lint config +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + colons: + max-spaces-after: -1 + level: error + commas: + max-spaces-after: -1 + level: error + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + max: 3 + level: error + hyphens: + level: error + indentation: disable + key-duplicates: enable + line-length: disable + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: disable + truthy: disable diff --git a/roles/matrix-coturn/molecule/default/INSTALL.rst b/roles/matrix-coturn/molecule/default/INSTALL.rst new file mode 100644 index 000000000..d926ca252 --- /dev/null +++ b/roles/matrix-coturn/molecule/default/INSTALL.rst @@ -0,0 +1,22 @@ +******* +Docker driver installation guide +******* + +Requirements +============ + +* Docker Engine + +Install +======= + +Please refer to the `Virtual environment`_ documentation for installation best +practices. If not using a virtual environment, please consider passing the +widely recommended `'--user' flag`_ when invoking ``pip``. + +.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ +.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site + +.. code-block:: bash + + $ python3 -m pip install 'molecule[docker]' diff --git a/roles/matrix-coturn/molecule/default/converge.yml b/roles/matrix-coturn/molecule/default/converge.yml new file mode 100644 index 000000000..a9e41c90f --- /dev/null +++ b/roles/matrix-coturn/molecule/default/converge.yml @@ -0,0 +1,29 @@ +--- +- name: Converge + hosts: all + tasks: + - name: "Include matrix-base" + include_role: + name: "matrix-base" + vars: + matrix_domain: "example.org" + matrix_vars_yml_snapshotting_enabled: false + run_self_check: false + - name: "Include matrix-coturn" + include_role: + name: "matrix-coturn" + vars: + matrix_systemd_services_list: [] + run_setup: true + matrix_base_data_path: "/matrix" + matrix_user_username: "root" + matrix_user_groupname: "root" + matrix_server_fqn_matrix: "example.org" + matrix_systemd_path: "/etc/systemd/system" + matrix_host_command_docker: "/usr/bin/env docker" + # matrix_user_uid: 0 + # matrix_user_gid: 0 + # maybe those should be added in role default/main.yml + matrix_coturn_enabled: true + matrix_coturn_turn_external_ip_address: 127.0.0.1 + matrix_coturn_turn_static_auth_secret: "VeryFakeSecret" diff --git a/roles/matrix-coturn/molecule/default/molecule.yml b/roles/matrix-coturn/molecule/default/molecule.yml new file mode 100644 index 000000000..22df460f2 --- /dev/null +++ b/roles/matrix-coturn/molecule/default/molecule.yml @@ -0,0 +1,27 @@ +--- +dependency: + name: galaxy +driver: + name: docker +platforms: + - name: coturn-test + image: fanchthesystem/ubuntu18-with-systemd:latest #fanchthesystem/centos7-with-systemd:latest # docker.io/pycontribs/centos:7 + override_command: false + privileged: true + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro +# - /var/run/docker.sock:/var/run/docker.sock +# network: +# - name: dind-network +# env: +# DOCKER_HOST: "tcp://dind:2375" +# https://blog.alekc.org/testing-ansible-roles-with-molecule-using-dind/ +# https://github.com/ansible/ansible/issues/71528 +provisioner: + name: ansible + log: true + config_options: + defaults: + timeout: 60 +verifier: + name: ansible diff --git a/roles/matrix-coturn/molecule/default/verify.yml b/roles/matrix-coturn/molecule/default/verify.yml new file mode 100644 index 000000000..a82dd6fd0 --- /dev/null +++ b/roles/matrix-coturn/molecule/default/verify.yml @@ -0,0 +1,9 @@ +--- +# This is an example playbook to execute Ansible tests. + +- name: Verify + hosts: all + tasks: + - name: Example assertion + assert: + that: true