= Sample Download of Project Managed by Chef = Chef creates a VM using Virtual Box and all of the tools necessary to manage the download. It is a fully functional Operating System encapsulated on the local workstation. The following steps were taken to download the most recent version of UA software to that controls [[http://people.alaska.edu|People Directory]]. $ cd iam-dev/[[br]] $ ls[[br]] $ mkdir cookbooks[[br]] $ cd cookbooks/[[br]] $ git clone !git@github.alaska.edu:OIT-IAM/iam-app-people.git[[br]] * ''Ensure git is applied to your location before executing the above command.''[[br]] $ ls -aFC [[br]]* ''Resulting directory listing'' {{{ ./ ../ iam-app-people/ }}} $ cd iam-app-people/[[br]] $ ls -aFC[[br]] * ''Resulting directory listing'' {{{ ./ Berksfile chefignore ../ Berksfile.lock deploy/ .git/ CHANGELOG.md files/ .gitignore Gemfile metadata.rb .kitchen/ README.md recipes/ .kitchen.ec2.yml Thorfile templates/ .kitchen.yml Vagrantfile test/ .travis.yml attributes/ }}} $ knife[[br]] * ''Ensure ChefDK is installed before executing the above command''[[br]] ''* see'' [[https://docs/chef.io/knife.html|About Knife]] [[br]] '' * The above command lists all possible sub-commands that should be used in conjunction with knife.'' {{{ OUTPUT EXCERPT ============== ERROR: You need to pass a sub-command (e.g., knife SUB-COMMAND) Usage: knife sub-command (options) -s, --server-url URL Chef Server URL --chef-zero-host HOST Host to start chef-zero on --chef-zero-port PORT Port (or port range) to start chef-zero on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works. -k, --key KEY API Client Key --[no-]color Use colored output, defaults to enabled -c, --config CONFIG The configuration file to use --config-option OPTION=VALUE Override a single configuration option --defaults Accept default values for all questions -d, --disable-editing Do not open EDITOR, just accept the data as is -e, --editor EDITOR Set the editor to use for interactive commands -E, --environment ENVIRONMENT Set the Chef environment (except for in searches, where this will be flagrantly ignored) --[no-]fips Enable fips mode -F, --format FORMAT Which format to use for output --[no-]listen Whether a local mode (-z) server binds to a port -z, --local-mode Point knife commands at local repository instead of server -u, --user USER API Client Username --print-after Show the data after a destructive operation -V, --verbose More verbose output. Use twice for max verbosity -v, --version Show chef version -y, --yes Say yes to all prompts for confirmation -h, --help Show this message Available subcommands: (for details, knife SUB-COMMAND --help) ** BOOTSTRAP COMMANDS ** knife bootstrap [SSH_USER@]FQDN (options) knife bootstrap windows ssh FQDN (options) knife bootstrap windows winrm FQDN (options) ** CLIENT COMMANDS ** knife client bulk delete REGEX (options) knife client create CLIENTNAME (options) ... }}} $ kitchen[[br]] ''* see'' [[https://docs.chef.io/kitchen.html|Kitchen]][[br]] ''* Using kitchen without a sub-command likewise produces a listing of possible sub-commands'' {{{ OUTPUT ====== Commands: kitchen console # Kitchen Console! kitchen converge [INSTANCE|REGEXP|all] # Change instance state to ... kitchen create [INSTANCE|REGEXP|all] # Change instance state to ... kitchen destroy [INSTANCE|REGEXP|all] # Change instance state to ... kitchen diagnose [INSTANCE|REGEXP|all] # Show computed diagnostic ... kitchen driver # Driver subcommands kitchen driver create [NAME] # Create a new Kitchen Driv... kitchen driver discover # Discover Test Kitchen dri... kitchen driver help [COMMAND] # Describe subcommands or o... kitchen exec INSTANCE|REGEXP -c REMOTE_COMMAND # Execute command on one or... kitchen help [COMMAND] # Describe available comman... kitchen init # Adds some configuration t... kitchen list [INSTANCE|REGEXP|all] # Lists one or more instances kitchen login INSTANCE|REGEXP # Log in to one instance kitchen package INSTANCE|REGEXP # package an instance kitchen setup [INSTANCE|REGEXP|all] # Change instance state to ... kitchen test [INSTANCE|REGEXP|all] # Test (destroy, create, co... kitchen verify [INSTANCE|REGEXP|all] # Change instance state to ... kitchen version # Print Kitchen's version i... }}} $ kitchen converge[[br]] ''* The people project contains every possible configuration file to build the project. The output is lengthy.'' ''* The execution will stop if there is an error.'' {{{ OUTPUT EXCERPT ============== -----> Starting Kitchen (v1.13.2) -----> Creating ... Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'bento/centos-6.7' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box 'bento/centos-6.7' default: URL: https://atlas.hashicorp.com/bento/centos-6.7 ==> default: Adding box 'bento/centos-6.7' (v2.2.7) for provider: virtualbox default: Downloading: https://atlas.hashicorp.com/bento/boxes/centos-6.7/versions/2.2.7/providers/virtualbox.box ==> default: Successfully added box 'bento/centos-6.7' (v2.2.7) for 'virtualbox'! ==> default: Importing base box 'bento/centos-6.7'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'bento/centos-6.7' is up to date... ==> default: Setting the name of the VM: kitchen-iam-app-people-default-centos-67_default_1477008499277_5702 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 80 (guest) => 8082 (host) (adapter 1) default: 443 (guest) => 8445 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Remote connection disconnect. Retrying... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... ... Current file[/etc/sensu/ssl/key.pem]: /tmp/kitchen/cache/cookbooks/iam-app-people/recipes/sensu.rb:122:in `from_file' at 1 location: - /tmp/kitchen/cache/cookbooks/iam-app-people/recipes/sensu.rb:122:in `from_file' Chef Client finished, 49/68 resources updated in 02 minutes 40 seconds Finished converging (3m4.23s). -----> Kitchen is finished. (4m27.33s) }}} $ kitchen converge[[br]] ''* Running the command a second time only illustrates no changes have been made and Chef will not rebuild the system''[[br]] $ kitchen verify[[br]] ''* A final check verifies the system is fully installed in the local chef-repo'' {{{ OUTPUT ====== -----> Starting Kitchen (v1.13.2) -----> Setting up ... Finished setting up (0m0.00s). -----> Verifying ... Preparing files for transfer -----> Installing Busser (busser) Fetching: thor-0.19.0.gem (100%) Successfully installed thor-0.19.0 Fetching: busser-0.7.1.gem (100%) Successfully installed busser-0.7.1 2 gems installed Installing Busser plugins: busser-serverspec Plugin serverspec installed (version 0.5.10) -----> Running postinstall for serverspec plugin Suite path directory /tmp/verifier/suites does not exist, skipping. Transferring files to -----> Running serverspec test suite -----> Installing Serverspec.. Fetching: diff-lcs-1.2.5.gem (100%) Fetching: rspec-expectations-3.5.0.gem (100%) Fetching: rspec-mocks-3.5.0.gem (100%) Fetching: rspec-3.5.0.gem (100%) Fetching: rspec-its-1.2.0.gem (100%) Fetching: multi_json-1.12.1.gem (100%) Fetching: net-ssh-3.2.0.gem (100%) Fetching: net-scp-1.2.1.gem (100%) Fetching: net-telnet-0.1.1.gem (100%) Fetching: sfl-2.3.gem (100%) Fetching: specinfra-2.63.3.gem (100%) Fetching: serverspec-2.37.2.gem (100%) -----> serverspec installed (version 2.37.2) /opt/chef/embedded/bin/ruby -I/tmp/verifier/suites/serverspec -I/tmp/verifier/gems/gems/rspec-support-3.5.0/lib:/tmp/verifier/gems/gems/rspec-core-3.5.4/lib /opt/chef/embedded/bin/rspec --pattern /tmp/verifier/suites/serverspec/\*\*/\*_spec.rb --color --format documentation --default-path /tmp/verifier/suites/serverspec Service "httpd" should be enabled should be running Port "80" should be listening Port "443" should be listening Package "sensu" should be installed Service "sensu-client" should be enabled should be running Finished in 0.68722 seconds (files took 0.4512 seconds to load) 7 examples, 0 failures Finished verifying (0m10.06s). -----> Kitchen is finished. (0m11.28s) }}} $ kitchen login[[br]] ''* Entering the kitchen allows the user to see what is in the Chef cookbook'' {{{ Last login: Fri Oct 21 00:12:22 2016 from 10.0.2.2 [vagrant@default-centos-67 ~]$ whoami vagrant [vagrant@default-centos-67 ~]$ ls ../ vagrant [vagrant@default-centos-67 ~]$ ls ../../ bin boot dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var [vagrant@default-centos-67 ~]$ ls [vagrant@default-centos-67 ~]$ ls /var cache crash db empty games lib local lock log mail nis opt preserve run spool tmp www yp [vagrant@default-centos-67 ~]$ ls /var/www cgi-bin error html icons [vagrant@default-centos-67 ~]$ ls /var/www/html entry.js index.css library_ldap.php people_logo.png search.js settings_gear.png UA-logo-people.jpg UAS-logo-people.jpg favicon.ico index.js library.php people_logo.text.png search.php UAA-logo-people.jpg UAlogo.png zoom-in.png generic.css index.php main.css search.css search.png UAF-logo-people.jpg uapeople_logo.png [vagrant@default-centos-67 ~]$ exit logout Connection to 127.0.0.1 closed. }}} $ kitchen destroy[[br]] ''* It is recommended to destroy this instance and you will create a completely new one once you submit changes or if you download a more recent version.'' {{{ -----> Starting Kitchen (v1.13.2) -----> Destroying ... ==> default: Forcing shutdown of VM... ==> default: Destroying VM and associated drives... Vagrant instance destroyed. Finished destroying (0m4.37s). -----> Kitchen is finished. (0m5.20s) }}}