1. Introdução
Bom, comecei a brincar com o Chef, estou achando bem interessante, tem um monte de features que quero explorar, principalmente o fluxo de Integração contínua, delivery e pipeline com Chef.
O Chef tem uma ferramenta de administração muito legal, se chama Knife, e é uma mão na roda, toda administração de nodes e cookbooks se faz através do Knife.
Achei interessante a boa quantidade de plugins para aumentar a extensão de funcionalidades do Chef, como por exemplo plugins para a gerencia e criação de instâncias nos maiores provedores de Cloud como Amazon EC2, Azure, Google CE, Rackspace, Digital Ocean, e também plugins para virtualização como Xen e Vmware-vsphere. Também tem plugin para o Docker.
Confesso que estou bastante empolgado com o Chef.
Neste tutorial vou compartilhar algumas coisas que fiz, então vamos instalar o Chef Server, Workstation “ChefDK”, configurar alguns nodes, e a criação de um cookbook/receita.
Para quem não sabe, de forma bem resumida, o Chef é um gerenciador de configurações e automação. Com ele é possível automatizar tarefas repetitivas, como deploys de novos servidores, instalação de pacotes e aplicações, execução de comandos, padronização de arquivos e configurações e orquestração de clientes. Através da orquestração você consegue executar tarefas e comandos em clientes. Os clientes serão referenciados como nodes.
Vamos conhecer alguns componentes do Chef
Chef Server → O Chef Server é core da infraestrutura de gerenciamento e automação, é nele que serão armazenados os cookbooks e receitas, assim como a comunicação e aplicação de receitas nos nodes.
Chef Client → Cada node precisa ter um cliente do Chef instalado; e este vai falar com o Chef Server, procurar por cookbooks e aplicá-los nos nodes.
Workstation → Workstation são os clientes administrativos do Chef Server.
Um Workstation pode ser seu próprio desktop, ou uma vm dedicada apenas para isto. É através do Workstation que criaremos nossos cookbooks e receitas e enviaremos para o Chef Server. Toda interação com o Chef Server será através do Workstation. Diferente de outros gerenciadores de configuração como Puppet e Ansible, da qual você se loga no servidor central (Puppet e Ansible) e faz as configurações diretamente no servidor, no Chef esta interação acontece da seguinte forma: Workstation → Chef Server.
Geralmente é um Workstation por administrador, cada integrante da equipe que vai trabalhar gerenciando o Chef pode ter seu próprio cliente workstation. Sua equipe tem 10 Sysadmins/Devops? Então você terá que ter 10 workstations, a não ser que queira dividir sua máquina com outras pessoas ;).
Nodes → Nodes são os clientes que receberão as configurações e automação. Neste caso são seus servidores, talvez desktops que você queira gerenciar as configurações, sua infra na nuvem, enfim, qualquer equipamento que você queira gerenciar.
Cookbook e Recipes → Cookbook e Receitas são as configurações que serão aplicadas nos nodes. Os cookbooks e receitas serão criadas nas máquinas de Workstation e enviadas para o Chef Server. Uma vez no Chef Server, as receitas serão enviadas e aplicadas nos nodes, sendo assim quando você quiser automatizar algum recurso nos nodes, você vai criar um cookbook com uma receita.
Exemplo: Vou criar um cookbook Pacotes, e dentro deste cookbook Pacotes, eu vou escrever uma receita, por exemplo install-mysql.rb, e dentro desta receita vou criar os passos necessários para instalar o mysql nos nodes.
Sendo assim eu tenho um cookbook chamado “Pacote”, e uma receita de instalação chamada “install-mysql.rb”.
Knife → É o command-line “CLI” tool do Chef, é com ele que você vai interagir com o Chef Server.
2. Pré-requisitos e infraestrutura
Dê uma olhada neste link para saber o quanto de memória, CPU, disco e etc para sua infraestrutura.
https://docs.chef.io/chef_system_requirements.html
Sistema Operacional:
Ubuntu 14.04 x86_64 – instalação mínima.
Versões utilizadas neste tutorial:
Chef server – 12.6.0-1
Chef DK – 0.14.25-1
Chef client – 12.10.24-1
Hostname
Todos os nodes precisam estar configurados com o correto FQDN.
# cat /etc/hosts | grep chef 10.0.2.40 chef-server-01.devopslab.com.br chef-server-01 # cat /etc/hostname chef-server-01 # hostname chef-server-01 # hostname -d devopslab.com.br # hostname -f chef-server-01.devopslab.com.br
Hosts
Chef Server
chef-server-01.devopslab.com.br
Chef Workstation
chef-workstation-01.devopslab.com.br
Chef nodes
chef-client-01.devopslab.com.br
chef-client-02.devopslab.com.br
chef-client-03.devopslab.com.br
3. Preparação do ambiente – Instalação do repositório apt
Os repositórios serão instalados tanto no chef-server como no chef workstation.
Ative o apt-get para poder buscar pacotes em urls https.
# apt-get install apt-transport-https
Adicione a Chave pública do Chef.
# wget -qO - https://downloads.chef.io/packages-chef-io-public.key | sudo apt-key add -
Crie um repositório Apt.
#cd /etc/apt/sources.list.d/ # echo "deb https://packages.chef.io/<CHANNEL>-apt <DISTRIBUTION> main" > chef-<CHANNEL>.list
Onde:
Substitua o CHANNEL por stable.
E DISTRIBUTION pelo o nome da sua distribuição Debian/Ubuntu.
Debian 6: squeeze
Debian 7: wheezy
For Debian 8: jessie
For Ubuntu 10.04: lucid
For Ubuntu 12.04: precise
For Ubuntu 14.04: trusty
# echo "deb https://packages.chef.io/stable-apt trusty main" > chef-stable.list # cat chef-stable.list deb https://packages.chef.io/stable-apt trusty main
Atualize o cache do apt-get.
# apt-get update
4. Chef Server – Instalação do Servidor Chef – Chef Server
Antes da instalação verifique o hostname.
# hostname -f chef-server-01.devopslab.com.br # hostname chef-server-01
Para prosseguir você precisa ter os repositórios instalados, coisa que já foi feito em um passo anterior.
# apt-get update # apt-get install chef-server-core
Instalação de todos os serviços do Chef.
# chef-server-ctl reconfigure
Vai demorar alguns minutos, pois serão instalados vários componentes, como PostgreSQL, Redis, Nginx, RabbitMQ, Solr e Chef Server. O resultado será algo parecido como este:
Recipe: private-chef::partybus * execute[set initial migration level] action run - execute cd /opt/opscode/embedded/service/partybus && ./bin/partybus init * ruby_block[migration-level file sanity check] action run (skipped due to not_if) Recipe: private-chef::opscode-chef-mover * execute[restart_opscode-chef-mover_log_service] action run - execute /opt/opscode/embedded/bin/sv restart /opt/opscode/sv/opscode-chef-mover/log Recipe: private-chef::redis_lb * execute[restart_redis_lb_log_service] action run - execute /opt/opscode/embedded/bin/sv restart /opt/opscode/sv/redis_lb/log Recipe: private-chef::nginx * execute[restart_nginx_log_service] action run - execute /opt/opscode/embedded/bin/sv restart /opt/opscode/sv/nginx/log Running handlers: Running handlers complete Deprecated features used! An attempt was made to change sysvinit_id from "SV" to nil by calling sysvinit_id(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. at 1 location: - /var/opt/opscode/local-mode-cache/cookbooks/enterprise/recipes/runit.rb:31:in `block in from_file' Chef Client finished, 394/461 resources updated in 05 minutes 47 seconds Chef Server Reconfigured!
4.1. Criação de um usuário administrativo do Chef e uma organização
Você pode criar quantos usuários forem necessários. Este usuário será utilizado no chef workstation que vamos configurar depois deste passo.
Organização geralmente é um por empresa, mas nada te impede de criar mais.
Usuário
Sintaxe:
chef-server-ctl user-create NOME_USUARIO PRIMEIRO_NOME ULTIMO_NOME EMAIL ‘SENHA’ –filename USUARIO_CHAVE
# mkdir /root/.chef # chef-server-ctl user-create adminleonardo Leonardo Admin leonardo@devopslab.com.br 'senha12345' --filename /root/.chef/adminleonardo.pem
Organização
Sintaxe:
chef-server-ctl org-create short_name ‘full_organization_name’ –association_user user_name –filename ORGANIZACAO-CHAVE.pem
# chef-server-ctl org-create devopslab 'DevOpsLab Technology ltda.' --association_user adminleonardo --filename /root/.chef/orgdevopslab.pem
Verificando o status do Chef Server.
root@chef-server-01:/# chef-server-ctl status run: bookshelf: (pid 866) 1475s; run: log: (pid 842) 1475s run: nginx: (pid 864) 1475s; run: log: (pid 840) 1475s run: oc_bifrost: (pid 877) 1475s; run: log: (pid 876) 1475s run: oc_id: (pid 862) 1475s; run: log: (pid 835) 1475s run: opscode-erchef: (pid 863) 1475s; run: log: (pid 836) 1475s run: opscode-expander: (pid 871) 1475s; run: log: (pid 868) 1475s run: opscode-solr4: (pid 865) 1475s; run: log: (pid 843) 1475s run: postgresql: (pid 872) 1475s; run: log: (pid 833) 1475s run: rabbitmq: (pid 875) 1475s; run: log: (pid 869) 1475s run: redis_lb: (pid 870) 1475s; run: log: (pid 839) 1475s
Sucesso!!!.
5. Chef Workstation – Instalação Chef Workstation
Instale o repositório do Chef.
O Workstation provavelmente será o seu próprio Desktop ou uma máquina virtual pequena, fica a seu critério.
Eu vou utilizar uma VM em Virtualbox só para ser meu chef workstation.
Instalação do Chef Development Kit.
# apt-get install chefdk
Verificação de todos os componentes instalados.
root@chef-workstation-01:~# chef verify Running verification for component 'berkshelf' Running verification for component 'test-kitchen' Running verification for component 'tk-policyfile-provisioner' Running verification for component 'chef-client' Running verification for component 'chef-dk' Running verification for component 'chef-provisioning' Running verification for component 'chefspec' Running verification for component 'generated-cookbooks-pass-chefspec' Running verification for component 'rubocop' Running verification for component 'fauxhai' Running verification for component 'knife-spork' Running verification for component 'kitchen-vagrant' Running verification for component 'package installation' Running verification for component 'openssl' Running verification for component 'inspec' Running verification for component 'delivery-cli' Running verification for component 'git' Running verification for component 'opscode-pushy-client' Running verification for component 'chef-sugar' Running verification for component 'knife-supermarket' ................................................................................. Verification of component 'fauxhai' succeeded. Verification of component 'kitchen-vagrant' succeeded. Verification of component 'openssl' succeeded. Verification of component 'delivery-cli' succeeded. Verification of component 'inspec' succeeded. Verification of component 'knife-supermarket' succeeded. Verification of component 'berkshelf' succeeded. Verification of component 'git' succeeded. Verification of component 'opscode-pushy-client' succeeded. Verification of component 'test-kitchen' succeeded. Verification of component 'knife-spork' succeeded. Verification of component 'chef-sugar' succeeded. Verification of component 'tk-policyfile-provisioner' succeeded. Verification of component 'chefspec' succeeded. Verification of component 'generated-cookbooks-pass-chefspec' succeeded. Verification of component 'rubocop' succeeded. Verification of component 'package installation' succeeded. Verification of component 'chef-client' succeeded. Verification of component 'chef-dk' succeeded. Verification of component 'chef-provisioning' succeeded.
Criação de um repositório para o Chef
Crie um repositório Chef, que será seu diretório de trabalho, pois serão armazenados todas as suas receitas do Chef (cookbooks).
# chef generate repo chef-repo
Configuração do Knife
Knife é uma ferramenta que faz uma interface entre o seu repositório local “chef-repo” e o Chef Server.
Quando você cria uma nova receita “cookbook”, você vai utilizar o Knife para jogar a configuração para o Chef Server.
Crie o diretório .chef.
# mkdir -p ~/chef-repo/.chef
Copie as 2 chaves que foi criada na instalação do Chef Server para a pasta .chef.
Lembra desta 2 chaves? Uma chave foi criada para a organização e uma para o usuário admin do Chef.
Chaves:
Admin: adminleonardo.pem
Organization: orgdevopslab.pem
root@chef-workstation-01:~# scp root@chef-server-01:/root/.chef/*.pem /root/chef-repo/.chef/ root@chef-server-01's password: adminleonardo.pem 100% 1678 1.6KB/s 00:00 orgdevopslab.pem 100% 1674 1.6KB/s 00:00 root@chef-workstation-01:~# ls /root/chef-repo/.chef adminleonardo.pem orgdevopslab.pem
Criação do arquivo knife.rb.
# cd /root/chef-repo/.chef
# knife configure
# knife configure WARNING: No knife configuration file found Where should I put the config file? [/root/.chef/knife.rb] /root/chef-repo/.chef/knife.rb Please enter the chef server URL: [https://chef-workstation-01:443] https://chef-server-01/organizations/devopslab Please enter an existing username or clientname for the API: [leonardo] adminleonardo Please enter the validation clientname: [chef-validator] devopslab-validator Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] /root/chef-repo/.chef/orgdevopslab.pem Please enter the path to a chef repository (or leave blank): /root/chef-repo ***** You must place your client key in: /root/chef-repo/.chef/adminleonardo.pem Before running commands with Knife ***** You must place your validation key in: /root/chef-repo/.chef/orgdevopslab.pem Before generating instance data with Knife ***** Configuration file written to /root/chef-repo/.chef/knife.rb
Vou explicar cada linha.
1.
Where should I put the config file? [/root/.chef/knife.rb] /root/chef-repo/.chef/knife.rb
Aqui é a localização do arquivo knife.rb.
2.
Please enter the chef server URL: [https://chef-workstation-01:443] https://chef-server-01/organizations/devopslab
Url do Chef Server + organização. Para verificar esta url, faça o login no Chef Server e rode o comando:
chef-server-ctl org-show
# chef-server-ctl org-show
devopslab: https://127.0.0.1/organizations/devopslab
Substitua o 127.0.0.1 pelo nome fqdn no seu servidor Chef.
3.
Please enter an existing username or clientname for the API: [leonardo] adminleonardo
Aqui você coloca o usuário criado na instalação do Chef Server, no meu caso é o usuário “adminleonardo”. Substitua pelo usuário que você definiu na instalação.
4.
Please enter the validation clientname: [chef-validator] devopslab-validator
Aqui é um nome para identificar o Chef Server, definido ao seu critério. Eu sugiro algo como
ORGNIZATION-NAME-validator.
5.
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] /root/chef-repo/.chef/orgdevopslab.pem
Nesta linha é definido o caminho da chave criada para a organização. Esta chave foi criada na instalação do Chef Server, e no meu caso é a chave: “orgdevopslab.pem”.
6.
Please enter the path to a chef repository (or leave blank): /root/chef-repo
Simplesmente Informe a localização do seu repositório; que foi criado logo acima em “chef generate repo chef-repo”.
knife.rb completo.
# cat knife.rb log_level :info log_location STDOUT node_name 'adminleonardo' client_key '/root/chef-repo/.chef/adminleonardo.pem' validation_client_name 'devopslab-validator' validation_key '/root/chef-repo/.chef/orgdevopslab.pem' chef_server_url 'https://chef-server-01/organizations/devopslab' syntax_check_cache_path '/root/chef-repo/.chef/syntax_check_cache' cookbook_path [ '/root/chef-repo/cookbooks' ]
Importando o certificado SSL do Chef Server.
Você precisa estabelecer uma relação de confiança com o Chef Server importando o certificado SSL do mesmo.
# knife ssl fetch
root@chef-workstation-01:~/chef-repo# cd /root/chef-repo root@chef-workstation-01:~/chef-repo# knife ssl fetch WARNING: Certificates from chef-server-01 will be fetched and placed in your trusted_cert directory (/root/chef-repo/.chef/trusted_certs). Knife has no means to verify these are the correct certificates. You should verify the authenticity of these certificates after downloading. Adding certificate for chef-server-01 in /root/chef-repo/.chef/trusted_certs/chef-server-01.crt
Validação
Para validar a comunicação com o Chef Server execute o comando “knife client list”.
root@chef-workstation-01:~/chef-repo# knife client list devopslab-validator
5.1. Ruby
Ao instalar o ChefDK, será instalado um versão do Ruby, no entando este Ruby não estará no PATH dos usuários, ou seja você não vai conseguir utilizar.
Sendo assim, configure a variável $PATH da Workstation de forma que o Ruby possa ser encontrado. Então logue na Workstation, com o usuário que vai administar o chef (knife e etc) e execute:
# echo ‘eval “$(chef shell-init bash)”‘ >> ~/.bash_profile
# source ~/.bash_profile
Para verificar se esta tudo ok faça:
# which ruby
/opt/chefdk/embedded/bin/ruby
O Ruby está mapeado no PATH.
5.2. Definindo um Editor
Ao editar cookbooks, recieitas, e outras configurações do Chef, será necessário ter um editor de texto definido.
Aí você escolhe o que você preferir, eu gosto do Vim.
# export EDITOR=’vim’
Ser for um nano
# export EDITOR=’nano’
6. Chef-client bootstrap – Instalação do cliente chef via bootstrap
Nossos clientes, ou seja todos os servidores, desktops, e qualquer máquina que será gerenciada pelo Chef-server será tratada como Nodes.
Chef-client é o agente que será instalado nos Nodes para fazer a comunicação com o Chef-Server. Todos os Nodes precisam ter um Chef-client instalado.
Vamos fazer uma instalação do Chef-client remotamente, via Bootstrap, ou seja, o próprio Chef vai fazer a instalação dos clientes nos Nodes.
A ferramenta que vai disparar o bootstrap é o Knife, que acabamos de configurar.
O Knife utiliza o SSH para fazer a instalação do Chef-client nos Nodes.
Você precisa ter um usuário com permissões de sudo.
Pode ser usado tanto SSH com senha ou SSH com chave de identificação para fazer a autenticação nos Nodes, tudo depende de como você utiliza o SSH na sua infraestrutura.
6.1. Instalação do Chef-client em um Ubuntu-Server-14.04 – Bootstrap chef client em Ubuntu 14
Vamos fazer a instalação do Chef-client no Ubuntu-Server-14.04 utilizando um usuário e senha com permissões de sudo.
Comando:
#knife bootstrap 192.168.0.21 -x username -P password –sudo
#knife bootstrap chef-client-02.devopslab.com.br -x meu_usuario -P minha_senha –sudo
# root@chef-workstation-01:~# cd chef-repo/
root@chef-workstation-01:~/chef-repo# knife bootstrap chef-client-02.devopslab.com.br -x meu_usuario -P minha_senha --sudo Doing old-style registration with the validation key at /root/chef-repo/.chef/orgdevopslab.pem... Delete your validation key in order to use your user credentials instead Connecting to chef-client-02.devopslab.com.br chef-client-02.devopslab.com.br -----> Installing Chef Omnibus (-v 12) chef-client-02.devopslab.com.br downloading https://omnitruck-direct.chef.io/chef/install.sh chef-client-02.devopslab.com.br to file /tmp/install.sh.1081/install.sh chef-client-02.devopslab.com.br trying curl... chef-client-02.devopslab.com.br ubuntu 14.04 x86_64 chef-client-02.devopslab.com.br Getting information for chef stable 12 for ubuntu... chef-client-02.devopslab.com.br downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12&p=ubuntu&pv=14.04&m=x86_64 chef-client-02.devopslab.com.br to file /tmp/install.sh.1086/metadata.txt chef-client-02.devopslab.com.br trying curl... chef-client-02.devopslab.com.br sha1 7d30b300f95f00036919ee8bf3b95ab73429e57e chef-client-02.devopslab.com.br sha256 663d6c42c90bbb9463bc02a7c5d777f7aa6ebd52c071a0c1963bc8c4db76dea2 chef-client-02.devopslab.com.br url https://packages.chef.io/stable/ubuntu/14.04/chef_12.10.24-1_amd64.deb chef-client-02.devopslab.com.br version 12.10.24 chef-client-02.devopslab.com.br downloaded metadata file looks valid... chef-client-02.devopslab.com.br downloading https://packages.chef.io/stable/ubuntu/14.04/chef_12.10.24-1_amd64.deb chef-client-02.devopslab.com.br to file /tmp/install.sh.1086/chef_12.10.24-1_amd64.deb chef-client-02.devopslab.com.br trying curl... chef-client-02.devopslab.com.br Comparing checksum with sha256sum... chef-client-02.devopslab.com.br Installing chef 12 chef-client-02.devopslab.com.br installing with dpkg... chef-client-02.devopslab.com.br Selecting previously unselected package chef. (Reading database ... 57726 files and directories currently installed.) chef-client-02.devopslab.com.br Preparing to unpack .../chef_12.10.24-1_amd64.deb ... chef-client-02.devopslab.com.br Unpacking chef (12.10.24-1) ... chef-client-02.devopslab.com.br Setting up chef (12.10.24-1) ... chef-client-02.devopslab.com.br Thank you for installing Chef! chef-client-02.devopslab.com.br Starting the first Chef Client run... chef-client-02.devopslab.com.br Starting Chef Client, version 12.10.24 chef-client-02.devopslab.com.br Creating a new client identity for chef-client-02.devopslab.com.br using the validator key. chef-client-02.devopslab.com.br resolving cookbooks for run list: [] chef-client-02.devopslab.com.br Synchronizing Cookbooks: chef-client-02.devopslab.com.br Installing Cookbook Gems: chef-client-02.devopslab.com.br Compiling Cookbooks... chef-client-02.devopslab.com.br [2016-05-29T09:31:46-03:00] WARN: Node chef-client-02.devopslab.com.br has an empty run list. chef-client-02.devopslab.com.br Converging 0 resources chef-client-02.devopslab.com.br chef-client-02.devopslab.com.br Running handlers: chef-client-02.devopslab.com.br Running handlers complete chef-client-02.devopslab.com.br Chef Client finished, 0/0 resources updated in 03 seconds
Validando:
knife node list
knife client list
root@chef-workstation-01:~/chef-repo# knife node list chef-client-02.devopslab.com.br root@chef-workstation-01:~/chef-repo# knife client list chef-client-02.devopslab.com.br devopslab-validator root@chef-workstation-01:~/chef-repo#
Veja que o Chef detecta automaticamente qual Sistema operacional está sendo utilizado.
chef-client-02.devopslab.com.br ubuntu 14.04 x86_64 chef-client-02.devopslab.com.br Getting information for chef stable 12 for ubuntu... chef-client-02.devopslab.com.br downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12&p=ubuntu&pv=14.04&m=x86_64
6.2. Instalação do Chef-client em um Centos 7 x86_64 – Bootstrap chef client em Centos 7
Vamos fazer a instalação do Chef-client no Centos 7 utilizando um usuário e senha com permissões de sudo.
# root@chef-workstation-01:~# cd chef-repo/
# knife bootstrap chef-client-03.devopslab.com.br -x meu_usuario -P minha_senha –sudo
root@chef-workstation-01:~/chef-repo# knife bootstrap chef-client-03.devopslab.com.br -x meu_usuario -P minha_senha --sudo Doing old-style registration with the validation key at /root/chef-repo/.chef/orgdevopslab.pem... Delete your validation key in order to use your user credentials instead Connecting to chef-client-03.devopslab.com.br chef-client-03.devopslab.com.br -----> Installing Chef Omnibus (-v 12) chef-client-03.devopslab.com.br downloading https://omnitruck-direct.chef.io/chef/install.sh chef-client-03.devopslab.com.br to file /tmp/install.sh.3048/install.sh chef-client-03.devopslab.com.br trying wget... chef-client-03.devopslab.com.br el 7 x86_64 chef-client-03.devopslab.com.br Getting information for chef stable 12 for el... chef-client-03.devopslab.com.br downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12&p=el&pv=7&m=x86_64 chef-client-03.devopslab.com.br to file /tmp/install.sh.3053/metadata.txt chef-client-03.devopslab.com.br trying wget... chef-client-03.devopslab.com.br sha1 4def83368a1349959fdaf0633c4d288d5ae229ce chef-client-03.devopslab.com.br sha256 6f00c7bdf96a3fb09494e51cd44f4c2e5696accd356fc6dc1175d49ad06fa39f chef-client-03.devopslab.com.br url https://packages.chef.io/stable/el/7/chef-12.10.24-1.el7.x86_64.rpm chef-client-03.devopslab.com.br version 12.10.24 chef-client-03.devopslab.com.br downloaded metadata file looks valid... chef-client-03.devopslab.com.br downloading https://packages.chef.io/stable/el/7/chef-12.10.24-1.el7.x86_64.rpm chef-client-03.devopslab.com.br to file /tmp/install.sh.3053/chef-12.10.24-1.el7.x86_64.rpm chef-client-03.devopslab.com.br trying wget... chef-client-03.devopslab.com.br Comparing checksum with sha256sum... chef-client-03.devopslab.com.br Installing chef 12 chef-client-03.devopslab.com.br installing with rpm... chef-client-03.devopslab.com.br warning: /tmp/install.sh.3053/chef-12.10.24-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY chef-client-03.devopslab.com.br Preparing... ################################# [100%] chef-client-03.devopslab.com.br Updating / installing... chef-client-03.devopslab.com.br 1:chef-12.10.24-1.el7 ################################# [100%] chef-client-03.devopslab.com.br Thank you for installing Chef! chef-client-03.devopslab.com.br Starting the first Chef Client run... chef-client-03.devopslab.com.br Starting Chef Client, version 12.10.24 chef-client-03.devopslab.com.br Creating a new client identity for chef-client-03.devopslab.com.br using the validator key. chef-client-03.devopslab.com.br resolving cookbooks for run list: [] chef-client-03.devopslab.com.br Synchronizing Cookbooks: chef-client-03.devopslab.com.br Installing Cookbook Gems: chef-client-03.devopslab.com.br Compiling Cookbooks... chef-client-03.devopslab.com.br [2016-05-29T10:37:20-03:00] WARN: Node chef-client-03.devopslab.com.br has an empty run list. chef-client-03.devopslab.com.br Converging 0 resources chef-client-03.devopslab.com.br chef-client-03.devopslab.com.br Running handlers: chef-client-03.devopslab.com.br Running handlers complete chef-client-03.devopslab.com.br Chef Client finished, 0/0 resources updated in 03 seconds
Versão do Sistema Operacional detectada.
chef-client-03.devopslab.com.br el 7 x86_64 chef-client-03.devopslab.com.br Getting information for chef stable 12 for el... chef-client-03.devopslab.com.br downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12&p=el&pv=7&m=x86_64
Verificando.
root@chef-workstation-01:~/chef-repo# knife node list chef-client-02.devopslab.com.br chef-client-03.devopslab.com.br
6.3. Instalação do Chef-client em um S.O AmazonAMI – Bootstrap chef client em AmazonAMI
Vou fazer uma instalação na Amazon, em uma instância do tipo AmazonAMI utilizando chaves de autenticação.
A instalação vai falhar pois eu preciso criar uma VPN entre a minha rede interna e a Amazon, para que a instância AmazonAMI se comunique com meu Chef-server.
Porém segue apenas uma demonstração de como seria a instalação na Amazon. Tudo funciona, menos a comunicação com meu Chef-server devido uma falta de VPN, mas se você já tiver a comunicação entre o Chef-Server e a rede da Amazon é um abraço meu amigo =)
A VPN não vou criar agora. Mas quando for fazer, como é minha rede interna, de casa, vou utilizar o OpenVPN mesmo.
Então segue uma demonstração de instalação do Chef-client na Amazon.
A única coisa que muda em relação as instalações anteriores é que ao invés de um usuário e senha, será passado a chave de autenticação na Amazon.
# knife bootstrap ec2-52-67-1-43.sa-east-1.compute.amazonaws.com -x ec2-user -i /root/AMAZON/amazonkey/AMAZON-KEY.pem –sudo
root@chef-workstation-01:~/chef-repo# knife bootstrap ec2-52-67-1-43.sa-east-1.compute.amazonaws.com -x ec2-user -i /root/AMAZON/amazonkey/AMAZON-KEY.pem --sudo Doing old-style registration with the validation key at /root/chef-repo/.chef/orgdevopslab.pem... Delete your validation key in order to use your user credentials instead Connecting to ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ec2-52-67-1-43.sa-east-1.compute.amazonaws.com -----> Installing Chef Omnibus (-v 12) ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloading https://omnitruck-direct.chef.io/chef/install.sh ec2-52-67-1-43.sa-east-1.compute.amazonaws.com to file /tmp/install.sh.2672/install.sh ec2-52-67-1-43.sa-east-1.compute.amazonaws.com trying wget... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com el 6 x86_64 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Getting information for chef stable 12 for el... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12&p=el&pv=6&m=x86_64 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com to file /tmp/install.sh.2687/metadata.txt ec2-52-67-1-43.sa-east-1.compute.amazonaws.com trying wget... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sha1 faec4e0bc2cc236170b400426cd3b51b5657fe90 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sha256 445b64e38827d8c787267bda57d2cd6be797b6f6f70eb34ec846eceee8f6fae9 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com url https://packages.chef.io/stable/el/6/chef-12.10.24-1.el6.x86_64.rpm ec2-52-67-1-43.sa-east-1.compute.amazonaws.com version 12.10.24 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloaded metadata file looks valid... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloading https://packages.chef.io/stable/el/6/chef-12.10.24-1.el6.x86_64.rpm ec2-52-67-1-43.sa-east-1.compute.amazonaws.com to file /tmp/install.sh.2687/chef-12.10.24-1.el6.x86_64.rpm ec2-52-67-1-43.sa-east-1.compute.amazonaws.com trying wget... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Comparing checksum with sha256sum... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Installing chef 12 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com installing with rpm... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com warning: /tmp/install.sh.2687/chef-12.10.24-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY ec2-52-67-1-43.sa-east-1.compute.amazonaws.com error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied) ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Installation failed ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Version: 12 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Please file a Bug Report at https://github.com/chef/omnitruck/issues/new ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Alternatively, feel free to open a Support Ticket at https://www.chef.io/support/tickets ec2-52-67-1-43.sa-east-1.compute.amazonaws.com More Chef support resources can be found at https://www.chef.io/support ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Please include as many details about the problem as possible i.e., how to reproduce ec2-52-67-1-43.sa-east-1.compute.amazonaws.com the problem (if possible), type of the Operating System and its version, etc., ec2-52-67-1-43.sa-east-1.compute.amazonaws.com and any other relevant details that might help us with troubleshooting. ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ec2-52-67-1-43.sa-east-1.compute.amazonaws.com mkdir: cannot create directory ‘/etc/chef’: Permission denied ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sh: line 179: /etc/chef/validation.pem: No such file or directory ec2-52-67-1-43.sa-east-1.compute.amazonaws.com chmod: cannot access ‘/etc/chef/validation.pem’: No such file or directory ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sh: line 210: /etc/chef/encrypted_data_bag_secret: No such file or directory ec2-52-67-1-43.sa-east-1.compute.amazonaws.com chmod: cannot access ‘/etc/chef/encrypted_data_bag_secret’: No such file or directory ec2-52-67-1-43.sa-east-1.compute.amazonaws.com mkdir: cannot create directory ‘/etc/chef’: Permission denied ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sh: line 216: /etc/chef/trusted_certs/chef-server-01.crt: No such file or directory ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sh: line 245: /etc/chef/client.rb: No such file or directory ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sh: line 255: /etc/chef/first-boot.json: No such file or directory ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Starting the first Chef Client run... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sh: line 262: chef-client: command not found root@chef-workstation-01:~/chef-repo# knife bootstrap ec2-52-67-1-43.sa-east-1.compute.amazonaws.com -x ec2-user -i /root/AMAZON/amazonkey/AMAZON-KEY.pem --sudo Doing old-style registration with the validation key at /root/chef-repo/.chef/orgdevopslab.pem... Delete your validation key in order to use your user credentials instead Connecting to ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ec2-52-67-1-43.sa-east-1.compute.amazonaws.com -----> Installing Chef Omnibus (-v 12) ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloading https://omnitruck-direct.chef.io/chef/install.sh ec2-52-67-1-43.sa-east-1.compute.amazonaws.com to file /tmp/install.sh.2751/install.sh ec2-52-67-1-43.sa-east-1.compute.amazonaws.com trying wget... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com el 6 x86_64 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Getting information for chef stable 12 for el... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12&p=el&pv=6&m=x86_64 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com to file /tmp/install.sh.2756/metadata.txt ec2-52-67-1-43.sa-east-1.compute.amazonaws.com trying wget... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sha1 faec4e0bc2cc236170b400426cd3b51b5657fe90 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com sha256 445b64e38827d8c787267bda57d2cd6be797b6f6f70eb34ec846eceee8f6fae9 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com url https://packages.chef.io/stable/el/6/chef-12.10.24-1.el6.x86_64.rpm ec2-52-67-1-43.sa-east-1.compute.amazonaws.com version 12.10.24 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloaded metadata file looks valid... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com downloading https://packages.chef.io/stable/el/6/chef-12.10.24-1.el6.x86_64.rpm ec2-52-67-1-43.sa-east-1.compute.amazonaws.com to file /tmp/install.sh.2756/chef-12.10.24-1.el6.x86_64.rpm ec2-52-67-1-43.sa-east-1.compute.amazonaws.com trying wget... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Comparing checksum with sha256sum... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Installing chef 12 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com installing with rpm... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com warning: /tmp/install.sh.2756/chef-12.10.24-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Preparing... ################################# [100%] ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Updating / installing... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com 1:chef-12.10.24-1.el6 ################################# [100%] ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Thank you for installing Chef! ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Starting the first Chef Client run... ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Starting Chef Client, version 12.10.24 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Creating a new client identity for chefnode-amazonami-01 using the validator key. ec2-52-67-1-43.sa-east-1.compute.amazonaws.com [2016-05-29T13:58:02+00:00] ERROR: Error connecting to https://chef-server-01/organizations/devopslab/clients, retry 1/5 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com [2016-05-29T13:58:07+00:00] ERROR: Error connecting to https://chef-server-01/organizations/devopslab/clients, retry 2/5 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com [2016-05-29T13:58:12+00:00] ERROR: Error connecting to https://chef-server-01/organizations/devopslab/clients, retry 3/5 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com [2016-05-29T13:58:17+00:00] ERROR: Error connecting to https://chef-server-01/organizations/devopslab/clients, retry 4/5 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com [2016-05-29T13:58:22+00:00] ERROR: Error connecting to https://chef-server-01/organizations/devopslab/clients, retry 5/5 ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ================================================================================ ec2-52-67-1-43.sa-east-1.compute.amazonaws.com Chef encountered an error attempting to create the client "chefnode-amazonami-01" ec2-52-67-1-43.sa-east-1.compute.amazonaws.com ================================================================================
6.4. Instalação do Chef-client em um Ubuntu-Server-14.04 – Bootstrap chef client no Ubuntu 14 com Chef + SSH Keys
Vamos fazer a instalação do Chef-client no Ubuntu-Server-14.04 utilizando chave de autenticação SSH.
root@chef-workstation-01:~/chef-repo# knife bootstrap chef-client-01.devopslab.com.br -x leonardo -i ~/.ssh/id_rsa --sudo Doing old-style registration with the validation key at /root/chef-repo/.chef/orgdevopslab.pem... Delete your validation key in order to use your user credentials instead Connecting to chef-client-01.devopslab.com.br chef-client-01.devopslab.com.br -----> Installing Chef Omnibus (-v 12) chef-client-01.devopslab.com.br downloading https://omnitruck-direct.chef.io/chef/install.sh chef-client-01.devopslab.com.br to file /tmp/install.sh.1086/install.sh chef-client-01.devopslab.com.br trying wget... chef-client-01.devopslab.com.br ubuntu 14.04 x86_64 chef-client-01.devopslab.com.br Getting information for chef stable 12 for ubuntu... chef-client-01.devopslab.com.br downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12&p=ubuntu&pv=14.04&m=x86_64 chef-client-01.devopslab.com.br to file /tmp/install.sh.1090/metadata.txt chef-client-01.devopslab.com.br trying wget... chef-client-01.devopslab.com.br sha1 7d30b300f95f00036919ee8bf3b95ab73429e57e chef-client-01.devopslab.com.br sha256 663d6c42c90bbb9463bc02a7c5d777f7aa6ebd52c071a0c1963bc8c4db76dea2 chef-client-01.devopslab.com.br url https://packages.chef.io/stable/ubuntu/14.04/chef_12.10.24-1_amd64.deb chef-client-01.devopslab.com.br version 12.10.24 chef-client-01.devopslab.com.br downloaded metadata file looks valid... chef-client-01.devopslab.com.br downloading https://packages.chef.io/stable/ubuntu/14.04/chef_12.10.24-1_amd64.deb chef-client-01.devopslab.com.br to file /tmp/install.sh.1090/chef_12.10.24-1_amd64.deb chef-client-01.devopslab.com.br trying wget... chef-client-01.devopslab.com.br Comparing checksum with sha256sum... chef-client-01.devopslab.com.br Installing chef 12 chef-client-01.devopslab.com.br installing with dpkg... chef-client-01.devopslab.com.br Selecting previously unselected package chef. (Reading database ... 57754 files and directories currently installed.) chef-client-01.devopslab.com.br Preparing to unpack .../chef_12.10.24-1_amd64.deb ... chef-client-01.devopslab.com.br Unpacking chef (12.10.24-1) ... chef-client-01.devopslab.com.br Setting up chef (12.10.24-1) ... chef-client-01.devopslab.com.br Thank you for installing Chef! chef-client-01.devopslab.com.br Starting the first Chef Client run... chef-client-01.devopslab.com.br Starting Chef Client, version 12.10.24 chef-client-01.devopslab.com.br Creating a new client identity for chef-client-01.devopslab.com.br using the validator key. chef-client-01.devopslab.com.br resolving cookbooks for run list: [] chef-client-01.devopslab.com.br Synchronizing Cookbooks: chef-client-01.devopslab.com.br Installing Cookbook Gems: chef-client-01.devopslab.com.br Compiling Cookbooks... chef-client-01.devopslab.com.br [2016-05-29T11:41:45-03:00] WARN: Node chef-client-01.devopslab.com.br has an empty run list. chef-client-01.devopslab.com.br Converging 0 resources chef-client-01.devopslab.com.br chef-client-01.devopslab.com.br Running handlers: chef-client-01.devopslab.com.br Running handlers complete chef-client-01.devopslab.com.br Chef Client finished, 0/0 resources updated in 03 seconds
Validação:
root@chef-workstation-01:~/chef-repo# knife node list chef-client-01.devopslab.com.br chef-client-02.devopslab.com.br chef-client-03.devopslab.com.br root@chef-workstation-01:~/chef-repo# knife client list chef-client-01.devopslab.com.br chef-client-02.devopslab.com.br chef-client-03.devopslab.com.br devopslab-validator
7. Primeiro Cookbook Chef
Agora que você já preparou sua cozinha, chegou a hora de cozinhar, então vamos fazer nossa primeira receita.
Seguinte!!! Vamos fazer um Nhoque com molho bolonhesa. Molho de tomate caseiro, a moda Italiana, vamos amassar o tomate.
Brincadeira… mas você já reparou que no Chef tudo é cozinha, receitas e utensílios, que coisa louca rsrsrs.
Vamos criar um cookbook para instalar um pacote qualquer. Vamos instalar aqui o pacote telnet.
Criação do Cookbook.
# knife cookbook create telnet
~/chef-repo# knife cookbook create telnet ** Creating cookbook telnet in /root/chef-repo/cookbooks ** Creating README for cookbook: telnet ** Creating CHANGELOG for cookbook: telnet ** Creating metadata for cookbook: telnet
O Cookbook fica armazenado dentro da pasta ~/chef-repo/cookbooks
#cd ~/chef-repo/cookbooks/telnet # ls attributes CHANGELOG.md definitions files libraries metadata.rb providers README.md recipes resources templates
Veja que dentro da pasta telnet foi criado toda uma estrutura de diretórios. Por hora vamos direto para a pasta “recipes”, que é onde vamos escrever o procedimento de instalação do pacote telnet.
Crie um arquivo .rb com o seguinte conteúdo:
# vi default.rb
package 'telnet' do action :install end
Veja que é bem intuitivo, foi declarado um recurso “package” e uma ação “install”. Fica bem claro que será instado o pacote telnet.
Faça uma verificação nas receitas para procurar por erros.
# knife cookbook test telnet
root@chef-workstation-01:~/chef-repo# knife cookbook test telnet WARNING: DEPRECATED: Please use ChefSpec or Rubocop to syntax-check cookbooks. checking telnet Running syntax check on telnet Validating ruby files Validating templates
Sem erros, apenas um Warning informando para você utilizar o ChefSpec ou Rubocop ao invés do knife test, fica a seu critério qual das ferramentas utilizar para a verificação da sintaxe das suas receitas.
Agora faça o upload do cookbook para o Chef-server.
# knife cookbook upload telnet
root@chef-workstation-01:~/chef-repo# knife cookbook upload telnet Uploading telnet [0.1.0] Uploaded 1 cookbook.
Vamos fazer um link entre os nodes e o cookbook. Basicamente vamos dizer quais cookbooks aplicar para determinados nodes.
# knife node run_list add chef-client-01.devopslab.com.br “recipe[telnet]”
root@chef-workstation-01:~/chef-repo# knife node run_list add chef-client-01.devopslab.com.br "recipe[telnet]" chef-client-01.devopslab.com.br: run_list: recipe[telnet]
“recipe[telnet]” é equivalente a “recipe[telnet::default]”, pois a receita é default.rb.
Se a receita tivesse outro nome, por exemplo pacotes, a sintaxe ficaria assim: “recipe[telnet::pacotes]”.
Verificando quais cookbooks estão associados ao node.
root@chef-workstation-01:~/chef-repo# knife node show chef-client-01.devopslab.com.br Node Name: chef-client-01.devopslab.com.br Environment: _default FQDN: chef-client-01.devopslab.com.br IP: 10.0.2.42 Run List: recipe[telnet] Roles: Recipes: Platform: ubuntu 14.04 Tags:
Faça o login no node e execute o comando chef-client para baixar a receita de instalação do Chef-server.
root@chef-client-01:~# chef-client Starting Chef Client, version 12.10.24 resolving cookbooks for run list: ["telnet"] Synchronizing Cookbooks: - telnet (0.1.0) Installing Cookbook Gems: Compiling Cookbooks... Converging 1 resources Recipe: telnet::default * apt_package[telnet] action install - install version 0.17-36build2 of package telnet Running handlers: Running handlers complete Chef Client finished, 1/1 resources updated in 08 seconds root@chef-client-01:~# root@chef-client-01:~# dpkg -l| grep telnet ii telnet 0.17-36build2 amd64 The telnet client
No comando acima foi executado o chef-client e o comando “dpkg -l”. Veja que o telnet foi instalado conforme o esperado.
Deixa eu testar em um Centos 7 só para ver o comportamento.
Primeiramente associar o cookbook telnet ao node chef-client-03.devopslab.com.br.
root@chef-workstation-01:~/chef-repo# knife node run_list add chef-client-03.devopslab.com.br "recipe[telnet]" chef-client-03.devopslab.com.br: run_list: recipe[telnet] root@chef-workstation-01:~/chef-repo# root@chef-workstation-01:~/chef-repo# knife node show chef-client-03.devopslab.com.br Node Name: chef-client-03.devopslab.com.br Environment: _default FQDN: chef-client-03.devopslab.com.br IP: 10.0.2.44 Run List: recipe[telnet] Roles: Recipes: Platform: centos 7.2.1511 Tags:
Agora vou executar o comando chef-client no node chef-client-03.devopslab.com.br (Centos 7).
[root@chef-client-03 ~]# chef-client Starting Chef Client, version 12.10.24 resolving cookbooks for run list: ["telnet"] Synchronizing Cookbooks: - telnet (0.1.0) Installing Cookbook Gems: Compiling Cookbooks... Converging 1 resources Recipe: telnet::default * yum_package[telnet] action install - install version 0.17-59.el7 of package telnet Running handlers: Running handlers complete Chef Client finished, 1/1 resources updated in 42 seconds [root@chef-client-03 ~]# [root@chef-client-03 ~]# rpm -qa | grep telnet telnet-0.17-59.el7.x86_64
Repare que tanto no Ubuntu como no Centos foi instalado bonitinho o pacote telnet, e o melhor foi que você não se preocupou se foi utilizado apt-get ou yum, rpm ou dpkg, pois o Chef e sua camada de abstração trata isto para você. O seu trabalho é apenas fazer a receita de instalação.
Referência:
https://docs.chef.io/packages.html
https://docs.chef.io/release/server_12-6/install_server.html#standalone
https://docs.chef.io/release/devkit/install_dk.html
https://docs.chef.io/install_bootstrap.html
https://docs.chef.io/knife_bootstrap.html
https://www.linode.com/docs/applications/chef/creating-your-first-chef-cookbook
https://www.linode.com/docs/applications/chef/deploy-a-chef-server-workstation-and-node-on-ubuntu-14-04/
Faça o que é difícil e a vida será mais fácil. Faça o que é fácil e a vida será mais difícil.