chef-partners/azure-chef-extension

"Provisioning succeeded"

davismar98 opened this issue · 4 comments

Hi,

I'm kind of new working with chef, so I don't know if I have some concepts wrong. I managed to install the extension in a VM with status "Provisioning succeeded" and Status Message "chef-service enabled" but my node does not appear in my Chef Manage dashboard and my recipe was not applied (isn't this what is supposed to happen if everything was done correctly?).

I provided the Chef Server URL, the Chef Node Name, Run List (recipe) Validation Client Name, Validation Key (.pem) and my Chef Server Certificate (.crt).

When I SSH my VM, inside /etc/chef I can see everything but the client.pem and the accepted_licences folder (I'm comparing with a node I have already bootstrapped). However, there's not a way to upload the client.pem from the Azure portal.

I can bootstrap a node from my Workstation using the same parameters. How can I troubleshoot this?

If this doesn't belong here, feel free to delete this issue.

No This is not expected. Your node should get registered on the chef-server. I am not sure what OS you are bootstrapping.
For linux location of log files
i. /var/log/waagent.log
ii. /var/log/azure/custom.log
iii. /var/log/azure/Chef.Bootstrap.WindowsAzure.LinuxChefClient//CommandExecution.log

For windows
C:\WindowsAzure\Logs\Plugins\Chef.Bootstrap.WindowsAzure.ChefClient\
C:\WindowsAzure\Logs\waagent.log

Also Could you please also share the information of azure-chef-extension you are installing.

Most probably the issue is with the client validation key client key you are uploading.

Are you installing azure-chef-extension using Azure portal ?

Thanks for your replay, @Vasu1105

I have checked the logs and I have the following:
[2019-08-22T18:34:39+00:00] ERROR: Running exception handlers [2019-08-22T18:34:39+00:00] ERROR: Exception handlers complete [2019-08-22T18:34:39+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out [2019-08-22T18:34:39+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2019-08-22T18:34:39+00:00] FATAL: Net::HTTPServerException: 401 "Unauthorized"
I found the issue.
I was using the server url "https://manage.chef.io/organizations/rampup" instead of "https://api.chef.io/organizations/rampup". Also, the Validation Client Name I was providing was "rampup" since that's the name of my organization but the Key downloaded from the server (rampup-validator.pem) suggested I had to use "rampup-validator" instead.

Now, my node was bootstrapped correctly and my recipe applied successfully :)

Now, I would like to install the extension in a Scale Set using Terraform.

I have the following so far:

extension {
name = "scale-set-chef-extension"
publisher = "Chef.Bootstrap.WindowsAzure"
type = "LinuxChefClient"
type_handler_version = "1210.13.2.1"
auto_upgrade_minor_version = true
protected_settings = [here goes the "validation_key"]
settings = [here go "bootstrap_options" and "runlist"]
}

How can I convert this Settings (fetched from the Azure Portal) to Terraform format?
{
"bootstrap_version": "",
"bootstrap_options": {
"chef_node_name": "mynode",
"chef_server_url": "https://api.chef.io/organizations/rampup",
"validation_client_name": "rampup-validator",
"node_ssl_verify_mode": "peer",
"environment": "_default",
"secret": ""
},
"runlist": "recipe[cron-delvalidate::default]",
"client_rb": ""
}

I would like to know if there already exist a template to install the Chef extension using Terraform.

Thanky you again!

@davismar98 I never tried this myself but I find this on net
settings = <<SETTINGS
"bootstrap_options": {
"chef_node_name": "${azurerm_virtual_machine.test.name}",
"chef_server_url": "",
"validation_client_name": ""
},
"runlist": "my_starting_runlist"
SETTINGS

@davismar98 I am closing this issue it was configuration problem.