<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Arrfab's blog - infra</title><link href="https://arrfab.net/" rel="alternate"></link><link href="https://arrfab.net/feeds/infra.atom.xml" rel="self"></link><id>https://arrfab.net/</id><updated>2017-10-11T00:00:00+02:00</updated><subtitle>Some tips and tricks, mostly around CentOS</subtitle><entry><title>Using Ansible Openstack modules on CentOS 7</title><link href="https://arrfab.net/posts/2017/Oct/11/using-ansible-openstack-modules-on-centos-7/" rel="alternate"></link><published>2017-10-11T00:00:00+02:00</published><updated>2017-10-11T00:00:00+02:00</updated><author><name>Fabian Arrotin</name></author><id>tag:arrfab.net,2017-10-11:/posts/2017/Oct/11/using-ansible-openstack-modules-on-centos-7/</id><summary type="html">&lt;p&gt;Suppose that you have a RDO/Openstack cloud already in place, but that you'd want to automate some operations : what can you do ? On my side, I already &lt;a href="/posts/2017/May/08/deploying-openstack-through-puppet-on-centos-7-a-journey/"&gt;mentioned&lt;/a&gt; that I used puppet to deploy initial clouds, but I still prefer Ansible myself when having to launch ad-hoc tasks, or even change configuration[s]. It's particulary true for our &lt;a href="https://ci.centos.org"&gt;CI environment&lt;/a&gt; where we run "agentless" so all configuration changes happen through Ansible.&lt;/p&gt;
&lt;p&gt;The good news is that Ansible has already some modules for &lt;a href="http://docs.ansible.com/ansible/latest/list_of_cloud_modules.html#openstack"&gt;Openstack&lt;/a&gt; but it has some requirements and a little bit of understanding before being able to use those.&lt;/p&gt;
&lt;p&gt;First of all, all the ansible os_ modules need &lt;a href="https://pypi.python.org/pypi/shade"&gt;"shade"&lt;/a&gt; on the host included in the play, and that will be responsible of all os_ modules launch. 
At the time of writing this post, it's &lt;em&gt;not&lt;/em&gt; yet available on mirror.centos.org, (a review is open so that will be soon available directly) but you can find the pkg on &lt;a href="https://cbs.centos.org/koji/buildinfo?buildID=20086"&gt;our CBS builders&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once installed, a simple os_image task was directly failing, despite the fact that auth: was present, and that's due to a simple reason : Ansible os_ modules still want to use v2 API, while it's now defaulting …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Suppose that you have a RDO/Openstack cloud already in place, but that you'd want to automate some operations : what can you do ? On my side, I already &lt;a href="/posts/2017/May/08/deploying-openstack-through-puppet-on-centos-7-a-journey/"&gt;mentioned&lt;/a&gt; that I used puppet to deploy initial clouds, but I still prefer Ansible myself when having to launch ad-hoc tasks, or even change configuration[s]. It's particulary true for our &lt;a href="https://ci.centos.org"&gt;CI environment&lt;/a&gt; where we run "agentless" so all configuration changes happen through Ansible.&lt;/p&gt;
&lt;p&gt;The good news is that Ansible has already some modules for &lt;a href="http://docs.ansible.com/ansible/latest/list_of_cloud_modules.html#openstack"&gt;Openstack&lt;/a&gt; but it has some requirements and a little bit of understanding before being able to use those.&lt;/p&gt;
&lt;p&gt;First of all, all the ansible os_ modules need &lt;a href="https://pypi.python.org/pypi/shade"&gt;"shade"&lt;/a&gt; on the host included in the play, and that will be responsible of all os_ modules launch. 
At the time of writing this post, it's &lt;em&gt;not&lt;/em&gt; yet available on mirror.centos.org, (a review is open so that will be soon available directly) but you can find the pkg on &lt;a href="https://cbs.centos.org/koji/buildinfo?buildID=20086"&gt;our CBS builders&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once installed, a simple os_image task was directly failing, despite the fact that auth: was present, and that's due to a simple reason : Ansible os_ modules still want to use v2 API, while it's now defaulting to v3 in Pike release. There is no way to force ansible itself to use v3, but as it uses shade behind the scene, there is a way to force this through &lt;a href="https://docs.openstack.org/os-client-config/latest/index.html"&gt;os-client-config&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That means that you just have to use a .yaml file (does that sound familiar for ansible ?) that will contain everything you  need to know about specific cloud, and then just in ansible declare which cloud you're configuring.&lt;/p&gt;
&lt;p&gt;That clouds.yaml file can be under $current_directory, ~/.config/openstack or /etc/openstack so it's up to you to decide where you want to temporary host it, but I selected /etc/openstack/ :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;: &lt;span class="nv"&gt;Ensuring&lt;/span&gt; &lt;span class="nv"&gt;we&lt;/span&gt; &lt;span class="nv"&gt;have&lt;/span&gt; &lt;span class="nv"&gt;required&lt;/span&gt; &lt;span class="nv"&gt;pkgs&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;ansible&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;openstack&lt;/span&gt;
  &lt;span class="nv"&gt;yum&lt;/span&gt;:
    &lt;span class="nv"&gt;name&lt;/span&gt;: &lt;span class="nv"&gt;python2&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;shade&lt;/span&gt;
    &lt;span class="nv"&gt;state&lt;/span&gt;: &lt;span class="nv"&gt;installed&lt;/span&gt;

&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;: &lt;span class="nv"&gt;Ensuring&lt;/span&gt; &lt;span class="nv"&gt;local&lt;/span&gt; &lt;span class="nv"&gt;directory&lt;/span&gt; &lt;span class="nv"&gt;to&lt;/span&gt; &lt;span class="nv"&gt;hold&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;os&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;client&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;config&lt;/span&gt; &lt;span class="nv"&gt;file&lt;/span&gt;
  &lt;span class="nv"&gt;file&lt;/span&gt;:
    &lt;span class="nv"&gt;path&lt;/span&gt;: &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;openstack&lt;/span&gt;
    &lt;span class="nv"&gt;state&lt;/span&gt;: &lt;span class="nv"&gt;directory&lt;/span&gt;
    &lt;span class="nv"&gt;owner&lt;/span&gt;: &lt;span class="nv"&gt;root&lt;/span&gt;
    &lt;span class="nv"&gt;group&lt;/span&gt;: &lt;span class="nv"&gt;root&lt;/span&gt;

&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;: &lt;span class="nv"&gt;Adding&lt;/span&gt; &lt;span class="nv"&gt;clouds&lt;/span&gt;.&lt;span class="nv"&gt;yaml&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;os&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;client&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;config&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;further&lt;/span&gt; &lt;span class="nv"&gt;actions&lt;/span&gt;
  &lt;span class="nv"&gt;template&lt;/span&gt;:
    &lt;span class="nv"&gt;src&lt;/span&gt;: &lt;span class="nv"&gt;clouds&lt;/span&gt;.&lt;span class="nv"&gt;yaml&lt;/span&gt;.&lt;span class="nv"&gt;j2&lt;/span&gt;
    &lt;span class="nv"&gt;dest&lt;/span&gt;: &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;openstack&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;clouds&lt;/span&gt;.&lt;span class="nv"&gt;yaml&lt;/span&gt;
    &lt;span class="nv"&gt;owner&lt;/span&gt;: &lt;span class="nv"&gt;root&lt;/span&gt;
    &lt;span class="nv"&gt;group&lt;/span&gt;: &lt;span class="nv"&gt;root&lt;/span&gt;
    &lt;span class="nv"&gt;mode&lt;/span&gt;: &lt;span class="mi"&gt;0700&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Of course such clouds.yaml file is itself a jinja2 template distributed by ansible on the host in the play &lt;em&gt;before&lt;/em&gt; using the os_* modules : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="x"&gt;clouds:&lt;/span&gt;
