{"id":29702546,"url":"https://github.com/devgateway/ansible-role-pacemaker","last_synced_at":"2025-07-23T12:39:35.371Z","repository":{"id":34512311,"uuid":"38453932","full_name":"devgateway/ansible-role-pacemaker","owner":"devgateway","description":"Ansible role to deploy Pacemaker HA clusters","archived":false,"fork":false,"pushed_at":"2020-01-10T00:08:29.000Z","size":81,"stargazers_count":18,"open_issues_count":10,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-15T15:31:31.797Z","etag":null,"topics":["ansible","ansible-role","cluster","corosync","heartbeat","high-availability","pacemaker","pcs"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devgateway.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-02T19:56:36.000Z","updated_at":"2023-09-21T10:28:27.000Z","dependencies_parsed_at":"2022-09-06T04:12:24.169Z","dependency_job_id":null,"html_url":"https://github.com/devgateway/ansible-role-pacemaker","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/devgateway/ansible-role-pacemaker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fansible-role-pacemaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fansible-role-pacemaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fansible-role-pacemaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fansible-role-pacemaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devgateway","download_url":"https://codeload.github.com/devgateway/ansible-role-pacemaker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devgateway%2Fansible-role-pacemaker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266680679,"owners_count":23967795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","cluster","corosync","heartbeat","high-availability","pacemaker","pcs"],"created_at":"2025-07-23T12:39:34.700Z","updated_at":"2025-07-23T12:39:35.347Z","avatar_url":"https://github.com/devgateway.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pacemaker role for Ansible\n\nThis role configures Pacemaker cluster by dumping the configuration (CIB), adjusting the XML, and\nreloading it. The role is idempotent, and supports check mode.\n\nIt has been redesigned to configure individual elements (cluster defaults, resources, groups,\nconstraints, etc) rather than the whole state of the cluster and all the services. This allows you\nto focus on specific resources, without interfering with the rest.\n\n## Requirements\n\nThis role has been written for and tested in Scientific Linux 7. It might also work in other\ndistros, please share your experience.\n\n## Tasks\n\nUse `tasks_from` Ansible directive to specify what you want to configure.\n\nBoolean values in properties (parsed by Pacemaker itself) don't have to be quoted. However,\nresource agents may expect Boolean-like arguments as integers, strings, etc. Such values **must**\nbe quoted.\n\n### `tasks_from: main`\n\nSet up nodes, configure cluster properties, and resource defaults.\n\n#### `pcmk_cluster_name`\n\nName of the cluster (optional).\n\nDefault: `hacluster`.\n\n#### `pcmk_password`\n\nThe plaintext password for the cluster user (optional). If omitted, will be derived from\n`ansible_machine_id` of the first host in the play batch. This password is only used in the initial\nauthentication of the nodes.\n\nDefault: `ansible_machine_id | to_uuid`\n\n#### `pcmk_user`\n\nThe system user to authenticate PCS nodes with (optional). PCS will authenticate all nodes with\neach other.\n\nDefault: `hacluster`\n\n#### `pcmk_cluster_options`\n\nDictionary with [cluster-wide options](https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/1.1/html/Pacemaker_Explained/s-cluster-options.html) (optional).\n\n#### `pcmk_votequorum`\n\nDictionary with votequorum options (optional). See `votequorum(5)`. Boolean values accepted.\n\n#### `pcmk_resource_defaults`\n\nDictionary of resource defaults (optional).\n\n### `tasks_from: resource`\n\nConfigure a simple resource.\n\n#### `pcmk_resource`\n\nDictionary describing a simple (*primitive*) resource. Contains the following members:\n\n* `id`: resource identifier; mandatory for simple resources;\n* `class`, `provider`, and `type`: resource agent descriptors; `provider` may be omitted, e.g. when\n  `type` is `service`;\n* `options`: optional dictionary of resource-specific attributes, e.g. address and netmask for\n  *IPaddr2*;\n* `op`: optional list of operations; each operation is a dictionary with required `name` and\n  `interval` members, and optional arbitrary members;\n* `meta`: optional dictionary of meta-attributes.\n\n### `tasks_from: group`\n\nConfigure a resource group.\n\n#### `pcmk_group`\n\nDictionary with two members:\n\n* `id` is the group identifier\n* `resources` is a dictionary where keys are resource IDs, and values have the same format as\n  `pcmk_resource` (except for `id` of the resources being optional).\n\n### `tasks_from: constraint`\n\nConfigure a constraint.\n\n##### `pcmk_constraint`\n\nDictionary defining a single constraint. The following members are required:\n\n* `type`: one of: `location`, `colocation`, or `order`;\n* `score`: constraint score (signed integer, `INFINITY`, or `-INFINITY`).\n\nDepending on the value of `type`, the following members are also required:\n\n* `location` requires `rsc` and `node`;\n* `colocation` requires `rsc` and `with-rsc`;\n* `order` requires `first` and `then`;\n\nThe dictionary may contain other members, e.g. `symmetrical`.\n\n## Example playbooks\n\n### Active-active chrooted BIND DNS server\n\n    ---\n    - name: Configure DNS cluster\n      hosts: dns-servers\n      tasks:\n    \n        - name: Set up cluster\n          include_role:\n            name: devgateway.pacemaker\n          vars:\n            pcmk_password: hunter2\n            pcmk_cluster_name: named\n            pcmk_cluster_options:\n              stonith-enabled: false\n    \n        - name: Configure IP address resource\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: resource\n          vars:\n            pcmk_resource:\n              id: dns-ip\n              class: ocf\n              provider: heartbeat\n              type: IPaddr2\n              options:\n                ip: 10.0.0.1\n                cidr_netmask: 8\n              op:\n                - name: monitor\n                  interval: 5s\n    \n        - name: Configure cloned BIND resource\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: advanced-resource\n          vars:\n            pcmk_resource:\n              type: clone\n              id: dns-clone\n              resources:\n                named:\n                  class: service\n                  type: named-chroot\n                  op:\n                    - name: monitor\n                      interval: 5s\n    \n        - name: Set up constraints\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: constraint\n          vars:\n            pcmk_constraint:\n              type: order\n              first: dns-ip\n              then: dns-clone\n\n### Active-active Squid proxy\n\n    ---\n    - name: Configure Squid cluster\n      hosts: proxy-servers\n      tasks:\n    \n        - name: Set up cluster\n          include_role:\n            name: devgateway.pacemaker\n          vars:\n            pcmk_password: hunter2\n            pcmk_cluster_name: squid\n            pcmk_cluster_options:\n              stonith-enabled: false\n    \n        - name: Configure IP address resource\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: resource\n          vars:\n            pcmk_resource:\n              id: squid-ip\n              class: ocf\n              provider: heartbeat\n              type: IPaddr2\n              options:\n                ip: 192.168.0.200\n                cidr_netmask: 24\n              op:\n                - name: monitor\n                  interval: 5s\n    \n        - name: Configure cloned BIND resource\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: advanced-resource\n          vars:\n            pcmk_resource:\n              id: squid\n                type: clone\n                resources:\n                  squid-service:\n                    class: service\n                    type: squid\n                    op:\n                      - name: monitor\n                        interval: 5s\n    \n        - name: Set up constraints\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: constraint\n          vars:\n            pcmk_constraint:\n              type: order\n              first: squid-ip\n              then: squid\n\n### Nginx, web application, and master-slave Postgres\n\nThe cluster runs two Postgres nodes with synchronous replication. Wherever master is, a virtual IP\naddress is running, where NAT is pointing at. Nginx and the webapp are running at the same node, but\nnot the other, in order to save resources. Based on [the example from Clusterlabs\nwiki](https://wiki.clusterlabs.org/wiki/PgSQL_Replicated_Cluster).\n\n    ---\n    - hosts:\n        - alpha\n        - bravo\n      tasks:\n    \n        - name: Set up Pacemaker with Postgres master/slave\n          include_role:\n            name: devgateway.pacemaker\n          vars:\n            pcmk_pretty_xml: true\n            pcmk_cluster_name: example\n            pcmk_password: hunter2\n            pcmk_cluster_options:\n              no-quorum-policy: ignore\n              stonith-enabled: false\n            pcmk_resource_defaults:\n              resource-stickiness: INFINITY\n              migration-threshold: 1\n    \n        - name: Configure simple resources\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: resource\n          loop_control:\n            loop_var: pcmk_resource\n          loop:\n            - id: coolapp\n              class: service\n              type: coolapp\n            - id: nginx\n              class: service\n              type: nginx\n            - id: virtual-ip\n              class: ocf\n              provider: heartbeat\n              type: IPaddr2\n              options:\n                ip: 10.0.0.23\n              meta:\n                migration-threshold: 0\n              op:\n                - name: start\n                  timeout: 60s\n                  interval: 0s\n                  on-fail: restart\n                - name: monitor\n                  timeout: 60s\n                  interval: 10s\n                  on-fail: restart\n                - name: stop\n                  timeout: 60s\n                  interval: 0s\n                  on-fail: restart\n    \n        - name: Configure master-slave Postgres\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: advanced-resource\n          vars:\n            pcmk_resource:\n              id: postgres\n              type: master\n              meta:\n                master-max: 1\n                master-node-max: 1\n                clone-max: 2\n                clone-node-max: 1\n                notify: true\n              resources:\n                postgres-replica-set:\n                  class: ocf\n                  provider: heartbeat\n                  type: pgsql\n                  options:\n                    pgctl: /usr/pgsql-9.4/bin/pg_ctl\n                    psql: /usr/pgsql-9.4/bin/psql\n                    pgdata: /var/lib/pgsql/9.4/data\n                    rep_mode: sync\n                    node_list: \"{{ ansible_play_batch | join(' ') }}\"\n                    restore_command: cp /var/lib/pgsql/9.4/archive/%f %p\n                    master_ip: 10.0.0.23\n                    restart_on_promote: \"true\"\n                    repuser: replication\n                  op:\n                    - name: start\n                      timeout: 60s\n                      interval: 0s\n                      on-fail: restart\n                    - name: monitor\n                      timeout: 60s\n                      interval: 4s\n                      on-fail: restart\n                    - name: monitor\n                      timeout: 60s\n                      interval: 3s\n                      on-fail: restart\n                      role: Master\n                    - name: promote\n                      timeout: 60s\n                      interval: 0s\n                      on-fail: restart\n                    - name: demote\n                      timeout: 60s\n                      interval: 0s\n                      on-fail: stop\n                    - name: stop\n                      timeout: 60s\n                      interval: 0s\n                      on-fail: block\n                    - name: notify\n                      timeout: 60s\n                      interval: 0s\n    \n        - name: Set up constraints\n          include_role:\n            name: devgateway.pacemaker\n            tasks_from: constraint\n          loop_control:\n            loop_var: pcmk_constraint\n          loop:\n            - type: colocation\n              rsc: virtual-ip\n              with-rsc: postgres\n              with-rsc-role: Master\n              score: INFINITY\n            - type: colocation\n              rsc: nginx\n              with-rsc: virtual-ip\n              score: INFINITY\n            - type: colocation\n              rsc: coolapp\n              with-rsc: virtual-ip\n              score: INFINITY\n            - type: order\n              first: postgres\n              first-action: promote\n              then: virtual-ip\n              then-action: start\n              symmetrical: false\n              score: INFINITY\n            - type: order\n              first: postgres\n              first-action: demote\n              then: virtual-ip\n              then-action: stop\n              symmetrical: false\n              score: 0\n\n## See also\n\n- [The official Pacemaker documentation](http://clusterlabs.org/doc/)\n\n## Copyright\n\nCopyright 2015-2019, Development Gateway. Licensed under GPL v3+.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgateway%2Fansible-role-pacemaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevgateway%2Fansible-role-pacemaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevgateway%2Fansible-role-pacemaker/lists"}