Add simple module test

This commit is contained in:
Chris Houseknecht
2017-10-11 13:15:16 -04:00
parent 3797eb3148
commit 1b9adeaf5e
4 changed files with 48 additions and 9 deletions

View File

@@ -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/
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@@ -1 +1 @@
localhost
localhost ansible_connection=local

View File

@@ -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

View File

@@ -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 }}'