-
Notifications
You must be signed in to change notification settings - Fork 20
/
pb_cluster_version_docker.yaml
126 lines (125 loc) · 5.3 KB
/
pb_cluster_version_docker.yaml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
- name: Gather K8s Cluster Version
hosts: target
gather_facts: False
strategy: free
tasks:
- name: kubelet
shell: kubelet --version | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]"
when:
- inventory_hostname in groups['k8s_cluster']
- name: kube-apiserver
shell: kubectl version | grep Server | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]"
when:
- inventory_hostname in groups['kube_control_plane']
- name: kubectl
shell: kubectl version --client=true | grep -Eo "\"v[0-9]+\.[0-9]+\.[0-9]\"" | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]"
when:
- inventory_hostname in groups['kube_control_plane']
- name: kubeadm
shell: kubeadm version | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]"
when:
- inventory_hostname in groups['k8s_cluster']
- name: kubeproxy
shell: |+
ps_value=$(docker ps | grep k8s_kube-proxy_kube-proxy)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- inventory_hostname in groups['k8s_cluster']
- name: etcd
shell: echo v$(etcd --version | grep etcd | grep -Eo "[0-9]+\.[0-9]+\.[0-9]")
when:
- inventory_hostname in groups['etcd']
- etcd_deployment_type is defined and etcd_deployment_type == 'host'
- name: etcd_docker
shell: |+
ps_value=$(docker ps | grep quay.io/coreos/etcd | grep {{etcd_member_name}})
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- inventory_hostname in groups['etcd']
- etcd_deployment_type is defined and etcd_deployment_type == 'docker'
- name: docker
shell: docker version --format '{{"{{.Server.Version}}"}}'
- name: calico
shell: |+
ps_value=$(docker ps | grep k8s_calico-node_calico-node)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- inventory_hostname in groups['k8s_cluster']
- kube_network_plugin == 'calico'
- name: flannel
shell: |+
ps_value=$(docker ps | grep k8s_kube-flannel_kube-flannel)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- inventory_hostname in groups['k8s_cluster']
- kube_network_plugin == 'flannel'
- name: runc
shell: echo v$(runc --version | grep runc | grep -Eo "[0-9]+\.[0-9]+\.[0-9]")
- name: nginx_image
shell: |+
ps_value=$(docker ps | grep k8s_nginx-proxy_nginx-proxy)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "nginx:[0-9]+\.[0-9]+\.[0-9]" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- inventory_hostname in groups['kube_node']
- inventory_hostname not in groups['kube_control_plane']
- name: coredns
shell: |+
ps_value=$(docker ps | grep k8s_coredns_coredns)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- inventory_hostname in groups['kube_control_plane']
- name: nodelocaldns
shell: |+
ps_value=$(docker ps | grep k8s_node-cache_nodelocaldns)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep k8s.gcr.io/dns/k8s-dns | grep -Eo "[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- enable_nodelocaldns
- name: netchecker
shell: |+
ps_value=$(docker ps | grep k8s_netchecker-agent_netchecker-agent)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- deploy_netchecker
- name: metrics_server
shell: |+
ps_value=$(docker ps | grep k8s_metrics-server_metrics-server)
if [ "${ps_value}" != "" ]; then
imageId=$(docker inspect $(echo ${ps_value} | awk '{print $1}') | grep -Eo -m 1 'sha256:[0-9a-z]*')
imageId=${imageId#sha256:}
docker inspect $imageId | grep -Eo "v[0-9]+\.[0-9]+\.[0-9]";
fi
when:
- deploy_netchecker