aboutsummaryrefslogtreecommitdiff
path: root/content/posts
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts')
-rw-r--r--content/posts/2019-03-03Welcome_to_my_blog.html6
-rw-r--r--content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html94
-rw-r--r--content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html70
-rw-r--r--content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html31
-rw-r--r--content/posts/2020-07-12Road_to_local_K8S.html101
-rw-r--r--content/posts/2020-07-14Friz_box_turned_off_DHCP.html12
-rw-r--r--content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html38
-rw-r--r--content/posts/2021-12-26Enable_NFS_on_K3S.html37
-rw-r--r--content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.html (renamed from content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html)0
9 files changed, 366 insertions, 23 deletions
diff --git a/content/posts/2019-03-03Welcome_to_my_blog.html b/content/posts/2019-03-03Welcome_to_my_blog.html
new file mode 100644
index 0000000..10b1f05
--- /dev/null
+++ b/content/posts/2019-03-03Welcome_to_my_blog.html
@@ -0,0 +1,6 @@
+<section>
+ <p>
+ On this blog, I'll be posting some personal projects that I'm working on
+ or just logging stuff that I don't want to forget.
+ </p>
+</section>
diff --git a/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html b/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html
new file mode 100644
index 0000000..d06a648
--- /dev/null
+++ b/content/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html
@@ -0,0 +1,94 @@
+<section>
+ <p>
+ Every time that I do a clean install on my machine it takes a few hours till I
+ get to point where I was before formatting it, install all packages, select
+ themes, icons, fonts, install IDEs, extensions and so on. After doing it a few
+ times I came to the conclusion that I would save time by spending time
+ automating this chore, and as a result, I could tinker a little more with my
+ system and not worry about spending a weekend re-installing everything (which
+ have happened more time that I'd like to remember).
+ </p>
+ <p>
+ So after a few attempts using python and bash I ended with many files and
+ keep everything organized and concise turned out to be more tedious than the
+ setup itself. So there comes <a href="https://www.ansible.com/">Ansible</a>.
+ It is an enterprise-graded software used to automate tasks. It has A LOT OF
+ features and it can be really helpful if you're a sysadmin but for now we're
+ going to focuson
+ <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#ansible-pull">
+ Ansible Pull
+ </a>
+ and
+ <a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks.html">
+ Playbooks
+ </a>. As better described:
+ <blockquote>
+ [Ansible-Pull] is used to up a remote copy of ansible on each managed
+ node, each set to run via cron and update playbook source via a source
+ repository. This inverts the default push architecture of Ansible into a
+ pull architecture, which has near-limitless scaling potential.
+
+ Playbooks are Ansible’s configuration, deployment, and orchestration
+ language. They can describe a policy you want your remote systems to
+ enforce, or a set of steps in a general IT process.
+ (<a href="https://docs.ansible.com/ansible/latest/cli/ansible-pull.html">source</a>)
+ </blockquote>
+ </p>
+ <p>
+ The goal is to pull and run a playbook remotely using a git repository. The
+ playbook will describe the tasks needed to setup our machine from scratch.
+ <br/>
+ But first lets tinker a bit a with playbooks locally with ansible-playbook,
+ to do so we need to add localhost to ansible's hosts list. Add it to
+ /etc/ansible/hosts:
+<pre><code>[all]
+localhost</code></pre>
+ </p>
+ <p>
+ As an experiment we're going to write a asks to install vim. Currently, I'm
+ using Fedora thus we going to use dnf modeule to install packages, but if
+ you're using another distribution look for a equivalent module like apt
+ module for Ubuntu.
+
+ The playbook to install is quite simple:
+
+<pre><code># main.yaml
+- hosts: all
+ tasks:
+ - name: install vim
+ dnf:
+ name: vim
+ state: latest</code></pre>
+ <dl>
+ <dt>host</dt>
+ <dd>it is required and it has to match our hosts otherwise the playbook won't run.</dd>
+ <dt>taks</dt>
+ <dd>
+ it is the list of tasks that the playbook will perform, in this case
+ will be dnf install vim.
+ </dd>
+ </dl>
+ </p>
+ <p>
+ To run a playbook use the command ansible-playbook commando to run main.yml
+ direct from disk, do to so just run the following command:
+<pre><code>sudo ansible-playbook --connection=local main.yml</code></pre>
+ </p>
+ <p>
+ After a few seconds, vim will be installed on your machine.
+<pre><code>PLAY [all] *************************************************************
+
+TASK [Gathering Facts] *************************************************
+ok: [localhost]
+
+TASK [install vim] *****************************************************
+ok: [localhost]
+
+PLAY RECAP *************************************************************
+localhost : ok=2 changed=0 unreachable=0 failed=0</code></pre>
+ </p>
+ <p>
+ This is the first step, next part we shall create a more complex playbook and
+ setup repository to run it remotely using ansible-pull.
+ </p>
+</section>
diff --git a/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html b/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html
new file mode 100644
index 0000000..707ba7d
--- /dev/null
+++ b/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html
@@ -0,0 +1,70 @@
+<section>
+ <a href="/posts/2019-03-07Automating_desktop_setup_with_ansible-pull_part-1.html">See part 1</a>
+ <p>
+ Now we're going to setup ansible to work with a git repository. The process is
+ quite similar to ansible-playbook, the only difference is that the source for
+ the playbook will be a remote repository and not a local file. Following the
+ previous example we'll get vim setup automated.
+ </p>
+ <p>
+ Create a git repository wherever you see
+ fit, <a href="https://about.gitlab.com/">gitlab</a>
+ and <a href="https://github.com/">github</a> offer free repositories. For
+ this task we need to add only two file: one for the yml file describing the
+ tasks and the .vimrc file.
+ </p>
+ <p>
+ In the .vimrc add your own configuration, you can see
+ mine
+ <a href="https://gitlab.com/gabrielgio/homestation/-/blob/debcf3458df511aef9f7dca0cb73f6cf6baddd5d/.vimrc">
+ over here
+ </a>, it is pretty simple as I don't use it but for simple text editing
+ (like this post) so you can start with that if you don't have one.
+ </p>
+ <p>
+ The yml file will have two tasks, one is to install vim, just like we did in the part 1.
+<pre><code># main.yml
+---
+- name: install vim
+ dnf:
+ name: vim
+ state: latest</code></pre>
+ </p>
+ <p>
+ To copy .vimrc file to your $HOME we going to
+ use <a href="https://docs.ansible.com/ansible/latest/modules/copy_module.html">copy
+ module</a>:
+ </p>
+ <p>
+ After we've added those two files to repository you will have be something
+ <a href="https://gitlab.com/gabrielgio/homestation/-/tree/debcf3458df511aef9f7dca0cb73f6cf6baddd5d">
+ like this.
+ </a>
+ <br/>
+ Parms:
+ <ul>
+ <li><strong>-i</strong> is a list of hosts</li>
+ <li><strong>-U</strong> is the get repository url</li>
+ </ul>
+ </p>
+ <p>
+ Remember man is your best friend, take a look at <code>man ansible-pull</code> to know
+ more about its parameters.
+ </p>
+ <p>
+ The best part you can quickly test and see the result by running my sample:
+<pre><code>ansible-pull \
+ -U https://gitlab.com/gabrielgio/homestation.git \
+ -C debcf3458df511aef9f7dca0cb73f6cf6baddd5d \
+ -i all \
+ main.yml</code></pre>
+ </p>
+ <p>
+ The idea here is to keep your repository as a source of truth when comes to
+ configuration, you can add ansible-pull to a CRON tab, so you just need to
+ push something to your repository and after a few minutes not only your
+ machine but all the machines that have it setup will run the playbooks. You
+ can use this method as a simple way to install software, update machines or
+ even distribute tooling company-wise.
+ </p>
+</section>
diff --git a/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html b/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html
new file mode 100644
index 0000000..f47040f
--- /dev/null
+++ b/content/posts/2019-11-16Compiling_emacs_from_source_code_on_fedora.html
@@ -0,0 +1,31 @@
+<section>
+<p>
+ Compiling emacs from source and installing on fedora.
+</p>
+<h3>Installing packages</h3>
+<p>
+ Install the following packages:
+<pre><code>sudo dnf install git autoconf make gcc texinfo \
+ gnutls-devel giflib-devel ncurses-devel \
+ libjpeg-turbo-devel giflib-devel gtk3-devel \
+ libXpm-devel libtiff-devel libxml2-devel -y</code></pre>
+</p>
+<h3>Cloning Repository</h3>
+<p>
+ Clone repository
+ <a href="http://savannah.gnu.org/projects/emacs/">savannah.gnu.org</a>
+<pre><code>git clone -b master git://git.sv.gnu.org/emacs.git</code></pre>
+</p>
+<h3>Compiling</h3>
+<p>
+ Navigate to the emacs folder <code>cd emacs</code> and execute the following
+ steps:
+<pre><code>./autogen.sh
+./configure
+make -j$(nproc)
+sudo make install
+</code></pre>
+ After verify version with <code>./emacs --version</code>, it
+ should be equal or higher than <strong>28.0.50</strong>.
+</p>
+</section>
diff --git a/content/posts/2020-07-12Road_to_local_K8S.html b/content/posts/2020-07-12Road_to_local_K8S.html
new file mode 100644
index 0000000..5d34b27
--- /dev/null
+++ b/content/posts/2020-07-12Road_to_local_K8S.html
@@ -0,0 +1,101 @@
+<section>
+ <h3>Goal</h3>
+ <p>
+ The goal is to deploy kubernetes on my local networks, and keep everything
+ as reproducible as possible.
+ </p>
+ <h3>Stack</h3>
+ <p>
+ I'll use Fedora Core OS, Matchbox and Terraform
+ <sup><a href="#footnotes">1</a></sup>, a match the requirements for
+ Tectonic<sup><a href="#footnotes">2</a></sup>.</p>
+ <h3>Steps</h3>
+ <ul>
+ <li>Network Setup DHCP/TFTP/DNS<sup><a href="#footnotes">3</a></sup></li>
+ <li>Matchbox<sup><a href="#footnotes">4</a></sup></li>
+ <li>PXE nextwork boot evnrionment</li>
+ <li>Terraform Tectonic<sup><a href="#footnotes">5</a></sup></li>
+ </ul>
+ <h3>Network Setup DHCP/TFTP/DNS</h3>
+ <p>First learning the basics</p>
+ <ul>
+ <li>
+ <a href="https://linuxhint.com/install_dhcp_server_ubuntu/">
+ https://linuxhint.com/install_dhcp_server_ubuntu/
+ </a>
+ </li>
+ <li>
+ <a href="https://www.youtube.com/watch?v=XQ3T14SIlV4">
+ https://www.youtube.com/watch?v=XQ3T14SIlV4
+ </a>
+ </li>
+ </ul>
+ <p>
+ To check open ports
+<pre><code>lsof -Pni | grep LISTEN</code></pre>
+ </p>
+ <p>
+ Run the provided<sup><a href="#footnotes">6</a></sup> image with dnsmasq and
+ PXE toolkit
+<pre><code>docker run --rm --cap-add=NET_ADMIN --net=host quay.io/coreos/dnsmasq \
+ -d -q \
+ --dhcp-range=192.168.1.3,192.168.1.254 \
+ --enable-tftp --tftp-root=/var/lib/tftpboot \
+ --dhcp-match=set:bios,option:client-arch,0 \
+ --dhcp-boot=tag:bios,undionly.kpxe \
+ --dhcp-match=set:efi32,option:client-arch,6 \
+ --dhcp-boot=tag:efi32,ipxe.efi \
+ --dhcp-match=set:efibc,option:client-arch,7 \
+ --dhcp-boot=tag:efibc,ipxe.efi \
+ --dhcp-match=set:efi64,option:client-arch,9 \
+ --dhcp-boot=tag:efi64,ipxe.efi \
+ --dhcp-userclass=set:ipxe,iPXE \
+ --dhcp-boot=tag:ipxe,http://matchbox.example.com:8080/boot.ipxe \
+ --address=/matchbox.example/192.168.1.2 \
+ --log-queries \
+ --log-dhcp</code></pre>
+ </p>
+ <h3>Matchbox</h3>
+ <p>...</p>
+ <h3>PXE network boot enviroment</h3>
+ <p>...</p>
+ <h3>Terraform Tectonic</h3>
+ <p>...</p>
+ <h3 id="footnotes">Links</h3>
+ <div >
+ <sup>1</sup>
+ <a href="https://coreos.com/tectonic/docs/latest/install/bare-metal/metal-terraform.html">
+ https://coreos.com/tectonic/docs/latest/install/bare-metal/metal-terraform.html
+ </a>
+ <div>
+ <div>
+ <sup>2</sup>
+ <a href="https://coreos.com/tectonic/docs/latest/install/bare-metal/requirements.html">
+ https://coreos.com/tectonic/docs/latest/install/bare-metal/requirements.html
+ </a>
+ <div>
+ <div>
+ <sup>3</sup>
+ <a href="https://coreos.com/matchbox/docs/latest/network-setup.html">
+ https://coreos.com/matchbox/docs/latest/network-setup.html
+ </a>
+ <div>
+ <div>
+ <sup>4</sup>
+ <a href="https://coreos.com/matchbox/docs/latest/deployment.html">
+ https://coreos.com/matchbox/docs/latest/deployment.html
+ </a>
+ <div>
+ <div>
+ <sup>5</sup>
+ <a href="https://coreos.com/tectonic/releases/">
+ https://coreos.com/tectonic/releases/
+ </a>
+ <div>
+ <div>
+ <sup>6</sup>
+ <a href="https://github.com/poseidon/matchbox/tree/v0.7.0/contrib/dnsmasq">
+ https://github.com/poseidon/matchbox/tree/v0.7.0/contrib/dnsmasq
+ </a>
+ <div>
+</section>
diff --git a/content/posts/2020-07-14Friz_box_turned_off_DHCP.html b/content/posts/2020-07-14Friz_box_turned_off_DHCP.html
index 7eb69ef..3ee5daf 100644
--- a/content/posts/2020-07-14Friz_box_turned_off_DHCP.html
+++ b/content/posts/2020-07-14Friz_box_turned_off_DHCP.html
@@ -1,9 +1,11 @@
<section>
<p>
- If you turned off your DHCP server follow these steps to connect to FritzBox settings.
- <br/>
+ If you turned off your DHCP server follow these steps to connect to
+ FritzBox settings. <br/>
<ul>
- <li> Set your computer IP to 170.254.1.2 and your mask to 255.255.0.0</li>
+ <li>
+ Set your computer IP to 170.254.1.2 and your mask to 255.255.0.0
+ </li>
<li> Then go to 169.254.1.1, login and re-enable the DHCP server:</li>
</ul>
</p>
@@ -11,7 +13,7 @@
On gnome turn the wired connection off on again to apply the settings.
</p>
<p>
- <strong>Note</strong>: why in the hell does FritzBox 7490 require a land-line telephone to be physically factory
- reset?
+ <strong>Note</strong>: why in the hell does FritzBox 7490 require a
+ land-line telephone to be physically factory reset?
</p>
</section>
diff --git a/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html b/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html
new file mode 100644
index 0000000..5fb1d78
--- /dev/null
+++ b/content/posts/2020-08-22Moving_from_Github_to_Gilab_pages.html
@@ -0,0 +1,38 @@
+<section>
+ <p>
+ This was quite simple, I had just to create a simple Gitlab pipeline job and
+ publish to pages this is done by:
+ </p>
+ <pre><code>image: clojure:lein-2.7.0
+
+before_script:
+ - lein deps
+
+test:
+ script:
+ - lein test
+
+pages:
+ stage: deploy
+ script:
+ - lein package
+ artifacts:
+ paths:
+ - public
+ only:
+ - master</code></pre>
+ <dl>
+ <dt>before_script</dt>
+ <dd>will download all the dependencies with <code>lein deps.</code></dd>
+ <dt>test</dt>
+ <dd>it is self explanatory</dd>
+ <dt>pages</dt>
+ <dd>
+ it will compile cljs into js with <code>lein package</code> into
+ <code>public</code> folder to later be published into gitlab pages. Take a
+ look at the <code>artifacts</code> property, it is used to say wich will
+ will be collected.
+ </dd>
+ </dl>
+
+</section>
diff --git a/content/posts/2021-12-26Enable_NFS_on_K3S.html b/content/posts/2021-12-26Enable_NFS_on_K3S.html
index 09f91e7..22ddf33 100644
--- a/content/posts/2021-12-26Enable_NFS_on_K3S.html
+++ b/content/posts/2021-12-26Enable_NFS_on_K3S.html
@@ -1,10 +1,10 @@
<section>
<p>
- By default <a href="https://k3s.io/">K3S</a> comes only with <a
- href="https://github.com/rancher/local-path-provisioner">local-path</a> storage class, and if you are
- running
- with more than one node in your cluster you may want to use a more &ldquo;distributed&rdquo;
- solution. For may case I opted for NFS.
+ By default <a href="https://k3s.io/">K3S</a> comes only
+ with <a href="https://github.com/rancher/local-path-provisioner">local-path</a>
+ storage class, and if you are running with more than one node in your
+ cluster you may want to use a more &ldquo;distributed&rdquo; solution.
+ For may case I opted for NFS.
</p>
<p>
To check the current storage class you can run:
@@ -16,21 +16,22 @@
<pre><code>NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d</code></pre>
<p>
- To start adding First you need to install <a href="https://github.com/helm/helm">helm</a> on your server. To do
- so you may
- run:
+ To start adding First you need to
+ install <a href="https://github.com/helm/helm">helm</a> on your server.
+ To do so you may run:
</p>
<pre><code>curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash</code></pre>
<p>
- Be careful when running scripts directly into bash always check the source
- Sometimes is also recommended to do not pipe directly to bash
+ Be careful when running scripts directly into bash always check the
+ source Sometimes is also recommended to do not pipe directly to bash
</p>
<p>
- Once it is installed we need to add the <a
- href="https://kubernetes.io/docs/concepts/storage/storage-classes/#nfs">NFS storage classes</a>. It has two
- providers, I have chose <a href="https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner">NFS Subdir
- External Provisioner</a>.
+ Once it is installed we need to add
+ the <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#nfs">NFS
+ storage classes</a>. It has two providers, I have
+ chose <a href="https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner">NFS
+ Subdir External Provisioner</a>.
</p>
<p>
Add the helm repo
@@ -46,12 +47,12 @@ local-path (default) rancher.io/local-path Delete
--set nfs.path=/exported/path</code></pre>
</div>
<p>
- Set the <code>nfs.server</code> and <code>nfs.path</code> accordingly with your setup.
+ Set the <code>nfs.server</code> and <code>nfs.path</code> accordingly
+ with your setup.
</p>
-
<p>
- After that if we run <code>k3s kubectl get storageclasses</code> it will now print another
- NFS provider:
+ After that if we run <code>k3s kubectl get storageclasses</code> it will
+ now print another NFS provider:
</p>
<pre><code>NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
diff --git a/content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html b/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.html
index 470965c..470965c 100644
--- a/content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html
+++ b/content/posts/2021-12-28K8S_private_gitlab_registry_using_podman.html