* project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
59 lines
2.4 KiB
YAML
59 lines
2.4 KiB
YAML
---
|
|
- name: Lookup node IP in kubernetes
|
|
command: >
|
|
{{ kubectl }} get nodes {{ node }}
|
|
-o jsonpath='{range .status.addresses[?(@.type=="InternalIP")]}{@.address}{"\n"}{end}'
|
|
register: remove_node_ip
|
|
when:
|
|
- groups['kube_control_plane'] | length > 0
|
|
- inventory_hostname in groups['etcd']
|
|
- ip is not defined
|
|
- access_ip is not defined
|
|
delegate_to: "{{ groups['etcd']|first }}"
|
|
failed_when: false
|
|
|
|
- name: Set node IP
|
|
set_fact:
|
|
node_ip: "{{ ip | default(access_ip | default(remove_node_ip.stdout)) | trim }}"
|
|
when:
|
|
- inventory_hostname in groups['etcd']
|
|
|
|
- name: Make sure node_ip is set
|
|
assert:
|
|
that: node_ip is defined and node_ip | length > 0
|
|
msg: "Etcd node ip is not set !"
|
|
when:
|
|
- inventory_hostname in groups['etcd']
|
|
|
|
- name: Lookup etcd member id
|
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep {{ node_ip }} | cut -d, -f1"
|
|
args:
|
|
executable: /bin/bash
|
|
register: etcd_member_id
|
|
ignore_errors: true # noqa ignore-errors
|
|
changed_when: false
|
|
check_mode: no
|
|
tags:
|
|
- facts
|
|
environment:
|
|
ETCDCTL_API: "3"
|
|
ETCDCTL_CERT: "{{ kube_cert_dir + '/etcd/server.crt' if etcd_deployment_type == 'kubeadm' else etcd_cert_dir + '/admin-' + groups['etcd']|first + '.pem' }}"
|
|
ETCDCTL_KEY: "{{ kube_cert_dir + '/etcd/server.key' if etcd_deployment_type == 'kubeadm' else etcd_cert_dir + '/admin-' + groups['etcd']|first + '-key.pem' }}"
|
|
ETCDCTL_CACERT: "{{ kube_cert_dir + '/etcd/ca.crt' if etcd_deployment_type == 'kubeadm' else etcd_cert_dir + '/ca.pem' }}"
|
|
ETCDCTL_ENDPOINTS: "https://127.0.0.1:2379"
|
|
delegate_to: "{{ groups['etcd']|first }}"
|
|
when: inventory_hostname in groups['etcd']
|
|
|
|
- name: Remove etcd member from cluster
|
|
command: "{{ bin_dir }}/etcdctl member remove {{ etcd_member_id.stdout }}"
|
|
environment:
|
|
ETCDCTL_API: "3"
|
|
ETCDCTL_CERT: "{{ kube_cert_dir + '/etcd/server.crt' if etcd_deployment_type == 'kubeadm' else etcd_cert_dir + '/admin-' + groups['etcd']|first + '.pem' }}"
|
|
ETCDCTL_KEY: "{{ kube_cert_dir + '/etcd/server.key' if etcd_deployment_type == 'kubeadm' else etcd_cert_dir + '/admin-' + groups['etcd']|first + '-key.pem' }}"
|
|
ETCDCTL_CACERT: "{{ kube_cert_dir + '/etcd/ca.crt' if etcd_deployment_type == 'kubeadm' else etcd_cert_dir + '/ca.pem' }}"
|
|
ETCDCTL_ENDPOINTS: "https://127.0.0.1:2379"
|
|
delegate_to: "{{ groups['etcd']|first }}"
|
|
when:
|
|
- inventory_hostname in groups['etcd']
|
|
- etcd_member_id.stdout | length > 0
|