Created
July 14, 2016 16:38
-
-
Save leifmadsen/24020886cde7c4a6574d6c6518aa2111 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: set ft=ansible | |
- name: Deploy on OpenStack | |
hosts: localhost | |
gather_facts: false | |
vars_files: | |
- ~/.ansible/vars/elk_vars.yml | |
tasks: | |
- name: Deploy an instance | |
os_server: | |
name: "{{ cloud_name_prefix }}-{{ item }}" | |
state: present | |
cloud: "{{ cloud_name }}" | |
region_name: "{{ cloud_region_name }}" | |
availability_zone: "{{ cloud_availability_zone }}" | |
image: "{{ cloud_image }}" | |
flavor: "{{ cloud_flavor }}" | |
key_name: "{{ cloud_key_name }}" | |
boot_from_volume: true | |
terminate_volume: true | |
volume_size: 20 | |
security_groups: default | |
auto_ip: yes | |
timeout: 200 | |
register: instances | |
with_items: | |
- elasticsearch | |
- logstash | |
- kibana | |
- name: Add host to inventory | |
add_host: | |
name: "{{ item.item }}" | |
groups: "{{ item.item }}" | |
ansible_host: "{{ item.server.public_v4 }}" | |
ansible_user: centos | |
ansible_become: true | |
with_items: "{{ instances.results }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment