[skip e2e] Add ansible deployment support for centos/redhat/debain/ubuntu (#18491)

Signed-off-by: john-h-luo <jiehua.luo@zilliz.com>

Signed-off-by: john-h-luo <jiehua.luo@zilliz.com>
pull/18650/head
john-h-luo 2022-08-12 20:56:46 +08:00 committed by GitHub
parent e93be80ed6
commit b8891aa714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 100 additions and 52 deletions

View File

@ -1,4 +1,4 @@
[defaults]
host_key_checking = False
inventory = inventory.ini
private_key_file=~/.my_ssh_keys/gpc_sshkey
private_key_file=~/.ssh/id_ed25519

View File

@ -1,16 +1,10 @@
---
- name: setup pre-requisites #Install prerequisite
hosts: all
- name: setup pre-requisites & Docker #Install prerequisite
hosts: dockernodes
become: yes
become_user: root
roles:
- install-modules
- configure-hosts-file
- name: install docker
become: yes
become_user: root
hosts: dockernodes
roles:
- docker-installation

View File

@ -3,9 +3,6 @@ dockernode01
dockernode02
dockernode03
[admin]
ansible-controller
[coords]
; Take note the IP of this host VM, and replace 10.170.0.17 with it.
dockernode01
@ -25,15 +22,18 @@ nodes
dependencies
[docker:vars]
ansible_python_interpreter= /usr/bin/python3
StrictHostKeyChecking= no
ansible_python_interpreter = /usr/bin/python3
StrictHostKeyChecking = no
ansible_connection = ssh
; Replace linux-user with your linux user name
ansible_user = linux-user
; Setup variables to controll what type of network to use when creating containers.
dependencies_network= host
nodes_network= host
; Setup varibale to controll what version of Milvus image to use.
image= milvusdb/milvus:master-20220412-4781db8a
; Setup varibale to controll what image version of Milvus to use.
image= milvusdb/milvus:v2.1.0
; Setup static IP addresses of the docker hosts as variable for container environment variable config.
; Before running the playbook, below 4 IP addresses need to be replaced with the IP of your host VM

View File

@ -1,5 +0,0 @@
---
- name: Configure Hosts File
lineinfile: path=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: "{{ groups['docker'] }}"

View File

@ -1,17 +1,16 @@
- name: etcd volume
docker_volume:
name: etcd_volume
- name: etcd
docker_container:
name: etcd
image: quay.io/coreos/etcd:v3.5.0
command: "etcd -listen-peer-urls=http://{{etcd_ip}}:2380 -advertise-client-urls=http://{{etcd_ip}}:2379 -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 -initial-advertise-peer-urls=http://{{etcd_ip}}:2380 --listen-metrics-urls=http://{{etcd_ip}}:2381 --initial-cluster default=http://{{etcd_ip}}:2380 --data-dir /etcd"
healthcheck:
test: ["CMD", "wget", "-q", "--tries=1", "--spider", "http://etcd_ip:/health"]
interval: 30s
timeout: 20s
retries: 3
volumes:
- etcd_volume:/etcd
command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
env:
ETCD_AUTO_COMPACTION_MODE: revision
ETCD_AUTO_COMPACTION_RETENTION: "1000"
ETCD_QUOTA_BACKEND_BYTES: "4294967296"
# volumes:
# - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
network_mode: "{{dependencies_network}}" #Use the network which defined as variable in Inventory.

View File

@ -1,3 +1,7 @@
- name: minio volume
docker_volume:
name: minio_volume
- name: "minio"
docker_container:
name: minio
@ -5,9 +9,9 @@
env:
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
command: "minio server /minio_data"
# volumes:
# - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/minio:/minio_data
volumes:
- minio_volume:/data
command: minio server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:9000/minio/health/live"]
interval: 30s

View File

@ -1,3 +1,11 @@
- name: pulsar volume
docker_volume:
name: pulsar_conf
- name: pulsar volume
docker_volume:
name: pulsar_data
- name: "pulsar"
docker_container:
name: pulsar
@ -11,5 +19,8 @@
# maxMessageSize is missing from standalone.conf, must use PULSAR_PREFIX_ to get it configured
PULSAR_PREFIX_maxMessageSize: "104857600"
PULSAR_GC: -XX:+UseG1GC
command: "bin/pulsar standalone --no-functions-worker --no-stream-storage" #/bin/bash -c bin/apply-config-from-env.py conf/standalone.conf &&
volumes:
- pulsar_conf:/pulsar/conf
- pulsar_data:/pulsar/data
command: bash -c '/pulsar/bin/apply-config-from-env.py /pulsar/conf/standalone.conf; exec bin/pulsar standalone --no-functions-worker'
network_mode: "{{dependencies_network}}" #Use the network which defined as variable in Inventory.

View File

@ -1,30 +1,64 @@
---
- name: Install Docker Dependencies
yum: name={{ item }} state=latest update_cache=yes
with_items:
- yum-utils
- device-mapper-persistent-data
- lvm2
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
- name: Add Docker Yum Repo
get_url:
url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
- name: Install Docker
yum:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: latest
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
- name: Start Docker Service
service:
name: docker
state: started
enabled: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
- name: Install Docker Dependencies
apt: name={{ item }} state=latest update_cache=yes
with_items:
- apt-transport-https
- ca-certificates
- software-properties-common
tags: docker
- software-properties-common
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Get Docker key
- name: Add Docker GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
tags: docker
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Add Docker packages to Repository
- name: Add Docker Apt Repo
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename|lower }} stable
tags: docker
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Install Docker-CE
apt: name="docker-ce" state=latest update_cache=yes
tags: docker
- name: Install Docker
apt:
update_cache: yes
state: latest
name:
- docker-ce
- docker-ce-cli
- containerd.io
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Install python3-docker
apt: name="python3-docker" state=latest update_cache=yes
tags: docker
- name: Install docker-compose python3 library
command: "pip3 install docker-compose"
- name: Install 'Docker SDK for Python'
pip:
name: docker

View File

@ -1,4 +1,16 @@
---
- name: Install Packages
yum: name={{ item }} state=latest update_cache=yes
with_items:
- ntp
- tcpdump
- python3
- wget
- openssl
- curl
- python3-pip
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
- name: Install Packages
apt: name={{ item }} state=latest update_cache=yes
with_items:
@ -9,5 +21,4 @@
- openssl
- curl
- python3-pip
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'