diff --git a/.travis.yml b/.travis.yml index 36bbf620..dab678e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,17 +13,27 @@ addons: install: # Install ansible - - pip install ansible + - pip install https://github.com/ansible/ansible/archive/devel.tar.gz # Check ansible version - ansible --version + - pip install . -e + # Create ansible.cfg with correct roles_path - printf '[defaults]\nroles_path=../' >ansible.cfg + # Start OpenShift + - docker run --publish 8443:8443 -d --name openshift openshift/origin:v3.6.0 start master --listen https://0.0.0.0:8443 + + # Wait for the container state to be running + - sleep 15 + + # Fetch a copy of the kube config file + - docker exec -it openshift cat /var/lib/origin/openshift.local.config/master/admin.kubeconfig >konfig.json + script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + - ansible-playbook tests/test.yml -i tests/inventory notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/tests/inventory b/tests/inventory index d18580b3..2302edae 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1 +1 @@ -localhost \ No newline at end of file +localhost ansible_connection=local diff --git a/tests/roles/hello-world/tasks/main.yml b/tests/roles/hello-world/tasks/main.yml index 95bae3a1..1409e033 100644 --- a/tests/roles/hello-world/tasks/main.yml +++ b/tests/roles/hello-world/tasks/main.yml @@ -3,6 +3,9 @@ name: hello state: absent debug: yes + kubeconfig: '{{ os_kubeconfig }}' + host: '{{ os_host }}' + verify_ssl: '{{ os_verify_ssl }}' register: delete_project - debug: var=delete_project @@ -14,6 +17,9 @@ display_name: Hello World description: Hello. debug: yes + kubeconfig: '{{ os_kubeconfig }}' + host: '{{ os_host }}' + verify_ssl: '{{ os_verify_ssl }}' register: create_project - debug: var=create_project @@ -32,6 +38,9 @@ labels: app: hello debug: yes + kubeconfig: '{{ os_kubeconfig }}' + host: '{{ os_host }}' + verify_ssl: '{{ os_verify_ssl }}' register: create_service - debug: var=create_service @@ -61,6 +70,9 @@ selector: app: hello strategy_type: Rolling + kubeconfig: '{{ os_kubeconfig }}' + host: '{{ os_host }}' + verify_ssl: '{{ os_verify_ssl }}' register: create_deployment - debug: var=create_deployment @@ -75,6 +87,9 @@ to_weight: 100 port_target_port: web-tcp tls_termination: edge + kubeconfig: '{{ os_kubeconfig }}' + host: '{{ os_host }}' + verify_ssl: '{{ os_verify_ssl }}' register: create_route - debug: var=create_route diff --git a/tests/test.yml b/tests/test.yml index 86faf4cb..9cc07464 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -1,9 +1,23 @@ --- -- hosts: localhost - remote_user: root +- hosts: all + gather_facts: no + + vars: + kubeconfig: ../konfig.json + host: localhost:8443 + verify_ssl: False + roles: - role: ansible-kubernetes-modules install_python_requirements: no - - role: hello-world - - role: hello-templates + + - role: hello-world + os_kubeconfig: '{{ kubeconfig }}' + os_host: '{{ host }}' + os_verify_ssl: '{{ verify_ssl }}' + +# - role: hello-templates +# kubeconfig: '{{ kubeconfig }}' +# host: '{{ host }}' +# verify_ssl: '{{ verify_ssl }}'