---
# defaults vars for redisha
# All vars could be overrided by declaration in each envoirnment file
#   for example : vars/env_{{ ansENV }}.yml

# ******* DO NOT CHANGE THIS FILE AS IT IS DEFAULT SETTINGS *******

############################# General ##############################

# Temporary directory for file deployment to the target nodes.
pathTemp: "/home/dietpi/build/"

# Gather facts fliter (for faster)
# Only use needed facts
gfacts_filter:
  - "!all"
  - distribution
  - distribution_major_version
  - distribution_release
  - distribution_version
  - os_family
  - pkg_mgr
  - python
  - python_version

######################### Build Settings ###########################

# The type of repository for push the docker image
#   true: It will create a private registry service to the swarm and 
#         push docker images onto it.
#   false: Use a docker repository
localRegistry: false

# The information of push the docker image.
imagePushDomain: "pvgharbor.duckdns.org"
registryUser: "ansible"
registryPass: "P@ssw0rd"

####################### Deployment Settings ########################

# The repository for pull the docker image
imagePullDomain: "pvgharbor.duckdns.org"

# The configuration
demolamp:
  imageName: "{{ imagePullDomain }}/demolamp/demolamp"
  pushRepoName: "{{ imagePushDomain }}/demolamp/demolamp"
  dockerFile: "Dockerfile_demolamp.yml"

# Update the docker-compose file (var=fileCompose) every execution.
#   true: Ansible will use template module to transfer the file.
#   false: If docker-compose file exists in the node and chosen "false",
#          Ansible will not update and template it.
updateComposeTpl: true

# The directory which store the docker-compose file (only in the first node).
pathCompose: "/opt/demolamp"

# The file which use by Ansible template module, replace all placeholders by 
# all ansible variables.
#   for example: files/{{ansTagVer}}/redis_stack.tpl
templateCompose: "demolamp.tpl"

# After Ansible template module replaced all placeholders in above, it will
# rename the docker-compose file name by below variables in the target node.
fileCompose: "demolamp.yml"

# The stack name use for startup the stack
stackName: demolamp

######################## Redis-HA Settings #########################

# ACL feature of the Redis-HA
#   true: enable the feature, require to connect with username-password pair.
#         REMARKS: you must also update acl files under vars/{{ansENV}}/ per envoirnment.
#   false: disable by default, retain the authentication method as same as Redis v5.x
enableACL: false

# Store Redis data to docker local volume.
#   true: Presist the data to docker local volume
#   false: Data will be lost every start or stop
storeRedisData: false

# The publish port for Redis, Replica and Sentinel.
publish_redisPort: 6379
publish_sentinelPort: 26379

# The admin credential for Redis and Replica.
#   Default is "redis4{{ ansENV }}" means "redis4hkdev" for example of HKDEV
redisAdminUser: "admin"
redisAdminPass: "redis4{{ ansENV }}"

# The admin credential for Sentinel
#   Default is "sentinel4{{ ansENV }}" means sentinel4hkdev" for example of HKDEV
sentinelAdminUser: "admin"
sentinelAdminPass: "sentinel4{{ ansENV }}"

# This setting equal to Sentinel configuration:
#   sentinel down-after-milliseconds <master-name> <milliseconds>
sentinelDownAfter: 5000
#   sentinel failover-timeout <master-name> <milliseconds>
sentinelFailover: 15000
#   sentinel parallel-syncs <master-name> <numreplicas>
sentinelParallelSync: 1
#   SENTINEL resolve-hostnames no
#   SENTINEL announce-hostnames no
sentinelResolveHostame: "no"
sentinelAnnounceHostame: "no"

# This setting equal to Sentinel configuration:
#   sentinel monitor <master-name> <ip> <redis-port> <quorum>
sentinelMasterName: "mymaster"
sentinelQuorum: 2

# To limit the memory usage of Redis and Replica.
redisha_memLimit: "1GB"

# Redis and Sentinel ACL file name
#   Note: Must match and place correctly under vars/{{ansENV}}/
filename_redisACL: "redis_users.acl"
filename_sentinelACL: "sentinel_users.acl"

# Redis-HA nodes setup
#   Note 1) Must declare in envoirnment variables file.
#           For example: vars/hkdev/env_hkdev.yml
#   Note 2) The hostname must match to "docker node ls".
#   Note 3) Must one master and at least two replicas.
#             isMaster: true
#             isReplica: false
#   
# ~~~Template~~~
#       redisha_nodes:
#         - hostname: "swarm-worker-01"
#           ipaddr: "192.168.1.10"
#           isMaster: true
#           isReplica: false
#         - hostname: "swarm-worker-02"
#           ipaddr: "192.168.1.11"
#           isMaster: false
#           isReplica: true
#         - hostname: "swarm-worker-N"
#           ipaddr: "192.168.1.N"
#           isMaster: false
#           isReplica: true
#
# ~~~Example~~~
#       redisha_nodes:
#         - hostname: "swarm-worker-01"
#           ipaddr: "192.168.1.10"
#           isMaster: true
#           isReplica: false
#         - hostname: "swarm-worker-02"
#           ipaddr: "192.168.1.11"
#           isMaster: false
#           isReplica: true
#         - hostname: "swarm-worker-03"
#           ipaddr: "192.168.1.13"
#           isMaster: false
#           isReplica: true