Installing the Razor-Client and Creating a Repository

This is part three in the Razor Series. In part #2 we saw how to configure DHCP ad TFTP and as I mentioned in a previous post, the client is now a separate component.

  1. Installing Razor - Yes the New Version..
  2. Razor - DHCP and TFTP
  3. Installing the Razor client and creating a repository
  4. Installers, Policies and Tags
  5. Razor - What Lies Within the installer?
  6. Installing ESXi with Razor

Here is how you would go about installing the razor-client which will allow you to interact with the server.
I installed it in my $HOME folder

First we will clone the code from Github.

git clone https://github.com/puppetlabs/razor-client

git clone

Change directory to the razor-client folder and install the required gems

cd razor-client  
bundle install  
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-zsh" data-lang="zsh"><span style="color:#f92672">[</span>!<span style="color:#f92672">[</span>gems<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_thumb_19.png <span style="color:#e6db74">&#34;gems&#34;</span><span style="color:#f92672">)</span><span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_19.png<span style="color:#f92672">)</span>  
  
Next create an alias that will include the url to the razor server <span style="color:#f92672">(</span>substitute the correct IP address / Hostname of course<span style="color:#f92672">)</span>, and you should add this to your profile <span style="color:#66d9ef">if</span> you want the command to be available each time you login.  

<span style="color:#e6db74">`</span>alias razor<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;</span>$PWD<span style="color:#e6db74">/bin/razor -u https://127.0.0.1:8080/api</span><span style="color:#e6db74">&#34;</span><span style="color:#e6db74">`</span>

<span style="color:#f92672">[</span>!<span style="color:#f92672">[</span>create alias<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_thumb_20.png <span style="color:#e6db74">&#34;create alias&#34;</span><span style="color:#f92672">)</span><span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_20.png<span style="color:#f92672">)</span>  
  
As you can see it is possible to install the client on the same machine as the server. If you are doing this <span style="color:#66d9ef">then</span> <span style="color:#66d9ef">then</span> you will not need the url - because it defaults to <span style="color:#f92672">[</span>https://localhost:8080/api<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://localhost:8080/api <span style="color:#e6db74">&#34;https://localhost:8080/api&#34;</span><span style="color:#f92672">)</span>  
  
And <span style="color:#66d9ef">if</span> you run the **razor** command you should see the following output  
  
<span style="color:#f92672">[</span>!<span style="color:#f92672">[</span>razor<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_thumb_21.png <span style="color:#e6db74">&#34;razor&#34;</span><span style="color:#f92672">)</span><span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_21.png<span style="color:#f92672">)</span>  
  
At the moment there is nothing there so looking at the repos/brokers/policies/nodes/tags will not give you much - yet…  
  
<span style="color:#f92672">[</span>!<span style="color:#f92672">[</span>razor commands<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_thumb_22.png <span style="color:#e6db74">&#34;razor commands&#34;</span><span style="color:#f92672">)</span><span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_22.png<span style="color:#f92672">)</span>  
  
First some terminology.

*   **Nodes -** Nodes are the clients that connect into the system.
*   **Brokers** - Brokers are responsible <span style="color:#66d9ef">for</span> handing a node off to a config management system, like Puppet or Chef.
*   **Tags** - A tag consists of a unique <span style="color:#e6db74">`</span>name<span style="color:#e6db74">`</span> and a <span style="color:#e6db74">`</span>rule<span style="color:#e6db74">`</span>. The rule is a characteristic present on the the node
*   **Repos** - A repository where the installation files of an Operating System reside
*   **Policies -** This is a defined set of steps that tie all the other bits and pieces in Razor together, and are what gets ultimately applied to a node.
*   **Installers** - This will be the set of actions needed to deploy the operating system - you can think as a set of kick start instructions.

Creating a repo, <span style="color:#66d9ef">for</span> that you will need to provide a URL to the installation ISO.  

&lt;div class<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;highlight&#34;</span>&gt;&lt;pre style<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;</span>&gt;&lt;code class<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;language-zsh&#34;</span> data-lang<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;zsh&#34;</span>&gt;razor create-repo --name&lt;span style<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color:#f92672&#34;</span>&gt;<span style="color:#f92672">=</span>&lt;/span&gt;ESXi_5_1 --iso-url &lt;span style<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color:#f92672&#34;</span>&gt;<span style="color:#f92672">[</span>&lt;/span&gt;https://webserver/VMware-VMvisor-Installer-5.1.0.update01-1065491.x86_64.iso&lt;span style<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color:#f92672&#34;</span>&gt;<span style="color:#f92672">]</span>&lt;/span&gt;&lt;span style<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color:#f92672&#34;</span>&gt;<span style="color:#f92672">(</span>&lt;/span&gt;https://webserver/VMware-VMvisor-Installer-5.1.0.update01-1065491.x86_64.iso&lt;span style<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;color:#f92672&#34;</span>&gt;<span style="color:#f92672">)</span>&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

<span style="color:#f92672">[</span>!<span style="color:#f92672">[</span>create-repo<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_thumb_23.png <span style="color:#e6db74">&#34;create-repo&#34;</span><span style="color:#f92672">)</span><span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_23.png<span style="color:#f92672">)</span>

What currently happens is that razor will <span style="color:#66d9ef">return</span> an ID <span style="color:#66d9ef">for</span> the repo and begin the import process. The file is
extracted to **/tmp** and eventually moved to the repo location that we defined in config file
<span style="color:#f92672">(</span>**/var/lib/razor/repo-store**<span style="color:#f92672">)</span>. A new directory will be created according to the repo name. 

<span style="color:#f92672">[</span>!<span style="color:#f92672">[</span>import files<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_thumb_24.png <span style="color:#e6db74">&#34;import files&#34;</span><span style="color:#f92672">)</span><span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_24.png<span style="color:#f92672">)</span>

**<span style="color:#f92672">(</span>Just as a side note - the repo is extracted into the /tmp folder but removed there after - so make sure you have adequate space on your razor server - or alternatively delete the temp files after the repo is created. There is currently a bug open on this <span style="color:#f92672">[</span>issue<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://github.com/puppetlabs/razor-server/issues/66<span style="color:#f92672">)</span>.<span style="color:#f92672">)</span>**  

When you now run razor repos you should see the repository you just created.  
  
<span style="color:#e6db74">`</span>razor repos<span style="color:#e6db74">`</span>

<span style="color:#f92672">[</span>!<span style="color:#f92672">[</span>razor repos<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_thumb_25.png <span style="color:#e6db74">&#34;razor repos&#34;</span><span style="color:#f92672">)</span><span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://maishsk.com/blog/images/Installing-the-razor-client-and-Creating_F134/image_25.png<span style="color:#f92672">)</span>  
  
In the <span style="color:#f92672">[</span>next post<span style="color:#f92672">]</span><span style="color:#f92672">(</span>https://blog.technodrone.cloud/2013/11/razor-installers-policies-and-tags.html<span style="color:#f92672">)</span> we will see how we create a policy and see what we can <span style="color:#66d9ef">do</span> with tags.</code></pre></div>