<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pedromussato.com/index.php?action=history&amp;feed=atom&amp;title=Chef_configuration_manager_%3A_role_creation</id>
	<title>Chef configuration manager : role creation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pedromussato.com/index.php?action=history&amp;feed=atom&amp;title=Chef_configuration_manager_%3A_role_creation"/>
	<link rel="alternate" type="text/html" href="https://wiki.pedromussato.com/index.php?title=Chef_configuration_manager_:_role_creation&amp;action=history"/>
	<updated>2026-04-10T16:58:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.pedromussato.com/index.php?title=Chef_configuration_manager_:_role_creation&amp;diff=237&amp;oldid=prev</id>
		<title>413vhcu1lq0463ob: Created page with &quot;=== &#039;&#039;&#039;Navigate to the Roles Directory&#039;&#039;&#039; === Roles are stored in a roles/ directory, usually within your Chef repository. If the directory doesn&#039;t exist, you can create it.  === &#039;&#039;&#039;Create the Role File&#039;&#039;&#039; === Now, create a new role file. You can name the role file anything, but it’s common to use a name that describes the purpose of the role. For example, let&#039;s create a role called rolename.  touch roles/rolename.json  === &#039;&#039;&#039;Edit the Role File&#039;&#039;&#039; === Open the rolenam...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.pedromussato.com/index.php?title=Chef_configuration_manager_:_role_creation&amp;diff=237&amp;oldid=prev"/>
		<updated>2025-02-03T13:13:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== &amp;#039;&amp;#039;&amp;#039;Navigate to the Roles Directory&amp;#039;&amp;#039;&amp;#039; === Roles are stored in a roles/ directory, usually within your Chef repository. If the directory doesn&amp;#039;t exist, you can create it.  === &amp;#039;&amp;#039;&amp;#039;Create the Role File&amp;#039;&amp;#039;&amp;#039; === Now, create a new role file. You can name the role file anything, but it’s common to use a name that describes the purpose of the role. For example, let&amp;#039;s create a role called rolename.  touch roles/rolename.json  === &amp;#039;&amp;#039;&amp;#039;Edit the Role File&amp;#039;&amp;#039;&amp;#039; === Open the rolenam...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== &amp;#039;&amp;#039;&amp;#039;Navigate to the Roles Directory&amp;#039;&amp;#039;&amp;#039; ===&lt;br /&gt;
Roles are stored in a roles/ directory, usually within your Chef repository. If the directory doesn&amp;#039;t exist, you can create it.&lt;br /&gt;
&lt;br /&gt;
=== &amp;#039;&amp;#039;&amp;#039;Create the Role File&amp;#039;&amp;#039;&amp;#039; ===&lt;br /&gt;
Now, create a new role file. You can name the role file anything, but it’s common to use a name that describes the purpose of the role. For example, let&amp;#039;s create a role called rolename.&lt;br /&gt;
 touch roles/rolename.json&lt;br /&gt;
&lt;br /&gt;
=== &amp;#039;&amp;#039;&amp;#039;Edit the Role File&amp;#039;&amp;#039;&amp;#039; ===&lt;br /&gt;
Open the rolename.json file and define the role. You&amp;#039;ll include your recipe within the run_list section of the role definition.&lt;br /&gt;
&lt;br /&gt;
Example rolename.json:&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;ROLE NAME&amp;quot;,&lt;br /&gt;
      &amp;quot;description&amp;quot;: &amp;quot;please write down something here, the tomorrow you will apreciate ;)&amp;quot;,&lt;br /&gt;
      &amp;quot;run_list&amp;quot;: [&lt;br /&gt;
        &amp;quot;RECIPE 1&amp;quot;,&lt;br /&gt;
        &amp;quot;RECIPE 2&amp;quot;,&lt;br /&gt;
        &amp;quot;RECIPE 3&amp;quot;&lt;br /&gt;
      ],&lt;br /&gt;
      &amp;quot;default_attributes&amp;quot;: {},&lt;br /&gt;
      &amp;quot;override_attributes&amp;quot;: {}&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;name&amp;quot;: The name of the role (e.g., rolename).&lt;br /&gt;
* &amp;quot;description&amp;quot;: A short description of the role.&lt;br /&gt;
* &amp;quot;run_list&amp;quot;: The list of recipes to be run. Here, you specify the recipes.&lt;br /&gt;
* &amp;quot;default_attributes&amp;quot; and &amp;quot;override_attributes&amp;quot;: Optional sections where you can specify any attributes you want to set for the role.&lt;br /&gt;
&lt;br /&gt;
=== &amp;#039;&amp;#039;&amp;#039;Upload the Role to the Chef Server&amp;#039;&amp;#039;&amp;#039; ===&lt;br /&gt;
Once you have created and saved the role file, you need to upload it to the Chef server using the knife command:&lt;br /&gt;
 knife role from file roles/filename.json&lt;br /&gt;
&lt;br /&gt;
=== &amp;#039;&amp;#039;&amp;#039;Assign the Role to Your Nodes&amp;#039;&amp;#039;&amp;#039; ===&lt;br /&gt;
Now that the role is created and uploaded, you can assign it to your nodes. To apply this role to a node, use the knife command to update the node&amp;#039;s run list:&lt;br /&gt;
 knife node run_list add NODE_NAME &amp;#039;ROLE NAME&amp;#039;&lt;br /&gt;
Replace NODE_NAME with the actual name of the node you want to assign the role to.&lt;br /&gt;
&lt;br /&gt;
=== &amp;#039;&amp;#039;&amp;#039;Verify the Role Assignment&amp;#039;&amp;#039;&amp;#039; ===&lt;br /&gt;
After applying the role, you can check if the role was successfully assigned to the node:&lt;br /&gt;
 knife node show NODE_NAME&lt;br /&gt;
This will show you the details of the node, including the run list, which should now include the rolename role.&lt;/div&gt;</summary>
		<author><name>413vhcu1lq0463ob</name></author>
	</entry>
</feed>