Skip to content

Instantly share code, notes, and snippets.

@jmlrt
Last active September 4, 2019 20:44
Show Gist options
  • Save jmlrt/86616285a66653c5f7a6ddf5bca4d312 to your computer and use it in GitHub Desktop.
Save jmlrt/86616285a66653c5f7a6ddf5bca4d312 to your computer and use it in GitHub Desktop.
deploy elasticsearch in docker container using kitchen-ci and ansible
---
driver:
name: docker
provisioner:
name: ansible_playbook
hosts: localhost
require_ansible_repo: true
ansible_verbose: true
ansible_version: latest
require_chef_for_busser: false
platforms:
- name: centos-7
driver_config:
image: centos:7
run_command: "/usr/sbin/init"
privileged: true
use_sudo: true
suites:
- name: main
provisioner:
idempotency_test: false
playbook: main.yml

How-to deploy elasticsearch in docker container using kitchen-ci and ansible

Using kitchen-ci allow us to benefit easily of a systemd compatible container

Requirements

  • Ruby
  • Bundler

Getting started

bundle install
kitchen converge
kitchen login
source 'https://rubygems.org'
gem 'test-kitchen'
gem 'kitchen-docker'
gem 'kitchen-ansible'
---
- hosts: localhost
tasks:
- yum_repository:
name: elasticsearch-7.x
state: present
baseurl: https://artifacts.elastic.co/packages/7.x/yum
description: Elasticsearch repository for 7.x packages
gpgcheck: yes
gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch
- yum:
name: elasticsearch
state: present
- systemd:
name: elasticsearch
state: restarted
daemon_reload: yes
- name: install tools
yum:
name: "{{ item }}"
state: present
loop:
- jq
- vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment