Site icon Learning & Doing

Cara Install Chef Infra pada AlmaLinux / CentOS 8 / Rocky Linux / Redhat 8

chef

“Cara Install Chef Infra pada AlmaLinux / CentOS 8 / Rocky Linux / Redhat 8”

Pengantar

Chef infra adalah salah satu alat Infrastruktur sumber terbuka sebagai Kode (IAC) populer yang digunakan dalam konfigurasi, administrasi, dan penyebaran sumber daya server di seluruh jaringan. CHEF ditulis dalam bahasa Ruby dan Erlang dan didistribusikan di bawah Lisensi Apache 2.0.

Chef architecture

Persiapan

On all the 3 servers

sudo hostnamectl set-hostname chef-server.example.com --static

sudo dnf -y install git vim wget curl bash-completion
sudo dnf -y update
sudo reboot

Setting NTP

sudo dnf install chrony -y
sudo systemctl start chronyd
sudo systemctl enable chronyd

Install Chef Infra

sudo yum -y install wget
wget https://packages.chef.io/files/stable/chef-server/${VER}/el/8/chef-server-core-${VER}-1.el7.x86_64.rpm
dnf localinstall chef-server-core-${VER}-1.el7.x86_64.rpm
sudo chef-server-ctl reconfigure

Setting Firewall

sudo firewall-cmd --permanent --add-service={http,https}
sudo firewall-cmd --reload

Buat Admin User

chef-server-ctl user create USERNAME FIRST_NAME [MIDDLE_NAME] LAST_NAME EMAIL PASSWORD
USERNAME="chefadmin"
FIRST_NAME="Chef"
LAST_NAME="Administrator"
EMAIL="chefadmin@games.com"
PASSWORD="Passw0rd"
KEY_PATH="/root/chefadmin.pem"
sudo chef-server-ctl user-create ${USERNAME} ${FIRST_NAME} ${LAST_NAME} ${EMAIL} ${PASSWORD} -f ${KEY_PATH}
sudo chef-server-ctl user-list
sudo chef-server-ctl org-create techviewleo 'Techviewleo, Inc.' \
--association_user chefadmin \
--filename /root/techviewleo-validator.pem
$ sudo chef-server-ctl org-list
sudo find /root -name "*.pem"
sudo chef-server-ctl install chef-manage 
sudo chef-server-ctl reconfigure 
sudo chef-manage-ctl reconfigure
 https://serverip/login

Install Chef Workstation

wget https://packages.chef.io/files/stable/chef-workstation/${VER}/el/8/chef-workstation-${VER}-1.el8.x86_64.rpm
sudo yum localinstall chef-workstation-${VER}-1.el8.x86_64.rpm
chef --version
knife --version
chef generate repo chef-repo
mkdir ~/chef-repo/.chef
cd chef-repo
ssh-keygen -b 4096
ssh-copy-id root@192.168.205.2
scp root@192.168.205.2:/root/*.pem ~/chef-repo/.chef/
chef generate cookbook chef-first-cookbook

Configure Knife dan Bootstrap a Client Node

Pada Workstation node

nano ~/chef-repo/.chef/config.rb
current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                'chefadmin'
client_key               "chefadmin.pem"
validation_client_name   'techviewleo-validator'
validation_key           "techviewleo-validator.pem"
chef_server_url          'https://chef-server.example.com/organizations/techviewleo'
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            ["#{current_dir}/../cookbooks"]
cd ~/chef-repo
 knife ssl fetch
cd ~/chef-repo/.chef
knife bootstrap 192.168.205.13 -x root -P ***** --node-name chef-client-node
knife node show chef-client-node

Penutup

Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Cara Install Chef Infra pada AlmaLinux / CentOS 8 / Rocky Linux / Redhat 8 . Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.

Exit mobile version