&lt;span class="x"&gt;  &lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;cloud_name&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt;:&lt;/span&gt;
&lt;span class="x"&gt;    auth:&lt;/span&gt;
&lt;span class="x"&gt;      username: admin&lt;/span&gt;
&lt;span class="x"&gt;      project_name: admin&lt;/span&gt;
&lt;span class="x"&gt;      password: &lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;openstack_admin_pass&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;span class="x"&gt;      auth_url: http://&lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt; &lt;span class="nv"&gt;openstack_controller&lt;/span&gt; &lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt;:5000/v3/&lt;/span&gt;
&lt;span class="x"&gt;      user_domain_name: default&lt;/span&gt;
&lt;span class="x"&gt;      project_domain_name: default&lt;/span&gt;
&lt;span class="x"&gt;    identity_api_version: 3&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You just have to adapt to your needs (see &lt;a href="https://docs.openstack.org/os-client-config/latest/user/configuration.html"&gt;doc&lt;/a&gt; for this) but the interesting part is the identity_api_version to force v3.&lt;/p&gt;
&lt;p&gt;Then, you can use all that in a simple way through ansible tasks, in this case adding users to a project :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Configuring&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;OpenStack&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;user&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;os_user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;cloud&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;{{ cloud_name }}&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;default_project&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;{{ item.0.name }}&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;domain&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;{{ item.0.domain_id }}&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;{{ item.1.login }}&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;{{ item.1.email }}&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;{{ item.1.password }}&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;           &lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;with_subelements&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;{{ cloud_projects }}&amp;quot;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;no_log&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;From a variables point of view, I decided to just have a simple structure to host project/users/roles/quotas like this : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nl"&gt;cloud_projects&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;domain_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;quota_cores&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;quota_instances&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;quota_ram&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;40960&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;login&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;demo_user&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nl"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="nv"&gt;@centos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nl"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Ch&lt;/span&gt;&lt;span class="nv"&gt;@ngeM3&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;role&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;admin&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;_member_&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;or&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;admin&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;login&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;demo_user2&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nl"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;demo2&lt;/span&gt;&lt;span class="nv"&gt;@centos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nl"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Ch&lt;/span&gt;&lt;span class="nv"&gt;@ngeMe2&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now that it works, you can explore all the other os_* modules and I'm already using those to :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Import cloud images in glance&lt;/li&gt;
&lt;li&gt;Create networks and subnets in neutron&lt;/li&gt;
&lt;li&gt;Create projects/users/roles in keystone&lt;/li&gt;
&lt;li&gt;Change quotas for those projects&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I'm just discovering how powerful those tools are, so I'll probably discover much more interesting things to do with those later. &lt;/p&gt;</content><category term="CentOS"></category><category term="sysadmin"></category><category term="infra"></category><category term="RDO"></category><category term="Openstack"></category><category term="ansible"></category></entry><entry><title>Using CentOS 7 armhfp VM on CentOS 7 aarch64</title><link href="https://arrfab.net/posts/2017/Sep/29/using-centos-7-armhfp-vm-on-centos-7-aarch64/" rel="alternate"></link><published>2017-09-29T00:00:00+02:00</published><updated>2017-09-29T00:00:00+02:00</updated><author><name>Fabian Arrotin</name></author><id>tag:arrfab.net,2017-09-29:/posts/2017/Sep/29/using-centos-7-armhfp-vm-on-centos-7-aarch64/</id><summary type="html">&lt;p&gt;Recently we got our hands on some aarch64 (aka ARMv8 / 64Bits) nodes running in a remote DC. On my (already too long) TODO/TOTEST list I had the idea of testing armhfp VM on top of aarch64. Reason is that when I need to test our packages, using my own &lt;a href="https://www.cubietruck.com/"&gt;Cubietruck&lt;/a&gt; or &lt;a href="https://www.raspberrypi.org/"&gt;RaspberryPi3&lt;/a&gt; is time consuming : removing the sdcard, reflashing with the correct &lt;a href="http://mirror.centos.org/altarch/7/isos/armhfp/"&gt;CentOS 7 image&lt;/a&gt; and booting/testing the pkg/update/etc ...&lt;/p&gt;
&lt;p&gt;So is that possible to just automate this through available aarch64 node as hypervisor ? Sure ! and it's just pretty straightforward if you have already played with libvirt.
Let's so start with a CentOS 7 aarch64 minimal setup and then : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;yum&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;qemu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;kvm&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt; &lt;span class="n"&gt;qemu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;kvm&lt;/span&gt; &lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;libvirt&lt;/span&gt; &lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;libguestfs&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="n"&gt;enable&lt;/span&gt; &lt;span class="n"&gt;libvirtd&lt;/span&gt; &lt;span class="c1"&gt;--now&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;That's pretty basic but for armhfp we'll have to do some extra steps : qemu normally tries to simulate a bios/uefi boot, which armhfp doesn't support, and qemu doesn't emulate the mandatory uboot to just chainload to the RootFS from the guest VM.&lt;/p&gt;
&lt;p&gt;So here is just what we need : &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Import the RootFS from an existing image&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;curl&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;mirror&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;altarch&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;isos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7 …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Recently we got our hands on some aarch64 (aka ARMv8 / 64Bits) nodes running in a remote DC. On my (already too long) TODO/TOTEST list I had the idea of testing armhfp VM on top of aarch64. Reason is that when I need to test our packages, using my own &lt;a href="https://www.cubietruck.com/"&gt;Cubietruck&lt;/a&gt; or &lt;a href="https://www.raspberrypi.org/"&gt;RaspberryPi3&lt;/a&gt; is time consuming : removing the sdcard, reflashing with the correct &lt;a href="http://mirror.centos.org/altarch/7/isos/armhfp/"&gt;CentOS 7 image&lt;/a&gt; and booting/testing the pkg/update/etc ...&lt;/p&gt;
&lt;p&gt;So is that possible to just automate this through available aarch64 node as hypervisor ? Sure ! and it's just pretty straightforward if you have already played with libvirt.
Let's so start with a CentOS 7 aarch64 minimal setup and then : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;yum&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;qemu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;kvm&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt; &lt;span class="n"&gt;qemu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;kvm&lt;/span&gt; &lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;libvirt&lt;/span&gt; &lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;libguestfs&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="n"&gt;enable&lt;/span&gt; &lt;span class="n"&gt;libvirtd&lt;/span&gt; &lt;span class="c1"&gt;--now&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;That's pretty basic but for armhfp we'll have to do some extra steps : qemu normally tries to simulate a bios/uefi boot, which armhfp doesn't support, and qemu doesn't emulate the mandatory uboot to just chainload to the RootFS from the guest VM.&lt;/p&gt;
&lt;p&gt;So here is just what we need : &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Import the RootFS from an existing image&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;curl&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;mirror&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;altarch&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;isos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;CubieTruck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xz&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;unxz&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;CubieTruck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Convert image to &lt;a href="https://en.wikipedia.org/wiki/Qcow"&gt;qcow2&lt;/a&gt; (that will give us more flexibility) and extend it a little bit&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;qemu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="k"&gt;convert&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;O&lt;/span&gt; &lt;span class="n"&gt;qcow2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;CubieTruck&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;guest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qcow2&lt;/span&gt;
&lt;span class="n"&gt;qemu&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="n"&gt;resize&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;guest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qcow2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="k"&gt;G&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Extract kernel+initrd as libvirt will boot that directly for the VM&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;mkdir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;
&lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;copy&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;guest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qcow2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So now that we have a RootFS, and also kernel/initrd, we can just use virt-install to create the VM (pointing to existing backend qcow2) :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt; \
 &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;centos7_armhfp&lt;/span&gt; \
 &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="mi"&gt;4096&lt;/span&gt; \
 &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt; &lt;span class="n"&gt;kernel&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;vmlinuz&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;4.9&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;203.&lt;/span&gt;&lt;span class="n"&gt;el7&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;initrd&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;initramfs&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;4.9&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;203.&lt;/span&gt;&lt;span class="n"&gt;el7&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;kernel_args&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;console=ttyAMA0 rw root=/dev/sda3&amp;quot;&lt;/span&gt; \
 &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;disk&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;guest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qcow2&lt;/span&gt; \
 &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; \
 &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;arch&lt;/span&gt; &lt;span class="n"&gt;armv7l&lt;/span&gt; \
 &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;machine&lt;/span&gt; &lt;span class="n"&gt;virt&lt;/span&gt; \
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And here we go : we have a armhfp VM that boots &lt;em&gt;really&lt;/em&gt; fast (compared to a armhfp board using a microsd card of course)&lt;/p&gt;
&lt;p&gt;At this stage, you can configure the node, etc.. The only thing you have to remember is that of course kernel will be provided from &lt;em&gt;outside&lt;/em&gt; the VM, so just extract it from an updated VM to boot on that kernel. Let's show how to do that, as in the above example, we configured the VM to run with 4Gb of ram, but only 3 are really seen inside (remember the 32bits mode and so the need for &lt;a href="https://en.wikipedia.org/wiki/Physical_Address_Extension"&gt;PAE&lt;/a&gt; on i386 ?)&lt;/p&gt;
&lt;p&gt;So let's use this example to show how to switch kernel : From the armhfp VM : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# &lt;span class="nv"&gt;Let&lt;/span&gt; &lt;span class="nv"&gt;extend&lt;/span&gt; &lt;span class="nv"&gt;first&lt;/span&gt; &lt;span class="nv"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;we&lt;/span&gt; &lt;span class="nv"&gt;have&lt;/span&gt; &lt;span class="nv"&gt;bigger&lt;/span&gt; &lt;span class="nv"&gt;disk&lt;/span&gt;
&lt;span class="nv"&gt;growpart&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;dev&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;sda&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="nv"&gt;resize2fs&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;dev&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;sda3&lt;/span&gt;
&lt;span class="nv"&gt;yum&lt;/span&gt; &lt;span class="nv"&gt;update&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;y&lt;/span&gt;
&lt;span class="nv"&gt;yum&lt;/span&gt; &lt;span class="nv"&gt;install&lt;/span&gt; &lt;span class="nv"&gt;kernel&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;lpae&lt;/span&gt;
&lt;span class="nv"&gt;systemctl&lt;/span&gt; &lt;span class="nv"&gt;poweroff&lt;/span&gt; # &lt;span class="nv"&gt;we&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ll modify libvirt conf file for new kernel&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Back to the hypervisor we can again extract needed files :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;copy&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;guest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qcow2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;vmlinuz&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;203&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;el7&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;lpae&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;copy&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;CentOS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Userland&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Minimal&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1708&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;guest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qcow2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;initramfs&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;203&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;el7&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;armv7hl&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;lpae&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libvirt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;armhfp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And just &lt;code&gt;virsh edit centos7_armhfp&lt;/code&gt; so that kernel and armhfp are pointing to correct location:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;kernel&amp;gt;&lt;/span&gt;/var/lib/libvirt/armhfp-boot/boot/vmlinuz-4.9.50-203.el7.armv7hl+lpae&lt;span class="nt"&gt;&amp;lt;/kernel&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;initrd&amp;gt;&lt;/span&gt;/var/lib/libvirt/armhfp-boot/boot/initramfs-4.9.50-203.el7.armv7hl+lpae.img&lt;span class="nt"&gt;&amp;lt;/initrd&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now that we have a "gold" image, we can even use exiting tools to provision quickly other nodes on that hypervisor ! :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt; &lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;clone&lt;/span&gt; &lt;span class="c1"&gt;--original centos7_armhfp --name armhfp_guest1 --file /var/lib/libvirt/images/armhfp_guest1.qcow2&lt;/span&gt;
&lt;span class="n"&gt;Allocating&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;armhfp_guest1.qcow2&amp;#39;&lt;/span&gt;                                               &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="n"&gt;GB&lt;/span&gt;  &lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;02&lt;/span&gt;     

