Skip to content

Instantly share code, notes, and snippets.

@Thermi
Created October 3, 2016 19:44
Show Gist options
  • Save Thermi/e74fb654d74d40f8f225ae81c2baac91 to your computer and use it in GitHub Desktop.
Save Thermi/e74fb654d74d40f8f225ae81c2baac91 to your computer and use it in GitHub Desktop.
ansible playbook
# https://docs.ansible.com/ansible/playbooks_best_practices.html#content-organization
# https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/index.html
# https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/cloud-aws-best-practices.html
# https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/cloud-aws-testing.html
- hosts: master_nodes
roles:
- centos7-setup
- { role: elasticsearch, es_instance_name: "cluster-master-1", es_heap_size: "1g",
es_config: {
cluster.name: "monitoring-cluster",
"discovery.zen.ping.multicast.enabled": false,
discovery.zen.ping.unicast.hosts: "ip-10-2-1-204.eu-west-1.compute.internal:9300",
http.port: 9200,
transport.tcp.port: 9300,
node.data: false,
node.master: true,
bootstrap.mlockall: false,
discovery.zen.ping.multicast.enabled: false,
discovery.type: "ec2",
"cloud.aws.region": "eu-west-1",
"discovery.ec2.groups": [ sg-645eb702, sg-185eb77e, sg-185eb77e ],
"discovery.ec2.availability_zones": "eu-west-1a"
}
}
vars:
es_scripts: false
es_templates: false
es_version_lock: false
ansible_user: centos
es_plugins:
- plugin: elasticsearch/license
version: latest
- plugin: elasticsearch-cloud-aws
version: 2.5.0
- hosts: data_nodes
roles:
- centos7-setup
- { role: elasticsearch, es_instance_name: "data-node-1", es_data_dirs: "/opt/elasticsearch",
es_config: {
"discovery.zen.ping.multicast.enabled": false,
discovery.zen.ping.unicast.hosts: "ip-10-2-1-204.eu-west-1.compute.internal:9300",
http.port: 9200,
transport.tcp.port: 9300,
node.data: true,
node.master: false,
bootstrap.mlockall: false,
cluster.name: "monitoring-cluster",
discovery.zen.ping.multicast.enabled: false,
discovery.type: "ec2",
"cloud.aws.region": "eu-west-1",
"discovery.ec2.groups": [ sg-645eb702, sg-185eb77e, sg-185eb77e ],
"discovery.ec2.availability_zones": "eu-west-1a"
}
}
- { role: elasticsearch, es_instance_name: "data-node-2",
es_config: {
"discovery.zen.ping.multicast.enabled": false,
discovery.zen.ping.unicast.hosts: "ip-10-2-1-204.eu-west-1.compute.internal:9300",
http.port: 9201,
transport.tcp.port: 9301,
node.data: true,
node.master: false,
bootstrap.mlockall: false,
cluster.name: "monitoring-cluster",
discovery.zen.ping.multicast.enabled: false,
discovery.type: "ec2",
"cloud.aws.region": "eu-west-1",
"discovery.ec2.groups": [ sg-645eb702, sg-185eb77e, sg-185eb77e ],
"discovery.ec2.availability_zones": "eu-west-1a"
}
}
vars:
es_scripts: false
es_templates: false
es_version_lock: false
ansible_user: centos
es_plugins:
- plugin: elasticsearch/license
version: latest
- plugin: elasticsearch-cloud-aws
version: 2.5.0
- hosts: client_nodes
roles:
- centos7-setup
- { role: elasticsearch, es_instance_name: "client-node-1", es_data_dirs: "/opt/elasticsearch",
es_config: {
"discovery.zen.ping.multicast.enabled": false,
discovery.zen.ping.unicast.hosts: "ip-10-2-1-204.eu-west-1.compute.internal:9300",
http.port: 9200,
transport.tcp.port: 9300,
node.data: false,
node.master: false,
bootstrap.mlockall: false,
cluster.name: "monitoring-cluster",
discovery.zen.ping.multicast.enabled: false,
discovery.type: "ec2",
"cloud.aws.region": "eu-west-1",
"discovery.ec2.groups": [ sg-645eb702, sg-185eb77e, sg-185eb77e ],
"discovery.ec2.availability_zones": "eu-west-1a"
}
}
vars:
es_scripts: false
es_templates: false
es_version_lock: false
ansible_user: centos
es_plugins:
- plugin: elasticsearch/license
version: latest
- plugin: elasticsearch-cloud-aws
version: 2.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment