From 93ad4d03b9d87d6177514de27bb94d9230da82e6 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Tue, 21 Jun 2022 21:39:04 +0200 Subject: ref: Move from orgmode to markdown I'll never ever again move away from markdown. fix: Move to http ... until I add a certificate --- LICENSE | 22 +++++ README.md | 2 +- config.toml | 2 +- content/logs/2019-11-16-compiling-emacs.org | 36 -------- content/logs/2020-07-13-k8s.org | 73 ---------------- content/logs/2020-07-14-fritzbox.org | 16 ---- content/logs/2020-08-22-genpass.org | 35 -------- content/logs/2020-12-28-k8s-private-registry.org | 57 ------------- content/logs/2021-12-26-nfs-k3s.org | 61 ------------- content/posts/2019-03-03-welcome-to-my-blog.md | 14 +++ content/posts/2019-03-03-welcome-to-my-blog.org | 12 --- content/posts/2019-03-07-ansible-part-1.md | 104 +++++++++++++++++++++++ content/posts/2019-03-07-ansible-part-1.org | 99 --------------------- content/posts/2019-04-22-ansible-part-2.md | 79 +++++++++++++++++ content/posts/2019-04-22-ansible-part-2.org | 75 ---------------- content/posts/2019-11-16-compiling-emacs.md | 40 +++++++++ content/posts/2020-07-13-k8s.md | 79 +++++++++++++++++ content/posts/2020-07-14-fritzbox.md | 16 ++++ content/posts/2020-08-22-genpass.md | 39 +++++++++ content/posts/2020-12-28-k8s-private-registry.md | 56 ++++++++++++ content/posts/2021-12-26-nfs-k3s.md | 62 ++++++++++++++ content/projects/_index.md | 14 +-- themes/flamingo/layouts/partials/header.html | 1 - 23 files changed, 520 insertions(+), 474 deletions(-) create mode 100644 LICENSE delete mode 100644 content/logs/2019-11-16-compiling-emacs.org delete mode 100644 content/logs/2020-07-13-k8s.org delete mode 100644 content/logs/2020-07-14-fritzbox.org delete mode 100644 content/logs/2020-08-22-genpass.org delete mode 100644 content/logs/2020-12-28-k8s-private-registry.org delete mode 100644 content/logs/2021-12-26-nfs-k3s.org create mode 100644 content/posts/2019-03-03-welcome-to-my-blog.md delete mode 100644 content/posts/2019-03-03-welcome-to-my-blog.org create mode 100644 content/posts/2019-03-07-ansible-part-1.md delete mode 100644 content/posts/2019-03-07-ansible-part-1.org create mode 100644 content/posts/2019-04-22-ansible-part-2.md delete mode 100644 content/posts/2019-04-22-ansible-part-2.org create mode 100644 content/posts/2019-11-16-compiling-emacs.md create mode 100644 content/posts/2020-07-13-k8s.md create mode 100644 content/posts/2020-07-14-fritzbox.md create mode 100644 content/posts/2020-08-22-genpass.md create mode 100644 content/posts/2020-12-28-k8s-private-registry.md create mode 100644 content/posts/2021-12-26-nfs-k3s.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..588d327 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2021 Gabriel Arakaki Giovanini + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/README.md b/README.md index fec77b5..c0e4911 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # My personal blog -[gabrielgio.me](https://gabrielgio.me) +[gabrielgio.me](http://gabrielgio.me) To run you just need to: diff --git a/config.toml b/config.toml index 43c6591..75f1f4e 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,4 @@ -baseURL = "https://gabrielgio.me/" +baseURL = "http://gabrielgio.me/" languageCode = "en-us" title = "Yet Another Blog" theme = "flamingo" diff --git a/content/logs/2019-11-16-compiling-emacs.org b/content/logs/2019-11-16-compiling-emacs.org deleted file mode 100644 index 23a2181..0000000 --- a/content/logs/2019-11-16-compiling-emacs.org +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Compiling emacs from source code on Fedora" -date: 2019-11-16 -lastmod: 2020-08-25 -tags: ['emacs', 'emacs27', 'linux', 'fedora'] ---- - -Compiling emacs from source and installing on fedora. - -* Installing Packages -Install the following packages: -#+BEGIN_SRC -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 -#+END_SRC - -* Cloning Repository -Clone repository [[http://savannah.gnu.org/projects/emacs/][savannah.gnu.org]]: -#+BEGIN_SRC -git clone -b master git://git.sv.gnu.org/emacs.git -#+END_SRC - -* Compiling -Navigate to emacs folder (~cd emacs~) and execute the following steps - -#+BEGIN_SRC sh -./autogen.sh -./configure -make -j$(nproc) -sudo make install -#+END_SRC - -After verify version with ~emacs --version~, it should be equal or higher than -=28.0.50=. diff --git a/content/logs/2020-07-13-k8s.org b/content/logs/2020-07-13-k8s.org deleted file mode 100644 index b55c982..0000000 --- a/content/logs/2020-07-13-k8s.org +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "Road to local k8s" -date: 2020-07-13 -tags: ['kubernetes', 'linux', 'fedora'] ---- - -* Goal -The goal is to deploy kubernetes on my local networks, and keep everything as -reproducible as possible. - -* Stack - -I'll use Fedora Core OS, Matchbox and Terraform [fn:1], a match the requirements -for Tectonic [fn:2] - -** Steps -- Network Setup DHCP/TFTP/DNS [fn:3] -- Matchbox [fn:4] -- PXE network boot environment -- Terraform Tectonic [fn:5] - -** Network Setup DHCP/TFTP/DNS -First learning the basics again: - -- https://linuxhint.com/install_dhcp_server_ubuntu/ -- https://www.youtube.com/watch?v=XQ3T14SIlV4 - - -To check open ports -#+BEGIN_SRC sh -lsof -Pni | grep LISTEN -#+END_SRC - -Run the provided [fn:dnsmasq] image with ~dnsmasq~ and PXE toolkit - -#+BEGIN_SRC sh -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 -#+END_SRC - - -** Matchbox -** PXE network boot environment -** Terraform Tectonic - ------- -* Links -[fn:1]https://coreos.com/tectonic/docs/latest/install/bare-metal/metal-terraform.html - -[fn:2]https://coreos.com/tectonic/docs/latest/install/bare-metal/requirements.html - -[fn:3]https://coreos.com/matchbox/docs/latest/network-setup.html - -[fn:4]https://coreos.com/matchbox/docs/latest/deployment.html - -[fn:5]https://coreos.com/tectonic/releases/ - -[fn:dnsmasq]https://github.com/poseidon/matchbox/tree/v0.7.0/contrib/dnsmasq diff --git a/content/logs/2020-07-14-fritzbox.org b/content/logs/2020-07-14-fritzbox.org deleted file mode 100644 index df0fb52..0000000 --- a/content/logs/2020-07-14-fritzbox.org +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Friz.box turned off DHCP" -date: 2020-07-14 -tags: ['fritz.box', 'DHCP'] ---- - -If you turned off your DHCP server follow these steps to connect to FritzBox -settings. - -- Set your computer IP to ~169.254.1.2~ and your mask to ~255.255.0.0~ -- Then go to ~169.254.1.1~, login and re-enable the DHCP server. - -On gnome turn the wired connection off on again to apply the settings. - -Note: why in the hell does FritzBox 7490 require a land-line telephone to be -physically factory reset? diff --git a/content/logs/2020-08-22-genpass.org b/content/logs/2020-08-22-genpass.org deleted file mode 100644 index c9a0a98..0000000 --- a/content/logs/2020-08-22-genpass.org +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "Moving from Github to Gitlab pages" -date: 2020-08-22 -tags: ['gitlab'] ---- - -This was quite simple, I had just to create a simple Gitlab pipeline job and -publish to pages this is done by: - -#+BEGIN_SRC -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 - -#+END_SRC - -- before_script :: will download all the dependencies with ~lein deps~. -- test :: is self explanatory. -- pages :: will compile the cljs into js with ~lein package~ and publish it into - pages. diff --git a/content/logs/2020-12-28-k8s-private-registry.org b/content/logs/2020-12-28-k8s-private-registry.org deleted file mode 100644 index 9a571ef..0000000 --- a/content/logs/2020-12-28-k8s-private-registry.org +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: "K8S private gitlab registry using podman" -date: 2021-12-28 -tags: ['kubernetes', 'linux', 'podman', 'gitlab', 'k3s'] ---- - -This is based on [[https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/][Log in to Docker Hub]]. -It is just a bit different to use podman - -First we should take a look at podman-login man page: - -#+BEGIN_SRC bash -man podman login -#+END_SRC - -It will give some valueable information like the location of auth.json file. -Now we can login using podman: - -#+BEGIN_SRC bash -podman login registry.gitlab.com -#+END_SRC - -Then check the ~auth.json~ file located at -~${XDG_RUNTIME_DIR}/containers/auth.json~ (as described by the manual). - -#+BEGIN_SRC bash -cat "${XDG_RUNTIME_DIR}/containers/auth.json" -#+END_SRC - -It will print your auth config: - -#+BEGIN_SRC json -{ - "auths": { - "registry.gitlab.com": { - "auth": "..." - } - } -} -#+END_SRC - -Now copy that file over to the server and register it in k8s with the following command: - -#+BEGIN_SRC bash -kubectl create secret generic regcred \ - --from-file=.dockerconfigjson=auth.json \ - --type=kubernetes.io/dockerconfigjson -#+END_SRC - -Once you have created you can list by ~kubectl get secret~: - -#+BEGIN_SRC -NAME TYPE DATA AGE -regcred kubernetes.io/dockerconfigjson 1 53s -#+END_SRC - - diff --git a/content/logs/2021-12-26-nfs-k3s.org b/content/logs/2021-12-26-nfs-k3s.org deleted file mode 100644 index 5785d4f..0000000 --- a/content/logs/2021-12-26-nfs-k3s.org +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: "Enable NFS on K3S" -date: 2021-12-26 -tags: ['kubernetes', 'linux', 'helm', 'k3s'] ---- - -By default [[https://k3s.io/][K3S]] comes only with [[https://github.com/rancher/local-path-provisioner][local-path]] storage class, and if you are running -with more than one node in your cluster you may want to use a more "distributed" -solution. For may case I opted for NFS. - -To check the current storage class you can run: - -#+BEGIN_SRC bash -k3s kubectl get storageclasses -#+END_SRC - -And it will print something like: - -#+BEGIN_SRC -NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE -local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d -#+END_SRC - -To start adding First you need to install [[https://github.com/helm/helm][helm]] on your server. To do so you may -run: - -#+BEGIN_SRC bash -curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -#+END_SRC - -*Be careful when running scripts directly into bash always check the source* -*Sometimes is also recommended to do not pipe directly to bash* - -Once it is installed we need to add the [[https://kubernetes.io/docs/concepts/storage/storage-classes/#nfs][NFS storage classes]]. It has two -providers, I have chose [[https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner][NFS Subdir External Provisioner]]. - -Add the helm repo - -#+BEGIN_SRC bash -helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/ -#+END_SRC - -Then we need to actually install the provider - - -#+BEGIN_SRC bash -helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \ - --set nfs.server=x.x.x.x \ - --set nfs.path=/exported/path -#+END_SRC - -Set the ~nfs.server~ and ~nfs.path~ accordingly with your setup. - -After that if we run ~k3s kubectl get storageclasses~ it will now print another -NFS provider: - -#+BEGIN_SRC -NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE -local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d -nfs-client cluster.local/nfs-subdir-external-provisioner Delete Immediate true 76m -#+END_SRC diff --git a/content/posts/2019-03-03-welcome-to-my-blog.md b/content/posts/2019-03-03-welcome-to-my-blog.md new file mode 100644 index 0000000..01aeff3 --- /dev/null +++ b/content/posts/2019-03-03-welcome-to-my-blog.md @@ -0,0 +1,14 @@ ++++ +title = "Welcome to my blog" +date = 2019-03-03 +lastmod = 2020-07-12 ++++ + +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. + +*Disclaimer*: English it\'s not my native language so if you find +something that you don\'t understand I\'d love you to open an +[issue](https://gitlab.com/gabrielgio/homestation/-/issuess), or if you +have something to add open a +[MR](phttps://gitlab.com/gabrielgio/homestation/-/merge_requests) diff --git a/content/posts/2019-03-03-welcome-to-my-blog.org b/content/posts/2019-03-03-welcome-to-my-blog.org deleted file mode 100644 index 889131d..0000000 --- a/content/posts/2019-03-03-welcome-to-my-blog.org +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Welcome to my blog" -date: 2019-03-03 -lastmod: 2020-07-12 ---- - -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. - -/Disclaimer/: English it's not my native language so if you find something that -you don't understand I'd love you to open an [[https://gitlab.com/gabrielgio/homestation/-/issuess][issue]], or if you have something to -add open a [[phttps://gitlab.com/gabrielgio/homestation/-/merge_requests][MR]] diff --git a/content/posts/2019-03-07-ansible-part-1.md b/content/posts/2019-03-07-ansible-part-1.md new file mode 100644 index 0000000..2746afc --- /dev/null +++ b/content/posts/2019-03-07-ansible-part-1.md @@ -0,0 +1,104 @@ +--- +layout: post +title: "Automating setup with ansible-pull part-1" +date: 2019-03-07 +lastmod: 2020-07-12 +tags: ['ansible','ansible-pull', 'linux', 'fedora'] +--- + +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 toy 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). + +\ + +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 [Ansible](https://www.ansible.com/). 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 +focus on [Ansible +Pull](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#ansible-pull) +and +[Playbooks](https://docs.ansible.com/ansible/latest/user_guide/playbooks.html). +As better described: + +> \[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. +> +> [source](https://docs.ansible.com/ansible/latest/cli/ansible-pull.html) + +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. + +But first lets toy 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`: + +``` service +[all] +localhost +``` + +As an experiment we\'re going to write a asks to install vim. Currently, I\'m +using [Fedora](https://getfedora.org/) thus we going to use [dnf +modeule](https://docs.ansible.com/ansible/latest/modules/dnf_module.html) to +install packages, but if you\'re using another distribution look for a +equivalent module like [apt +module](https://docs.ansible.com/ansible/latest/modules/apt_module.html) for +[Ubuntu](https://ubuntu.com/). + +The playbook to install is quite straightforward: + +``` yaml +# main.yaml +- hosts: all + tasks: + - name: install vim + dnf: + name: vim + state: latest +``` + +`hosts:` is required and it has to match our hosts otherwise the +playbook won\'t run. + +`tasks:` is the list of tasks that the playbook will perform, in this +case will be `dnf install vim`. + +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: + +``` bash +sudo ansible-playbook --connection=local main.yml +``` + +After a few seconds, vim will be installed on your machine. + +``` +PLAY [all] ************************************************************* + +TASK [Gathering Facts] ************************************************* +ok: [localhost] + +TASK [install vim] ***************************************************** +ok: [localhost] + +PLAY RECAP ************************************************************* +localhost : ok=2 changed=0 unreachable=0 failed=0 +``` + +This is the first step, next part we shall create a more complex +playbook and setup repository to run it remotely using `ansible-pull`. diff --git a/content/posts/2019-03-07-ansible-part-1.org b/content/posts/2019-03-07-ansible-part-1.org deleted file mode 100644 index c8782e9..0000000 --- a/content/posts/2019-03-07-ansible-part-1.org +++ /dev/null @@ -1,99 +0,0 @@ ---- -layout: post -title: "Automating setup with ansible-pull part-1" -date: 2019-03-07 -lastmod: 2020-07-12 -tags: ['ansible', 'ansible-pull', 'linux', 'fedora'] ---- - -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). - - - -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 [[https://www.ansible.com/][Ansible]]. 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 focus on [[https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#ansible-pull][Ansible Pull]] and -[[https://docs.ansible.com/ansible/latest/user_guide/playbooks.html][Playbooks]]. As better described: - -#+BEGIN_QUOTE -[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. - -[[https://docs.ansible.com/ansible/latest/cli/ansible-pull.html][source]] -#+END_QUOTE - -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. - -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~: - -#+BEGIN_SRC service -[all] -localhost -#+END_SRC - -As an experiment we're going to write a asks to install vim. Currently, I'm using -[[https://getfedora.org/][Fedora]] thus we going to use [[https://docs.ansible.com/ansible/latest/modules/dnf_module.html][dnf modeule]] to install packages, but if you're using -another distribution look for a equivalent module like [[https://docs.ansible.com/ansible/latest/modules/apt_module.html][apt module]] for [[https://ubuntu.com/][Ubuntu]]. - -The playbook to install is quite simple: - -#+BEGIN_SRC yaml -# main.yaml -- hosts: all - tasks: - - name: install vim - dnf: - name: vim - state: latest -#+END_SRC - -~hosts:~ is required and it has to match our hosts otherwise the playbook won't -run. - -~tasks:~ is the list of tasks that the playbook will perform, in this case will -be ~dnf install vim~. - -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: - -#+BEGIN_SRC bash -sudo ansible-playbook --connection=local main.yml -#+END_SRC - - -After a few seconds, vim will be installed on your machine. - -#+BEGIN_SRC -PLAY [all] ************************************************************* - -TASK [Gathering Facts] ************************************************* -ok: [localhost] - -TASK [install vim] ***************************************************** -ok: [localhost] - -PLAY RECAP ************************************************************* -localhost : ok=2 changed=0 unreachable=0 failed=0 -#+END_SRC - - -This is the first step, next part we shall create a more complex playbook and -setup repository to run it remotely using ~ansible-pull~. - diff --git a/content/posts/2019-04-22-ansible-part-2.md b/content/posts/2019-04-22-ansible-part-2.md new file mode 100644 index 0000000..e50005e --- /dev/null +++ b/content/posts/2019-04-22-ansible-part-2.md @@ -0,0 +1,79 @@ +--- +title: "Automating desktop setup with ansible-pull part-2" +date: 2019-04-22 +lastmod: 2020-07-12 +tags: ['ansible', 'ansible-pull', 'linux', 'fedora'] +--- + +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. + +Create a git repository wherever you see fit, +[gitlab](https://about.gitlab.com/) and [github](https://github.com/) 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. + +In the `.vimrc` add your own configuration, you can see mine [over +here](https://gitlab.com/gabrielgio/homestation/-/blob/debcf3458df511aef9f7dca0cb73f6cf6baddd5d/.vimrc), +it is pretty small as I don\'t use it but for small text editing (like this +post) so you can start with that if you don\'t have one. + +The `yml` file will have two tasks, one is to install vim, just like we +did in the part 1. + +``` yaml +# main.yml +--- +- name: install vim + dnf: + name: vim + state: latest +``` + +To copy `.vimrc` file to your `$HOME` we going to use [copy +module](https://docs.ansible.com/ansible/latest/modules/copy_module.html): + +``` yaml +# main.yml +--- +- name: copy vimrc file + copy: + src: config/.vimrc + dest: ~/ + mode: 0644 +``` + +After we\'ve added those two files to repository you will have be something +[like +this](https://gitlab.com/gabrielgio/homestation/-/tree/debcf3458df511aef9f7dca0cb73f6cf6baddd5d). + +And now we just need to run `ansible-pull` command + +``` shell +# you may need run it as a sudo +ansible-pull -U $YOUR_REPO -i all main.yml +``` + +Params: + +- **`-i`** is a list of hosts. +- **`-U`** is the git repository URL. + +Remember `man` is your best friend, take a look at `man ansible-pull` to +know more about its parameters. + +The best part you can quickly test and see the result by running my +sample: + +``` shell +ansible-pull -U https://gitlab.com/gabrielgio/homestation.git -C debcf3458df511aef9f7dca0cb73f6cf6baddd5d -i all main.yml +``` + +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 straightforward way to install software, update machines or +even distribute tooling company-wise. diff --git a/content/posts/2019-04-22-ansible-part-2.org b/content/posts/2019-04-22-ansible-part-2.org deleted file mode 100644 index cea1161..0000000 --- a/content/posts/2019-04-22-ansible-part-2.org +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: "Automating desktop setup with ansible-pull part-2" -date: 2019-04-22 -lastmod: 2020-07-12 -tags: ['ansible', 'ansible-pull', 'linux', 'fedora'] ---- - -[[{{< ref "2019-03-07-ansible-part-1.org " >}}][See part 1]] - -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. - -Create a git repository wherever you see fit, [[https://about.gitlab.com/][gitlab]] and [[https://github.com/][github]] 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. - - -In the ~.vimrc~ add your own configuration, you can see mine [[https://gitlab.com/gabrielgio/homestation/-/blob/debcf3458df511aef9f7dca0cb73f6cf6baddd5d/.vimrc][over here]], 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. - -The ~yml~ file will have two tasks, one is to install vim, just like we did in -the part 1. - -#+BEGIN_SRC yaml -# main.yml ---- -- name: install vim - dnf: - name: vim - state: latest -#+END_SRC - -To copy ~.vimrc~ file to your ~$HOME~ we going to use [[https://docs.ansible.com/ansible/latest/modules/copy_module.html][copy module]]: - -#+BEGIN_SRC yaml -# main.yml ---- -- name: copy vimrc file - copy: - src: config/.vimrc - dest: ~/ - mode: 0644 -#+END_SRC - -After we've added those two files to repository you will have be something [[https://gitlab.com/gabrielgio/homestation/-/tree/debcf3458df511aef9f7dca0cb73f6cf6baddd5d][like -this]]. - -And now we just need to run ~ansible-pull~ command - -#+BEGIN_SRC shell -# you may need run it as a sudo -ansible-pull -U $YOUR_REPO -i all main.yml -#+END_SRC - -Params: -- *~-i~* is a list of hosts. -- *~-U~* is the git repository URL. - -Remember ~man~ is your best friend, take a look at ~man ansible-pull~ to know -more about its parameters. - -The best part you can quickly test and see the result by running my sample: -#+BEGIN_SRC shell -ansible-pull -U https://gitlab.com/gabrielgio/homestation.git -C debcf3458df511aef9f7dca0cb73f6cf6baddd5d -i all main.yml -#+END_SRC - -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. diff --git a/content/posts/2019-11-16-compiling-emacs.md b/content/posts/2019-11-16-compiling-emacs.md new file mode 100644 index 0000000..6773344 --- /dev/null +++ b/content/posts/2019-11-16-compiling-emacs.md @@ -0,0 +1,40 @@ +--- +title: "Compiling emacs from source code on Fedora" +date: 2019-11-16 +lastmod: 2020-08-25 +tags: ['emacs', 'emacs27','linux', 'fedora'] +--- + +Compiling emacs from source and installing on fedora. + +# Installing Packages + +Install the following packages: + +```shell +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 +``` + +# Cloning Repository + +Clone repository +[savannah.gnu.org](http://savannah.gnu.org/projects/emacs/): + + git clone -b master git://git.sv.gnu.org/emacs.git + +# Compiling + +Navigate to emacs folder (`cd emacs`) and run the following steps + +```shell +./autogen.sh +./configure +make -j$(nproc) +sudo make install +``` + +After verify version with `emacs --version`, it should be equal or +higher than `28.0.50`. diff --git a/content/posts/2020-07-13-k8s.md b/content/posts/2020-07-13-k8s.md new file mode 100644 index 0000000..8b706c1 --- /dev/null +++ b/content/posts/2020-07-13-k8s.md @@ -0,0 +1,79 @@ +--- +title: "Road to local k8s" +date: 2020-07-13 +tags: ['kubernetes', 'linux', 'fedora'] +--- + +# Goal + +The goal is to deploy kubernetes on my local networks, and keep everything as +reproducible as possible. + +# Stack + +I\'ll use Fedora Core OS, Matchbox and Terraform [^1], a match the requirements +for Tectonic [^2] + +## Steps + +- Network Setup DHCP/TFTP/DNS [^3] +- Matchbox [^4] +- PXE network boot environment +- Terraform Tectonic [^5] + +## Network Setup DHCP/TFTP/DNS + +First learning the basics again: + +- +- + +To check open ports + +```shell +lsof -Pni | grep LISTEN +``` + +Run the provided [^6] image with `dnsmasq` and PXE toolkit + +``` {.bash org-language="sh"} +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 +``` + +## Matchbox + +## PXE network boot environment + +## Terraform Tectonic + +------------------------------------------------------------------------ + +# Links + +[^1]: + +[^2]: + +[^3]: + +[^4]: + +[^5]: + +[^6]: diff --git a/content/posts/2020-07-14-fritzbox.md b/content/posts/2020-07-14-fritzbox.md new file mode 100644 index 0000000..bba7f4e --- /dev/null +++ b/content/posts/2020-07-14-fritzbox.md @@ -0,0 +1,16 @@ +--- +title: "Friz.box turned off DHCP" +date: 2020-07-14 +tags: ['fritz.box', 'DHCP'] +--- + +If you turned off your DHCP server follow these steps to connect to FritzBox +settings. + +- Set your computer IP to `169.254.1.2` and your mask to `255.255.0.0` +- Then go to `169.254.1.1`, login and re-enable the DHCP server. + +On gnome turn the wired connection off on again to apply the settings. + +Note: why in the hell does FritzBox 7490 require a land-line telephone to be +physically factory reset? diff --git a/content/posts/2020-08-22-genpass.md b/content/posts/2020-08-22-genpass.md new file mode 100644 index 0000000..3991a86 --- /dev/null +++ b/content/posts/2020-08-22-genpass.md @@ -0,0 +1,39 @@ +--- +title: "Moving from Github to Gitlab pages" +date: 2020-08-22 +tags: ['gitlab'] +--- + +This was quite fast, I had just to create a small Gitlab pipeline job and +publish to pages this is done by: + +```yml +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 +``` + +before_script +: will download all the dependencies with `lein deps`. + +test +: is self explanatory. + +pages +: will compile the cljs into js with `lein package` and publish it + into pages. diff --git a/content/posts/2020-12-28-k8s-private-registry.md b/content/posts/2020-12-28-k8s-private-registry.md new file mode 100644 index 0000000..6706da7 --- /dev/null +++ b/content/posts/2020-12-28-k8s-private-registry.md @@ -0,0 +1,56 @@ +--- +title: "K8S private gitlab registry using podman" +date: 2021-12-28 +tags: ['kubernetes', 'linux', 'podman', 'gitlab', 'k3s'] +--- + +This is based on [Log in to Docker +Hub](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/). +It is just a bit different to use podman + +First we should take a look at podman-login man page: + +``` bash +man podman login +``` + +It will give some valueable information like the location of auth.json +file. Now we can login using podman: + +``` bash +podman login registry.gitlab.com +``` + +Then check the `auth.json` file located at +`${XDG_RUNTIME_DIR}/containers/auth.json` (as described by the manual). + +``` bash +cat "${XDG_RUNTIME_DIR}/containers/auth.json" +``` + +It will print your auth config: + +``` json +{ + "auths": { + "registry.gitlab.com": { + "auth": "..." + } + } +} +``` + +Now copy that file over to the server and register it in k8s with the +following command: + +``` bash +kubectl create secret generic regcred \ + --from-file=.dockerconfigjson=auth.json \ + --type=kubernetes.io/dockerconfigjson +``` + +Once you have created you can list by `kubectl get secret`: +``` +NAME TYPE DATA AGE +regcred kubernetes.io/dockerconfigjson 1 53s +``` diff --git a/content/posts/2021-12-26-nfs-k3s.md b/content/posts/2021-12-26-nfs-k3s.md new file mode 100644 index 0000000..e9988c7 --- /dev/null +++ b/content/posts/2021-12-26-nfs-k3s.md @@ -0,0 +1,62 @@ +--- +title: "Enable NFS on K3S" +date: 2021-12-26 +tags: ['kubernetes', 'linux', 'helm', 'k3s'] +--- + +By default [K3S](https://k3s.io/) comes only with +[local-path](https://github.com/rancher/local-path-provisioner) storage +class, and if you are running with more than one node in your cluster +you may want to use a more \"distributed\" solution. For may case I +opted for NFS. + +To check the current storage class you can run: + +``` bash +k3s kubectl get storageclasses +``` + +And it will print something like: + + NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE + local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d + +To start adding First you need to install +[helm](https://github.com/helm/helm) on your server. To do so you may +run: + +``` bash +curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash +``` + +**Be careful when running scripts directly into bash always check the +source** **Sometimes is also recommended to do not pipe directly to +bash** + +Once it is installed we need to add the [NFS storage +classes](https://kubernetes.io/docs/concepts/storage/storage-classes/#nfs). +It has two providers, I have chose [NFS Subdir External +Provisioner](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner). + +Add the helm repo + +``` bash +helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/ +``` + +Then we need to actually install the provider + +``` bash +helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \ + --set nfs.server=x.x.x.x \ + --set nfs.path=/exported/path +``` + +Set the `nfs.server` and `nfs.path` accordingly with your setup. + +After that if we run `k3s kubectl get storageclasses` it will now print +another NFS provider: + + NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE + local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 154d + nfs-client cluster.local/nfs-subdir-external-provisioner Delete Immediate true 76m diff --git a/content/projects/_index.md b/content/projects/_index.md index 3195403..7dfbe4c 100644 --- a/content/projects/_index.md +++ b/content/projects/_index.md @@ -8,24 +8,24 @@ draft = false Just a list of some projects I have done and find useful on my day-to-day life. -- [Hub Watcher](https://hub-watcher.gabrielgio.me/) +- [Hub Watcher](https://hub-watcher.gabrielgio.me/) [[gitlab](https://gitlab.com/gabrielgio/hub-watcher)] - + A small project to monitor changes in a docker image from [docker hub](https://hub.docker.com/). By default every 5 minutes it will fetch the digest of image and compare with the previous returned digest, if they are different it will make a post request to a given url. - + I created it so I can automatically trigger my gitlab pipeline to build my custom nextcloud image everytime Nextcloud GmbH updates their image. - + - [Reddit to Nextcloud importer](https://gabrielgio.gitlab.io/reddit-nextcloud-importer/) [[github](https://gitlab.com/gabrielgio/reddit-nextcloud-importer)] A small project that monitors user\'s saved posts on reddit, downloads its - media and uploads to a nextcloud instance. - + media and uploads to a nextcloud instance. + It combines 3 projects: [praw](https://github.com/praw-dev/praw) to read and motitor user's saved feed, [gallery-dl](https://github.com/mikf/gallery-dl) to download media from several sources, and @@ -44,7 +44,7 @@ Just a list of some projects I have done and find useful on my day-to-day life. - [Password generator](https://genpass.gabrielgio.me/) [[gitlab](https://gitlab.com/gabrielgio/genpass)] - + It started with me having fun with clojure script ([last commit](https://gitlab.com/gabrielgio/genpass/-/tree/2db3d88503fbe219e99c464c4cc8e768613e1359)). Now I have been using it as a playground to play a bit with rust/wasm and it diff --git a/themes/flamingo/layouts/partials/header.html b/themes/flamingo/layouts/partials/header.html index 80240ee..317d589 100644 --- a/themes/flamingo/layouts/partials/header.html +++ b/themes/flamingo/layouts/partials/header.html @@ -8,7 +8,6 @@