-
Notifications
You must be signed in to change notification settings - Fork 28
/
centos7-elasticsearch-docker.yml
70 lines (70 loc) · 2.38 KB
/
centos7-elasticsearch-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
- hosts: localhost
vars:
base_image: "centos:7.9.2009"
base_command: "sleep 900"
tagrepo: "localhost:5000/systemctl"
tagname: "elasticsearch"
tagversion: "latest"
docker: docker
tasks:
- name: downloads upfront
import_role:
name: "elasticsearch"
tasks_from: "software_download.yml"
allow_duplicates: yes
- name: name of setup container
set_fact:
container1: "{{ tagname.replace('/','-') + '-build-' + lookup('pipe', 'echo $PPID') }}"
- debug: var=container1
- name: remove setup container
command: "{{docker}} rm -f '{{ container1 }}'"
ignore_errors: yes
- name: start docker mirror package repo
shell: ./docker_mirror.py start {{base_image}} -a
register: mirror
- name: start setup container
command: "{{docker}} run -d --rm=true {{ mirror.stdout_lines[0] }} \
--name '{{ container1 }}' '{{ base_image }}' {{base_command}}"
- name: initial setup container
add_host:
hostname: elasticsearch-root
ansible_host: "{{ container1 }}"
ansible_connection: 'docker'
ansible_user: "root"
# ansible_python_interpreter: /usr/bin/python
- name: setup deployment user
delegate_to: elasticsearch-root
import_role:
name: "setup-deployment-user"
vars:
deployment_docker: yes
- name: attach setup container
add_host:
hostname: elasticsearch-host
groups: elasticsearch
ansible_host: "{{ container1 }}"
ansible_connection: 'docker'
ansible_user: "ansible"
# ^^^^^^^^^
# ansible_python_interpreter: /usr/bin/python
- name: gather facts on it
delegate_to: elasticsearch-host
setup:
gather_subset: "all"
- name: setup systemctl replacement
delegate_to: elasticsearch-host
import_role:
name: "setup-systemctl-replacement"
vars:
deployment_docker: yes
- name: setup the container
delegate_to: elasticsearch-host
import_role:
name: "elasticsearch"
- name: commit the container
command: "{{docker}} commit \
-c 'CMD [\"/usr/bin/systemctl\"]' \
'{{ container1 }}' '{{ tagrepo }}/{{ tagname }}:{{ tagversion }}'"
- name: remove setup container
command: "{{docker}} rm -f '{{ container1 }}'"
ignore_errors: yes