couchbaselabs.couchbase_server
Couchbase Server Ansible Role
#####################
###########################
###############################
###################################
#####################################
###### ############# ######
###### ############# ######
###### ######
###### ######
######\ /######
#####################################
###################################
###############################
###########################
###################
Works with Ansible Galaxy
You can install this role using the ansible-galaxy command and run it directly from the git repository.
Follow these steps to install it:
ansible-galaxy install couchbaselabs.couchbase_server
Ensure you have write access to /etc/ansible/roles/, which is the default installation path. Alternatively, you can set a custom role path by creating a $HOME/.ansible.cfg file and adding the following:
[defaults]
roles_path = <path_to_your_preferred_role_location>
Replace <path_to_your_preferred_role_location> with a directory where you have write access.
For more information, check the ansible-galaxy documentation.
Role Variables
If you're looking for a simple setup for development or non-production environments, the default variable values for the Couchbase Server role should work well. The only variable that you must specify is couchbase_nodes:.
If you need to adjust settings for performance or other specific needs, this section details the role variables and their default values.
couchbase_server_edition
Choose between enterprise or community editions of Couchbase Server. The default is enterprise.
couchbase_server_version
Specify the version and build you want to install. The default is latest. For example, you can choose 6.6.0-7909. To check available versions, run:
yum list --showduplicates couchbase-server
couchbase_server_download_url
Provide a complete URL to a *.rpm or *.deb file from which you want to install Couchbase Server.
couchbase_os
All settings in couchbase_os are optional. If you don’t specify them, the defaults will be used.
| Variable | Default | Description |
|---|---|---|
| firewalld | false | Install firewalld and open Couchbase ports |
| disable_thp | true | Install the disable-thp script to optimize memory |
| common_tools | false | Install common tools like git, jq, etc. |
| kernel_tunings | true | Apply memory tuning settings |
| user_limits | true | Set user limits for the couchbase user |
Example
couchbase_os:
firewalld: true
disable_thp: true
common_tools: true
kernel_tunings: true
user_limits: true
couchbase_nodes
All properties in couchbase_nodes are optional except for hostname, which is required. If services: is not specified, it will use default services defined in couchbase_server.default_services, which is data,index,query.
| Variable | Default | Description |
|---|---|---|
| *hostname | null | Required: The hostname of the node |
| group | null | The group name for the node; defaults to the main group |
| services | - data - index - query |
Services to run on the node; available options are: - data - index - query - fts - eventing - analytics |
Example
couchbase_nodes:
- hostname: host1.couchbase.example.com
group: AZA
services:
- data
- hostname: host2.couchbase.example.com
group: AZB
services:
- data
- hostname: host3.couchbase.example.com
group: AZA
services:
- index
couchbase_cluster
All properties in couchbase_cluster are optional and will use defaults if not specified.
| Variable | Default | Description |
|---|---|---|
| name | My Cluster | The name of the Couchbase Cluster |
| rest_protocol | http | Protocol to use for REST API |
| port | 8091 | Default cluster port |
| notifications | true | Enable console notifications |
| index_storage | default | Sets storage mode for index service |
| default_services | - data - index - query |
Default services for the cluster |
Example
couchbase_cluster:
name: Demo
rest_protocol: http
port: 8091
notifications: true
index_storage: default
default_services:
- data
- index
- query
couchbase_memory_quotas
All properties in couchbase_memory_quotas are optional.
| Variable | Default | Description |
|---|---|---|
| analytics | 1024 | Memory quota for Analytics service (in MB) |
| data | 4098 | Data service memory quota (in MB) |
| eventing | 256 | Memory quota for Eventing service (in MB) |
| fts | 512 | Memory quota for full-text service (in MB) |
| index | 512 | Memory quota for Index service (in MB) |
Example
couchbase_memory_quotas:
analytics: 1024
data: 16000
eventing: 256
fts: 512
index: 512
couchbase_security
All properties in couchbase_security are optional.
| Variable | Default | Description |
|---|---|---|
| admin_user | Administrator | Username for the cluster admin |
| admin_password | password | Password for the cluster admin |
| disable_http_ui | false | Whether the Couchbase Web Console can be accessed over HTTP |
| disable_www_authenticate | false | Whether the server responds to unauthenticated requests |
| cluster_encryption_level | control | Encryption level for the cluster |
| tls_min_version | tlsv1 | Minimum TLS version for Couchbase services |
| tls_honor_cipher_order | true | Ensures cipher order compliance across services |
Example
couchbase_security:
admin_user: Administrator
admin_password: password
disable_http_ui: false
disable_www_authenticate: false
cluster_encryption_level: control
tls_min_version: tlsv1
tls_honor_cipher_order: true
couchbase_paths
All properties in couchbase_paths are optional.
| Variable | Default | Description |
|---|---|---|
| data | /opt/couchbase/var/lib/couchbase/data | Data files storage path |
| index | /opt/couchbase/var/lib/couchbase/data | Index files storage path |
| analytics | /opt/couchbase/var/lib/couchbase/data | Analytics service files path |
| eventing | /opt/couchbase/var/lib/couchbase/data | Eventing service files path |
Example
couchbase_paths:
data: /opt/couchbase/var/lib/couchbase/data
index: /opt/couchbase/var/lib/couchbase/index
analytics: /opt/couchbase/var/lib/couchbase/analytics
eventing: /opt/couchbase/var/lib/couchbase/eventing
couchbase_rebalance_settings
All properties in couchbase_rebalance_settings are optional.
| Variable | Default | Description |
|---|---|---|
| rebalance_retry | false | Enable automatic rebalance retry |
| wait_for | 300 | Time to wait after a failed rebalance before retrying |
| max_attempts | 1 | Number of times to retry a failed rebalance |
| moves_per_node | 4 | Concurrent vBucket moves per node during rebalance |
Example
couchbase_rebalance_settings:
rebalance_retry: false
wait_for: 300
max_attempts: 1
moves_per_node: 4
couchbase_audit
All properties in couchbase_audit are optional.
| Variable | Default | Description |
|---|---|---|
| enabled | true | Whether auditing is enabled |
| log_path | /opt/couchbase/var/lib/couchbase/logs | Path for audit logs |
| log_rotate_interval | 86400 | Audit log rotation interval (in seconds) |
| log_rotate_size | 20971520 | Size limit for audit logs (in bytes) |
Example
couchbase_audit:
enabled: true
log_path: /opt/couchbase/var/lib/couchbase/logs
log_rotate_interval: 86400
log_rotate_size: 20971520
couchbase_password_policy
All properties in couchbase_password_policy are optional.
| Variable | Default | Description |
|---|---|---|
| min_length | 6 | Minimum password length |
| uppercase | false | Require at least one uppercase letter |
| lowercase | false | Require at least one lowercase letter |
| digit | false | Require at least one digit |
| special_char | false | Require at least one special character |
Example
couchbase_password_policy:
min_length: 6
uppercase: false
lowercase: false
digit: false
special_char: false
couchbase_query_settings
All properties in couchbase_query_settings are optional.
| Variable | Default | Description |
|---|---|---|
| pipeline_batch | 16 | Items execution operators can batch |
| pipeline_cap | 512 | Maximum items each operator can buffer |
| scan_cap | 512 | Maximum buffer size for index scans |
| timeout | 0 | Server execution timeout |
| prepared_limit | 16384 | Max number of prepared statements |
| completed_limit | 4000 | Max number of completed requests |
| completed_threshold | 1000 | Threshold for caching completed queries |
| log_level | info | Log level for query services |
| max_parallelism | 1 | Max parallelism per query |
Example
couchbase_query_settings:
pipeline_batch: 16
pipeline_cap: 512
scan_cap: 512
timeout: 0
prepared_limit: 16384
completed_limit: 4000
completed_threshold: 1000
log_level: info
max_parallelism: 1
couchbase_index_settings
All properties in couchbase_index_settings are optional.
| Variable | Default | Description |
|---|---|---|
| max_rollback_points | 2 | Max number of rollback points |
| stable_snapshot_interval | 5000 | Snapshot interval for recovery (in seconds) |
| memory_snapshot_interval | 200 | In-memory snapshot interval (in milliseconds) |
| threads | 0 | Max number of CPUs for the indexer |
| log_level | info | Log level for the index service |
Example
couchbase_index_settings:
max_rollback_points: 2
stable_snapshot_interval: 5000
memory_snapshot_interval: 200
threads: 0
log_level: info
couchbase_autofailover
All properties in couchbase_autofailover are optional.
| Variable | Default | Description |
|---|---|---|
| enabled | true | Enable auto-failover |
| failover_timeout | 120 | Timeout to consider a node down |
| max_failovers | 1 | Max auto-failover events before intervention |
| failover_of_server_groups | false | Enable failover for entire server groups |
| failover_on_data_disk_issues | true | Enable failover on data service disk issues |
| failover_data_disk_period | 120 | Check period for disk failures (in seconds) |
| can_abort_rebalance | true | Allow auto-failover to abort rebalance |
Example
couchbase_autofailover:
enabled: true
failover_timeout: 120
max_failovers: 1
failover_of_server_groups: false
failover_on_data_disk_issues: true
failover_data_disk_period: 120
can_abort_rebalance: true
couchbase_email_alerts
All properties in couchbase_email_alerts are optional.
| Variable | Default | Description |
|---|---|---|
| enabled | false | Enable email alerts for this cluster |
| username | null | Email server username for authentication |
| password | null | Email server password for authentication |
| host | localhost | Email server hostname |
| port | 25 | Email server port |
| encrypt | false | Enable SSL for email server connection |
| sender | couchbase@localhost | Email address for alerts |
| recipients | [] | List of alert email recipients |
| alerts | - alert-auto-failover-node - alert-auto-failover-max-reached - alert-auto-failover-node-down - alert-auto-failover-cluster-small - alert-auto-failover-disable - alert-ip-changed - alert-disk-space - alert-meta-overhead - alert-meta-oom - alert-write-failed - alert-audit-msg-dropped - alert-indexer-max-ram - alert-timestamp-drift-exceeded - alert-communication-issue |
List of alerts that can trigger an email |
Example
couchbase_email_alerts:
enabled: true
host: localhost
port: 25
encrypt: false
sender: couchbase@localhost
recipients:
- [email protected]
alerts:
- alert-auto-failover-node
- alert-auto-failover-max-reached
- alert-auto-failover-node-down
- alert-auto-failover-cluster-small
- alert-auto-failover-disable
- alert-ip-changed
- alert-disk-space
- alert-meta-overhead
- alert-meta-oom
- alert-write-failed
- alert-audit-msg-dropped
- alert-indexer-max-ram
- alert-timestamp-drift-exceeded
- alert-communication-issue
couchbase_buckets[]
The couchbase_buckets variable is empty by default. Specify the properties for each bucket, with name being required while others are optional.
| Variable | Default | Description |
|---|---|---|
| *name | null | Bucket name (max 100 characters) |
| type | couchbase | Bucket type: "couchbase", "ephemeral", "memcached" |
| storage_backend | couchstore | Storage type for the bucket (only for "couchbase") |
| ram_size | 100 | Memory for bucket cache (in MB) |
| replicas | 1 | Number of server replicas |
| priority | low | Background task priority |
| eviction_policy | valueOnly | Memory eviction policy |
| conflict_resolution | sequence | Conflict resolution mechanism for XDCR |
| flush | false | Allow flush operation |
| durability_min_level | none | Minimum durability level |
| compression_mode | passive | Compression mode for the bucket |
| max_ttl | 0 | Max TTL for documents in bucket |
| enable_index_replica | false | Enable view index replication |
Example
couchbase_buckets:
- name: baseball
type: couchbase
ram_size: 400
replicas: 1
compression_mode: active
- name: ecommerce
type: couchbase
ram_size: 700
replicas: 1
compression_mode: active
- name: movies
type: couchbase
ram_size: 450
replicas: 1
compression_mode: active
couchbase_sample_buckets[]
The couchbase_sample_buckets variable is empty by default. Supported values include "travel-sample", "beer-sample", or "gamesim-sample".
Example
couchbase_sample_buckets:
- travel-sample
couchbase_xdcr_remotes[]
The couchbase_xdcr_remotes variable is empty by default. Each item in the list must include the following properties.
| Variable | Default | Description |
|---|---|---|
| *name | null | Remote cluster reference name |
| *hostname | null | Hostname of remote cluster |
| *username | null | Username for remote cluster |
| *password | null | Password for remote cluster |
Example
couchbase_xdcr_remotes:
- name: My Cluster
hostname: remotehost.couchbase.example.com
username: Administrator
password: password
couchbase_xdcr_replications[]
The couchbase_xdcr_replications variable is empty by default. Each item must specify from_bucket, to_bucket, and cluster_name.
| Variable | Default | Description |
|---|---|---|
| *from_bucket | null | Source bucket for replication |
| *to_bucket | null | Target bucket for replication |
| *cluster_name | null | Cluster reference for target |
| filter_expression | null | Regular expression for filtering replication |
| checkpoint_interval | 600 | Checkpoint interval (in seconds) |
| worker_batch_size | 500 | Worker batch size |
| doc_batch_size | 2048 | Document batch size (in KB) |
| failure_restart_interval | 10 | Restart interval for failed connections |
| optimistic_replication_threshold | 256 | Document size for optimistic replication |
| source_nozzle_per_node | 2 | Number of nozzles per source node |
| target_nozzle_per_node | 2 | Number of nozzles per target node |
| bandwidth_usage_limit | 0 | Bandwidth limit for replication (in MB/s) |
| enable_compression | true | Enable XDCR compression |
| log_level | Info | XDCR log level |
| stats_interval | 1000 | Stats update interval (in ms) |
| priority | High | Replication priority |
| reset_expiry | false | Reset expiration for documents |
| filter_deletion | false | Prevent delete operations in target |
| filter_expiration | false | Prevent expiration operations in target |
Example
couchbase_xdcr_replications:
- from_bucket: beer
to_bucket: demo
cluster_name: My Cluster
couchbase_ldap
All properties in the couchbase_ldap variable are optional.
| Variable | Default | Description |
|---|---|---|
| hosts | [] | List of LDAP server hosts |
| port | 389 | LDAP port |
| encryption | none | Security option for LDAP communication |
| cacert | cacert | Path to CA certificate for validation |
| server_cert_validation | false | Enable certificate validation |
| bind_dn | null | DN of binding user |
| bind_password | null | Password for binding user |
| client_cert | null | Client TLS certificate for authentication |
| client_key | null | Client TLS key for authentication |
| authentication_enabled | false | Enable LDAP for user authentication |
| user_dn_query | null | LDAP user DN query |
| authorization_enabled | false | Enable LDAP for user authorization |
| group_query | null | LDAP group query |
| max_parallel_connections | 100 | Max connections to LDAP servers |
| max_cache_size | 10000 | Max cached requests |
| cache_value_lifetime | 300000 | Lifetime for cached values |
| enable_nested_groups | false | Enable nested group searches |
| nested_groups_max_depth | 10 | Max depth for nested groups |
| request_timeout | 1000 | LDAP request timeout in milliseconds |
Example
couchbase_ldap:
hosts:
- ldap.example.com
port: 389
encryption: none
server_cert_validation: false
bind_dn: uid=aaronb,ou=People,dc=example,dc=com
bind_password: password
authentication_enabled: true
user_dn_query: ou=People,dc=example,dc=com??one?(uid=%u)
authorization_enabled: true
group_query: ou=People,dc=example,dc=com?(gidNumber=5000)?one
max_parallel_connections: 100
max_cache_size: 10000
cache_value_lifetime: 300000
enable_nested_groups: true
nested_groups_max_depth: 10
couchbase_user_groups[]
The couchbase_user_groups variable is empty by default. Each group must include the name property.
| Variable | Default | Description |
|---|---|---|
| *name | null | Target group for operations |
| description | null | Group description |
| ldap_ref | null | LDAP group’s distinguished name |
| roles | [] | Roles for the RBAC user profile |
Example
couchbase_user_groups:
- name: Demo
description: test
roles:
- cluster_admin
- replication_admin
- name: Test
description: test
roles:
- cluster_admin
- replication_admin
- name: admins
description: test
roles:
- cluster_admin
- replication_admin
couchbase_users[]
The couchbase_users variable is empty by default. Each user must specify the username property.
| Variable | Default | Description |
|---|---|---|
| username | null | RBAC user’s username |
| password | null | User password for local RBAC profile |
| name | null | Full name for the user profile |
| roles | [] | Roles for the RBAC user profile |
| groups | null | Groups the user should join |
| domain | local | Auth domain for the user profile |
Example
couchbase_users:
- username: aaronb
name: Aaron B
roles:
- admin
- cluster_admin
groups:
- Demo
auth_domain: external
- username: jadt
password: password
name: Jad Talbert
roles:
- admin
- cluster_admin
groups:
- Demo
- Test
auth_domain: local
couchbase_indexes[]
The couchbase_indexes variable is empty by default. Each index must include the bucket and definition properties.
| Variable | Default | Description |
|---|---|---|
| *bucket | null | Name of bucket for index creation |
| *definition | null | Index definition (without WITH {...}) |
| num_replicas | null | Number of replicas to create |
| num_partitions | null | Number of index partitions |
| nodes | [] | List of nodes for deploying the index |
| sec_key_size | null | Average length of index key values |
| doc_key_size | null | Average length of document key |
| arr_size | null | Average length of the array field |
| num_doc | null | Expected number of documents |
| resident_ratio | null | Estimated resident ratio of the index |
Example
couchbase_indexes:
- bucket: demo
definition: CREATE INDEX idx_test ON demo (username)
replicas: 1
- bucket: demo
definition: CREATE INDEX idx_test2 ON demo (email)
replicas: 1
- bucket: ecommerce
definition: CREATE INDEX idx_test3 ON ecommerce (username)
replicas: 1
Installs, initializes and configures Couchbase Server clusters
ansible-galaxy install couchbaselabs.couchbase_server