Adjusts /etc/hosts to fix hostname -f which is read by OHAI and sets a node's FQDN
Currently this cookbook is designed to work only on Ubuntu flavored VMs on the AZURE PLATFORM.
- Ubuntu Linux 14.04+
- Support for other Liunx Platforms will not be done by me, but can/will be supported via fork & pull
- Chef 12.0 or later
- Ohai
Key | Type | Description | Default |
---|---|---|---|
['azure_fqdn_fix']['domain'] |
String | The domain name of your node | 'example.of.long.domain.com' |
['azure_fqdn_fix']['hostname'] |
String | The hostname your node | 'default-hostname' |
If your browser does not support markdown tables, the table is better formatted as JSON here:
{
'azure_fqdn_fix' :
{
'domain' :
{
'type' : 'String',
'Description' : "The domain name of your node",
'Default' : 'example.of.long.domain.com'
},
'hostname' :
{
'type' : 'String',
'Description' : "The hostname name of your node",
'Default' : 'default-hostname'
}
}
}
node['domain']
and node['hostname']
are not a reliable way of putting together a node's FQDN if it is hosted on Azure. Once you set up your public-ip DNS resolver name in the Azure portal, you are ready to use this recipe in your run_list
.
['azure_fqdn_fix']['hostname']
is whatever you set your public resolver hostname to. It is whatever you put in the space that you fill in.
['azure_fqdn_fix']['domain']
is the portion of the DNS resolver hostname that you cannot change. It is usually underneath the editable region and has the format of region.cloudapp.azure.com
- Set the attributes
node['azure_fqdn_fix']['domain']
andnode['azure_fqdn_fix']['hostname']
in your node through some means - Include
azure_fqdn_fix
in your node'srun_list
:
{
"name":"my_node",
"run_list": [
"recipe[azure_fqdn_fix]"
]
}
- I highly recommend setting the
['azure_fqdn_fix']['domain']
at the environment scope since most of your VM's in a cluster will be in the same geographical resource center. - It is highly advised that you set up the DNS resolver BEFORE you run your bootstrap of your node because you can pass the --json-attributes flag (-j for short) and configure the public resolver as
{'azure_fqdn_fix' : { 'hostname' : 'I-picked-this-hostname' }}
. If you didn't set thedomain
attribute at the environment scope, you should include it in your json attributes hash. - If you are fixing the FQDN of a node which has been deployed with this recipe:
- Follow usage above
- Run
sudo chef-client
to run the recipe - Run
ohai
to update the node["fqdn"] attribute - Run
sudo chef-client
to report the updated FQDN to the chef-server
If you have a recipe in your run_list
which for some reason changes the file permissions or ownership of the files in the /etc/
directory then you should run this recipe before the one(s) that do(es) because this recipe will alter the owner, group, and mode of the /etc/hosts
file.
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
License: MIT Contributors: Justin Karnes