diff options
Diffstat (limited to '_posts')
-rw-r--r-- | _posts/2019-03-03-welcome-to-my-blog.md | 10 | ||||
-rw-r--r-- | _posts/2019-03-07-ansible-part-1.md | 101 | ||||
-rw-r--r-- | _posts/2019-04-22-ansible-part-2.md | 59 | ||||
-rw-r--r-- | _posts/2019-11-16-compiling-emacs.md | 46 |
4 files changed, 0 insertions, 216 deletions
diff --git a/_posts/2019-03-03-welcome-to-my-blog.md b/_posts/2019-03-03-welcome-to-my-blog.md deleted file mode 100644 index fa6244a..0000000 --- a/_posts/2019-03-03-welcome-to-my-blog.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -layout: post -title: "Welcome to my blog" -date: 2019-03-03 -categories: jekyll update ---- -On this blog, I'll be posting some personal projects that I'm working or some stuff that I find interesting to talk about, I hope be able to keep it interesting and produce something of value. - -> 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 even have something to add, open a [MR](https://gitlab.com/gabrielgio/homestation/-/merge_requests) - diff --git a/_posts/2019-03-07-ansible-part-1.md b/_posts/2019-03-07-ansible-part-1.md deleted file mode 100644 index 89934e8..0000000 --- a/_posts/2019-03-07-ansible-part-1.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -layout: post -title: "Automating desktop setup with ansible-pull part-1" -date: 2019-03-07 -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 ( -[genius](https://i.imgur.com/BtWuQgT.png)) that It would be nice to -automate this chore, and as a result, I could tinker a little more with -my system and not be afraid of spending a weekend reinstalling -everything (which have happened more time that I'd likei to remenber) - -So after a few attempts using python or/and bash, I couldn't get something -that scales and ended with many files and keep the files organized and -concise turned out to be more tedious than the setup itself. So it comes -[Ansible](https://www.ansible.com/). It is an enterprise-grade software -used to automate tasks. It has many features I can be really helpful as -a sysadmin but what we gonna focus here is cliente side of thing using -[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 describe: - -> 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. - -The next step is to pull a playbook from a git account and run on -the host, the playbook will have tasks needed to setup our -machine. - -To run it locally first we need to add localhost to hosts list, to do so we -only the following text added to `/etc/ansible/hosts`: - -{% highlight text %} -[all] -localhost -{% endhighlight %} - -As an experiment we're gonna make tasks to install vim. Currently, I -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 - -The playbook to install is quite simple: - -{% highlight yml %} -# main.yml -- hosts: all - tasks: - - name: install vim - dnf: - name: vim - state: latest -{% endhighlight %} - -Fist `hosts:` it is required and it has to match our hosts so we are -able to run that playbook. Then `tasks:` which is a list of task that -the playbook will perform that in this case will be `dnf install` for -the vim package. - -Ansible pull requires a repository but for the first example I want to -keep it simple so we will use `ansible-playbook` commando to run -`main.yml` direct from disk, do to so just run the following command: - -{% highlight bash %} -sudo ansible-playbook --connection=local main.yml -{% endhighlight %} - -After a few seconds, vim will be installed on your machine. -{% highlight bash %} -PLAY [all] ************************************************************* - -TASK [Gathering Facts] ************************************************* -ok: [localhost] - -TASK [install vim] ***************************************************** -ok: [localhost] - -PLAY RECAP ************************************************************* -localhost : ok=2 changed=0 unreachable=0 failed=0 -{% endhighlight %} - -This is the first step, next part we shall create a more complex -playbook and setup repo and actually use `ansible-pull` - - - - - - diff --git a/_posts/2019-04-22-ansible-part-2.md b/_posts/2019-04-22-ansible-part-2.md deleted file mode 100644 index c5936de..0000000 --- a/_posts/2019-04-22-ansible-part-2.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: post -title: "Automating desktop setup with ansible-pull part-2" -date: 2019-04-22 -tags: ['ansible', 'ansible-pull', 'linux', 'fedora'] ---- - -[See part 1]({% post_url 2019-03-07-ansible-part-1 %}) - -Now we're gonna setup ansible to work with a git repository. The process is quite similar with `ansible-playbook` the only difference is that command will get a repository instead of a folder. Following the previews example we'll get vim setup automated. - -Do 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're gonna 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 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 itself, identical as in the part 1. - -{% highlight yml %} -# main.yml ---- -- name: install vim - dnf: - name: vim - state: latest -{% endhighlight %} - -To copy `.vimrc` file to your `$HOME` we going to use [copy module](https://docs.ansible.com/ansible/latest/modules/copy_module.html): - -{% highlight yml %} -# main.yml ---- -- name: copy vimrc file - copy: - src: config/.vimrc - dest: ~/ - mode: 0644 -{% endhighlight %} - -After adding those two files your repository will be something [like this](https://gitlab.com/gabrielgio/homestation/-/tree/debcf3458df511aef9f7dca0cb73f6cf6baddd5d). - -And now we just need to run `ansible-pull` command - -{% highlight bash %} -# you may need run it as a sudo -ansible-pull -U <YOUR_REPO> -i all main.yml -{% endhighlight %} - -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 just running my sample: -{% highlight bash %} -ansible-pull -U https://gitlab.com/gabrielgio/homestation.git -C debcf3458df511aef9f7dca0cb73f6cf6baddd5d -i all main.yml -{% endhighlight %} - -The idea here is to keep your repository as a source of truth when comes to configuration, you can add this task to your 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 receive an update. You can use this method as a simple way to install software, update machines or even distribute tools company-wise. diff --git a/_posts/2019-11-16-compiling-emacs.md b/_posts/2019-11-16-compiling-emacs.md deleted file mode 100644 index 5dfa252..0000000 --- a/_posts/2019-11-16-compiling-emacs.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: post -title: "Compiling emacs from source code on fedora" -date: 2019-11-16 -tags: ['emacs', 'emacs27', 'linux', 'fedora'] ---- - -Lately I have been using emacs quite heavily, I started using org mode after a friend insistently -telling me to try, got hooked and now I'm addicted on spacemacs+evil mode, very useful, I recommend it! -I'm compiling emacs because emacs 27, which it is not available on fedora repos yet, has some serious start up -performance improvement which I more then welcome when using spacemacs. - -But enough talking lets down to the business. - -First install the following packages: - -{% highlight bash %} -sudo dnf install git autoconf make gcc texinfo gnutls-devel giflib-devel ncurses-devel libjpeg-turbo-devel giflib-devel gtk3-devel libXpm-devel -{% endhighlight %} - -Then we need to clone the repo from [savannah.gnu.org](http://savannah.gnu.org/projects/emacs/) where is hosted -the source code of emacs: -{% highlight bash %} - git clone -b master git://git.sv.gnu.org/emacs.git -{% endhighlight %} - -Navigate to emacs folder that we've just cloned and execute the following steps - -{% highlight bash %} -./autogen.sh -./configure -make -j$(nproc) -sudo make install -{% endhighlight %} - -After that you will have emacs 27 or further running on your machine. To verify the version just run `emacs --version`. - -### Bonus content -For maximum awesomeness I would suggest using [spacemacs](https://www.spacemacs.org/), -tt has a lot of features out of the box. To install: - -{% highlight bash %} -git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d -{% endhighlight %} - - |