-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathcentos7-elasticsearch-deploy.yml
46 lines (46 loc) · 1.42 KB
/
centos7-elasticsearch-deploy.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
- hosts: localhost
vars:
base_image: "centos:7.9.2009"
base_command: "sleep 900"
tagrepo: "localhost:5000/systemctl"
tagname: "elasticsearch"
tasks:
- name: attach container
add_host:
hostname: '{{ container1 }}'
ansible_connection: 'docker'
ansible_user: "root"
# ansible_python_interpreter: /usr/bin/python
- name: gather facts on it
delegate_to: '{{ container1 }}'
setup:
gather_subset: "all"
- name: setup systemctl.py
delegate_to: '{{ container1 }}'
import_role:
name: "setup-systemctl-replacement"
vars:
deployment_docker: yes
- name: setup the container
delegate_to: '{{ container1 }}'
import_role:
name: "elasticsearch"
# detect version:
- name: software package
set_fact:
software_package: '{{ elasticsearch_rpm.split("-")[0] }}'
- name: software version
delegate_to: '{{ container1 }}'
shell: "rpm -q --info {{ software_package }} | sed -e '/Version *:/!d' -e 's/.*: *//' -e q"
register: software_version
- name: write version
delegate_to: '{{ container1 }}'
copy:
dest: "/VERSION"
content: "{{ software_version.stdout | trim }}"
- name: setup systemctl.py again
delegate_to: '{{ container1 }}'
import_role:
name: "setup-systemctl-replacement"
vars:
deployment_docker: yes