PIGSTY

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 cluster

Here are available sub tasks:

  • etcd_assert : generate etcd identity
  • etcd_install : install etcd rpm packages
  • etcd_dir : create etcd data & conf dir
  • etcd_config : generate etcd config
    • etcd_conf : generate etcd main config
    • etcd_cert : generate etcd ssl cert
  • etcd_launch : launch etcd service
  • etcd_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=existing
bin/etcd-add <ip> # append new members to existing etcd cluster

It'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 cluster

Here are available sub tasks:

  • etcd_safeguard : check safeguard and abort if enabled
  • prometheus : remove etcd targets registration from prometheus
  • etcd_leave : try graceful leaving etcd cluster before purge
  • etcd_stop : stop and disable etcd service with systemd
  • etcd_data : remove etcd data (disable with etcd_rm_data=false)
  • etcd_pkg : uninstall etcd packages (enable with etcd_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 cluster

The removal playbook uses the new etcd_remove role with configurable parameters:

  • etcd_safeguard: Prevents accidental removal when set to true
  • etcd_rm_data: Controls whether ETCD data is deleted (true by default)
  • etcd_rm_pkg: Controls whether ETCD packages are uninstalled (false by default)