&lt;span class="n"&gt;Clone&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;armhfp_guest1&amp;#39;&lt;/span&gt; &lt;span class="n"&gt;created&lt;/span&gt; &lt;span class="n"&gt;successfully&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nb"&gt;real&lt;/span&gt;    &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;m2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;809&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;
&lt;span class="k"&gt;user&lt;/span&gt;    &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;m0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;473&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;
&lt;span class="n"&gt;sys&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;m0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;062&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;

&lt;span class="n"&gt;time&lt;/span&gt; &lt;span class="n"&gt;virt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;sysprep&lt;/span&gt; &lt;span class="c1"&gt;--add /var/lib/libvirt/images/armhfp_guest1.qcow2 --operations defaults,net-hwaddr,machine-id,net-hostname,ssh-hostkeys,udev-persistent-net --hostname guest1&lt;/span&gt;

&lt;span class="n"&gt;virsh&lt;/span&gt; &lt;span class="k"&gt;start&lt;/span&gt; &lt;span class="n"&gt;armhfp_guest1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;As simple as that.
Of course, in the previous example we were just using the default network from libvirt, and not any bridge, but you get the idea : all the rest with well-known concept for libvirt on linux.&lt;/p&gt;</content><category term="CentOS"></category><category term="sysadmin"></category><category term="infra"></category><category term="arm"></category><category term="armhfp"></category><category term="aarch64"></category></entry><entry><title>Using NFS for OpenStack (glance,nova) with selinux</title><link href="https://arrfab.net/posts/2017/Jul/28/using-nfs-for-openstack-glancenova-with-selinux/" rel="alternate"></link><published>2017-07-28T00:00:00+02:00</published><updated>2017-07-28T00:00:00+02:00</updated><author><name>Fabian Arrotin</name></author><id>tag:arrfab.net,2017-07-28:/posts/2017/Jul/28/using-nfs-for-openstack-glancenova-with-selinux/</id><summary type="html">&lt;p&gt;As announced already, I was (between other things) playing with Openstack/RDO and had deployed some small openstack setup in the CentOS Infra. Then I had to look at our existing &lt;a href="https://wiki.centos.org/DevCloud"&gt;DevCloud&lt;/a&gt; setup. This setup was based on Opennebula running on CentOS 6, and also using Gluster as backend for the VM store. That's when I found out that Gluster isn't a valid option anymore : Gluster is was deprecated and was now even removed from &lt;a href="https://docs.openstack.org/releasenotes/cinder/ocata.html"&gt;Cinder&lt;/a&gt;. Sad as one advantage of gluster is that you could (you had to ! ) user libgfapi so that qemu-kvm process could talk directly to gluster through ligbfapi and not accessing VM images over locally mounted gluster volumes (please, don't even try to do that, through fuse).&lt;/p&gt;
&lt;p&gt;So what could be a replacement for Gluster from an openstack side ? I still have some dedicated nodes for storage backend[s], but not enough to even just think about Ceph. So it seems my only option was to consider NFS. (Technically speaking driver was removed from cinder, but I could have only tried to use it for glance and nova, as I have no need for cinder for DevCloud project, but clearly it would be dangerous for potential …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As announced already, I was (between other things) playing with Openstack/RDO and had deployed some small openstack setup in the CentOS Infra. Then I had to look at our existing &lt;a href="https://wiki.centos.org/DevCloud"&gt;DevCloud&lt;/a&gt; setup. This setup was based on Opennebula running on CentOS 6, and also using Gluster as backend for the VM store. That's when I found out that Gluster isn't a valid option anymore : Gluster is was deprecated and was now even removed from &lt;a href="https://docs.openstack.org/releasenotes/cinder/ocata.html"&gt;Cinder&lt;/a&gt;. Sad as one advantage of gluster is that you could (you had to ! ) user libgfapi so that qemu-kvm process could talk directly to gluster through ligbfapi and not accessing VM images over locally mounted gluster volumes (please, don't even try to do that, through fuse).&lt;/p&gt;
&lt;p&gt;So what could be a replacement for Gluster from an openstack side ? I still have some dedicated nodes for storage backend[s], but not enough to even just think about Ceph. So it seems my only option was to consider NFS. (Technically speaking driver was removed from cinder, but I could have only tried to use it for glance and nova, as I have no need for cinder for DevCloud project, but clearly it would be dangerous for potential upgrades)&lt;/p&gt;
&lt;p&gt;It's no that I'm a fan of storing qcow2 images on top of NFS, but it seems it was my only option, and at least the most transparent/less intrusive path, would I need to migrate to something else later.
So let's test this before then using NFS through &lt;a href="http://en.wikipedia.org/wiki/InfiniBand"&gt;Infiniband&lt;/a&gt; (using &lt;a href="https://www.kernel.org/doc/Documentation/infiniband/ipoib.txt"&gt;IPoIB&lt;/a&gt;), and so at "good speed" (still have the infiniband hardware in place running for gluster, that will be replaced)&lt;/p&gt;
&lt;p&gt;It's easy to mount the nfs exported dir under /var/lib/glance/images for glance, and then on every compute node also a nfs export under /var/lib/nova/instances/.&lt;/p&gt;
&lt;p&gt;That's where you have to see what would be blocked by Selinux, as it seems the current policy shipped with openstack-selinux-0.8.6-0 (from Ocata) doesn't seem to allow that.&lt;/p&gt;
&lt;p&gt;I initially tested services one and one and decided to open &lt;a href="https://github.com/redhat-openstack/openstack-selinux/pull/13"&gt;Pull Request&lt;/a&gt; for this, but in the mean time I rebuilt a custom selinux policy that seems to do the job in my rdo playground.&lt;/p&gt;
&lt;p&gt;Here it is the .te that you can compile into usable .pp policy file : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;module&lt;/span&gt; &lt;span class="nv"&gt;os&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;local&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;nfs&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;.&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;require&lt;/span&gt; {
    &lt;span class="nv"&gt;type&lt;/span&gt; &lt;span class="nv"&gt;glance_api_t&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;type&lt;/span&gt; &lt;span class="nv"&gt;virtlogd_t&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;type&lt;/span&gt; &lt;span class="nv"&gt;nfs_t&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;class&lt;/span&gt; &lt;span class="nv"&gt;file&lt;/span&gt; { &lt;span class="nv"&gt;append&lt;/span&gt; &lt;span class="nv"&gt;getattr&lt;/span&gt; &lt;span class="nv"&gt;open&lt;/span&gt; &lt;span class="nv"&gt;read&lt;/span&gt; &lt;span class="nv"&gt;write&lt;/span&gt; &lt;span class="k"&gt;unlink&lt;/span&gt; &lt;span class="nv"&gt;create&lt;/span&gt; }&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;class&lt;/span&gt; &lt;span class="nv"&gt;dir&lt;/span&gt; { &lt;span class="nv"&gt;search&lt;/span&gt; &lt;span class="nv"&gt;getattr&lt;/span&gt; &lt;span class="nv"&gt;write&lt;/span&gt; &lt;span class="nv"&gt;remove_name&lt;/span&gt; &lt;span class="nv"&gt;create&lt;/span&gt; &lt;span class="nv"&gt;add_name&lt;/span&gt; }&lt;span class="c1"&gt;;&lt;/span&gt;
}

#&lt;span class="o"&gt;=============&lt;/span&gt; &lt;span class="nv"&gt;glance_api_t&lt;/span&gt; &lt;span class="o"&gt;==============&lt;/span&gt;
&lt;span class="nv"&gt;allow&lt;/span&gt; &lt;span class="nv"&gt;glance_api_t&lt;/span&gt; &lt;span class="nv"&gt;nfs_t&lt;/span&gt;:&lt;span class="nv"&gt;dir&lt;/span&gt; { &lt;span class="nv"&gt;search&lt;/span&gt; &lt;span class="nv"&gt;getattr&lt;/span&gt; &lt;span class="nv"&gt;write&lt;/span&gt; &lt;span class="nv"&gt;remove_name&lt;/span&gt; &lt;span class="nv"&gt;create&lt;/span&gt; &lt;span class="nv"&gt;add_name&lt;/span&gt; }&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;allow&lt;/span&gt; &lt;span class="nv"&gt;glance_api_t&lt;/span&gt; &lt;span class="nv"&gt;nfs_t&lt;/span&gt;:&lt;span class="nv"&gt;file&lt;/span&gt; { &lt;span class="nv"&gt;write&lt;/span&gt; &lt;span class="nv"&gt;getattr&lt;/span&gt; &lt;span class="k"&gt;unlink&lt;/span&gt; &lt;span class="nv"&gt;open&lt;/span&gt; &lt;span class="nv"&gt;create&lt;/span&gt; &lt;span class="nv"&gt;read&lt;/span&gt;}&lt;span class="c1"&gt;;&lt;/span&gt;

#&lt;span class="o"&gt;=============&lt;/span&gt; &lt;span class="nv"&gt;virtlogd_t&lt;/span&gt; &lt;span class="o"&gt;==============&lt;/span&gt;
&lt;span class="nv"&gt;allow&lt;/span&gt; &lt;span class="nv"&gt;virtlogd_t&lt;/span&gt; &lt;span class="nv"&gt;nfs_t&lt;/span&gt;:&lt;span class="nv"&gt;dir&lt;/span&gt; &lt;span class="nv"&gt;search&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;allow&lt;/span&gt; &lt;span class="nv"&gt;virtlogd_t&lt;/span&gt; &lt;span class="nv"&gt;nfs_t&lt;/span&gt;:&lt;span class="nv"&gt;file&lt;/span&gt; { &lt;span class="nv"&gt;append&lt;/span&gt; &lt;span class="nv"&gt;getattr&lt;/span&gt; &lt;span class="nv"&gt;open&lt;/span&gt; }&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Of course you also need to enable some booleans. Some are already loaded by openstack-selinux (and you can see that from the enabled booleans by looking at /etc/selinux/targeted/active/booleans.local)  but you also now need &lt;code&gt;virt_use_nfs=1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now that it works, I can replay that (all that coming from puppet) on the DevCloud nodes &lt;/p&gt;</content><category term="CentOS"></category><category term="sysadmin"></category><category term="infra"></category><category term="Openstack"></category><category term="RDO"></category><category term="puppet"></category></entry><entry><title>Deploying Openstack through puppet on CentOS 7 - a Journey</title><link href="https://arrfab.net/posts/2017/May/08/deploying-openstack-through-puppet-on-centos-7-a-journey/" rel="alternate"></link><published>2017-05-08T00:00:00+02:00</published><updated>2017-05-08T00:00:00+02:00</updated><author><name>Fabian Arrotin</name></author><id>tag:arrfab.net,2017-05-08:/posts/2017/May/08/deploying-openstack-through-puppet-on-centos-7-a-journey/</id><summary type="html">&lt;p&gt;It's not a secret that I was playing/experimenting with &lt;a href="http://www.openstack.org"&gt;OpenStack&lt;/a&gt; in the &lt;a href="/posts/2017/Apr/14/deploying-openstack-poc-on-centos-with-linux-bridge/"&gt;last days&lt;/a&gt;.
When I mention OpenStack, I should even say &lt;a href="http://www.rdoproject.org"&gt;RDO&lt;/a&gt; , as it's RPM packaged, built and tested on CentOS infra.&lt;/p&gt;
&lt;p&gt;Now that it's time to deploy it in Production, that's when you should have a deeper look at how to proceed and which tool to use. Sure, &lt;a href="https://wiki.openstack.org/wiki/Packstack"&gt;Packstack&lt;/a&gt; can help you setting up a quick &lt;a href="https://en.wikipedia.org/wiki/Proof_of_concept"&gt;PoC&lt;/a&gt; but after some discussions with people hanging around in the #rdo irc channel on freenode, it seems that almost everybody agreed on the fact that it's not the kind of tool you want to use for a proper deploy.&lt;/p&gt;
&lt;p&gt;Let's so have a look at the available options. While I really like/prefer &lt;a href="http://www.ansible.com"&gt;Ansible&lt;/a&gt;, we (CentOS Project) still use &lt;a href="https://puppet.com/"&gt;puppet&lt;/a&gt; as our Configuration Management tool, and itself using &lt;a href="https://theforeman.org/"&gt;Foreman&lt;/a&gt; as the &lt;a href="https://docs.puppet.com/puppet/4.10/nodes_external.html#what-is-an-enc"&gt;ENC&lt;/a&gt;. So let's see both options.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ansible : Lot of &lt;a href="http://docs.ansible.com/ansible/list_of_cloud_modu"&gt;natives modules&lt;/a&gt; exist to manage an existing/already deployed openstack cloud, but nothing really that can help setting up one from scratch. OTOH it's true that &lt;a href="https://docs.openstack.org/project-deploy-guide/openstack-ansible/ocata/"&gt;Openstack Ansible&lt;/a&gt; exists, but that will setup openstack components into LXC containers, and wasn't really comfortable with the whole idea (YMMV) &lt;/li&gt;
&lt;li&gt;Puppet : Lot of …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;It's not a secret that I was playing/experimenting with &lt;a href="http://www.openstack.org"&gt;OpenStack&lt;/a&gt; in the &lt;a href="/posts/2017/Apr/14/deploying-openstack-poc-on-centos-with-linux-bridge/"&gt;last days&lt;/a&gt;.
When I mention OpenStack, I should even say &lt;a href="http://www.rdoproject.org"&gt;RDO&lt;/a&gt; , as it's RPM packaged, built and tested on CentOS infra.&lt;/p&gt;
&lt;p&gt;Now that it's time to deploy it in Production, that's when you should have a deeper look at how to proceed and which tool to use. Sure, &lt;a href="https://wiki.openstack.org/wiki/Packstack"&gt;Packstack&lt;/a&gt; can help you setting up a quick &lt;a href="https://en.wikipedia.org/wiki/Proof_of_concept"&gt;PoC&lt;/a&gt; but after some discussions with people hanging around in the #rdo irc channel on freenode, it seems that almost everybody agreed on the fact that it's not the kind of tool you want to use for a proper deploy.&lt;/p&gt;
&lt;p&gt;Let's so have a look at the available options. While I really like/prefer &lt;a href="http://www.ansible.com"&gt;Ansible&lt;/a&gt;, we (CentOS Project) still use &lt;a href="https://puppet.com/"&gt;puppet&lt;/a&gt; as our Configuration Management tool, and itself using &lt;a href="https://theforeman.org/"&gt;Foreman&lt;/a&gt; as the &lt;a href="https://docs.puppet.com/puppet/4.10/nodes_external.html#what-is-an-enc"&gt;ENC&lt;/a&gt;. So let's see both options.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ansible : Lot of &lt;a href="http://docs.ansible.com/ansible/list_of_cloud_modu"&gt;natives modules&lt;/a&gt; exist to manage an existing/already deployed openstack cloud, but nothing really that can help setting up one from scratch. OTOH it's true that &lt;a href="https://docs.openstack.org/project-deploy-guide/openstack-ansible/ocata/"&gt;Openstack Ansible&lt;/a&gt; exists, but that will setup openstack components into LXC containers, and wasn't really comfortable with the whole idea (YMMV) &lt;/li&gt;
&lt;li&gt;Puppet : Lot of &lt;a href="http://git.openstack.org/cgit/openstack/"&gt;puppet modules&lt;/a&gt; so you can automatically reuse/import those into your existing puppet setup, and seems to be the prefered method when discussing with people in #rdo (when not using &lt;a href="https://wiki.openstack.org/wiki/TripleO"&gt;TripleO&lt;/a&gt; though)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, after some analysis, and despite the fact that I really prefer Ansible over Puppet, I decided (so that it could still make sense in our infra) to go the "puppet modules way". That was the beginning of a journey, where I saw a lot of &lt;a href="https://en.wiktionary.org/wiki/yak_shaving"&gt;Yaks to shave&lt;/a&gt; too.&lt;/p&gt;
&lt;p&gt;It started with me trying to "just" reuse and adapt some existing modules I found. &lt;strong&gt;Wrong&lt;/strong&gt;. And it's even fun because it's one of my mantras : "Don't try to automate what you can't understand from scratch" (And I fully agree with Matthias' &lt;a href="https://ma.ttias.be/automating-unknown/"&gt;thought&lt;/a&gt; on this ).&lt;/p&gt;
&lt;p&gt;So one can just read all the openstack puppet modules, and then try to understand how to assemble them together to build a cloud. But I remembered that Packstack itself &lt;em&gt;is&lt;/em&gt; puppet driven. So I just decided to have a look at what it was generating and start from that to write my own module from scratch. How to proceed ? Easy : on a VM, just install packstack, generate answer file, "salt" it your needs, and generate the manifests :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt; &lt;span class="n"&gt;yum&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;openstack&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;ocata&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;yum&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;openstack&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;packstack&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;
 &lt;span class="n"&gt;packstack&lt;/span&gt; &lt;span class="c1"&gt;--gen-answer-file=answers.txt&lt;/span&gt;
 &lt;span class="n"&gt;vim&lt;/span&gt; &lt;span class="n"&gt;answers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;txt&lt;/span&gt;
 &lt;span class="n"&gt;packstack&lt;/span&gt; &lt;span class="c1"&gt;--answer-file=answers.txt --dry-run&lt;/span&gt;
 &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;installation&lt;/span&gt; &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;available&lt;/span&gt; &lt;span class="k"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;packstack&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20170508&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;101433&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;49&lt;/span&gt;&lt;span class="n"&gt;cCcj&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;openstack&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log&lt;/span&gt;
 &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="k"&gt;generated&lt;/span&gt; &lt;span class="n"&gt;manifests&lt;/span&gt; &lt;span class="k"&gt;are&lt;/span&gt; &lt;span class="n"&gt;available&lt;/span&gt; &lt;span class="k"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;packstack&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20170508&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;101433&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;49&lt;/span&gt;&lt;span class="n"&gt;cCcj&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;manifests&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So now we can have a look at all the generated manifests and start from scratch our own, reimporting all the needed openstack puppet modules, and that's what I did .. but started to encounter some issues. The first one was that the puppet version we were using was 3.6.2 (everywhere on every release/arch we support, so centos 6 and 7, and x86_64,i386,aarch64,ppc64,ppc64le). &lt;/p&gt;
&lt;p&gt;One of the openstack component is &lt;a href="https://www.rabbitmq.com/"&gt;RabbitMQ&lt;/a&gt; but openstack modules rely on the puppetlabs module to deploy/manage it. You'll see a lot of those external modules being called/needed by openstack puppet. The first thing that I had to do was investigating our own modules as some are the same name, but not coming from puppetlabs/forge, so instead of analyzing all those, I moved everything RDO related to a &lt;a href="https://theforeman.org/manuals/1.12/index.html#4.2ManagingPuppet"&gt;different environment&lt;/a&gt; so that it wouldn't conflict with some our our existing modules. Back now to the RabbitMQ one : puppet errors where trying to just use it. First yak to shave : updating the whole CentOS infra puppet to higher version because of a &lt;a href="https://tickets.puppetlabs.com/browse/MODULES-1781"&gt;puppet bug&lt;/a&gt;. Let's so rebuild puppet for centos 6/7 and with a higher version on &lt;a href="https://cbs.centos.org/koji/packageinfo?packageID=390"&gt;CBS&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;That means of course testing our own modules, on our Test Foreman/puppetmasterd instance first, and as upgraded worked, I applied it everywhere. Good, so let's jump to the next yak.&lt;/p&gt;
&lt;p&gt;After the rabbitmq issue was solved, I encountered other ones coming from openstack puppet modules now, as the .rb ruby code used for type/provider was expecting ruby2 and not 1.8.3, which was the one available on our puppetmasterd (yeah, our Foreman was on a CentOS 6 node) so another yak to shave : migrating our Foreman instance from CentOS 6 to a new CentOS 7 node. Basically installing a CentOS 7 node with the &lt;em&gt;same&lt;/em&gt; Foreman version running on CentOS 6 node, and then following &lt;a href="https://theforeman.org/manuals/1.12/index.html#5.5Backup,RecoveryandMigration"&gt;procedure&lt;/a&gt;, but then, again, time lost to test update/upgrade and also all other modules, etc (One can see why I prefer agentless cfgmgmt).&lt;/p&gt;
&lt;p&gt;Finally I found that some of the openstack puppet modules aren't touching the whole config. Let me explain why. In Openstack &lt;a href="https://releases.openstack.org/ocata/"&gt;Ocata&lt;/a&gt;, some things are mandatory, like the &lt;a href="https://docs.openstack.org/developer/nova/placement.html"&gt;Placement API&lt;/a&gt;, but despite all the classes being applied, I had some issues to have it to run correctly when deploying an instance. It's true that I initially had a bug in my puppet code for the user/password to use to configure the rabbitmq settings, but it was solved and also applied correctly in /etc/nova/nova.conf (setting "transport_url=") . But openstack nova services (all nova-*.log files btw) were always saying that credentials given were refused by rabbitmq, while tested manually)&lt;/p&gt;
&lt;p&gt;After having verified in the rabbitmq logs, I saw that despite what was configured in nova.conf, services were still trying to use the wrong user/pass to connect to rabbitmq. Strange as &lt;a href="http://git.openstack.org/cgit/openstack/puppet-nova/tree/manifests/cell_v2/simple_setup.pp"&gt;::nova::cell_v2::simple_setup&lt;/a&gt; was included and was supposed also to use the transport_url declared at the nova.conf level (and so configured by ::nova) . That's how I discovered that something "ugly" happened : in fact even if you modify nova.conf, it stores some settings in the mysql DB, and you can see those (so the "wrong" ones in my case) with :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;nova&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;manage&lt;/span&gt; &lt;span class="n"&gt;cell_v2&lt;/span&gt; &lt;span class="n"&gt;list_cells&lt;/span&gt; &lt;span class="c1"&gt;--debug&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Something to keep in mind, as for initial deployment, if your rabbitmq user/pass needs to be changed, and despite the fact that puppet will not complain, it will only update the conf file, but not the settings imported first by puppet in the DB (table nova_api.cell_mapping if you're interested)
After that, everything was then running, and reinstalled/reprovisioned multiple times my test nodes to apply the puppet module/manifests from puppetmasterd to confirm. &lt;/p&gt;
&lt;p&gt;That was quite a journey, but it's probably only the beginning but it's a good start. Now to investigate other option for cinder/glance as it seems Gluster was deprecated and I'd like to know hy.&lt;/p&gt;
&lt;p&gt;Hope this helps if you need to bootstrap openstack with puppet !&lt;/p&gt;</content><category term="CentOS"></category><category term="sysadmin"></category><category term="infra"></category><category term="Openstack"></category><category term="RDO"></category><category term="puppet"></category></entry><entry><title>Deploying Openstack PoC on CentOS with linux bridge</title><link href="https://arrfab.net/posts/2017/Apr/14/deploying-openstack-poc-on-centos-with-linux-bridge/" rel="alternate"></link><published>2017-04-14T00:00:00+02:00</published><updated>2017-04-14T00:00:00+02:00</updated><author><name>Fabian Arrotin</name></author><id>tag:arrfab.net,2017-04-14:/posts/2017/Apr/14/deploying-openstack-poc-on-centos-with-linux-bridge/</id><summary type="html">&lt;p&gt;I was recently in a need to start "playing" with &lt;a href="http://www.openstack.org"&gt;Openstack&lt;/a&gt; (working in an existing &lt;a href="http://www.rdoproject.org"&gt;RDO&lt;/a&gt; setup) so I thought that it would be good idea to have my personal playground to start deploying from scratch/breaking/fixing that playground setup.&lt;/p&gt;
&lt;p&gt;At first sight, Openstack looks &lt;a href="https://docs.openstack.org/admin-guide/_images/openstack-arch-kilo-logical-v1.png"&gt;impressive&lt;/a&gt; and "over-engineered", as it's complex and have zillions of modules to make it work. But then when you dive into it, you understand that the choice is yours to make it complex or not. Yeah, that sentence can look strange, but I'll explain you why.&lt;/p&gt;
&lt;p&gt;First, you should just write your requirements, and then only have a look at the needed openstack components. For my personal playground, I just wanted to have a basic thing that would let me deploy VMs on demand, &lt;em&gt;in&lt;/em&gt; the existing network, and so directly using bridge as I want the VMs to be directly integrated into the existing network/subnet.&lt;/p&gt;
&lt;p&gt;So just by looking at the mentioned &lt;a href="https://docs.openstack.org/admin-guide/_images/openstack-arch-kilo-logical-v1.png"&gt;diagram&lt;/a&gt;, we just need :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;keystone (needed for the identity service)&lt;/li&gt;
&lt;li&gt;nova (hypervisor part)&lt;/li&gt;
&lt;li&gt;neutron (handling the network part)&lt;/li&gt;
&lt;li&gt;glance (to store the OS images that will be used to create the VMs)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now that I have my requirements and list …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I was recently in a need to start "playing" with &lt;a href="http://www.openstack.org"&gt;Openstack&lt;/a&gt; (working in an existing &lt;a href="http://www.rdoproject.org"&gt;RDO&lt;/a&gt; setup) so I thought that it would be good idea to have my personal playground to start deploying from scratch/breaking/fixing that playground setup.&lt;/p&gt;
&lt;p&gt;At first sight, Openstack looks &lt;a href="https://docs.openstack.org/admin-guide/_images/openstack-arch-kilo-logical-v1.png"&gt;impressive&lt;/a&gt; and "over-engineered", as it's complex and have zillions of modules to make it work. But then when you dive into it, you understand that the choice is yours to make it complex or not. Yeah, that sentence can look strange, but I'll explain you why.&lt;/p&gt;
&lt;p&gt;First, you should just write your requirements, and then only have a look at the needed openstack components. For my personal playground, I just wanted to have a basic thing that would let me deploy VMs on demand, &lt;em&gt;in&lt;/em&gt; the existing network, and so directly using bridge as I want the VMs to be directly integrated into the existing network/subnet.&lt;/p&gt;
&lt;p&gt;So just by looking at the mentioned &lt;a href="https://docs.openstack.org/admin-guide/_images/openstack-arch-kilo-logical-v1.png"&gt;diagram&lt;/a&gt;, we just need :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;keystone (needed for the identity service)&lt;/li&gt;
&lt;li&gt;nova (hypervisor part)&lt;/li&gt;
&lt;li&gt;neutron (handling the network part)&lt;/li&gt;
&lt;li&gt;glance (to store the OS images that will be used to create the VMs)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now that I have my requirements and list of needed components, let's see how to setup my PoC ... The &lt;a href="http://www.rdoproject.org"&gt;RDO project&lt;/a&gt; has good doc for this, including the &lt;a href="https://www.rdoproject.org/install/quickstart/"&gt;Quickstart&lt;/a&gt; guide. You can follow that guide, and as everything is packaged/built/tested and also delivered through CentOS mirror network, you can have a working RDO/openstack All-in-one setup working in minutes ...&lt;/p&gt;
&lt;p&gt;The only issue is that it doesn't fit my need, as it will setup unneeded components, and the network layout isn't the one I wanted either, as it will be based on openvswitch, and other rules (so multiple layers I wanted to get rid of). The good news is that &lt;a href="https://www.rdoproject.org/install/quickstart/"&gt;Packstack&lt;/a&gt; is in fact a wrapper tool around puppet modules, and it also supports lot of options to configure your PoC.&lt;/p&gt;
&lt;p&gt;Let's assume that I wanted a PoC based on openstack-newton, and that my machine has two nics : eth0 for mgmt network and eth1 for VMs network. You don't need to configure the bridge on the eth1 interface, as that will be done automatically by neutron. So let's follow the quickstart guide, but we'll just adapt the packstack command line :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;yum&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;openstack&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;newton&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="n"&gt;disable&lt;/span&gt; &lt;span class="n"&gt;firewalld&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt; &lt;span class="n"&gt;firewalld&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="n"&gt;disable&lt;/span&gt; &lt;span class="n"&gt;NetworkManager&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="n"&gt;stop&lt;/span&gt; &lt;span class="n"&gt;NetworkManager&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="n"&gt;enable&lt;/span&gt; &lt;span class="n"&gt;network&lt;/span&gt;
&lt;span class="n"&gt;systemctl&lt;/span&gt; &lt;span class="k"&gt;start&lt;/span&gt; &lt;span class="n"&gt;network&lt;/span&gt;
&lt;span class="n"&gt;yum&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="n"&gt;openstack&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;packstack&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Let's fix eth1 to ensure that it's started but without &lt;em&gt;any&lt;/em&gt; IP on it : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;sed&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;s/BOOTPROTO=&amp;quot;dhcp&amp;quot;/BOOTPROTO=&amp;quot;none&amp;quot;/&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;sysconfig&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;scripts&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;ifcfg&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;eth1&lt;/span&gt;
&lt;span class="n"&gt;sed&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;s/ONBOOT=&amp;quot;no&amp;quot;/ONBOOT=&amp;quot;yes&amp;quot;/&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;etc&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;sysconfig&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;scripts&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;ifcfg&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;eth1&lt;/span&gt;
&lt;span class="n"&gt;ifup&lt;/span&gt; &lt;span class="n"&gt;eth1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And now let's call packstack with the required option so that we'll use basic linux bridge (and so no openvswitch), and we'll instruct that it will have to use eth1 for that mapping&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;packstack&lt;/span&gt; &lt;span class="c1"&gt;--allinone --provision-demo=n --os-neutron-ml2-type-drivers=flat --os-neutron-ml2-mechanism-drivers=linuxbridge --os-neutron-ml2-flat-networks=physnet0 --os-neutron-l2-agent=linuxbridge --os-neutron-lb-interface-mappings=physnet0:eth1 --os-neutron-ml2-tenant-network-types=&amp;#39; &amp;#39; --nagios-install=n &lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;At this stage we have openstack components installed, and /root/keystonerc_admin file that we can source for openstack CLI operations.
We have instructed neutron to use linuxbridge, but we haven't (yet) created a network and a subnet tied to it, so let's do that now :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;source&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;root&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;keystonerc_admin&lt;/span&gt;
&lt;span class="nv"&gt;neutron&lt;/span&gt; &lt;span class="nv"&gt;net&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;create&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;shared&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;provider&lt;/span&gt;:&lt;span class="nv"&gt;network_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;flat&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;provider&lt;/span&gt;:&lt;span class="nv"&gt;physical_network&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;physnet0&lt;/span&gt; &lt;span class="nv"&gt;othernet&lt;/span&gt;
&lt;span class="nv"&gt;neutron&lt;/span&gt; &lt;span class="nv"&gt;subnet&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;create&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;name&lt;/span&gt; &lt;span class="nv"&gt;other_subnet&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;enable_dhcp&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;allocation&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;pool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;192&lt;/span&gt;.&lt;span class="mi"&gt;168&lt;/span&gt;.&lt;span class="mi"&gt;123&lt;/span&gt;.&lt;span class="mi"&gt;1&lt;/span&gt;,&lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;192&lt;/span&gt;.&lt;span class="mi"&gt;168&lt;/span&gt;.&lt;span class="mi"&gt;123&lt;/span&gt;.&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;192&lt;/span&gt;.&lt;span class="mi"&gt;168&lt;/span&gt;.&lt;span class="mi"&gt;123&lt;/span&gt;.&lt;span class="mi"&gt;254&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;dns&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;nameserver&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;192&lt;/span&gt;.&lt;span class="mi"&gt;168&lt;/span&gt;.&lt;span class="mi"&gt;123&lt;/span&gt;.&lt;span class="mi"&gt;254&lt;/span&gt; &lt;span class="nv"&gt;othernet&lt;/span&gt; &lt;span class="mi"&gt;192&lt;/span&gt;.&lt;span class="mi"&gt;168&lt;/span&gt;.&lt;span class="mi"&gt;123&lt;/span&gt;.&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Before import image[s] and creating instances, there is one thing left to do : instruct dhcp_agent that metadata for cloud-init inside the VM will not be served from traditional "router" inside of openstack. And also don't forget to let traffic (in/out) pass through security group (see &lt;a href="https://docs.openstack.org/user-guide/cli-nova-configure-access-security-for-instances.html"&gt;doc&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Just be sure to have &lt;code&gt;enable_isolated_metadata = True&lt;/code&gt; in  /etc/neutron/dhcp_agent.ini and then &lt;code&gt;systemctl restart neutron-dhcp-agent&lt;/code&gt; : and from that point, cloud metadata will be served from dhcp too.&lt;/p&gt;
&lt;p&gt;From that point you can just follow the &lt;a href="https://www.rdoproject.org/install/running-an-instance/"&gt;quickstart&lt;/a&gt; guide to create projects/users, import images, create instances and/or do all this from &lt;a href="https://docs.openstack.org/user-guide/cli-cheat-sheet.html"&gt;cli&lt;/a&gt; too  &lt;/p&gt;
&lt;p&gt;One last remark with linuxbridge in an existing network : as neutron will have a dhcp-agent listening on the bridge, the provisioned VMs will get an IP from the pool declared in the "neutron subnet-create" command. However (and I saw that when I added other compute nodes in the same setup), you'll have a potential conflict with an existing dhcpd instance on the same segment/network, so your VM can potentially get their IP from your existing dhcpd instance on the network, and not from neutron. As a workaround, you can just ignore the mac addresses range used by openstack, so that your VMs will always get their IP from neutron dhcp.
To do this, there are different options, depending on your local dhcpd instance : &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;for dnsmasq : dhcp-host=fa:16:3e:&lt;em&gt;:&lt;/em&gt;:*,ignore (see &lt;a href="http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example"&gt;doc&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;for ISC dhcpd : "ignore booting" (see &lt;a href="https://linux.die.net/man/5/dhcpd.conf"&gt;doc&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The default mac addresses range for openstack VMs is indeed fa:16:3e:00:00:00 (see /etc/neutron/neutron.conf, so that can be changed too)&lt;/p&gt;
&lt;p&gt;Those were some of my findings for my openstack PoC/playground. Now that I understand a little bit more all this, I'm currently working on some puppet integration for this, as there are official openstack puppet modules available on &lt;a href="http://git.openstack.org/cgit"&gt;git.openstack.org&lt;/a&gt; that one can import to deploy/configure openstack (and better than using packstack). But lot of "yaks to shave" to get to that point, so surely for another future blog post.&lt;/p&gt;</content><category term="CentOS"></category><category term="sysadmin"></category><category term="infra"></category><category term="Openstack"></category><category term="RDO"></category></entry><entry><title>Remotely kicking a CentOS install through ligthweight 1Mb iso image</title><link href="https://arrfab.net/posts/2017/Apr/13/remotely-kicking-a-centos-install-through-ligthweight-1mb-iso-image/" rel="alternate"></link><published>2017-04-13T00:00:00+02:00</published><updated>2017-04-13T00:00:00+02:00</updated><author><name>Fabian Arrotin</name></author><id>tag:arrfab.net,2017-04-13:/posts/2017/Apr/13/remotely-kicking-a-centos-install-through-ligthweight-1mb-iso-image/</id><summary type="html">&lt;p&gt;As a sysadmin, you probably deploy your bare-metal nodes through kickstarts in combination with pxe/dhcp. That's the most convenient way to deploy nodes in an existing environment. But what about having to remotely init a new DC/environement, without anything at all ? Suppose that you have a standalone node that you have to deploy, but there is no PXE/Dhcp environment configured (yet).&lt;/p&gt;
&lt;p&gt;The simple solution would be to , as long as you have at least some kind of management/out-of-band network, to either ask the local DC people to burn the CentOS Minimal iso image on a usb stick, or other media. But I was in a need to deploy a machine without any remote hand available locally there to help me. The only things I had were :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;access to the ipmi interface of that server&lt;/li&gt;
&lt;li&gt;the fixed IP/netmask/gateway/dns settings for the NIC connected to that segment/vlan&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One simple solution would have been to just "attach" the CentOS 7 iso as a virtual media, and then boot the machine, and setup from "locally emulated" cd-rom drive. But that's not something I wanted to do, as I didn't want to slow the install, as that …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As a sysadmin, you probably deploy your bare-metal nodes through kickstarts in combination with pxe/dhcp. That's the most convenient way to deploy nodes in an existing environment. But what about having to remotely init a new DC/environement, without anything at all ? Suppose that you have a standalone node that you have to deploy, but there is no PXE/Dhcp environment configured (yet).&lt;/p&gt;
&lt;p&gt;The simple solution would be to , as long as you have at least some kind of management/out-of-band network, to either ask the local DC people to burn the CentOS Minimal iso image on a usb stick, or other media. But I was in a need to deploy a machine without any remote hand available locally there to help me. The only things I had were :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;access to the ipmi interface of that server&lt;/li&gt;
&lt;li&gt;the fixed IP/netmask/gateway/dns settings for the NIC connected to that segment/vlan&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One simple solution would have been to just "attach" the CentOS 7 iso as a virtual media, and then boot the machine, and setup from "locally emulated" cd-rom drive. But that's not something I wanted to do, as I didn't want to slow the install, as that would come from my local iso image, and so using my "slow" bandwidth. Instead, I directly wanted to use the Gbit link from that server to kick the install. So here is how you can do it with ipxe.iso. &lt;a href="http://ipxe.org"&gt;Ipxe&lt;/a&gt; is really helpful for such thing. The only "issue" was that I had to configure the nic first with Fixed IP (remember ? no dhcpd yet).&lt;/p&gt;
&lt;p&gt;So, download the &lt;a href="http://boot.ipxe.org/ipxe.iso"&gt;ipxe.iso&lt;/a&gt; image, add it as "virtual media" (and transfer will be fast, as that's under 1Mb), and boot the server.
Once it boots from the iso image, don't let ipxe run, but instead hit CTRL/B when you see ipxe starting . Reason is that we don't want to let it starting the dhcp discover/offer/request/ack process, as we know that it will not work.&lt;/p&gt;
&lt;p&gt;You're then presented with ipxe shell, so here we go (all parameters are obviously to be adapted, including net adapter number) :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="n"&gt;net0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="n"&gt;net0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;netmask&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="n"&gt;net0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;gateway&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;
&lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="n"&gt;dns&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;

&lt;span class="n"&gt;ifopen&lt;/span&gt; &lt;span class="n"&gt;net0&lt;/span&gt;
&lt;span class="n"&gt;ifstat&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;From that point you should have network connectivity, so we can "just" chainload the CentOS pxe images and start the install :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;initrd&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;mirror&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;x86_64&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pxeboot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;initrd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;
&lt;span class="k"&gt;chain&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;mirror&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;x86_64&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pxeboot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;vmlinuz&lt;/span&gt; &lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ifnames&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;biosdevname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;ksdevice&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;eth2&lt;/span&gt; &lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;repo&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;mirror&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;centos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;x86_64&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;en_GB&lt;/span&gt; &lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keymap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;latin1&lt;/span&gt; &lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vnc&lt;/span&gt; &lt;span class="n"&gt;inst&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vncpassword&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;CHANGEME&lt;/span&gt; &lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="n"&gt;netmask&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="n"&gt;dns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Then you can just enjoy your CentOS install running all from network, and so at "full steam" !
You can also combine directly with inst.ks= to have a fully automated setup.
Worth knowing that you can also regenerate/build an updated/customized ipxe.iso with those scripts directly too. That's more or less what we used to also have a 1Mb universal installer for CentOS 6 and 7, see &lt;a href="https://wiki.centos.org/HowTos/RemoteiPXE"&gt;https://wiki.centos.org/HowTos/RemoteiPXE&lt;/a&gt; , but that one defaults to dhcp&lt;/p&gt;
&lt;p&gt;Hope it helps&lt;/p&gt;</content><category term="CentOS"></category><category term="sysadmin"></category><category term="infra"></category></entry><entry><title>Enabling SPF record for centos.org</title><link href="https://arrfab.net/posts/2017/Jan/17/enabling-spf-record-for-centosorg/" rel="alternate"></link><published>2017-01-17T00:00:00+01:00</published><updated>2017-01-17T00:00:00+01:00</updated><author><name>Fabian Arrotin</name></author><id>tag:arrfab.net,2017-01-17:/posts/2017/Jan/17/enabling-spf-record-for-centosorg/</id><summary type="html">&lt;p&gt;In the last weeks, I noticed that spam activity was back, including against centos.org infra. One of the most used technique was &lt;a href="https://en.wikipedia.org/wiki/Email_spoofing#Technical_detail"&gt;Email Spoofing&lt;/a&gt; (aka "forged from address"). That's how I discovered that we never implemented &lt;a href="https://en.wikipedia.org/wiki/Sender_Policy_Framework"&gt;SPF&lt;/a&gt; for centos.org (while some of the Infra team members had that on their personal SMTP servers).&lt;/p&gt;
&lt;p&gt;While SPF itself is "just" a TXT dns record in your zone, you have to think twice before implementing it. And publishing yourself such a policy doesn't mean that your SMTP servers are checking SPF either. There are PROS and CONS to SPF so read first multiple sources/articles to understand how it will impact your server/domain when sending/receiving :&lt;/p&gt;
&lt;h2&gt;sending&lt;/h2&gt;
&lt;p&gt;The first thing to consider is how people having an alias can send send their mails : either behind their known MX borders (and included in your SPF) or through alternate SMTP servers relaying (after &lt;a href="http://www.postfix.org/access.5.html"&gt;being&lt;/a&gt; &lt;a href="http://www.postfix.org/SMTPD_ACCESS_README.html"&gt;authorized&lt;/a&gt; of course) through servers listed in your SPF.&lt;/p&gt;
&lt;p&gt;One thing to know with SPF is that it breaks &lt;a href="https://en.wikipedia.org/wiki/Sender_Policy_Framework#FAIL_and_forwarding"&gt;plain forwarding&lt;/a&gt; and &lt;a href="http://www.openspf.org/FAQ/Forwarding"&gt;aliases&lt;/a&gt; but it's not how you will setup &lt;em&gt;your&lt;/em&gt; SPF record, but how originator domain does it : For example if you have joe@domain.com sending …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In the last weeks, I noticed that spam activity was back, including against centos.org infra. One of the most used technique was &lt;a href="https://en.wikipedia.org/wiki/Email_spoofing#Technical_detail"&gt;Email Spoofing&lt;/a&gt; (aka "forged from address"). That's how I discovered that we never implemented &lt;a href="https://en.wikipedia.org/wiki/Sender_Policy_Framework"&gt;SPF&lt;/a&gt; for centos.org (while some of the Infra team members had that on their personal SMTP servers).&lt;/p&gt;
&lt;p&gt;While SPF itself is "just" a TXT dns record in your zone, you have to think twice before implementing it. And publishing yourself such a policy doesn't mean that your SMTP servers are checking SPF either. There are PROS and CONS to SPF so read first multiple sources/articles to understand how it will impact your server/domain when sending/receiving :&lt;/p&gt;
&lt;h2&gt;sending&lt;/h2&gt;
&lt;p&gt;The first thing to consider is how people having an alias can send send their mails : either behind their known MX borders (and included in your SPF) or through alternate SMTP servers relaying (after &lt;a href="http://www.postfix.org/access.5.html"&gt;being&lt;/a&gt; &lt;a href="http://www.postfix.org/SMTPD_ACCESS_README.html"&gt;authorized&lt;/a&gt; of course) through servers listed in your SPF.&lt;/p&gt;
&lt;p&gt;One thing to know with SPF is that it breaks &lt;a href="https://en.wikipedia.org/wiki/Sender_Policy_Framework#FAIL_and_forwarding"&gt;plain forwarding&lt;/a&gt; and &lt;a href="http://www.openspf.org/FAQ/Forwarding"&gt;aliases&lt;/a&gt; but it's not how you will setup &lt;em&gt;your&lt;/em&gt; SPF record, but how originator domain does it : For example if you have joe@domain.com sending to joe@otherdomain.com itself being an alias to joe2@domain.com, that will break, as MX for domain.com will see that a mail for domain.com was 'sent' from otherdomain.com and not from an IP listed in &lt;em&gt;their&lt;/em&gt; SPF. There are workaround for this though, aka remailing and &lt;a href="https://en.wikipedia.org/wiki/Sender_Rewriting_Scheme"&gt;SRS&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;receiving&lt;/h2&gt;
&lt;p&gt;So you have a SPF in place and so restrict from where you are sending mails ? Great, but SPF &lt;em&gt;only&lt;/em&gt; works if other SMTP servers involved are checking for it, and so you should do the same !
The fun part is that even if you have CentOS 7, and so &lt;a href="http://www.postfix.org"&gt;Postfix&lt;/a&gt; 2.10, there is nothing by default that let you verify SPF : as stated on &lt;a href="http://www.postfix.org/addon.html"&gt;this page&lt;/a&gt; : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;Note&lt;/span&gt;: &lt;span class="nv"&gt;Postfix&lt;/span&gt; &lt;span class="nv"&gt;already&lt;/span&gt; &lt;span class="nv"&gt;ships&lt;/span&gt; &lt;span class="nv"&gt;with&lt;/span&gt; &lt;span class="nv"&gt;SPF&lt;/span&gt; &lt;span class="nv"&gt;support&lt;/span&gt;, &lt;span class="nv"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;form&lt;/span&gt; &lt;span class="nv"&gt;of&lt;/span&gt; &lt;span class="nv"&gt;a&lt;/span&gt; &lt;span class="nv"&gt;plug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;policy&lt;/span&gt; &lt;span class="nv"&gt;daemon&lt;/span&gt;. &lt;span class="nv"&gt;This&lt;/span&gt; &lt;span class="nv"&gt;is&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;preferred&lt;/span&gt; &lt;span class="nv"&gt;integration&lt;/span&gt; &lt;span class="nv"&gt;model&lt;/span&gt;, &lt;span class="nv"&gt;at&lt;/span&gt; &lt;span class="nv"&gt;least&lt;/span&gt; &lt;span class="k"&gt;until&lt;/span&gt; &lt;span class="nv"&gt;SPF&lt;/span&gt; &lt;span class="nv"&gt;is&lt;/span&gt; &lt;span class="nv"&gt;mandated&lt;/span&gt; &lt;span class="nv"&gt;by&lt;/span&gt; &lt;span class="nv"&gt;standards&lt;/span&gt;. 
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So for our postfix setup, we decided to use &lt;a href="https://launchpad.net/pypolicyd-spf"&gt;pypolicy-spf&lt;/a&gt; : lightweight, easy , written in python. The needed packages are already available in Epel, but we also &lt;a href="https://cbs.centos.org/koji/packageinfo?packageID=5142"&gt;rebuilt&lt;/a&gt; it on &lt;a href="https://cbs.centos.org/koji/packageinfo?packageID=5142"&gt;CBS&lt;/a&gt;. Once installed, &lt;a href="http://bazaar.launchpad.net/~kitterman/pypolicyd-spf/1.3/view/head:/policyd-spf.conf.commented"&gt;configured&lt;/a&gt; &lt;em&gt;and&lt;/em&gt; &lt;a href="http://bazaar.launchpad.net/~kitterman/pypolicyd-spf/1.3/view/head:/policyd-spf.1#L251"&gt;integrated&lt;/a&gt; with Postfix, you'll start (based on your .conf settings) blocking mail that arrives to your SMTP servers, but from IP/servers not listed in the originator domain SPF policy (if any).&lt;/p&gt;
&lt;p&gt;If you have issues with our SPF current policy on centos.org, feel free to reach us in #centos-devel on irc.freenode.net to discuss it.&lt;/p&gt;</content><category term="CentOS"></category><category term="sysadmin"></category><category term="infra"></category></entry></feed>