環境准備
DC/OS 集群
- Master 節點 (選舉)
- Agent 節點
- Private
- Public
- Bootstrap 節點
跳板機安裝ansible、mazer並且跳板機到其他4個節點為ssh免密鑰登陸
跳板機安裝ansible、dcos.dcos_ansible、mazer
yum instal -y ansible
curl https://bootstrap.pypa.io/get-pip.py | python #安裝pip
pip install mazer==0.4.0 #通過pip安裝mazer
mazer install dcos.dcos_ansible
ansible hosts配置文件
[root@jumpserver ~]# cd /etc/ansible/
[root@jumpserver ansible]# pwd
/etc/ansible
[root@jumpserver ansible]# ls
ansible.cfg hosts roles
[root@jumpserver ansible]# cat hosts
[bootstrap]
3.115.184.172
[master]
18.177.76.161
[private]
52.198.146.9
[public]
13.115.17.255
---
dcos_ansible配置文件
需要注意⚠️以下三個文件
[root@jumpserver dcos-ansible-0.52.0]# cat ansible.cfg
[defaults]
inventory = inventory
host_key_checking = False
remote_user = root ##這個需要是root要不會報錯
forks = 100
hash_behaviour = replace
[ssh_connection]
control_path = %(directory)s/%%C
pipelining = True
ssh_args = -o PreferredAuthentications=publickey -o ControlMaster=auto -o ControlPersist=5m
如果使用ansible部署,這個配置文件不用動
[root@jumpserver dcos-ansible-0.52.0]# cat dcos.yml
---
- name: Wait for instances to become reachable
hosts: all
gather_facts: no
tasks:
- name: Wait for instances to become reachable
wait_for_connection:
delay: 10
sleep: 10
timeout: 120
- name: Collect DC/OS versions
hosts: all
tasks:
- name: Collect DC/OS versions
setup:
- name: DC/OS Requirements
hosts: all
become: true
tasks:
- include_role:
name: DCOS.requirements
- name: "Setup and configure BOOTSTRAP nodes"
hosts: bootstraps
become: true
tasks:
- include_role:
name: DCOS.bootstrap
- name: "Setup and configure MASTER nodes"
hosts: masters
serial: 1
become: true
tasks:
- include_role:
name: DCOS.master
- name: "Setup and configure AGENT nodes"
hosts: agents
become: true
tasks:
- include_role:
name: DCOS.agent
[root@jumpserver dcos-ansible-0.52.0]#
inventory與ansible hosts的IP是一樣的
[root@jumpserver dcos-ansible-0.52.0]# cat inventory
[bootstraps]
3.115.184.172
[masters]
18.177.76.161
[agents_private]
52.198.146.9
[agents_public]
13.115.17.255
[bootstraps:vars]
node_type=bootstrap
[masters:vars]
node_type=master
dcos_legacy_node_type_name=master
[agents_private:vars]
node_type=agent
dcos_legacy_node_type_name=slave
[agents_public:vars]
node_type=agent_public
dcos_legacy_node_type_name=slave_public
[agents:children]
agents_private
agents_public
[common:children]
bootstraps
masters
agents
agents_public
[root@jumpserver dcos-ansible-0.52.0]#
docs.yml配置文件
[root@jumpserver all]# cat dcos.yml
---
dcos:
download: "https://downloads.mesosphere.com/dcos-enterprise/stable/2.0.0/dcos_generate_config.ee.sh" #⚠️這里是企業版的鏈接,如果是社區版的鏈接不一樣
version: "2.0.0"
# image_commit: "acc9fe548aea5b1b5b5858a4b9d2c96e07eeb9de"
enterprise_dcos: true
selinux_mode: permissive
config:
# This is a direct yaml representation of the DC/OS config.yaml
# Please see https://docs.mesosphere.com/1.12/installing/production/advanced-configuration/configuration-reference/
# for parameter reference.
cluster_name: "testenv"
security: permissive
bootstrap_url: http://172.31.47.3:8080 #私網IP
exhibitor_storage_backend: static
master_discovery: static
master_list:
- 172.31.44.60 #私網IP
agent_list:
- 172.31.42.187 #私網IP
public_agent_list:
- 172.31.36.233 #私網IP
license_key_contents: "這里是填寫key的地方"
ip_detect_contents: | #⚠️前面的幾個空格鍵
#!/bin/sh #⚠️前面的幾個空格鍵
#set -o nounset -o errexit
#ip addr show dev eth0 primary | awk '/(inet .*\/)/ { print $2 }' | cut -d'/' -f1
set -o nounset -o errexit #⚠️前面的幾個空格鍵
export PATH=/usr/sbin:/usr/bin:$PATH #⚠️前面的幾個空格鍵
echo $(ip addr show ens5 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) #⚠️注意網卡名稱
執行安裝
[root@jumpserver dcos-ansible-0.52.0]# ls
ansible.cfg dcos.yml Dockerfile group_vars inventory inventory.example Jenkinsfile molecule README.md roles TESTING.MD test_requirements.txt
[root@jumpserver dcos-ansible-0.52.0]# pwd
/root/.ansible/collections/ansible_collections/dcos/dcos_ansible/dcos-ansible-0.52.0
[root@jumpserver dcos-ansible-0.52.0]# ansible-playbook dcos.yml #注意所在的目錄
點擊ENTER繼續。。。
瀏覽器訪問
http://masterIP
企業版默認用戶名密碼為:bootstrapuser/deleteme