blob: 3ee13a4099baa332cad042236df7de705ac84ec2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/usr/bin/ansible-playbook --module-path=../../../library/
#
# ./oadm_manage_node.yml -e "cli_master_test=$OPENSHIFT_MASTER
---
- hosts: "{{ cli_master_test }}"
gather_facts: no
user: root
tasks:
- name: get list of nodes
oc_obj:
state: list
kind: node
register: obj_out
- name: Set the node to work with
set_fact:
node_to_test: "{{ obj_out['results']['results'][0]['items'][0]['metadata']['name'] }}"
- name: list pods from a node
oadm_manage_node:
list_pods: True
node:
- "{{ node_to_test }}"
register: podout
- debug: var=podout
- assert:
that: "'{{ node_to_test }}' in podout.results.nodes"
msg: Pod data was not returned
- name: set node to unschedulable
oadm_manage_node:
schedulable: False
node:
- "{{ node_to_test }}"
register: nodeout
- debug: var=nodeout
- name: assert that schedulable=False
assert:
that: nodeout.results.nodes[0]['schedulable'] == False
msg: "{{ node_to_test }} schedulable set to True"
- name: get node scheduable
oc_obj:
kind: node
state: list
name: "{{ node_to_test }}"
namespace: None
register: nodeout
- debug: var=nodeout
- name: assert that schedulable=False
assert:
that: nodeout.results.results[0]['spec']['unschedulable']
- name: set node to schedulable
oadm_manage_node:
schedulable: True
node:
- "{{ node_to_test }}"
register: nodeout
- debug: var=nodeout
- name: assert that schedulable=False
assert:
that: nodeout.results.nodes[0]['schedulable']
msg: "{{ node_to_test }} schedulable set to False"
|