"Linux" "Services" "SaaS" Docker+kubernetes (4. Manage machines and software with ansible)

Source: Internet
Author: User
Tags etcd k8s

1. Introduction

1.1. Company environment use Puppet, but I prefer ansible, reason two, first, I am Red Hat loyalty powder:), second, I am more familiar with Python

1.2. Ansible Official website: https://www.ansible.com/

1.3. Ansible Chinese document website: http://www.ansible.com.cn/

2. Environment

2.1. Ansible:ansible-2.4.2.0-1.el7

3. Installation

3.1. Direct Yum is good

Yum Install ansible

4. Configuration

4.1. Generate SSH Key

Ssh-keygen -t RSA

4.2. Remove the list of servers from the DNS server on 10.30.2.81

Cat /var/named/hccos.cn.zone | grep 172| awk ' {print $1,$4} '| sed " s/172/.hccos.cn #172/g "

4.3. Paste the list of machines from the previous step into the/etc/ansible/hosts, and assign them to the default group.

[Default]hctjosinfra01.hccos.cn #172.16.0.81hctjosinfra02.hccos.cn #172.16.0.82hctjosetcd01.hccos.cn #172.16.0.83hctjosetcd02.hccos.cn #172.16.0.84hctjosetcd03.hccos.cn #172.16.0.85hctjcephmon01.hccos.cn #172.16.0.86hctjcephmon02.hccos.cn #172.16.0.87hctjcephmon03.hccos.cn #172.16.0.88hctjcephadm01.hccos.cn #172.16.0.89hctjosk8smaster01.hccos.cn #172.16.0.90hctjosk8sslave01.hccos.cn #172.16.0.91hctjosk8sslave02.hccos.cn #172.16.0.92hctjcephblock01.hccos.cn #172.16.0.93hctjcephblock02.hccos.cn #172.16.0.94hctjosk8snode01.hccos.cn #172.16.0.95hctjosk8snode02.hccos.cn #172.16.0.96hctjosk8snode03.hccos.cn #172.16.0.97hctjosk8snode04.hccos.cn #172.16.0.98hctjosadm01.hccos.cn #172.16.0.99hctjosmysql01.hccos.cn #172.16.0.25hctjosmysql02.hccos.cn #172.16.0.26hctjosmysql03.hccos.cn #172.16.0.27hctjoscache01.hccos.cn #172.16.0.45hctjoscache02.hccos.cn #172.16.0.46hctjoscache03.hccos.cn #172.16.0.47hctjosdr01.hccos.cn #172.16.0.48hctjosdr02.hccos.cn #172.16.0.49

4.4. Password-free login on target host for Ssh-key copy

 for  in $ (grep hctj/etc/ansible/hosts |  grep"#.*"| Cut  Do ssh-copy-ID done

4.5. Under the/etc/ansible, the architecture is set up.

[Email protected] etc]# tree/etc/ansible//etc/ansible/├──ansible.cfg├──hosts├──main.yaml└──roles    ├──   Cache    │└──cache.yaml    ├──ceph    │└──ceph.yaml    ├──default    │├──default.yaml    ├──dr    │ └──dr.yaml    ├──etcd    │└──etcd.yaml    ├──k8s    │└──k8s.yaml    └──mysql        └──mysql.yaml8 files

4.6. Edit Main.yaml

"Linux" "Services" "SaaS" Docker+kubernetes (4. Manage machines and software with ansible)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.