环境准备
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