ChefDK cheatsheet


Knife SSH to node and run a command

 knife ssh 'name:dnirpo-ubuntu-58' 'ls -a' -x 'someusername' -a ipaddress -P 'somePassword'

'name:' -- refers to node name
'la -a' -- a command to run, here is just to list all files
-x flag -- username
-a ipaddress -- attribute to specify if no FQDN available on the node
-P -- password (upper case because lower case stands for port parameter)

Update run-list on a node

 knife node run_list set 'dnipro-ubuntu-58' 'recipe[your_cookbook_name::your_receipe_name]'


The request failed because your clock has drifted by more than 15 minutes

sudo ntpdate 10.11.122.79

It will synchronise date and time with server, where 10.11.122.79 -- chef server ip. In case of fail due to 'socket in use' error, kill the ntp process (grep for ntp process running)

Comments