mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-22 13:36:06 -03:30
* 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>
52 lines
2.0 KiB
YAML
52 lines
2.0 KiB
YAML
---
|
|
- name: Join Member | Add member to etcd cluster # noqa 301 305
|
|
command: "{{ bin_dir }}/etcdctl member add {{ etcd_member_name }} --peer-urls={{ etcd_peer_url }}"
|
|
register: member_add_result
|
|
until: member_add_result.rc == 0 or 'Peer URLs already exists' in member_add_result.stderr
|
|
failed_when: member_add_result.rc != 0 and 'Peer URLs already exists' not in member_add_result.stderr
|
|
retries: "{{ etcd_retries }}"
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
environment:
|
|
ETCDCTL_API: "3"
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem"
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem"
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"
|
|
|
|
- include_tasks: refresh_config.yml
|
|
vars:
|
|
etcd_peer_addresses: >-
|
|
{% for host in groups['etcd'] -%}
|
|
{%- if hostvars[host]['etcd_member_in_cluster'].rc == 0 -%}
|
|
{{ "etcd"+loop.index|string }}=https://{{ hostvars[host].etcd_access_address | default(hostvars[host].ip | default(fallback_ips[host])) }}:2380,
|
|
{%- endif -%}
|
|
{%- if loop.last -%}
|
|
{{ etcd_member_name }}={{ etcd_peer_url }}
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
|
|
- name: Join Member | Ensure member is in etcd cluster
|
|
shell: "set -o pipefail && {{ bin_dir }}/etcdctl member list | grep {{ etcd_access_address }} >/dev/null"
|
|
args:
|
|
executable: /bin/bash
|
|
register: etcd_member_in_cluster
|
|
changed_when: false
|
|
check_mode: no
|
|
retries: "{{ etcd_retries }}"
|
|
delay: "{{ retry_stagger | random + 3 }}"
|
|
until: etcd_member_in_cluster.rc == 0
|
|
tags:
|
|
- facts
|
|
environment:
|
|
ETCDCTL_API: "3"
|
|
ETCDCTL_CERT: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem"
|
|
ETCDCTL_KEY: "{{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem"
|
|
ETCDCTL_CACERT: "{{ etcd_cert_dir }}/ca.pem"
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_access_addresses }}"
|
|
|
|
- name: Configure | Ensure etcd is running
|
|
service:
|
|
name: etcd
|
|
state: started
|
|
enabled: yes
|