Skip to content

Commit

Permalink
added tests and fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aawarner committed Aug 9, 2019
1 parent d92fab4 commit 0a84687
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 15 deletions.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
language: python
python:
- "3.7"

# Install packages
install:
- "pip install -r requirements.txt"

before_script:
-"find . -name '*.yml' | xargs yamllint -s"

script:
# Basic role syntax check
- ansible-playbook -i inventory deploy-pods --syntax-check
- ansible-playbook -i inventory undeploy-pods --syntax-check
2 changes: 1 addition & 1 deletion deploy-pods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
vars_files:
- var.yml
roles:
- deploy-vm-template
- deploy-vm-template
1 change: 1 addition & 0 deletions inventory
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
student01-CSR deploy_vsphere_datastore='datastore1' guest_notes='CSR #01' inventory_ip='ip address 10.10.10.120 255.255.255.0'
student02-CSR deploy_vsphere_datastore='datastore1' guest_notes='CSR #02' inventory_ip='ip address 10.10.10.121 255.255.255.0'
student03-CSR deploy_vsphere_datastore='datastore1' guest_notes='CSR #03' inventory_ip='ip address 10.10.10.122 255.255.255.0'
[student-router1]
student04-CSR deploy_vsphere_datastore='datastore1' guest_notes='CSR #04' inventory_ip='ip address 10.10.10.123 255.255.255.0'
student05-CSR deploy_vsphere_datastore='datastore1' guest_notes='CSR #05' inventory_ip='ip address 10.10.10.124 255.255.255.0'
student06-CSR deploy_vsphere_datastore='datastore1' guest_notes='CSR #06' inventory_ip='ip address 10.10.10.125 255.255.255.0'
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ansible==2.8
yamllint
20 changes: 10 additions & 10 deletions roles/deploy-vm-template/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
hostname: '{{ deploy_vsphere_host }}'
username: '{{ deploy_vsphere_user }}'
password: '{{ deploy_vsphere_password }}'
validate_certs: no
validate_certs: false
datacenter: '{{ deploy_vsphere_datacenter }}'
folder: '{{ deploy_vsphere_folder }}'
name: '{{ inventory_hostname }}'
annotation: "{{ guest_notes }}"
disk:
- size_gb: '{{ guest_disk }}'
type: thin
datastore: '{{ deploy_vsphere_datastore }}'
- size_gb: '{{ guest_disk }}'
type: thin
datastore: '{{ deploy_vsphere_datastore }}'
hardware:
memory_mb: '{{ guest_memory }}'
num_cpus: '{{ guest_vcpu }}'
networks:
- name: '{{ port_group1 }}'
- name: '{{ port_group2 }}'
- name: '{{ port_group3 }}'
- name: '{{ port_group1 }}'
- name: '{{ port_group2 }}'
- name: '{{ port_group3 }}'
template: '{{ guest_template }}'
wait_for_ip_address: no
wait_for_ip_address: false
delegate_to: localhost

# Bootstrap CSR1000v using vApp properties
Expand All @@ -33,7 +33,7 @@
password: '{{ deploy_vsphere_password }}'
name: '{{ inventory_hostname }}'
state: present
validate_certs: no
validate_certs: false
vapp_properties:
- id: com.cisco.csr1000v.hostname.1
type: string
Expand Down Expand Up @@ -103,7 +103,7 @@
hostname: "{{ deploy_vsphere_host }}"
username: "{{ deploy_vsphere_user }}"
password: "{{ deploy_vsphere_password }}"
validate_certs: no
validate_certs: false
folder: "/{{ deploy_vsphere_datacenter }}/{{ deploy_vsphere_folder }}"
name: "{{ inventory_hostname }}"
state: powered-on
Expand Down
6 changes: 3 additions & 3 deletions roles/destroy-vm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
hostname: "{{ deploy_vsphere_host }}"
username: "{{ deploy_vsphere_user }}"
password: "{{ deploy_vsphere_password }}"
validate_certs: no
validate_certs: false
folder: "/{{ deploy_vsphere_datacenter }}/{{ deploy_vsphere_folder }}"
name: "{{ inventory_hostname }}"
state: powered-off
Expand All @@ -18,8 +18,8 @@
hostname: "{{ deploy_vsphere_host }}"
username: "{{ deploy_vsphere_user }}"
password: "{{ deploy_vsphere_password }}"
validate_certs: no
validate_certs: false
name: "{{ inventory_hostname }}"
state: absent
delegate_to: localhost
register: facts
register: facts
2 changes: 1 addition & 1 deletion undeploy-pods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
vars_files:
- var.yml
roles:
- destroy-vm
- destroy-vm
1 change: 1 addition & 0 deletions var.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Infrastructure
# - Defines the vCenter / vSphere environment
deploy_vsphere_host: '10.10.10.10'
Expand Down

0 comments on commit 0a84687

Please sign in to comment.