def run_chef_knife(host):
knife = "knife bootstrap --no-host-key-verify " \
"--ssh-user root --ssh-identity-file %s/.ssh/id_rsa_prox " \
"--environment=scicomp-env-compute " \
'--server-url "https://chef.fhcrc.org/organizations/cit" ' \
"--run-list 'role[cit-base]','role[scicomp-base]' " \
"--node-name %s " \
"%s" % (homedir,host,host)
if host == 'hostname':
print('you can also execute this knife command manually:')
print('************************************')
print(knife)
print('************************************')
else:
if os.path.exists('%s/.chef' % homedir):
print('*** executing knife command:')
print(knife)
ret = subprocess.run(knife, shell=True)
else:
print ('chef/knife config dir %s/.chef does not exist.' % homedir)
评论列表
文章目录