Skip to content

Commit

Permalink
Ansible completed 2
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 26, 2020
1 parent 36ad75e commit 3920e30
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 30 deletions.
4 changes: 3 additions & 1 deletion Ansible/roles/iperfcon/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
---
# defaults file for iperfcon
# defaults file for iperfcon
state: present
namspace_deployment: iperfcon
10 changes: 0 additions & 10 deletions Ansible/roles/iperfcon/tasks/2_pashe

This file was deleted.

33 changes: 31 additions & 2 deletions Ansible/roles/iperfcon/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,55 @@
---
- name: deploying the iperf-server pod
k8s:
state: "{{ state }}"
definition: "{{ lookup('template', 'iperf-server-deployment.yml.j2') | from_yaml }}"
state: "{{ state }}"
definition: "{{ lookup('template', 'iperf-server-deployment.yml.j2') | from_yaml }}"
namespace: '{{ namspace_deployment }}'

- name: deploying the iperf-server service
k8s:
state: "{{ state }}"
definition: "{{ lookup('template', 'iperf-server-service.yml.j2') | from_yaml }}"
namespace: '{{ namspace_deployment }}'

- name: deploying the iperf-client pod
k8s:
state: "{{ state }}"
definition: "{{ lookup('template', 'iperf-client-deployment.yml.j2') | from_yaml }}"
namespace: '{{ namspace_deployment }}'

- name: deploying the iperf-client service
k8s:
state: "{{ state }}"
definition: "{{ lookup('template', 'iperf-client-service.yml.j2') | from_yaml }}"
namespace: '{{ namspace_deployment }}'

- name: deploying the iperf-client route
k8s:
state: "{{ state }}"
definition: "{{ lookup('template', 'iperf-client-route.yml.j2') | from_yaml }}"
namespace: '{{ namspace_deployment }}'

- name: get the route for iperf client
k8s_info:
api_version: v1
kind: Route
name: iperf-client
namespace: '{{ namspace_deployment }}'
register: iperf_client_route

- debug:
msg: "{{ iperf_client_route.resources[0].spec.host }}"

- name: get the service of the iperf server
k8s_info:
api_version: v1
kind: Service
name: iperf-server
namespace: '{{ namspace_deployment }}'
register: iperf_server_svc

- name: deploying the iperf-client pod
k8s:
state: "{{ state }}"
definition: "{{ lookup('template', 'iperf-check-deployment.yml.j2') | from_yaml }}"
namespace: '{{ namspace_deployment }}'
25 changes: 11 additions & 14 deletions Ansible/roles/iperfcon/templates/iperf-check-deployment.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: iperf-check
namespace: iperf
spec:
selector:
matchLabels:
Expand All @@ -17,16 +16,14 @@ spec:
- name: iperf-check
image: quay.io/ooichman/iperf-check
env:
- name: URL_INTERVAL
value: 30
- name: IPREF_CLIENT_URI
value: ''
- name: IPREF_SERVER
value: ''
- name: WARNING_LIMIT
value: 50000m
- name: CRITICAL_LIMIT
value: 30000m
- name: USE_DEBUG
value: False

- name: URL_INTERVAL
value: '30'
- name: IPREF_CLIENT_URI
value: "{{ iperf_client_route.resources[0].spec.host }}"
- name: IPREF_SERVER
value: "{{ iperf_server_svc.resources[0].metadata.name }}"
- name: WARNING_LIMIT
value: 50000m
- name: CRITICAL_LIMIT
value: 30000m
resources: {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: iperf-client
namespace: iperf
spec:
selector:
matchLabels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: iperf-server
namespace: iperf
spec:
selector:
matchLabels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Service
metadata:
name: iperf-server
namespace: iperf
spec:
selector:
app: iperf-server
Expand Down

0 comments on commit 3920e30

Please sign in to comment.