<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Openstack | Luis Cacho</title><link>https://luiscachog.io/tag/openstack/</link><atom:link href="https://luiscachog.io/tag/openstack/index.xml" rel="self" type="application/rss+xml"/><description>Openstack</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Wed, 13 Feb 2019 00:00:00 +0000</lastBuildDate><image><url>https://luiscachog.io/media/icon_hu4fa4dbbaafd6f1b45a88958b9b4a0dd0_11007_512x512_fill_lanczos_center_3.png</url><title>Openstack</title><link>https://luiscachog.io/tag/openstack/</link></image><item><title>Bulk Delete Rackspace Cloud Files data via API</title><link>https://luiscachog.io/bulk-delete-cloud-files-api/</link><pubDate>Wed, 13 Feb 2019 00:00:00 +0000</pubDate><guid>https://luiscachog.io/bulk-delete-cloud-files-api/</guid><description>&lt;p>Sometimes it is necessary to delete all the content of the Cloud Files containers, however, the API does not have a proper method to delete the data and the containers on the same API call.
Also, accoring to the documentation, you can only delete &lt;strong>empty&lt;/strong> containers.&lt;/p>
&lt;p>So, in cases where you need to delete the &lt;strong>data and the containers&lt;/strong> at the same time, you should follow the next steps:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>Download &lt;a href="https://github.com/cloudnull/turbolift" target="_blank" rel="noopener">Turbolift&lt;/a>, I know it is an old tool.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">git clone https://github.com/cloudnull/turbolift
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> turbolift
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>In order to get and isolated installation, we are going to create a Python Virtual Environment (virtualenv)&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">mkvirtualenv turbolift
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">workon turbolift
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Install the tool&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">pip install turbolift
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;li>
&lt;p>Now, prior to start to play with the API calls, we need to grab some data to authenticate with the API:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Variable&lt;/th>
&lt;th>Definition&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>USERNAME&lt;/td>
&lt;td>This is the Rackspace Public Cloud username&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>APIKEY&lt;/td>
&lt;td>This is your API-KEY&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>REGION&lt;/td>
&lt;td>This is the Region where the Cloud Files are located (dfw, ord, iad, lon, hkg)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>TOKEN&lt;/td>
&lt;td>The TOKEN is generated after you get authenticated&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>ENDPOINT&lt;/td>
&lt;td>This ENDPOINT is given also after you get authenticated&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/li>
&lt;li>
&lt;p>Next step, we are going to use &lt;a href="https://curl.haxx.se/" target="_blank" rel="noopener">cURL&lt;/a>, to perform all the API calls:&lt;/p>
&lt;ul>
&lt;li>First of all, get the TOKEN:&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">&lt;span class="nv">USERNAME&lt;/span>&lt;span class="o">=&lt;/span>YOUR-USERNAME
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">APIKEY&lt;/span>&lt;span class="o">=&lt;/span>YOUR-APIKEY
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">TOKEN&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>curl -s -XPOST https://identity.api.rackspacecloud.com/v2.0/tokens &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -d&lt;span class="s1">&amp;#39;{&amp;#34;auth&amp;#34;:{&amp;#34;RAX-KSKEY:apiKeyCredentials&amp;#34;:{&amp;#34;username&amp;#34;:&amp;#34;&amp;#39;&lt;/span>&lt;span class="nv">$USERNAME&lt;/span>&lt;span class="s1">&amp;#39;&amp;#34;,&amp;#34;apiKey&amp;#34;:&amp;#34;&amp;#39;&lt;/span>&lt;span class="nv">$APIKEY&lt;/span>&lt;span class="s1">&amp;#39;&amp;#34;}}}&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -H&lt;span class="s2">&amp;#34;Content-type:application/json&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> jq &lt;span class="s1">&amp;#39;.access.token.id&amp;#39;&lt;/span> &lt;span class="p">|&lt;/span> tr -d &lt;span class="s2">&amp;#34;\&amp;#34;&amp;#34;&lt;/span>&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>Next step, get the ENDPOINT:&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">&lt;span class="nv">ENDPOINT&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="k">$(&lt;/span>curl -s -XPOST https://identity.api.rackspacecloud.com/v2.0/tokens &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -d&lt;span class="s1">&amp;#39;{&amp;#34;auth&amp;#34;:{&amp;#34;RAX-KSKEY:apiKeyCredentials&amp;#34;:{&amp;#34;username&amp;#34;:&amp;#34;&amp;#39;&lt;/span>&lt;span class="nv">$CL_USERNAME&lt;/span>&lt;span class="s1">&amp;#39;&amp;#34;,&amp;#34;apiKey&amp;#34;:&amp;#34;&amp;#39;&lt;/span>&lt;span class="nv">$APIKEY&lt;/span>&lt;span class="s1">&amp;#39;&amp;#34;}}}&amp;#39;&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -H&lt;span class="s2">&amp;#34;Content-type:application/json&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> jq &lt;span class="s1">&amp;#39;.access.serviceCatalog[] | select((.name==&amp;#34;cloudFiles&amp;#34;) or (.name==&amp;#34;cloudFilesCDN&amp;#34;)) | {name} + .
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1"> endpoints[] | .publicURL&amp;#39;&lt;/span> &lt;span class="p">|&lt;/span> tr -d &lt;span class="s2">&amp;#34;\&amp;#34;&amp;#34;&lt;/span> &lt;span class="p">|&lt;/span> grep -v cdn &lt;span class="p">|&lt;/span> grep -i &lt;span class="nv">$REGION&lt;/span>&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>In this case we are skipping all te CDN endpoints, but you can add them if is necessary.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>With all the collected data, next step is use turbolift to delete the Cloud Files container and their data. To do it, I use a for-loop:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> i in &lt;span class="k">$(&lt;/span>curl -s -H &lt;span class="s2">&amp;#34;X-Auth-Token: &lt;/span>&lt;span class="nv">$TOKEN&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span> &lt;span class="nv">$ENDPOINT&lt;/span>&lt;span class="k">)&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="k">do&lt;/span> turbolift -u &lt;span class="nv">$USERNAME&lt;/span> -a &lt;span class="nv">$APIKEY&lt;/span> --os-rax-auth &lt;span class="nv">$REGION&lt;/span> delete -c &lt;span class="nv">$i&lt;/span> &lt;span class="p">;&lt;/span> &lt;span class="k">done&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;/li>
&lt;/ol>
&lt;p>Now, you have all the Data and Cloud Files containers deleted on one region.&lt;/p>
&lt;p>&amp;#x1f604;&lt;/p></description></item><item><title>My First Contribution to OpenStack project</title><link>https://luiscachog.io/my-first-contribution-to-openstack/</link><pubDate>Thu, 15 Mar 2018 00:00:00 +0000</pubDate><guid>https://luiscachog.io/my-first-contribution-to-openstack/</guid><description>&lt;p>I been working since last year using &lt;a href="https://www.ansible.com/" target="_blank" rel="noopener">Ansible&lt;/a> for fun and to trying to get prepared to become a DevOps, so I found an excelent OpenStack project called &lt;a href="https://github.com/openstack/ara" target="_blank" rel="noopener">ARA Records Ansible&lt;/a>.&lt;/p>
&lt;figure id="figure-ansible-logo">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="Ansible Logo" srcset="
/media/posts/my-first-contribution-to-openstack/Ansible-Logo_hub884469535c087589ce6d86f0418926d_8020_e8654a6c9737fb6cf9a9d6a845d8f829.webp 400w,
/media/posts/my-first-contribution-to-openstack/Ansible-Logo_hub884469535c087589ce6d86f0418926d_8020_34c2626c3a799dab177de63acc44cc35.webp 760w,
/media/posts/my-first-contribution-to-openstack/Ansible-Logo_hub884469535c087589ce6d86f0418926d_8020_1200x1200_fit_q90_h2_lanczos_3.webp 1200w"
src="https://luiscachog.io/media/posts/my-first-contribution-to-openstack/Ansible-Logo_hub884469535c087589ce6d86f0418926d_8020_e8654a6c9737fb6cf9a9d6a845d8f829.webp"
width="760"
height="760"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
Ansible Logo
&lt;/figcaption>&lt;/figure>
&lt;figure id="figure-ara-logo">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="ARA Logo" srcset="
/media/posts/my-first-contribution-to-openstack/ARA-Logo_hu17e4256629a5c6ba45baa8e753225cf6_37253_b02dfcb5baf4780ab653a7834a9e4c0a.webp 400w,
/media/posts/my-first-contribution-to-openstack/ARA-Logo_hu17e4256629a5c6ba45baa8e753225cf6_37253_303171032104318092c9459674593e15.webp 760w,
/media/posts/my-first-contribution-to-openstack/ARA-Logo_hu17e4256629a5c6ba45baa8e753225cf6_37253_1200x1200_fit_q90_h2_lanczos_3.webp 1200w"
src="https://luiscachog.io/media/posts/my-first-contribution-to-openstack/ARA-Logo_hu17e4256629a5c6ba45baa8e753225cf6_37253_b02dfcb5baf4780ab653a7834a9e4c0a.webp"
width="760"
height="556"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
ARA Logo
&lt;/figcaption>&lt;/figure>
&lt;p>Basically it is a project from the OpenStack community that makes it easier to understand and troubleshoot your Ansible roles and playbooks.
If you want more information, please refer to the &lt;a href="http://ara.readthedocs.io/en/latest/" target="_blank" rel="noopener">Documentation Page&lt;/a>.&lt;/p>
&lt;p>Anyhow, I just found a little bug on the Ansible Role to install ARA &lt;a href="https://opendev.org/recordsansible/ansible-role-ara" target="_blank" rel="noopener">ansible-role-ara&lt;/a> on Debian based distros and just send the patch to fix it.&lt;/p>
&lt;p>Here is the link to my &lt;a href="https://opendev.org/recordsansible/ansible-role-ara/commit/3e194e169070213c0bcfd007c97222ce318c6556" target="_blank" rel="noopener">contribution&lt;/a>.&lt;/p>
&lt;p>And, as I am proud of my first commit on a big project here is the screenshot too:&lt;/p>
&lt;figure id="figure-first-openstack-contrib">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="My First OpenStack Contribution" srcset="
/media/posts/my-first-contribution-to-openstack/OpenStack-Contribution_hue50cae8c9a4f3ce2cc82fba8663fd3f2_54865_0af5728d9b6f3d8f558a246cb97b792f.webp 400w,
/media/posts/my-first-contribution-to-openstack/OpenStack-Contribution_hue50cae8c9a4f3ce2cc82fba8663fd3f2_54865_6aa243ac01ede5843567d9273ddd14a0.webp 760w,
/media/posts/my-first-contribution-to-openstack/OpenStack-Contribution_hue50cae8c9a4f3ce2cc82fba8663fd3f2_54865_1200x1200_fit_q90_h2_lanczos_3.webp 1200w"
src="https://luiscachog.io/media/posts/my-first-contribution-to-openstack/OpenStack-Contribution_hue50cae8c9a4f3ce2cc82fba8663fd3f2_54865_0af5728d9b6f3d8f558a246cb97b792f.webp"
width="748"
height="699"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
My First OpenStack Contribution
&lt;/figcaption>&lt;/figure>
&lt;p>I feel happy and motivated to still learn about this Open-Source project and a lot more.&lt;/p>
&lt;p>&amp;#x1f604;&lt;/p></description></item></channel></rss>