GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Devops/Chef at master · awsdevopsgit/Devops Expand file tree/ Copy pathChefMore file actions 80 lines (79 loc) · 2.93 KB / Copy pathChefFile metadata and controls80 lines (79 loc) · 2.93 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 keywords: data_bags, roles, cookbooks, starter kit, chef supermarket, --------- chef-apply <filename> ----->to create file knif bootstrap ip -x root -p password -N nodename ---> to connect with the chef client server chef-client -----> used to check in the client server knif cookbook create <CBname> ---> to create CB knif cookbook test <CBname> ----> to test cookbook knif upload <CBname> ---> to upload CBname chef server knif cookbook list ---> it will list the available CB in the client server in chef-repo-->.chef-->we have 2 files are 1. .pem and 2. knif.rb when we download starter kit from cheff server it will generate cheff-repo dir in the cheff DK inside this we have .pem and knif.rb files to get connected with cheff server. knif cookbook list ------> will show cookbook list in cheff DK knif cookbook delete <CBname> ------> will delete CB ============================================================================================================================================================================== COOKBOOK Default.rb file ------------------------------------- package "httpd" do action :install end service "httpd" do action :enable end service "httpd" do action :start do end file '/var/www/html/index.html' do content '<html> <body bgcolor="cc4400"> <hi> "Hello chef-client" </hi> </body> </html>' end ----------------------------------------- kinf node run_list add <nodename> "recipe[CBname]" knif data bag create users -------> it will create users in data bags knif data bag create group -------> it will create group in date bags kinf data bag from file users user1.json -------> to move files from cheff DK to the cheff server ============================================================================================================================================================================= JSON for creating users and group ---------------------------------- Users ------- { "id": "user1", "comment": "devops user1", "uid": 2000, "gid": 0000, "home": "/home/user1", "shell": "/bin/bash" } Group ------ "id": "devops", "gid": 3000, "users": ["user1", "user2"] } ========================================================================================================================================== Searching for variables through CB ------------------------------------ search("users", "*:*").each do |user_data| user user_data["id"] do comment user_data["comment"] uid user_data["uid"] gid user_data["gid"] home user_data["home"] shell user_data["shell"] end end include_recipe "users::groups" ----------->including users to the group search for groups ------------------ search("groups", "*:*").each do |group_data| groups group_data["id"] do gid groups_data["gid"] members group_data["members"] end end ============================================================================================================================================ -->in chef super market we will have cookbooks that we can download as per our requirement. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |