主要是记录一下自己在搭建中过程遇到一些问题
详细步骤参考Chef Documentation
一. 环境准备
virtualbox:7.0
vagrant:2.4.1
我使用的是三台Ubuntu 18.04,注意在Vagrantfile设置三台虚拟机的private_network。
| name | private_work_ip |
|---|---|
| chef-server | 192.168.33.20 |
| chef-workstation | 192.168.33.21 |
| chef-client | 192.168.33.22 |
首次进入要通过vagrant ssh,进入后设置/etc/ssh/sshd_config,之后才能用一般的ssh账户和密码登录。
二. 本地配置
1. Chef Server
按照Chef Infra Server Prerequisites 进行设置,例如:Hostname必须符合FQDN或是一个IP地址。
2. Chef Workstation
- 设置本地vi ~/.chef/credentials时,因为本地没有https的ssl证书,要如下设置
[default]
client_name = 'cw'
client_key = '~/.chef/cw.pem'
chef_server_url = 'https://192.168.33.20/organizations/4thcafe'
ssl_verify_mode = 'verify_none'
- 配置chef client时只需一行
knife bootstrap 192.168.33.21 --sudo -x vagrant -P vagrant -N node2 --node-ssl-verify-mode none
3. Chef client
除了ssh外不需单独额外设置