3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
19 when: reinitialized_nodes is defined and inventory_hostname in reinitialized_nodes
21 - name: Remove old etcd directory
24 path: /var/lib/etcd/default.etcd/
25 when: reinitialized_nodes is defined and inventory_hostname in reinitialized_nodes
27 - name: Remove and add reinitialized members
29 echo "{{item.key}}" >> /tmp/out.txt
30 id=$(/bin/etcdctl --endpoints http://{{installation_controller}}:2379 member list | grep "{{item.key}}" | /usr/bin/awk -F[:\[] '{print $1}')
32 /bin/etcdctl --endpoints http://{{installation_controller}}:2379 member remove $id
34 /bin/etcdctl --endpoints http://{{installation_controller}}:2379 member add "{{item.key}}" http://"{{hostvars[item.key]['networking']['infra_internal']['ip']}}":2380
35 with_dict: "{{ reinitialized_nodes }}"
36 when: reinitialized_nodes is defined and inventory_hostname == installation_controller and item.key in groups['management']