Sunday, September 15, 2019

Testing/Writing Chef Cookbooks



Writing cookbooks

Cookbooks has attributes, recipes, templates etc


Using Community cookbooks
  1. Modify Berksfile in the cookbook by adding cookbook name, say, cookbook 'yum-centos', '~> 3.0.0'
  2. Modify metadata.rb in cookbook by updating dependencies, say, depends 'yum-centos', '~> 3.0.0'
  3. Execute below commands
$ berks install
$ berks upload
Prerequisites

Make sure we have below configs/files
  • Chef cookbook
  • Chef Environment
  • Chef Role
Testing cookbook locally

  1. Install vagrant from https://www.vagrantup.com/downloads.html
  2. Install Virtualbox
  3. Modify .kitchen.yml file referring to community cookbook recipe to test locally.
  4. Goto cookbook directory and execute kitchen commands to build, list, login to new created resource from chef cookbooks.
$ kitchen converge
$ kitchen list
$ kitchen login
Update authentication key
# Connect to chef server 
[pd@ip-disects ~]$ ssh -A -t SSH_SERVER_IP 

# Following commands are executed on chef server 
[pd@ip-disects ~]$ sudo chef-server-ctl user-create praveend Praveen Darshanam praveend@chef.io Myp@ssw0rd -f /tmp/praveend.key 
ERROR: Conflict 
Response: Username or email address already in use. 

[pd@ip-disects ~]$ sudo chef-server-ctl user-delete praveend 
Do you want to delete the user praveend? (Y/N) y 
Checking organization memberships... 
Checking admin group memberships for 1 org(s). 
FATAL: praveend is in the 'admins' group of the following organization(s): 
- disects



Run this command again with the --remove-from-admin-groups option to remove the user from these admin group(s) automatically. 
[pd@ip-disects ~]$ sudo chef-server-ctl user-delete praveend --remove-from-admin-groups 
Do you want to delete the user praveend? (Y/N) y 
Checking organization memberships... 
Checking admin group memberships for 1 org(s). 
Removing praveend from admins group of 'disects' 
Deleting user praveend. 

[pd@ip-disects ~]$ sudo chef-server-ctl user-create praveend Praveen Darshanam praveend@chef.io Myp@ssw0rd -f /tmp/praveend.key 
[pd@ip-disects ~]$ sudo chef-server-ctl org-user-add disects praveend --admin 
User praveend is added to admins and billing-admins group


Upload working cookbook to chef server after local testing. Test the cookbook on a cluster node to make sure everything is working fine, this needs some experience though.
$ knife cookbook upload cookbook_name


4 comments:

  1. ARE YOU A VICTIM OF FALSE HACKERS & BANK LOAN SCAM⁉️

    We have been having recent complains from individuals about how they lost money 💵 to SPAMMERS who call themselves HACKERS or BANK LOAN OFFERS. They are all over the internet sharing false testimonies. Please do not fall for their lies for this is just a way to LURE you to them.

    They say lies in the likes of such-:
    ▪️Bitcoin Auctioning ▪️Western Union Hack
    ▪️Blank Credit Card ▪️Clearing Criminal Records
    ▪️Loan Offers. ▪️Bank Account Loading
    ▪️Changing University Grades & so on.
    These are all lies and you shouldn’t fall for them.

    🏵GLOBAL PLUGGERS🏵 is here to help you Recover all your Money 💵 that you have been Ripped of.
    WHO ARE GLOBAL PLUGGERS⁉️
    We are a group of Computer💻 Experts who are memebers of the “HACKERONE” Forum. We have dedicated ourselves to help Victims of these SCAM(s) recover all the Money that has been taken falsely from them.

    If you have been a victim of thes Thieves, then you need to contact us as soon as possible so you can get your money back.
    Email-: globalpluggers@gmail.com
    No. +1 (808) 600 0773 ( Number also available on WhatsApp)

    Note:
    Please know that we do not charge you for Fund Recovery Service, Our Funds Recovery Service is to help and so it’s Free.

    We also provide Legit Hacking Services such as-:
    🔸Phone Hacking/Cloning
    🔸Email Hacking & Password Recovery
    🔸Social Media Hacking & Passowrd Recovery
    🔸Deleted Files Recovery 🔸Mobil Tracking
    🔸Virus detection & Elimination.

    Contact-:
    Email globalpluggers@gmail.com
    No. +1 (808) 600 0773 (number also available on WhatsApp)








    ReplyDelete
  2. They are all scammers, they will make you pay after which they will give you an excuse asking you to pay more money, they have ripped me of $2000, i promised i was going to expose them.
    I figured it all out when my colleague took me to Pavel

    (HACKINTECHNOLOGY@GMAIL.COM)
    CELL PHONE +16692252253

    He did perfect job, he hacks all accounts ranging from (Emails, Facebook, whatsapp, imo, skype, instagram, Phone cloning, DMV removal, tracking locations, background checks Kik etc. he also hacks cell phones, cell phone tapping and cloning, clears bad driving and criminal records, bank transfers, locates missing individuals e.t.c. You should contact him and please stop using contacts you see on websites to execute jobs for you, you can ask around to find a real hacker.

    ReplyDelete
  3. Greetings....
    Check out these credit cards today. 
    My name is Robert Williams from California. A successful business owner and father. I got one of these already programmed Credit cards that allows me withdraw a maximum of $5,000 daily for 30 days. I am so happy about these cards because I received mine last week and have already used it to get $20,000. Mr frank Richard   of Creditcards.atm@gmail.com is giving out these cards to support people in any kind of financial problem. I must be sincere to you, when i first saw the advert, I believed it to be illegal and a hoax but when I contacted Mr Frank Richard , he confirmed to me that although it is illegal, nobody gets caught while using these cards because they have been programmed to disable every communication once inserted into any Automated Teller Machine(ATM). If interested contact him as soon as possible 
    Email:Creditcards.atm@gmail.com 

    Whatsapp:+1(305) 330-3282

    ReplyDelete
  4. Are you interested in any kinds of hacking services?
    Feel free to contact TECHNECHHACKS.

    For years now we’ve helped so many organizations and companies in hacking services.
    TECHNECHHACKS is a team of certified hackers that has their own specialty and they are five star rated hackers.

    We give out jobs to hackers (gurus only) to those willing to work, with or without a degree, to speed up the availability of time given to jobs!!

    Thus an online binary decoding exam will be set for those who needs employment under the teams establishment.


    we deal with the total functioning of sites like,



    + SOCIAL MEDIA (Facebook, Twitter, Instagram, Snapchat, google hangout etc.)

    + CREDIT CARDS INSTALLATION

    + WESTERN UNION TRANSFER

    + MONEY FLIPPING

    + BANK ACCOUNTS

    + IOS/OS

    + CRIMINAL RECORDS

    + SCHOOL GRADES

    + CREDIT SCORES

    + SPOUSES PHONE

    + BTC RECOVERY

    + BTC MINING

    + BTC INVESTMENT

    Thus bewere of scammers because most persons are been scammed and they ended up getting all solutions to their cyber bullies and attacks by US.

    I am Jason williams one of the leading hack agent.

    PURPOSE IS TO GET YOUR JOBS DONE AT EXACTLY NEEDED TIME REQUESTED!!!



    And our WORK SUCCESS IS 100%!!!



    I’m always available for you when you need help.

    Contact or write us on:

    Technechhacks@gmail.com

    SIGNED....!

    Jason. W.

    ReplyDelete