![]() If you wish to increase or decrease the limit, simply adjust the highlighted parameters in the Vagrantfile. Here the memory is set to 2GB and the CPU is set to 2. Memory And Vcore Allocationįor all the three vagrant boxes, we need to set up the memory and CPU value. Understanding Vagrantfile Configurationīefore building the Ansible lab, you have to understand the configurations inside the Vagrantfile and shell scripts. # running adhoc command to see if everything is fineĪnsible all -i inventory -m "shell" -a "uptime"Īll of these three files are hosted in my GitHub repository. # Creating the inventory file for all 3 nodes to run some adhoc command.Įcho -e "controller\n\n\nmanaged1\n\n\nmanaged2" > inventoryĮcho -e "\ninventory = inventory" > ansible.cfgĮcho -e "- RUNNING ANSBILE ADHOC COMMAND - UPTIME -" PROJECT_DIRECTORY="/home/vagrant/ansible_project/" Sshpass -p 'vagrant' ssh-copy-id -o "StrictHostKe圜hecking=no" CREATE THE INVENTORY FILE # LOOPING THROUGH AND DISTRIBUTING THE KEYįor val in controller managed1 managed2 doĮcho "- COPYING KEY TO $ NODE -" ![]() Ssh-keygen -b 2048 -t rsa -f /home/vagrant/.ssh/id_rsa -q -N "" # THIS SCRIPT WILL CREATE SSH KEYPAIR AND DISTRIBUTE ACROSS ALL NODES The contents of this file is given below: #!/usr/bin/env bash It will also run a sample ansible ad-hoc command for validation. This script will take care of generating an ssh key pair, distributing it across all three nodes. ![]() This script should be manually triggered once all three VM build is completed. VAGRANT COMMANDS INSTALL# Install ansible using pip only in controller node VAGRANT COMMANDS UPDATESudo apt update
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |