<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Bad It Boys Blog</title>
        <link>https://baditboys.netlify.app/en/blog</link>
        <description>Bad It Boys Blog</description>
        <lastBuildDate>Sat, 02 Jan 2021 00:00:00 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <item>
            <title><![CDATA[Perform a dev symphony with TabNine and Visual Studio Code]]></title>
            <link>https://baditboys.netlify.app/en/blog/tabnine</link>
            <guid>https://baditboys.netlify.app/en/blog/tabnine</guid>
            <pubDate>Sat, 02 Jan 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[Are you a passionate developer looking for a way to harmonize your code to create a symphony of programming lines? Then TabNine and Visual Studio Code are the tools for you.]]></description>
            <content:encoded><![CDATA[<p>Are you a passionate developer looking for a way to harmonize your code to create a symphony of programming lines? Then TabNine and Visual Studio Code are the tools for you.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-is-tabnine">What is TabNine<a href="#what-is-tabnine" class="hash-link" aria-label="Direct link to What is TabNine" title="Direct link to What is TabNine">​</a></h2><p>TabNine is the ultimate development add-on, offering real-time code suggestions to help you achieve perfection in no time. And with an easy installation on Visual Studio Code, you can start playing your code symphony in no time.</p><p>TabNine is a programming virtuoso, understanding the context of your code to suggest the best lines of code. This can help you avoid common mistakes and write more efficient code. For example, if you are writing a piece of code to iterate through a list, TabNine can suggest the best options for traversing that list, such as the "for" loop or the "map" method.</p><p>TabNine is also a genius composer, always up to date with the latest development trends. This means that you can count on TabNine to offer you the best suggestions, no matter what version of your programming language you use. And with Visual Studio Code, you have a complete development environment to play your code symphony.</p><p>Translated with <a href="http://www.DeepL.com/Translator" target="_blank" rel="noopener noreferrer">www.DeepL.com/Translator</a> (free version)</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="install-tabnine">Install TabNine<a href="#install-tabnine" class="hash-link" aria-label="Direct link to Install TabNine" title="Direct link to Install TabNine">​</a></h2><p>To use TabNine with Visual Studio Code, just follow these simple steps:</p><ul><li>Open Visual Studio Code and go to the Extensions section.</li><li>Search for TabNine in the list of available extensions.</li><li>Click on Install to schedule the extension.</li><li>Once the installation is complete, click on Activate to start using TabNine.</li><li>To use TabNine, simply start typing code and select a code suggestion of the extension.</li></ul><p>Once installed, you'll need to create a TabNine account to enjoy all the features of this development tool. It only takes a few minutes and will allow you to benefit from all the real-time suggestions and constant updates of TabNine. So don't wait any longer and add TabNine to your Visual Studio Code development environment today!</p><p>TabNine and Visual Studio Code are the perfect development tools to compose your code symphony. With real-time suggestions, contextual understanding, constant updates and a complete development environment, you can create epic pieces of development in no time. So don't wait any longer and let your passion for programming flow with TabNine and Visual Studio Code.</p>]]></content:encoded>
            <category>vscode</category>
            <category>development</category>
        </item>
        <item>
            <title><![CDATA[Dockerfile]]></title>
            <link>https://baditboys.netlify.app/en/blog/docker-file</link>
            <guid>https://baditboys.netlify.app/en/blog/docker-file</guid>
            <pubDate>Mon, 19 Oct 2020 09:20:15 GMT</pubDate>
            <description><![CDATA[Hello, this post will explain how to create a Dockerfile for a Ruby container that already has MDL installed.]]></description>
            <content:encoded><![CDATA[<p>Hello, this post will explain how to create a Dockerfile for a Ruby container that already has <a href="https://baditboys.netlify.app/posts/mdldocker/" target="_blank" rel="noopener noreferrer">MDL</a> installed.
Please check my previous <a href="https://baditboys.netlify.app/posts/docker/" target="_blank" rel="noopener noreferrer">post</a> to better understand Docker.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-is-t">What is t?<a href="#what-is-t" class="hash-link" aria-label="Direct link to What is t?" title="Direct link to What is t?">​</a></h2><p>A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
Using docker build users can create an automated build that executes several command-line instructions in succession.</p><p>Much like Vagrant that uses a vagrantfile to create and customize a virtual machine to your needs, Docker uses a dockerfile to create and customize a container!
They may be similiar but they are very different! (you can learn how to use Vagrant to create a Windows Server vm <a href="https://baditboys.netlify.app/posts/windowsserver/" target="_blank" rel="noopener noreferrer">here</a>)</p><p>As meantion earlier, for this example, we're going to create a ruby container with mdl installed.
So we need to start our dockerfile:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">FROM ruby:latest</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>FROM creates a layer from the ruby latest Docker image.</p><p>Next:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">FROM ruby:latest</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">WORDIR /mdl</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>WORDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile.
If the WORKDIR doesn’t exist, it will be created even if it’s not used in any subsequent Dockerfile instruction.</p><p>Next:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">FROM ruby:latest</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">WORDIR /mdl</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">RUN gem install mdl</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>RUN has 2 forms:</p><ul><li>RUN command (shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows)</li><li>RUN <!-- -->["executable", "param1", "param2"]<!-- --> (exec form)</li></ul><p>In our example, RUN executes a <strong>command</strong> that installs MDL directly in the ruby container</p><p>Next:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">FROM ruby:latest</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">WORDIR /mdl</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">RUN gem install mdl</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ENTRYPOINT [ "/bin/bash" ]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>ENTRYPOINT, like RUN, has 2 forms! Shell form or exec form.</p><p>The exec form, which is the preferred form:</p><p>ENTRYPOINT <!-- -->["executable", "param1", "param2"]</p><p>The shell form:</p><p>ENTRYPOINT command param1 param2</p><p>In our case, we're using it in exec form so we can execute our bash.
This will leave our container open because bash is running in the background.</p><p>So, now that we have our dockerfile we have to build our container in order to run it!</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">docker build --tag user/mdl</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The <strong>---tag</strong> command names the image of the container in question.
And now that the container is build we can run it!</p><p>For this will use the following command:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">docker run -tid --name mdl -v /home/vagrant:/mdlfiles user/mdl</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To be sure if your container is running properly do a simple <code>docker ps -a</code> just to have confirmation.
Doing so will show you all of your containers details and status.</p><p>After confirming that the container is up and running we want to execute <strong>mdl</strong> to check our markdown file.
To do so we'll need to run the mdl command inside a bash that will get the .md file inside the folder that we shared and named "mdlfiles"</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">docker exec mdl bash -c "mdl /mdfile/myfile.md"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If you have some inconsistencies regarding the rules of the mdl tool you'll get a result like this:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:5: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:77: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:25: MD012 Multiple consecutive blank lines</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:51: MD012 Multiple consecutive blank lines</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:13: MD013 Line length</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:52: MD013 Line length</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:54: MD013 Line length</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:89: MD024 Multiple headers with the same content</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:19: MD026 Trailing punctuation in header</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">/mdfile/docker.md:26: MD026 Trailing punctuation in header</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>After correcting all of them you should have no return after your command! :)</p><p><strong>NOTE:</strong> if these command lines are confusing to you or you don't know what something means, please check my previous <a href="https://baditboys.netlify.app/posts/mdldocker/" target="_blank" rel="noopener noreferrer">post</a>.</p>]]></content:encoded>
            <category>docker</category>
        </item>
        <item>
            <title><![CDATA[How to install Markdown Lint in a Docker container]]></title>
            <link>https://baditboys.netlify.app/en/blog/mdldocker</link>
            <guid>https://baditboys.netlify.app/en/blog/mdldocker</guid>
            <pubDate>Mon, 19 Oct 2020 09:20:15 GMT</pubDate>
            <description><![CDATA[Hello, this post will explain how to install and use Markdown Lint in a Docker container.]]></description>
            <content:encoded><![CDATA[<p>Hello, this post will explain how to install and use Markdown Lint in a Docker container.
Please check my previous post to better understand Docker.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="before-you-start">Before you start<a href="#before-you-start" class="hash-link" aria-label="Direct link to Before you start" title="Direct link to Before you start">​</a></h2><p>Please, make sure that you checked my previous Docker post because I will be using some references to that post, and it would be easier to follow this post :)</p><p>In this case, will be using a ruby container to install our mdl tool. You show how to set up a ruby container in that previous Docker post that I mention.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="markdown-lint">Markdown Lint<a href="#markdown-lint" class="hash-link" aria-label="Direct link to Markdown Lint" title="Direct link to Markdown Lint">​</a></h3><p>This is a tool for markdown (md) files that includes a library of rules to encourage standards and consistency for Markdown files and that confirms if the files are following theses rules.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="ruby-container">Ruby container<a href="#ruby-container" class="hash-link" aria-label="Direct link to Ruby container" title="Direct link to Ruby container">​</a></h3><p>So, to start, lets run the ruby container!
Copy paste the following line into your terminal:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">docker</span><span class="token plain"> run -tid -v /home/vagrant:/mdfiles --name ruby --entrypoint</span><span class="token operator" style="color:#393A34">=</span><span class="token plain">/bin/bash ruby:latest</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Okay, so you look at this command line and ask yourself what in the world is all of this!? Well, let me explain :)</p><p>The -tid is 3 different things:</p><ul><li>-t or --tty: Allocate a pseudo-TTY</li><li>-i or --interactive: Keep STDIN open even if not attached</li><li>-d or --detach: Detached mode: run command in the background</li></ul><p>Afterwards, we do a -v for volume, that in our case, is used to mirror the folder where we have our .md file.
This will allow us to have "the same folder" in our container. Remember that the <strong>/</strong> is root and then we create a new folder in the container named "mdfiles"</p><p>Then we use the --name and as the name suggest it's to attibute a name to your container.</p><p>We run --entrypoint /bin/bash to let a bash opened. This allows the container to stay opened (up) instead of closing just after the run.
When you do an exec, it doesn't goes on bash (exec is sh and not bash).
That's why we have to make the container run bash, to be able to use all the bash command</p><p>The difference between docker run and docker exec is that docker exec executes a command on a running container. On the other hand, docker run creates a temporary container, executes the command in it and stops the container when it is $So we use --entrypoint to run a container, and let it open until we decide to stop it</p><p>You can also give a command to your container directly by doing so:
Note: If you have a windows container you use powershell instead of bash</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">docker</span><span class="token plain"> </span><span class="token builtin class-name">exec</span><span class="token plain"> ruby </span><span class="token function" style="color:#d73a49">bash</span><span class="token plain"> -c </span><span class="token string" style="color:#e3116c">"ip add"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>We execute the bash terminal with the command (-c) "ip add"
This will show you the IP adress of your ruby container</p><p>And now we can install the mdl tool:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">docker</span><span class="token plain"> </span><span class="token builtin class-name">exec</span><span class="token plain"> ruby </span><span class="token function" style="color:#d73a49">bash</span><span class="token plain"> -c </span><span class="token string" style="color:#e3116c">"gem install mdl"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Great, everything looks nice and clean!
Now, pick a .md file of your choosing, and run mdl:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">docker</span><span class="token plain"> </span><span class="token builtin class-name">exec</span><span class="token plain"> ruby </span><span class="token function" style="color:#d73a49">bash</span><span class="token plain"> -c </span><span class="token string" style="color:#e3116c">"mdl /mdfiles/myfile.md"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will run the mdl tool through your md file and will inform you of how many errors you have, the lines they are and what was the rule that wasn't respected.</p>]]></content:encoded>
            <category>docker</category>
        </item>
        <item>
            <title><![CDATA[Docker]]></title>
            <link>https://baditboys.netlify.app/en/blog/docker</link>
            <guid>https://baditboys.netlify.app/en/blog/docker</guid>
            <pubDate>Thu, 15 Oct 2020 09:20:15 GMT</pubDate>
            <description><![CDATA[Hello, this post will explain how Docker works and its basics.]]></description>
            <content:encoded><![CDATA[<p>Hello, this post will explain how Docker works and its basics.
We'll use a Vagrant and Virual Box to create a Virtual Machine dedicated to docker. You can get the vagrantfile <a href="https://app.vagrantup.com/gusztavvargadr/boxes/docker-linux" target="_blank" rel="noopener noreferrer">here</a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-is-it">What is it??<a href="#what-is-it" class="hash-link" aria-label="Direct link to What is it??" title="Direct link to What is it??">​</a></h2><p>As explained in <a href="https://opensource.com/resources/what-docker" target="_blank" rel="noopener noreferrer">opensource.com</a> Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.</p><p>In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-use-it">How to use it<a href="#how-to-use-it" class="hash-link" aria-label="Direct link to How to use it" title="Direct link to How to use it">​</a></h2><p>In order to be able to run a container we need to have it available for us.
So, to start we'll need to <strong>pull</strong> the wanted container and for this we will go to <a href="https://hub.docker.com/" target="_blank" rel="noopener noreferrer">DockerHub</a>.</p><p>For the sake of the example I'll use a Nginx and a Grafana containers.</p><p>Type in your terminal (where you runned your vagrantfile) the following command:</p><p>Nginx:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">docker</span><span class="token plain"> pull nginx</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Check out the DockerHub Nginx page for more detail <a href="https://hub.docker.com/_/nginx" target="_blank" rel="noopener noreferrer">here</a></p><p>Grafana:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">docker</span><span class="token plain"> pull grafana/grafana</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Check out the DockerHub Grafana page for more detail <a href="https://hub.docker.com/r/grafana/grafana" target="_blank" rel="noopener noreferrer">here</a></p><p>Now that we pulled the containers, they're "installed" in your machine so that you are able to use them.</p><p>But now we need to run our containers and we need to attribute them with specific ports.
To do so we'll need to use the -p command.</p><p>So, let's check how do we run a container that we have available and how do we give it a port number of our choosing.
For that, copy paste the following line in your terminal:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">docker</span><span class="token plain"> run -d --name</span><span class="token operator" style="color:#393A34">=</span><span class="token plain">grafana -p </span><span class="token number" style="color:#36acaa">3000</span><span class="token plain">:3000 grafana/grafana</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will run Grafana in the port 3000. To confirm this we'll need to go to your brower and tyoe 127.0.0.1:3000
Doing so should open your personal Grafana's site.</p><p>Note that when you do -p 3000:3000 the second number is the designated port in your host. the option is "-p container_port_number:host_port_mapped"
For example, if we do -p 3000:6000 then the ip for your grafana site will be 127.0.0.1:6000</p><p><strong>TIP:</strong> If you did all of this and still got an error opening the web page, go check your VM preferences in VIrtualBox and make sure that you add port 3000 in the Port Redirections.
To reach Port Redirections just open VirtaulBox, go to the Configuration of your Docker VM to the Network part. You'll find a Advance section and inside there will be the Port Redirection.
VB &gt; VM Configuration &gt; Network &gt; Advance &gt; Port Redirection</p>]]></content:encoded>
            <category>docker</category>
        </item>
        <item>
            <title><![CDATA[Typora / MarktText WYSIWYG Markdown editors]]></title>
            <link>https://baditboys.netlify.app/en/blog/marktext</link>
            <guid>https://baditboys.netlify.app/en/blog/marktext</guid>
            <pubDate>Fri, 14 Aug 2020 21:03:59 GMT</pubDate>
            <description><![CDATA[A WYSIWYG editor to edit Markdown files?]]></description>
            <content:encoded><![CDATA[<p>A WYSIWYG editor to edit Markdown files?</p><p>Interrested ? Follow the guide!</p><p>[Update]<!-- --> Typora is not an open-source software, and only the beta version seems to be  free. If taking habits on a free soft to later paid software bores you, we suggest using a open-source typora clone: MarkText.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="typora-marktext-from-markdown-with-love"><del>Typora</del> MarkText, From Markdown, with Love<a href="#typora-marktext-from-markdown-with-love" class="hash-link" aria-label="Direct link to typora-marktext-from-markdown-with-love" title="Direct link to typora-marktext-from-markdown-with-love">​</a></h2><p>This tool is called typora, and the official site is there: <del><a href="https://typora.io/" target="_blank" rel="noopener noreferrer">typora</a></del> <a href="https://github.com/marktext/marktext" target="_blank" rel="noopener noreferrer">MarkText</a></p><p>I present to you this tool that I will test for the series of articles around gitlab CI / CD.</p><p>It is available for Windows, Linux, and Mac OS.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="get-the-power-of-markdown-without-using-markdown">Get the power of Markdown, without using Markdown<a href="#get-the-power-of-markdown-without-using-markdown" class="hash-link" aria-label="Direct link to Get the power of Markdown, without using Markdown" title="Direct link to Get the power of Markdown, without using Markdown">​</a></h3><p>The editor features provide you the power of the markdown format, because it is possible to save files directly in markdown, but also to copy the text in markdown format.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="what-you-see-is-what-you-get">What You See Is What You Get<a href="#what-you-see-is-what-you-get" class="hash-link" aria-label="Direct link to What You See Is What You Get" title="Direct link to What You See Is What You Get">​</a></h4><p>Here is the article, in its french version, opened with typora. (MarkText would have the exact same result)</p><p><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597500080/baditboys/posts_content/2020-08-15_15-58_nbf3c2_p4agaz.webp" class="img_ev3q"></p><p>You can apply the style you want (<em>Header 1-2-3, bold, etc.</em> ) by selecting it in the menu, or using the standard shortcuts (CTRL+B, CTRL+I)</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="save-in-markdown">Save in Markdown<a href="#save-in-markdown" class="hash-link" aria-label="Direct link to Save in Markdown" title="Direct link to Save in Markdown">​</a></h4><p>You just have to save the file with marktext (only .md is authorized) or choose markdown with typora (which propose .txt too)</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="export-markdown-content">Export markdown content<a href="#export-markdown-content" class="hash-link" aria-label="Direct link to Export markdown content" title="Direct link to Export markdown content">​</a></h4><p><del>Typora</del> MarkText let you export (or copy) a part of the document, directly with the markdown syntax.</p><p>Here is the result of the export with the french version of the article:</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Un éditeur WYSIWYG pour éditSauvegarder au format MDer des fichiers Markdown ?</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Si ça vous intrigue, suivez le guide !</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> Typora, par amour du markdown</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">C'est outil s'appelle typora, et le site officiel est là: </span><span class="token url" style="color:#36acaa">[</span><span class="token url content" style="color:#36acaa">typora</span><span class="token url" style="color:#36acaa">](</span><span class="token url" style="color:#36acaa">https://typora.io/</span><span class="token url" style="color:#36acaa">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Je vous présente cet outil que je vais tester pour la série d'article autour de gitlab CI/CD.</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Il est disponible pour Windows, Linux, et en version beta (à l'heure d'acriture de ces lignes) pour Mac OS.</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">##</span><span class="token title important"> Des fonctionnalités pour profiter de la puissance du markdown</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Les fonctionnalités de l'éditeur permettent de profiter de la puissance du format markdown, car il est à la fois possible de sauvegarder des fichiers directement en markdown, mais également de copier le texte au format markdown.</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">###</span><span class="token title important"> Un éditeur wysiwyg</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Voici, par exemple, le rendu de cet article (dans sa version française)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>You only have to select the part you want to export, and use the menu entry, or use the shortcut: CTRL + MAJ + C (the shortcut works on both typora and marktext)</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="spell-checker">Spell checker<a href="#spell-checker" class="hash-link" aria-label="Direct link to Spell checker" title="Direct link to Spell checker">​</a></h4><p>I assume that you know what I am talking about.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="markdown-quality">Markdown quality<a href="#markdown-quality" class="hash-link" aria-label="Direct link to Markdown quality" title="Direct link to Markdown quality">​</a></h4><p>We use, to ensure quality of our markdown files syntax, a tool called markdownlint. The french version of the post got that result:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">$ mdl content/posts/*.md --ignore-front-matter --rules ~MD013,~MD026,~MD033</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:13: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:15: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:21: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:23: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:27: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:39: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:45: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:47: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:50: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:52: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:58: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:60: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:64: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:75: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:81: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:82: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:84: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:96: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:100: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:109: MD009 Trailing spaces</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:35: MD012 Multiple consecutive blank lines</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:36: MD012 Multiple consecutive blank lines</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:90: MD012 Multiple consecutive blank lines</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:91: MD012 Multiple consecutive blank lines</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:105: MD012 Multiple consecutive blank lines</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">content/posts/typora_fr.fr.md:106: MD012 Multiple consecutive blank lines</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The markdown syntax seems to be good. The only thing that isn't fixed by the tool is the rules that concern double spaces, spaces in the end of lines, double blank lines, etc.</p><p>In a word: everything that you can SEE on the wySiwyg.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="the-purpose-of-using-marktexttypora">The purpose of using Marktext/Typora<a href="#the-purpose-of-using-marktexttypora" class="hash-link" aria-label="Direct link to The purpose of using Marktext/Typora" title="Direct link to The purpose of using Marktext/Typora">​</a></h3><h4 class="anchor anchorWithStickyNavbar_LWe7" id="hugo-websites-posts">Hugo websites posts<a href="#hugo-websites-posts" class="hash-link" aria-label="Direct link to Hugo websites posts" title="Direct link to Hugo websites posts">​</a></h4><p><del>typora</del> MarkText is very usefull to write Hugo website text content, likes posts or authors descriptions.</p><p>For example, you can just copy the MD content in the gitlab/github web editor, paste it on Marktext, modify it, and copy as MD to re paste it on the gitlab/github editor.</p><p>You can also manage the content foder directly on the tool, but you'll have to use git in bash to push your modification on the gitlab/github repository:</p><p><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597501064/baditboys/posts_content/2020-08-15_16-16_jeccl9_gmj1gh.webp" class="img_ev3q"></p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="our-tools">Our tools<a href="#our-tools" class="hash-link" aria-label="Direct link to Our tools" title="Direct link to Our tools">​</a></h4><p>We're using a set of tool based on (or compliant with) markdown:</p><ul><li>Wikis;</li><li>Basecode READMEs;</li><li>KB;</li><li>ADR</li></ul><p>The export tool (aka <em>copy as markdown</em>) is very useful to be able to edit text as in a standard texte editor, but being able to use the power of markdown when you want to change the structure of a text. This case commonly appears when editing a wiki or a kb pages. The more we add, the more we need to review the structure.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="conclusion">Conclusion<a href="#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion">​</a></h2><p>I will start the articles about gitlab CI/CD with Marktext, and, to be honest, I truly think that I will get back to a MD editor.</p><p>But I have to confess that it is a great tool for those who want to get the power of markdown without learning/practicing the syntax. And I'm not totally sure that I will get back to a standard editor after I get habits on Marktext...</p>]]></content:encoded>
            <category>hugo-tips</category>
            <category>markdown</category>
        </item>
        <item>
            <title><![CDATA[Chocolatey]]></title>
            <link>https://baditboys.netlify.app/en/blog/chocolatey</link>
            <guid>https://baditboys.netlify.app/en/blog/chocolatey</guid>
            <pubDate>Fri, 31 Jul 2020 08:17:15 GMT</pubDate>
            <description><![CDATA[This post is to explain what is Chocolatey, how can we install it and how can we use it]]></description>
            <content:encoded><![CDATA[<p>This post is to explain what is Chocolatey, how can we install it and how can we use it</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="chocolatey">Chocolatey:<a href="#chocolatey" class="hash-link" aria-label="Direct link to Chocolatey:" title="Direct link to Chocolatey:">​</a></h2><p>Chocolatey is a module for windows to install packages (tools) on to the machine. Also known as a software management tool.</p><p>It allows us to perform various tasks via command line.</p><p>For example, "choco install tool" is the equivalent to "apt install tool" on Ubuntu.</p><p>So to install it you need to copy paste this command line to your terminal:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  Set-ExecutionPolicy Bypass -Scope Process -orce; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">SHELL</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This command will install chocolatey and allow you to use "choco install" to install other tools into your windows machine such as Git or VSCode.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="example">Example:<a href="#example" class="hash-link" aria-label="Direct link to Example:" title="Direct link to Example:">​</a></h2><p>You want to install some tools that you need and to do so you'll use Chocolatey!</p><p>So, in your terminal type any of the following commands:</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">choco install git -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">choco install vscode -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">choco install hugo -y</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These commands will install the respective tools, but you can install the tools that you need. The only thing that you need to is <strong>choco install "tool that you want"</strong> :)
Note, that the <strong>-y</strong> is to answer Yes to the questions asked by the installation process;</p>]]></content:encoded>
            <category>windows</category>
            <category>vm</category>
        </item>
        <item>
            <title><![CDATA[How to Manage Windows Features with Ansible]]></title>
            <link>https://baditboys.netlify.app/en/blog/winfeaturepost</link>
            <guid>https://baditboys.netlify.app/en/blog/winfeaturepost</guid>
            <pubDate>Fri, 22 May 2020 09:39:11 GMT</pubDate>
            <description><![CDATA[Hello everyone, the goal of this post is to explain how to manage Windows Features using Ansible playbooks;]]></description>
            <content:encoded><![CDATA[<p>Hello everyone, the goal of this post is to explain how to manage Windows Features using Ansible playbooks;</p><p>To start, lets try and understand what is what. We want to install a windows feature in our machine/vm and we want to do so by using <a href="https://agpa-88.gitlab.io/vabh/posts/ansiblepost/" target="_blank" rel="noopener noreferrer">Ansible</a> to automate all the installations and add-ons.</p><p>To do so using Ansible we need to use Ansible modules! And, in this case, we want to use <strong>win_feature</strong> module. But what are modules? Lets see:</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="modules">Modules<a href="#modules" class="hash-link" aria-label="Direct link to Modules" title="Direct link to Modules">​</a></h2><p>Ansible modules are reusable, standalone scripts that can be used by the Ansible API, or by the ansible or ansible-playbook programs.</p><p>We can use modules to install, copy, move, download and a lot of others actions. There's also a lot of different modules, and I mean a lot!</p><p>Ansible has modules for Cloud, Database, Network, Monitoring, Windows, almost everything you can imagine!</p><p>But for this post we'll be focusing just on a specific windows module provided by Ansible that is <strong>win_feature</strong> module.</p><p><strong>NOTE</strong> that this is just a quick overview of what modules are! You can check the official Ansible documetation on <a href="https://docs.ansible.com/ansible/latest/modules/modules_by_category.html" target="_blank" rel="noopener noreferrer">Modules</a> to have a more in depth analyses.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="win_feature">win_feature<a href="#win_feature" class="hash-link" aria-label="Direct link to win_feature" title="Direct link to win_feature">​</a></h2><p>This module installs or uninstalls Windows Roles or Features on Windows Server.</p><p>But, to know which feature we want to install we need to find its name. And for that we'll use a command that will list all of the features with the added information if they're installaed or not.</p><p>So type in your terminal the following:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Get-WindowsFeature</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This should return a full list of the features:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">PS C:\&gt; Get-WindowsFeature</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Display Name                                            Name                       Install State</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">------------                                            ----                       -------------</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[ ] Active Directory Certificate Services               AD-Certificate                 Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [ ] Certification Authority                         ADCS-Cert-Authority            Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [ ] Certificate Enrollment Policy Web Service       ADCS-Enroll-Web-Pol            Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [ ] Certificate Enrollment Web Service              ADCS-Enroll-Web-Svc            Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [ ] Certification Authority Web Enrollment          ADCS-Web-Enrollment            Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [ ] Network Device Enrollment Service               ADCS-Device-Enrollment         Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [ ] Online Responder                                ADCS-Online-Cert               Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">(...)</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[X] Web Server (IIS)                                    Web-Server                     Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [X] Web Server                                      Web-WebServer                  Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [X] Common HTTP Features                        Web-Common-Http                Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Default Document                        Web-Default-Doc                Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Directory Browsing                      Web-Dir-Browsing               Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] HTTP Errors                             Web-Http-Errors                Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Static Content                          Web-Static-Content             Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] HTTP Redirection                        Web-Http-Redirect              Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] WebDAV Publishing                       Web-DAV-Publishing             Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [X] Health and Diagnostics                      Web-Health                     Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] HTTP Logging                            Web-Http-Logging               Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Custom Logging                          Web-Custom-Logging             Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Logging Tools                           Web-Log-Libraries              Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] ODBC Logging                            Web-ODBC-Logging               Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Request Monitor                         Web-Request-Monitor            Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Tracing                                 Web-Http-Tracing               Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [X] Performance                                 Web-Performance                Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Static Content Compression              Web-Stat-Compression           Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            [X] Dynamic Content Compression             Web-Dyn-Compression            Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">(...)</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[X] .NET Framework 4.7 Features                         NET-Framework-45-Fea...        Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [X] .NET Framework 4.7                              NET-Framework-45-Core          Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [ ] ASP.NET 4.7                                     NET-Framework-45-ASPNET        Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    [X] WCF Services                                    NET-WCF-Services45             Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [ ] HTTP Activation                             NET-WCF-HTTP-Activat...        Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [ ] Message Queuing (MSMQ) Activation           NET-WCF-MSMQ-Activat...        Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [ ] Named Pipe Activation                       NET-WCF-Pipe-Activat...        Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [ ] TCP Activation                              NET-WCF-TCP-Activati...        Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        [X] TCP Port Sharing                            NET-WCF-TCP-PortShar...        Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">(...)</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now we can see a full list of all Windows features (in the example above there's only a selected few) with the added information if they're installed or not.</p><p>This could be a great way to see what features do you need to add to your playbook.</p><p>Now, let me show you a way to find out if a a feature that you already know the name is installed or not.</p><p>For this case we'll search for the .NET Framework feature. We're going to check the feature correct name and if it's installed or not.</p><p>For that we'll use the command below:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Get-WindowsFeature | Where-Object {$_. name-match ".Net"} | Format-List Name,DisplayName, Installstate | more</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will return the following:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Print-Internet</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : Internet Printing</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Web-Net-Ext</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : .NET Extensibility 3.5</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Web-Net-Ext45</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : .NET Extensibility 4.7</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Web-Asp-Net</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : ASP.NET 3.5</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Web-Asp-Net45</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : ASP.NET 4.7</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : NET-Framework-45-ASPNET</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : ASP.NET 4.7                             #As you can see the feature is available, therefore not installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : BitLocker-NetworkUnlock</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : BitLocker Network Unlock</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Internet-Print-Client</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : Internet Printing Client</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Telnet-Client</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : Telnet Client</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : WAS-NET-Environment</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : .NET Environment 3.5</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Available</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : Wireless-Networking</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : Wireless LAN Service</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Available</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now that we confirmed the name and the install state we can add to our playbook.yaml the win_feature module that we talked about earlier in the post.</p><p>Lets take a look at playbook.yaml containing the <strong>win_feature</strong> module</p><div class="language-yaml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-yaml codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">---</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">-</span><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> Install Windows Features</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token key atrule" style="color:#00a4db">hosts</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> all</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token key atrule" style="color:#00a4db">tasks</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">          </span><span class="token punctuation" style="color:#393A34">-</span><span class="token plain"> </span><span class="token key atrule" style="color:#00a4db">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> Install .Net Framework 4.5</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token key atrule" style="color:#00a4db">win_feature</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">                    </span><span class="token key atrule" style="color:#00a4db">name</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> NET</span><span class="token punctuation" style="color:#393A34">-</span><span class="token plain">Framework</span><span class="token punctuation" style="color:#393A34">-</span><span class="token plain">45</span><span class="token punctuation" style="color:#393A34">-</span><span class="token plain">ASPNET</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">                    </span><span class="token key atrule" style="color:#00a4db">state</span><span class="token punctuation" style="color:#393A34">:</span><span class="token plain"> present</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>As you can see, playbook.yaml will install the latest .Net Framework Windows feature.</p><p>Lets search for the .net Framework feature on our terminal and see what changed:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">PS C:\&gt; Get-WindowsFeature | Where-Object {$_. name-match "NET-Framework-45-ASPNET"} | Format-List Name,DisplayName, Installstate | more</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Name         : NET-Framework-45-ASPNET</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">DisplayName  : ASP.NET 4.7</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">InstallState : Installed</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>And there it is! We successfully installed a windows feature of our choosing using Ansible playbooks!</p><p>Now, is up to you to see what Windows Feature do you wish to install on your server!</p><p>Remember that you can make a playbook installing as many features as you wish.
I hope that this post will help you understand a bit better the win_feature module :)</p>]]></content:encoded>
            <category>devops</category>
            <category>virtualization</category>
        </item>
        <item>
            <title><![CDATA[Vagrant Plugins]]></title>
            <link>https://baditboys.netlify.app/en/blog/pluginspost</link>
            <guid>https://baditboys.netlify.app/en/blog/pluginspost</guid>
            <pubDate>Wed, 20 May 2020 15:44:47 GMT</pubDate>
            <description><![CDATA[Hello everyone, I've created this post to explain what is a Plugin on Vagrant, how to install them and use them correctly in our vagrantfile;]]></description>
            <content:encoded><![CDATA[<p>Hello everyone, I've created this post to explain what is a <strong>Plugin</strong> on Vagrant, how to install them and use them correctly in our vagrantfile;
This post will be updated as I'll get more information about other plugins</p><p>To start lets take a look at a simple vagrantfile containing a Windows Server 2019 box:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This is just to give you a visual of a very simple vagrantfile containing just the box, the name of the vm, RAM memory and a shell terminal ready to go.</p><p>Let's proceed!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="reload">Reload<a href="#reload" class="hash-link" aria-label="Direct link to Reload" title="Direct link to Reload">​</a></h2><p>What's the use of <strong>reload</strong> ?</p><p>Well, using reload in your vagrantfile is the same as doing a reboot in your machine;</p><p>So, lets put this into context;</p><p>Say that we've installed Chocolatey and want to use it to install git.</p><p>Well that's easy, but we can't do it right away because since the vm was not reloaded (rebooted) it can't take into account the modification made previously;</p><p>So, to fix this, we need to add a reload provisioner to our vagrantfile!</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">config.vm.provision :reload</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The above command is what we need to add to our <strong>vagrantfile</strong> but we can't use it if it's not installed.</p><p>So,to install the <strong>reload</strong> porvisioner open a Powershell terminal and type:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">vagrant plugin install vagrant-reload</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will install the plugin that will allow you to use the <strong>reload</strong> provisioner on our vagrantfile;</p><p>Do you remember our simple vagrantfile ? Lets take a look of how the vagrantfile looks with the installation of Chocolatey:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>In our vagrantfile above, we install Chocolatey. But, remember, we want to use it to install our tools and without reloading the vm this won't be possible!</p><p>What we're going to do is, reload after installing Chocolatey and after reloading where going to open a new <strong>Shell</strong> terminal provisioner so we can install Git using Chocolatey;</p><p>So, lets take a look at our vagrantfile and see how all of this works put togheter:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision :reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    choco install git -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Great! We achieved the installation of the plugin and the successful reload of our vm !</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="disk-size">Disk Size<a href="#disk-size" class="hash-link" aria-label="Direct link to Disk Size" title="Direct link to Disk Size">​</a></h2><p>Another usefull plugin is the <strong>Disk Size</strong>!</p><p>This plugin will allow us to manage the disk size of our vm (everybody who uses Vagrant knows that this is a sensible issue :) )</p><p>As seen previous, we first need to install the plugin directly to our machine so we can use it in our vagrantfile.</p><p>So, copy paste the following:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">vagrant plugin </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> vagrant-disksize</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Great, the plugin is installed and ready to be put to work!</p><p>Lets see how it looks:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">config.disksize.size = '40GB'</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>As you can see, i want have a 40gb disk size. but where should we place it? Lets have a look at a basic vagrantfile:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Very simple and basic vagrantfile but there's something missing! Where's the <strong>disk size</strong>?</p><p>Well, since it's a part of the configuration of the vm we will place it just after the vm box:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  wvm.disksize.size = "40GB"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>And there it is! You can now create vm's with the amount of disk size that you wish :)</p><p><strong>NOTE:</strong> If you start your vm and see that your windows vm doesn't have the disk size you attributed and probably only have up to 20gb of disk size.</p><p>The other amount is not attributed to the right partition.
To correct this we'll type the following command into a Powershell:
(don't forget at the end of the command line to add your GB, in my case I gave 40gb so i'll put 39 at the end of the command)</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Resize-Partition -DriveLetter C -Size 39gb</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Hope to see you soon on the next post :)</p>]]></content:encoded>
            <category>devops</category>
            <category>virtualization</category>
        </item>
        <item>
            <title><![CDATA[Gérer plusieurs auteurs grâce à la taxonomie]]></title>
            <link>https://baditboys.netlify.app/en/blog/taxonomy</link>
            <guid>https://baditboys.netlify.app/en/blog/taxonomy</guid>
            <pubDate>Mon, 18 May 2020 13:49:56 GMT</pubDate>
            <description><![CDATA[Not all themes have the ability to manage multiple authors within a blog. And I'm probably a bad observer, because I didn't see, in the presentation of the available themes, if a theme natively manages several authors or not.]]></description>
            <content:encoded><![CDATA[<p>Not all themes have the ability to manage multiple authors within a blog. And I'm probably a bad observer, because I didn't see, in the presentation of the available themes, if a theme natively manages several authors or not.</p><p>It's quite unpleasant to have found THE perfect theme, and that a simple functionality is missing. So I decided to "trick", and use the native taxonomy management, in order to register several authors on a blog. And for the time being, it works pretty well.</p><p>To write this article, I was inspired by the following tutorial: <a href="https://www.netlify.com/blog/2018/07/24/hugo-tips-how-to-create-author-pages/" target="_blank" rel="noopener noreferrer">How to create author pages</a>.</p><p>I take care to complete it only on the points for which I had to experiment a lot.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="uses-of-taxonomies">Uses of taxonomies<a href="#uses-of-taxonomies" class="hash-link" aria-label="Direct link to Uses of taxonomies" title="Direct link to Uses of taxonomies">​</a></h2><p>There are two standard taxonomies in Hugo:</p><ul><li>Tags;</li><li>Categories.</li></ul><p>To use Hugo's standard taxonomies, or those native to the chosen theme, it's very simple, you just have to add to your archetype the following elements:</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token front-matter-block punctuation" style="color:#393A34">---</span><span class="token front-matter-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">tags</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml"> faire son site</span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml"> hugo</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml">tips</span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">categories</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml"> hugo</span><span class="token front-matter-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block"></span><span class="token front-matter-block punctuation" style="color:#393A34">---</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>LThe principle is simple: as soon as you add a category or a tag, and the theme manages it well, you will find a page <code>http://[votresite]/tags/</code> and another one called <code>/catégories/</code> that list tags and categories, and a page per item listing the articles that mention the item in their archetypes.</p><p>Now let's see how to create a new taxonomy that would open the possibility to add one or more authors to an article.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="creating-a-taxonomy">Creating a taxonomy<a href="#creating-a-taxonomy" class="hash-link" aria-label="Direct link to Creating a taxonomy" title="Direct link to Creating a taxonomy">​</a></h2><p>Each taxonomy has two templates:</p><ul><li>list.html, which corresponds to the template of the page that will describe one of the items (an author, for us, and all the articles linked to it)</li><li>terms.html, which corresponds to the page that will list all the items of a taxonomy (all the authors, therefore)</li></ul><p>In our case, we will create an author taxonomy. It will be post authors, and not book authors, as in the example of the previous link.</p><p>We are going to work in two tree structures:</p><ul><li>the <em>content</em> folder, logically at the root of the hugo site ;</li><li>the <em>layout</em> folder of the theme used by the site.</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="the-data-concerning-the-items-of-the-taxonomy">The data concerning the items of the taxonomy<a href="#the-data-concerning-the-items-of-the-taxonomy" class="hash-link" aria-label="Direct link to The data concerning the items of the taxonomy" title="Direct link to The data concerning the items of the taxonomy">​</a></h3><p>In the <em>content</em> folder, we will create a folder for each author, in which a <em>_index.md</em> file will be placed,</p><div class="language-files codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-files codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">content</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└── authors/</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    ├── j0rdan-m/</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    │   └── _index.md</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    └── author-2/</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        └── _index.md</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Each <em>_index.md</em> describes an author, and is composed as follows:</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token front-matter-block punctuation" style="color:#393A34">---</span><span class="token front-matter-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">name</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"> j0rdan</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml">m</span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">photo</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"> </span><span class="token front-matter-block front-matter yaml language-yaml string" style="color:#e3116c">'https://j0rdan-m.gitlab.io/blog/pearlbonnet.png'</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">twitter</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"> </span><span class="token front-matter-block front-matter yaml language-yaml string" style="color:#e3116c">'@j0rdan_m'</span><span class="token front-matter-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block"></span><span class="token front-matter-block punctuation" style="color:#393A34">---</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">j0rdan is an author of the blog</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="meta-data">Meta-data<a href="#meta-data" class="hash-link" aria-label="Direct link to Meta-data" title="Direct link to Meta-data">​</a></h3><p>The data concerning the authors are ready, now we have to set up the meta-data.</p><p>To do this, we will have to create an <em>outside</em> folder in the layout of our theme (and not the taxonomies folder, which may be surprising).</p><div class="language-files codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-files codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">my_theme/</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">└── layout/</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    └── authors/</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        └── list.html</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        └── terms.html</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>wThe <em>list.html</em> file does not list the authors, but the articles that mention the authors (or any other choice of taxonomy).</p><p>So, here is the basic content of the <em>list.hml</em> file:</p><div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">{{ .Params.name }}</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">img</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">src</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">{{ .Params.photo }}</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">alt</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">/&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">h2</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Bio</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">h2</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ .Content }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ with .Params.twitter }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">p</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">a</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">https://twitter.com/{{ substr . 1 }}</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">      Follow {{ $.Params.name }} on Twitter</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">a</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">p</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ end }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">h2</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Articles</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">h2</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">ul</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ range .Data.Pages }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">li</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">a</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">{{ .Permalink }}</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">{{ .Title }}</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">a</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">li</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ end }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">ul</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The <em>terms.html</em> file is the template of the page that will list all the authors, and propose a link for each one:</p><div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">Authors</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">h1</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">ul</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ range .Data.Pages }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">li</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">a</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">{{ .Permalink }}</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">{{ .Params.name }}</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">a</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">li</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ end }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">ul</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Warning, it will be necessary to integrate upstream and downstream of the proposed codes the content of the theme, taking example on the default page (probably in <em>themes/my_theme/layouts/_default/single.html</em>)</p><p>The theme used by this blog offered a nice comment to isolate the theme info from the content (thanks to the <code>&lt;section&gt;&lt;/section&gt;</code> tag. Another theme I use mentions </p><main></main>)<p></p><p>Since we are on this <em>single.html</em> page, we will be able to add a mention of the authors:</p><div class="language-html codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-html codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">{{- range .Params.authors }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  {{- with $.Site.GetPage "taxonomyTerm" (printf "authors/%s" (urlize .)) }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">figure</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">img</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">src</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">{{ .Params.photo }}</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">alt</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">/&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">figcaption</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">a</span><span class="token tag" style="color:#00009f"> </span><span class="token tag attr-name" style="color:#00a4db">href</span><span class="token tag attr-value punctuation attr-equals" style="color:#393A34">=</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag attr-value" style="color:#e3116c">{{ .Permalink }}</span><span class="token tag attr-value punctuation" style="color:#393A34">"</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">{{ .Params.name }}</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">a</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">figcaption</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">figure</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  {{ end }}</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">{{ end }}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This mention is to be added at the place of the page where you want it to appear, of course.</p><p>Finally, now that everything is ready, we can declare the taxonomy in our config.toml file, by adding the following note:</p><div class="language-ini codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ini codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">[taxonomies]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  author = "authors"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  tag = "tags"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  category = "categories"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>On a personal note, I have manually added an entry in the menu, knowing that the viewing address of your taxonomy will be: <code>http://[mon site]/authors/</code></p><p>So that's how, thanks to taxonomies, this blog became a multi-author blog.</p>]]></content:encoded>
            <category>hugo-tips</category>
        </item>
        <item>
            <title><![CDATA[Windows Server with Vagrant, WSL and Ansible]]></title>
            <link>https://baditboys.netlify.app/en/blog/wslvmpost</link>
            <guid>https://baditboys.netlify.app/en/blog/wslvmpost</guid>
            <pubDate>Tue, 12 May 2020 09:20:15 GMT</pubDate>
            <description><![CDATA[Hello again, this post will explain how to create a Windows Server virtual machine with Vagrant, WSL and Ansible.]]></description>
            <content:encoded><![CDATA[<p>Hello again, this post will explain how to create a Windows Server virtual machine with Vagrant, WSL and Ansible.
I assume that you already saw my previous Windows Server post where I explain how to create a <a href="https://agpa-88.gitlab.io/vabh/posts/windowsserver/" target="_blank" rel="noopener noreferrer">Windows Server</a> vm, so go check that out if you didn't :)</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="before-we-start-plugins">Before we start, Plugins!<a href="#before-we-start-plugins" class="hash-link" aria-label="Direct link to Before we start, Plugins!" title="Direct link to Before we start, Plugins!">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="installation">Installation<a href="#installation" class="hash-link" aria-label="Direct link to Installation" title="Direct link to Installation">​</a></h3><h4 class="anchor anchorWithStickyNavbar_LWe7" id="windows">Windows<a href="#windows" class="hash-link" aria-label="Direct link to Windows" title="Direct link to Windows">​</a></h4><p>So, to put in action some plugins into our Vagrantfile we need to installed them directly to our terminal.</p><p>To do so, open an Powershell and install the following plugins (note that this plugin is for Windows OS):</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">vagrant plugin install vagrant-reload</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will allow us to reload our vm during the creation of the vm.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="others-os">Others OS<a href="#others-os" class="hash-link" aria-label="Direct link to Others OS" title="Direct link to Others OS">​</a></h4><p>Now, we want to use windows features but are using a Linux or MacOS.</p><p>For that, we need to install the following plugins in our Linux or MacOS machine:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">vagrant plugin </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> vagrant-reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vagrant plugin </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> winrm</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vagrant plugin </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> winrm-fs</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">vagrant plugin </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> winrm-elevated</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will allow us to reload our vm and to use windows features with vagrant;</p><p>Now that we've have our plugins installed lets continue;</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="wsl">WSL<a href="#wsl" class="hash-link" aria-label="Direct link to WSL" title="Direct link to WSL">​</a></h2><p>What's WSL and what it does? WSL stands for Windows Subsystem for Linux and, by installing it on our Windows Server, it will allow us, basically, to have Linux on a Windows terminal.</p><p>Meaning that you can, for example, install a tool in your Windows vm using Linux commands like <strong>wsl sudo apt ansible -y</strong> (this command will install Ansible in your Windows virtual machine).</p><p>But to use WSL we need to install it! And to install it we're going to use Vagrant. Lets take a look at our Vagrantfile:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If this vagrantfile looks familiar it should! This is the vagrantfile from our previous post where we define our machine configuration and installed Chocolatey.</p><p>Now what we want to do is install WSL and to do so we need to add the installation command into our Shell provisioner.</p><p>So, copy paste this to the shell terminal in your vagranfile:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Enable-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online -NoRestart -WarningAction SilentlyContinue</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>So, our vagrantfile should look like this for now:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Enable-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online -NoRestart -WarningAction SilentlyContinue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>So, we now have WSL installed in our Windows Server vm! This is great and we now have the freedom to use it at will!</p><p>Since we installed Chocoaltey and WSL we want to be sure that the machine takes in to account the modifications applied.</p><p>For that we will use a provisioner (shell) reload:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision :reload</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>We will add this after our shell provisioner just like this:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Enable-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online -NoRestart -WarningAction SilentlyContinue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # trigger reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision :reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now that our provisioner is reloaded we can install Kali Linux (Linux distribution base on Debian).</p><p>For that we're going to open another termninal and use chocolatey to install it.</p><p>Right after installing kali linux we're going to reload our provisioner once again.</p><p>This will give us certitude that everything was restarted including the virtual machine itself!</p><p>So, lets see what we need to add:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">  # execute code after reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    choco install wsl-kalilinux -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # trigger reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision :reload</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>And now that everything is fresh and clean lets open another shell terminal and start using WSL!</p><p>To start using WSL and see if it works lets add a shell with a simple package update:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">wsl sudo apt update</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Pretty easy right? So, lets see how we can use it effectively.</p><p>To try it out lets install some tools that we're going to need.</p><p>So lets install Ansible and unzip package:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Enable-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online -NoRestart -WarningAction SilentlyContinue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # trigger reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision :reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # execute code after reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo apt update</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo apt install -y ansible</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo apt install -y unzip</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Why do we need to install Ansible and Unzip might you ask? Well, we'll need to unzip some files so that's why we need Unzip.</p><p>For Ansible it requires a little bit more explaination, come with me :)</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="ansible">Ansible<a href="#ansible" class="hash-link" aria-label="Direct link to Ansible" title="Direct link to Ansible">​</a></h2><p>Ansible is an automation engine, that works with <strong>.yml</strong> files called playbooks, that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.</p><p>It uses no agents and no additional custom security infrastructure, so it's easy to deploy - and most importantly, it uses a very simple language (YAML, in the form of Ansible Playbooks) that allow you to describe your automation jobs in a way that approaches plain English.</p><p>We also have a <strong>hosts</strong> (also known as Inventory) file. That's where we're going to add our target machines that we wish to run the playbooks.</p><p>Go check the link for a more deep and detailed information about <a href="https://www.ansible.com/overview/how-ansible-works" target="_blank" rel="noopener noreferrer">Ansible</a> and what it does</p><p>So, to use Ansible we need a working playbook, hosts and a bunch  of other stuff! And for that we're going to use <strong>wget</strong> to donwload a zip file containing all of this (our unzip package will come in handy :D )</p><p>Just copy paste this to your provisioner:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">    wsl wget https://github.com/j0rdan-m/vagrant_wsl_ansible/archive/master.zip</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will download the zip file.</p><p>But we need to unzip it, so:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">    wsl unzip master.zip</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Thanks to this work we now have working playbooks available to us.</p><p>But before we check them out lets configure our <strong>hosts file</strong>. We will just add the localhost machine into the hosts file with an user, password, connection method and port configuration.</p><p>If everything is correct this should work perfectly with your playbooks</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo [self] &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo 127.0.0.1 &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo [self:vars] &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_port=5985 &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_connection=winrm &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_winrm_transport=basic &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_user=vagrant &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_password=vagrant &gt;&gt; /etc/ansible/hosts"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>And, just to be sure that everything is correct, lets ping our vm:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible self -m win_ping</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now that the hosts file is correct we can advance to our playbooks!</p><p>We have 3 to be exact! One to install IIS, one to install some tools (Git, VSCode and SumatraPDF) and the last one that creates a service user and gives him the rights to the correct folders.</p><p>To use them we need to use <strong>ansible-playbook</strong> command just like this:</p><div class="language-powershell codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-powershell codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible-playbook vagrant_wsl_ansible-master/tools.yml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible-playbook vagrant_wsl_ansible-master/iis.yml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible-playbook vagrant_wsl_ansible-master/users.yml</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This will launch each playbook in the order presented.</p><p>So, our playbook should look something like this:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Enable-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online -NoRestart -WarningAction SilentlyContinue</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # trigger reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision :reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # execute code after reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    choco install wsl-kalilinux -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # trigger reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision :reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  # execute code after reload</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo apt update</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo apt install -y ansible</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo apt install -y unzip</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl wget https://github.com/j0rdan-m/vagrant_wsl_ansible/archive/master.zip</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl unzip master.zip</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo [self] &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo 127.0.0.1 &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo [self:vars] &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_port=5985 &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_connection=winrm &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_winrm_transport=basic &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_user=vagrant &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl sudo bash -c "echo ansible_password=vagrant &gt;&gt; /etc/ansible/hosts"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible self -m win_ping</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible-playbook vagrant_wsl_ansible-master/tools.yml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible-playbook vagrant_wsl_ansible-master/iis.yml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    wsl ansible-playbook vagrant_wsl_ansible-master/users.yml</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>We now have a fully working Windows Server virtual machine with Ansible and a bunch of other cool stuff in it!</p><p>Hope that this was helpfull and make sure to check the other posts ;)</p>]]></content:encoded>
            <category>devops</category>
            <category>provisionning</category>
            <category>virtualization</category>
        </item>
        <item>
            <title><![CDATA[Create a Windows Server VM with Vagrant]]></title>
            <link>https://baditboys.netlify.app/en/blog/windowsserver</link>
            <guid>https://baditboys.netlify.app/en/blog/windowsserver</guid>
            <pubDate>Tue, 05 May 2020 09:21:08 GMT</pubDate>
            <description><![CDATA[Hello everyone, I've created this post to explain how we can create a Windows Server VM using Vagrant with some extra applications. We will learn how to install all of the tools that we need to make our server VM.]]></description>
            <content:encoded><![CDATA[<p>Hello everyone, I've created this post to explain how we can create a Windows Server VM using Vagrant with some extra applications. We will learn how to install all of the tools that we need to make our server VM.
We will need Vagrant, Chocolatey, Git, Hugo and VSCode.</p><p>Let's start!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="vagrant">Vagrant<a href="#vagrant" class="hash-link" aria-label="Direct link to Vagrant" title="Direct link to Vagrant">​</a></h2><p>Now lets see how we can create one to our needs and wants.</p><p>So, first things first, the VM. We decided to go with a Windows Server 2019 os and to do so we searched for a Windows Server box on <a href="https://app.vagrantup.com/boxes/search" target="_blank" rel="noopener noreferrer">vagrants box websit</a>
In the website just tap, into the search box, the type of vm your looking for (could be Linux, Windows, etc). In our case we just have to type "mcree/win2019" and you'll find it.
Inside the box page you'll find "Vagrantfile" and "New". Our interest for this post is the "Vagrantfile".
As you can see in the box page there's the initial Vagrantfile configuration. You will need this to create (up) your virtual server machine.
This is the start of our Vagrantfile:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>As you can see, we get the box for our vm and its version.</p><p>Now, lets add the name of our vm and the amount of memory (RAM) do we want to give to it:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">wvm.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now that we have our vm name and RAM capacity lets configure the network:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">wvm.vm.define "Windows Server 2019" do |web|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  web.vm.hostname = "winserver19"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  web.vm.network "public_network"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Here we define the hostname of the vm and the type of network that we wish to give the vm (Public, Private, etc)</p><p>Note that there's multiple variants of network configuration, this post will only show you the most basic way to <strong>Up</strong> your vm;</p><p>And the Vagrantfile should look something like this by now:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  wvm.vm.define "Windows Server 2019" do |web|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    web.vm.hostname = "winserver19"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    web.vm.network "public_network"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This is a very simple and easy (just how we like it) to configurate Vagrantfile.</p><p>But we want to have some tools installed on the vm when we <strong>Up</strong> our virtual machine. To do so we're going to use a terminal (shell).</p><p>So, we need to add to the Vagrantfile the terminal:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">SHELL</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This is the terminal that is going allow you to give commands to add, remove, move and a bunch of other things to the vm;</p><p>So, we're going to install Chocolatey (see below explaination of what is chocolatey and how to install it) and, using Chocolatey, we're going to install Git, VSCode and Hugo;</p><p>Note that <strong>SHELL</strong> at the end of the terminal replaces the <strong>end</strong> in the other configurations seen previously.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="chocolatey">Chocolatey<a href="#chocolatey" class="hash-link" aria-label="Direct link to Chocolatey" title="Direct link to Chocolatey">​</a></h2><p>Chocolatey is a module for windows to install packages (tools) on to the machine. For example, "choco install tool" is the equivalent to "apt install tool" on Ubuntu.
So to install it you need to copy paste this command to your vagrantfile shell provisioner:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  Set-ExecutionPolicy Bypass -Scope Process -orce; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">SHELL</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This command will install chocolatey and allow you to use "choco install" to install other tools into your windows server such as Git or VSCode.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="tools">Tools<a href="#tools" class="hash-link" aria-label="Direct link to Tools" title="Direct link to Tools">​</a></h2><p>Now you need to install the tools that you need and to do so you'll use Chocolatey!
So, add to your vagranfile shell the following commands:</p><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">choco install git -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">choco install vscode -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">choco install hugo -y</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These commands will install the respective tools, but you can install the tools that you need. The only thing that you need to is <strong>choco install "tool that you want"</strong> :)
Note, that the <strong>-y</strong> is to answer Yes to the questions asked by the installation process;</p><p>So, our Vagrantfile looks like it's complete! So lets see how it looks like with all put togheter:</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="the-complete-vagrantfile">The complete Vagrantfile<a href="#the-complete-vagrantfile" class="hash-link" aria-label="Direct link to The complete Vagrantfile" title="Direct link to The complete Vagrantfile">​</a></h2><div class="language-ruby codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ruby codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"># -*- mode: ruby -*-</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"># vi: set ft=ruby :</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Vagrant.configure("2") do |config|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box = "mcree/win2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.box_version = "1.0.1584095692"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provider "virtualbox" do |v|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.name = "Windows Server 2019"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    v.memory = "2048"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  wvm.vm.define "Windows Server 2019" do |web|</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    web.vm.hostname = "winserver19"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    web.vm.network "public_network"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  end</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  config.vm.provision "shell", inline: &lt;&lt;-SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    Set-ExecutionPolicy Bypass -Scope Process -orce; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    choco install git -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    choco install vscode -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    choco install hugo -y</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  SHELL</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">end</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>]]></content:encoded>
            <category>devops</category>
            <category>virtualization</category>
        </item>
        <item>
            <title><![CDATA[Write a readable tuto with Markdown]]></title>
            <link>https://baditboys.netlify.app/en/blog/writetips</link>
            <guid>https://baditboys.netlify.app/en/blog/writetips</guid>
            <pubDate>Tue, 28 Apr 2020 18:49:31 GMT</pubDate>
            <description><![CDATA[Hi everyone,]]></description>
            <content:encoded><![CDATA[<p>Hi everyone,</p><p>Here is how I write technicals articles, to make it readable, and usefull for the future myself who want to remember how to use that technical stuff I wrote an article about several month ago.</p><p>What you're reading is the introduction. I start by intro, because my theme take that text as summary in the first page.</p><p>Here is my post.md file beginning :</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important">*my archetype*</span><br></span><span class="token-line" style="color:#393A34"><span class="token title important"></span><span class="token title important punctuation" style="color:#393A34">--</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">Aujourd'hui, en français, je souhaite aborder le sujet des archétypes du moteur de génération de site Hugo. Ce moteur très performant est d'ailleurs utilisé pour générer ces pages.</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">&lt;!--truncate--&gt;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Some theme understand the "more balise" so my intro ends with it.</p><p>I can end my intro after the <code>&lt;!--truncate--&gt;</code> if I think it's too long, or something else.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="titles">Titles<a href="#titles" class="hash-link" aria-label="Direct link to Titles" title="Direct link to Titles">​</a></h2><p>I continue the post by using title. I think Title is important, because it allow us understand the structure of the article, and allow "power users" to go directly to the part they except to find informations.</p><p>on my previous article, about archetypes, my titles was :</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> archetypes/Default.md</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">(...)</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> archetypes/mon_mien.md</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">(...)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>I could have used a more complex structure by using second or third level of titles</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> First level</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">##</span><span class="token title important"> Second level</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">###</span><span class="token title important"> Third level</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>That code will be displayed like this on the blog :</p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="first-level">First level<a href="#first-level" class="hash-link" aria-label="Direct link to First level" title="Direct link to First level">​</a></h2><p>blablabla</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="second-level">Second level<a href="#second-level" class="hash-link" aria-label="Direct link to Second level" title="Direct link to Second level">​</a></h3><p>blablabla explained</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="third-level">Third level<a href="#third-level" class="hash-link" aria-label="Direct link to Third level" title="Direct link to Third level">​</a></h4><p>blablabla more specified</p><hr><p>It's important to put Title on your tutos. Sometimes, readers would read more than one tuto at the same time, and it's easier to go to next part when title organized the page.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="code-display">Code display<a href="#code-display" class="hash-link" aria-label="Direct link to Code display" title="Direct link to Code display">​</a></h2><p>There is two kinds of way to put code on markdown :</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="inline-code">inline code<a href="#inline-code" class="hash-link" aria-label="Direct link to inline code" title="Direct link to inline code">​</a></h3><p>This is when you use <code>``` 'my code is cool' ```</code> in the same line than the rest of the text</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="single-line-code-isolated">single line code isolated<a href="#single-line-code-isolated" class="hash-link" aria-label="Direct link to single line code isolated" title="Direct link to single line code isolated">​</a></h3><p>This is when you use :</p><div class="language-code codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-code codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">```</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">my code is cool</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">```</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The code is isolated from the rest of the paragraph</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="my-advise">My advise<a href="#my-advise" class="hash-link" aria-label="Direct link to My advise" title="Direct link to My advise">​</a></h3><p>Always use the second one. For a simple reason : People do use copy/paste. And it is so easier to copy paste a single line.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="next-tips">Next tips<a href="#next-tips" class="hash-link" aria-label="Direct link to Next tips" title="Direct link to Next tips">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="bullets">Bullets<a href="#bullets" class="hash-link" aria-label="Direct link to Bullets" title="Direct link to Bullets">​</a></h3><ul><li>Do not</li><li>use</li><li>bullet</li><li>everywhere</li></ul><p>Do it when it's usefull. There are two cases :</p><ul><li>list of stuff</li><li>list of stuff</li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="use-quote-for-quoting">Use quote for quoting<a href="#use-quote-for-quoting" class="hash-link" aria-label="Direct link to Use quote for quoting" title="Direct link to Use quote for quoting">​</a></h3><p>Use quote for quote. I know it sounds weird, but you could want to use the nice quote format for something else. Don't.</p><blockquote><p>Quote style is for quote - Dr. CssProvider</p></blockquote>]]></content:encoded>
            <category>hugo-tips</category>
        </item>
        <item>
            <title><![CDATA[How to deploy an Ubuntu virtual machine]]></title>
            <link>https://baditboys.netlify.app/en/blog/ubuntu</link>
            <guid>https://baditboys.netlify.app/en/blog/ubuntu</guid>
            <pubDate>Mon, 27 Apr 2020 15:18:01 GMT</pubDate>
            <description><![CDATA[This post will explain to you how to deploy an Ubuntu machine very easily and quick!]]></description>
            <content:encoded><![CDATA[<p>This post will explain to you how to deploy an Ubuntu machine very easily and quick!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-do-you-need">What do you need?<a href="#what-do-you-need" class="hash-link" aria-label="Direct link to What do you need?" title="Direct link to What do you need?">​</a></h2><p>We will use 2 tools to make the deployment of the Ubuntu vm very fast!</p><p>These tools are Vagrant and Virtual Box.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="installation">Installation<a href="#installation" class="hash-link" aria-label="Direct link to Installation" title="Direct link to Installation">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="by-download">By Download<a href="#by-download" class="hash-link" aria-label="Direct link to By Download" title="Direct link to By Download">​</a></h3><p>Note that you have to choose the OS where you wish to install the tool (Linux, Windows, etc...)</p><ul><li><p>Vagrant -&gt; <a href="https://www.vagrantup.com/downloads.html" target="_blank" rel="noopener noreferrer">download Vagrant</a></p></li><li><p>Virtual Box -&gt; <a href="https://www.virtualbox.org/wiki/Downloads" target="_blank" rel="noopener noreferrer">download Virtualbox</a></p></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="by-using-package-management">By using package management<a href="#by-using-package-management" class="hash-link" aria-label="Direct link to By using package management" title="Direct link to By using package management">​</a></h3><h4 class="anchor anchorWithStickyNavbar_LWe7" id="windows---chocolatey">Windows - Chocolatey<a href="#windows---chocolatey" class="hash-link" aria-label="Direct link to Windows - Chocolatey" title="Direct link to Windows - Chocolatey">​</a></h4><p>To start you need to install Chocolatey. For that I have a post explaining how to it correctly here -&gt;
Now that you have installed Chocolatey lets use it.
Lets start with VirtualBox, so for this use the following command:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">choco </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> virtualbox</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>And now Vagrant:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">choco </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> vagrant</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="linux---apt">Linux - apt<a href="#linux---apt" class="hash-link" aria-label="Direct link to Linux - apt" title="Direct link to Linux - apt">​</a></h4><p>This is the same concept as <strong>choco install</strong> but for Linux of course.
So, for Linux, we will use <strong>apt install</strong>.
For VirtualBox:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">sudo</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">apt</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> virtualbox</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>For Vagrant:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">sudo</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">apt</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> vagrant</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="deployment">Deployment:<a href="#deployment" class="hash-link" aria-label="Direct link to Deployment:" title="Direct link to Deployment:">​</a></h2><p>So, first we need the Vagrant box (don't forget to see the Vagrant post on the page to learn a bit more about Vagrant boxes). For this example we will use <a href="https://app.vagrantup.com/ubuntu/boxes/bionic64" target="_blank" rel="noopener noreferrer">Ubuntu 18.04 LTS</a></p><p>Now, in your local machine, access your terminal, create a folder for your Vagrant box and, inside your new folder, type:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">vagrant init ubuntu/bionic64</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Doing this will add the box to your local Vagrant.
And now, let's create our Ubuntu virtual machine! So tap in your terminal:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">vagrant up</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>And there it is! Your first fresh and clean Ubuntu vm!</p>]]></content:encoded>
            <category>ubuntu</category>
            <category>vm</category>
        </item>
        <item>
            <title><![CDATA[Utiliser les archetypes]]></title>
            <link>https://baditboys.netlify.app/en/blog/archetypes</link>
            <guid>https://baditboys.netlify.app/en/blog/archetypes</guid>
            <pubDate>Fri, 17 Apr 2020 12:49:31 GMT</pubDate>
            <description><![CDATA[Today I want to talk about the archetypes of the Hugo site generation engine.]]></description>
            <content:encoded><![CDATA[<p>Today I want to talk about the archetypes of the Hugo site generation engine.
This very powerful engine is used to generate these pages.</p><p>The archetypes are the elements that generate the Hugo page headers, when created with the command <code>hugo new my_file.md</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="archetypesdefaultmd">archetypes/Default.md<a href="#archetypesdefaultmd" class="hash-link" aria-label="Direct link to archetypes/Default.md" title="Direct link to archetypes/Default.md">​</a></h2><p>The default.md in the archetype applies to all the "new hugo" you will create.
This default.md is customizable, as seen in the previous article, <em>Managing content in a Hugo site</em>, but it can also be multiplied.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="archetypesmon_mienmd">archetypes/mon_mien.md<a href="#archetypesmon_mienmd" class="hash-link" aria-label="Direct link to archetypes/mon_mien.md" title="Direct link to archetypes/mon_mien.md">​</a></h2><p>Let's imagine the case of an ESN site (at random ;) ), in which we will find a home page, a certain number of 'Products' pages, 'Offers' pages and a 'blog' page.</p><p>you just have to create, in the folder <em>archetypes</em>, three files :</p><ul><li>product.md</li><li>offer.md</li><li>post.md</li></ul><p>these three files will contain the appropriate archetypes according to the type of page.</p><p>It is very simple to apply an archetype to a page: the archetype must have the same name as the directory hosting the page type!</p><p>For example, to create a product page, an offer page and a blog post, we will use these three commands:</p><div class="language-markdown codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-markdown codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> Nouvelle page produit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">hugo new produit/eaviz.md</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> Nouvelle offre Marte</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">hugo new offre/expert_ansible.md</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token title important punctuation" style="color:#393A34">#</span><span class="token title important"> Nouvel article de blog</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">hugo new post/gestion_archetype.md</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="managing-themes">Managing themes<a href="#managing-themes" class="hash-link" aria-label="Direct link to Managing themes" title="Direct link to Managing themes">​</a></h2><p>Like the config.toml of the <em>exampleSite</em> section of a theme, I strongly advise you to start from the archetype(s) proposed by a theme.
This will allow you to know the right working directories to see your pages appear in the places provided by the theme.</p>]]></content:encoded>
            <category>hugo-tips</category>
        </item>
        <item>
            <title><![CDATA[Managing content in a Hugo site]]></title>
            <link>https://baditboys.netlify.app/en/blog/content_management</link>
            <guid>https://baditboys.netlify.app/en/blog/content_management</guid>
            <pubDate>Tue, 14 Apr 2020 09:39:30 GMT</pubDate>
            <description><![CDATA[This article has the very simple objective of demystifying the elements that we want to have on the site (image in the articles, avatar, etc.). It is all the more subtle that the behavior you get with Hugo as a web server, a Hugo site deployed on gitlab Pages or a cloud cluster are not the same depending on the standard you choose to apply.]]></description>
            <content:encoded><![CDATA[<p>This article has the very simple objective of demystifying the elements that we want to have on the site (image in the articles, avatar, etc.). It is all the more subtle that the behavior you get with Hugo as a web server, a Hugo site deployed on gitlab Pages or a cloud cluster are not the same depending on the standard you choose to apply.</p><p>The purpose of this post is to clarify the way to proceed to facilitate the creation of post.</p><p><em>Disclaimer: the official tutorial is *<strong>*very bad**</strong> in the case of a site that we want to deploy under gitlab Pages !</em></p><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="page-management">Page management<a href="#page-management" class="hash-link" aria-label="Direct link to Page management" title="Direct link to Page management">​</a></h2><p>In the context of a site in blog mode, it is relatively simple.</p><p>The command <code>hugo new &lt;repertoire&gt;/&lt;nom d'article&gt;.md</code> allows you to add articles in MD format in the "directory" folder. Usually, we use "post" for a blog.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page-properties">Page properties<a href="#page-properties" class="hash-link" aria-label="Direct link to Page properties" title="Direct link to Page properties">​</a></h3><p>The properties of a page are managed in the header of the created pages.
They can be found in the following form:</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token hr punctuation" style="color:#393A34">---</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">title: "mon article"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">date: AAAA/MM/DD/THH:MM:SS</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">draft: true</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This is the standard generated by Hugo. There are two things to note:</p><ol><li>In a deployment in gitlab, only "draft: false" pages are displayed. The "draft: true" pages are ignored when building the site. It is then possible to build a site locally (with the -D option for draft) and test some pages while taking advantage of gitlab hosting.</li><li>The basic version can be completed with other information about the created page:</li></ol><ul><li>subtitle: to add a subtitle</li><li>tags: to add tags to an article</li><li>categories: to categorize the articles</li></ul><p>In short, nothing crazy, but it is useful. So, the header of the article you are reading is :</p><div class="language-md codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-md codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token front-matter-block punctuation" style="color:#393A34">---</span><span class="token front-matter-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">title</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"> </span><span class="token front-matter-block front-matter yaml language-yaml string" style="color:#e3116c">"Gérer du contenu dans un site Hugo"</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">date</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"> </span><span class="token front-matter-block front-matter yaml language-yaml datetime number" style="color:#36acaa">2020-04-14T09:39:30Z</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">draft</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"> </span><span class="token front-matter-block front-matter yaml language-yaml boolean important" style="color:#36acaa">false</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">subtitle</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"> </span><span class="token front-matter-block front-matter yaml language-yaml string" style="color:#e3116c">"Comment gérer du contenu dans un site statique généré par Hugo"</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">tags</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml"> français</span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml"> hugo</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml">tips</span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml key atrule" style="color:#00a4db">categories</span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">:</span><span class="token front-matter-block front-matter yaml language-yaml"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block front-matter yaml language-yaml"></span><span class="token front-matter-block front-matter yaml language-yaml punctuation" style="color:#393A34">-</span><span class="token front-matter-block front-matter yaml language-yaml"> hugo</span><span class="token front-matter-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token front-matter-block"></span><span class="token front-matter-block punctuation" style="color:#393A34">---</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="image-management">Image management<a href="#image-management" class="hash-link" aria-label="Direct link to Image management" title="Direct link to Image management">​</a></h3><p>To manage the images displayed in an article, here is the solution I propose, and which has the advantage of working with hugo locally, but also with a gitlab deployment:</p><ol><li>Create a sub-folder "images" in the "content" directory</li><li>Put the images you want to appear in your article</li><li>add <code>![texte alternatif](../../images/mon_image.jpg)</code> in your article, where you want the image to appear.</li></ol><hr><h2 class="anchor anchorWithStickyNavbar_LWe7" id="manage-content-related-to-themes-background-photos-avatars-etc">Manage content related to themes (background photos, avatars, etc.)<a href="#manage-content-related-to-themes-background-photos-avatars-etc" class="hash-link" aria-label="Direct link to Manage content related to themes (background photos, avatars, etc.)" title="Direct link to Manage content related to themes (background photos, avatars, etc.)">​</a></h2><p>In these cases, the management of local images can be complicated to manage if you want the operation to be identical whether you use the hugo engine locally or in the Gitlab Pages version.</p><p>That's why I propose to manage it in the following way:</p><p>Create a directory called "static" at the root of your site. Put the images you want to use directly in this directory, without putting them in a subdirectory. They will then be usable in your config.toml file by simply giving their name.</p>]]></content:encoded>
            <category>hugo-tips</category>
        </item>
        <item>
            <title><![CDATA[Go on Hugo for gitlab CI/CD]]></title>
            <link>https://baditboys.netlify.app/en/blog/hugo</link>
            <guid>https://baditboys.netlify.app/en/blog/hugo</guid>
            <pubDate>Sat, 11 Apr 2020 21:03:59 GMT</pubDate>
            <description><![CDATA[To be honnest, I wasn't sure that would be the best website FW i would discover.]]></description>
            <content:encoded><![CDATA[<p>To be honnest, I wasn't sure that would be the best website FW i would discover.
Actually, using md files, fast build for html producing, and the gitlab CI/CD compliance is something very exciting !</p><p>But you should start carefully, because the quickstart isn't compliant with a gitlab Pages deployment.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-quickstart-with-hugo">How to quickstart with hugo<a href="#how-to-quickstart-with-hugo" class="hash-link" aria-label="Direct link to How to quickstart with hugo" title="Direct link to How to quickstart with hugo">​</a></h2><p>This is how I think you should start with Hugo :</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-1---theme-selection">step 1 - Theme selection<a href="#step-1---theme-selection" class="hash-link" aria-label="Direct link to step 1 - Theme selection" title="Direct link to step 1 - Theme selection">​</a></h3><p>First, choose <strong><em>carefully</em></strong> the thème you want to use. It's important because the way you'll configure your website could be (very) specific to your theme.</p><p>To choose wisely, you juste have to go on <a href="https://themes.gohugo.io" target="_blank" rel="noopener noreferrer">themes.gohugo.io</a> and look at demo.
All demos include the markdown syntax restitution, which could allow you to be sure that the theme answer your desire !</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-2---website-name">step 2 - Website name<a href="#step-2---website-name" class="hash-link" aria-label="Direct link to step 2 - Website name" title="Direct link to step 2 - Website name">​</a></h3><p>Second, choose wisely the website name.
Because it has to be the folder name. when you'll deploy your website on gitlab Pages, you would have the following website <code>URL : http://username.gitlab.io/foldername/</code></p><p>If you're creating a blog, "blog" would be a good name. If you're on website to propose a product, "productName" would be wise.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-3---website-creation">step 3 - website creation<a href="#step-3---website-creation" class="hash-link" aria-label="Direct link to step 3 - website creation" title="Direct link to step 3 - website creation">​</a></h3><p>Easiest part of the tutorial. Do nothing else typing the following command :</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">hugo new site &lt;foldername&gt;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now, you've a new folder called <em>foldername</em> with some stuff in it. Before doing anything, follow the next step. DO NOT ENTER IN THE NEW FOLDER</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-4---theme-downloading">step 4 - theme downloading<a href="#step-4---theme-downloading" class="hash-link" aria-label="Direct link to step 4 - theme downloading" title="Direct link to step 4 - theme downloading">​</a></h3><p>Go on your chosen theme repository and DO NOT CLONE the git repository. Get the zip file, and unzip it on <em>foldername/themes/themeName</em>.</p><p>Be carefull, the content of the theme has to be on <em>themeName</em>, not on <em>themeName/hugo-theme-name-master</em>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-5---use-examplesite-as-template">step 5 - Use exampleSite as template<a href="#step-5---use-examplesite-as-template" class="hash-link" aria-label="Direct link to step 5 - Use exampleSite as template" title="Direct link to step 5 - Use exampleSite as template">​</a></h3><p>Copy the <em>themeName/exampleSite/config.toml</em> directly on your <em>foldername</em>, replacing the standard one.</p><p>On the config.toml file, modify the theme selection line by</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">theme = "&lt;themeName&gt;"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Since you want to use hugo with gitlab pages, you should also modify the <em>baseURL</em> on config.toml :</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">baseurl = "https://&lt;username&gt;.gitlab.io/&lt;foldername&gt;"</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="gitlab-pages-deployment">Gitlab Pages deployment<a href="#gitlab-pages-deployment" class="hash-link" aria-label="Direct link to Gitlab Pages deployment" title="Direct link to Gitlab Pages deployment">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="warning">Warning<a href="#warning" class="hash-link" aria-label="Direct link to Warning" title="Direct link to Warning">​</a></h3><p>DO NOT GIT INIT ANYTHING ! You'll create a gitlab project and you'll init</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-6---create-gitlab-project">step 6 - Create gitlab project<a href="#step-6---create-gitlab-project" class="hash-link" aria-label="Direct link to step 6 - Create gitlab project" title="Direct link to step 6 - Create gitlab project">​</a></h3><p>On gitlab, create a new projet, called by the same name as your folder name. Do not initialize it with a readme or something else.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-7---create-your-ci-file">step 7 - Create your CI file<a href="#step-7---create-your-ci-file" class="hash-link" aria-label="Direct link to step 7 - Create your CI file" title="Direct link to step 7 - Create your CI file">​</a></h3><p>Go on your folder name, and create a file called <code>.gitlab-ci.yml</code></p><p>Edit the file with the following code :</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">image: monachus/hugo</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">variables:</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  GIT_SUBMODULE_STRATEGY: recursive</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">pages:</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  script:</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  - hugo</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  artifacts:</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    paths:</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">    - public</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  only:</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">  - master</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-8---push-your-website">step 8 - Push your website<a href="#step-8---push-your-website" class="hash-link" aria-label="Direct link to step 8 - Push your website" title="Direct link to step 8 - Push your website">​</a></h3><p>First, init the repo :</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">git init</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Then, add /public directory to our .gitignore file</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">echo "/public" &gt;&gt; .gitignore</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Finally, commit and push code to master branch</p><div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">git add .</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">git commit -m "Initial commit"</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">git remote add origin https://gitlab.com/YourUsername/your-hugo-site.git</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">git push -u origin master</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="step-9---see--wait">step 9 - See &amp; Wait<a href="#step-9---see--wait" class="hash-link" aria-label="Direct link to step 9 - See &amp; Wait" title="Direct link to step 9 - See &amp; Wait">​</a></h3><p>Go on the "CI/CD pipeline" tab of your gitlab repository</p><p>Check the build, and wait for passed. You're in ! Your website is published on <em>username</em>.gitlab.io/<em>foldername</em></p>]]></content:encoded>
            <category>hugo-tips</category>
            <category>gitops</category>
            <category>devops</category>
        </item>
        <item>
            <title><![CDATA[About The Page]]></title>
            <link>https://baditboys.netlify.app/en/blog/aboutthepage</link>
            <guid>https://baditboys.netlify.app/en/blog/aboutthepage</guid>
            <pubDate>Wed, 01 Jan 2020 13:18:41 GMT</pubDate>
            <description><![CDATA[Hello World, this is a blog about general IT items, like Vagrant, Ansible, Docker, Git, CI/CD, etc.]]></description>
            <content:encoded><![CDATA[<p>Hello World, this is a blog about general IT items, like Vagrant, Ansible, Docker, Git, CI/CD, etc.</p><p>It's only a support to formalize the research activities of two bad it boys.</p><h1>About the website:</h1><p>Here are some information about the technical stack of the website.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="the-stack">The Stack<a href="#the-stack" class="hash-link" aria-label="Direct link to The Stack" title="Direct link to The Stack">​</a></h2><p><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597159006/baditboys/posts_content/f7ac3d60-dfac-11e9-8e48-eb53c00d5867-jamstack_xuqjff_lx01df.webp" alt="jamstack icone" class="img_ev3q"></p><p>To provide this website, we're running the JAMstack: Javascript, Apis, Mark-up languages.</p><p>More precisely, our stack is composed by:</p><p><a href="https://www.markdownguide.org/" target="_blank" rel="noopener noreferrer"><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597159098/baditboys/posts_content/markdown-512_c2efvu_irbmec.webp" alt="Markdown" class="img_ev3q"></a> <!-- -->&nbsp;<!-- -->&nbsp;<a href="https://cloudinary.com/" target="_blank" rel="noopener noreferrer"><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597159961/baditboys/posts_content/cloudinary-icon_ttaqxl.webp" alt="Cloudinary" class="img_ev3q"></a> <!-- -->&nbsp;<!-- -->&nbsp;<a href="https://gohugo.io/" target="_blank" rel="noopener noreferrer"><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597159203/baditboys/posts_content/29385237_ewmdwe_iefpyv.webp" alt="Hugo" class="img_ev3q"></a> <!-- -->&nbsp;<!-- -->&nbsp;<a href="https://gitlab.com" target="_blank" rel="noopener noreferrer"><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597159283/baditboys/posts_content/1108px-GitLab_Logo.svg_kdo5im_sgbbt3.webp" alt="Gitlab" class="img_ev3q"></a> <!-- -->&nbsp;<!-- --> <a href="https://www.netlify.com/" target="_blank" rel="noopener noreferrer"><img loading="lazy" src="https://res.cloudinary.com/j0rdan-m/image/upload/v1597159345/baditboys/posts_content/netlify-logo-758722CDF4-seeklogo.com_bmlufe_fiqpm4.webp" alt="Netlify" class="img_ev3q"></a></p><p>We are writing articles in arkdown, using Cloudinary to store and share images. The blog is build with hugo, tested and deployed on Netlify by Gitlab CI/CD.</p><p>Here is our workflow:</p><p>{{<!-- -->}}</p>]]></content:encoded>
        </item>
    </channel>
</rss>