PIGSTY

Playbook

Automate node lifecycle management with Ansible playbooks

Pigsty provides two playbooks for node management:

PlaybookPurposeUsageScope
node.ymlAdd node to pigsty./node.yml -l <target>Single node or cluster
node-rm.ymlremove node from pigsty./node-rm.yml -l <target>Single node or cluster

node.yml

The node.yml playbook transforms bare computing resources into fully configured, monitored, and service-ready nodes within your Pigsty infrastructure. This comprehensive automation handles everything from basic OS configuration to advanced monitoring setup.

node-id       : generate node identity
node_name     : setup hostname
node_hosts    : setup /etc/hosts records
node_resolv   : setup dns resolver
node_firewall : setup firewall & selinux
node_ca       : add & trust ca certificate
node_repo     : add upstream repo
node_pkg      : install yum packages
node_feature  : setup numa, grub, static network
node_kernel   : enable kernel modules
node_tune     : setup tuned profile
node_sysctl   : setup additional sysctl parameters
node_profile  : write /etc/profile.d/node.sh
node_ulimit   : setup resource limits
node_data     : setup main data dir
node_admin    : setup admin user and ssh key
node_timezone : setup timezone
node_ntp      : setup ntp server/clients
node_crontab  : add/overwrite crontab tasks
node_vip      : setup optional l2 vrrp vip for node cluster
  - vip_install
  - vip_config
  - vip_launch
  - vip_reload
haproxy       : setup haproxy on node to expose services
  - haproxy_install
  - haproxy_config
  - haproxy_launch
  - haproxy_reload
monitor       : setup node_exporter & promtail for metrics & logs
  - haproxy_register
  - vip_dns
  - node_exporter
    - node_exporter_config
    - node_exporter_launch
  - vip_exporter
    - vip_exporter_config
    - vip_exporter_launch
  - node_register
  - promtail
    - promtail_clean
    - promtail_config
    - promtail_install
    - promtail_launch

asciicast


node-rm.yml

The node-rm.yml playbook performs clean, comprehensive removal of nodes from your Pigsty infrastructure. This automation ensures all services, configurations, and monitoring integrations are properly deregistered and cleaned up, preventing orphaned resources and maintaining system hygiene.

register       : remove register from prometheus & nginx
  - prometheus : remove registered prometheus monitor target
  - nginx      : remove nginx proxy record for haproxy admin
vip            : remove node keepalived if enabled
haproxy        : remove haproxy load balancer
node_exporter  : remove monitoring exporter
vip_exporter   : remove keepalived_exporter if enabled
promtail       : remove loki log agent
profile        : remove /etc/profile.d/node.sh