Playbook
control primitives
There’s a built-in playbook: etcd.yml for etcd cluster installation.
etcd.yml
To create a new etcd cluster, run the following playbook:
./etcd.yml # install etcd cluster on group 'etcd'bin/etcd-add # create entire etcd clusterHere are available sub tasks:
etcd_assert: generate etcd identityetcd_install: install etcd rpm packagesetcd_dir: create etcd data & conf diretcd_config: generate etcd configetcd_conf: generate etcd main configetcd_cert: generate etcd ssl cert
etcd_launch: launch etcd serviceetcd_register: register etcd to prometheus
If you want to append a new member to an existing etcd cluster,
you have to add it to the config inventory, and run the playbook with etcd_init = existing
against the new member:
./etcd.yml -l <new_instance> -e etcd_init=existingbin/etcd-add <ip> # append new members to existing etcd clusterIt's usually OK to re-run the playbook, it will update the etcd cluster config and restart etcd instances.
Change Since Pigsty v3.6+
Since Pigsty v3.6+, the etcd.yml playbook no longer has cluster removal capabilities. Use the dedicated etcd-rm.yml playbook and etcd_remove role for etcd cluster removal operations.
etcd-rm.yml
To remove the etcd cluster, run the following playbook:
./etcd-rm.yml # remove etcd clusterHere are available sub tasks:
etcd_safeguard: check safeguard and abort if enabledprometheus: remove etcd targets registration from prometheusetcd_leave: try graceful leaving etcd cluster before purgeetcd_stop: stop and disable etcd service with systemdetcd_data: remove etcd data (disable withetcd_rm_data=false)etcd_pkg: uninstall etcd packages (enable withetcd_rm_pkg=true)
To remove a member from an existing etcd cluster, you can run the playbook
./etcd-rm.yml -l <ip>bin/etcd-rm <ip> # remove specific members from etcd cluster
bin/etcd-rm # remove entire etcd clusterThe removal playbook uses the new etcd_remove role with configurable parameters:
etcd_safeguard: Prevents accidental removal when set totrueetcd_rm_data: Controls whether ETCD data is deleted (trueby default)etcd_rm_pkg: Controls whether ETCD packages are uninstalled (falseby default)