gabrielgio.me @ 2dacc92f01056d24a0af49f007079a79825ff048

Add ansible-pull part 1
  1diff --git a/_posts/2019-03-03-welcome-to-my-blog.markdown b/_posts/2019-03-03-welcome-to-my-blog.md
  2rename from _posts/2019-03-03-welcome-to-my-blog.markdown
  3rename to _posts/2019-03-03-welcome-to-my-blog.md
  4index b40f49fab8aab53fd328f02ed6b33c230871e3f5..8973461675afd056b4f231bd83bb1d32dc4bc62e 100644
  5--- a/_posts/2019-03-03-welcome-to-my-blog.markdown
  6+++ b/_posts/2019-03-03-welcome-to-my-blog.md
  7@@ -1,7 +1,7 @@
  8 ---
  9 layout: post
 10 title:  "Welcome to my blog"
 11-date:   2019-03-03 10:50:11 -0300
 12+date:   2019-03-03
 13 categories: jekyll update
 14 ---
 15 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.
 16diff --git a/_posts/2019-03-07-ansible-part-1.md b/_posts/2019-03-07-ansible-part-1.md
 17new file mode 100644
 18index 0000000000000000000000000000000000000000..7512865b2202578c99945b6dd7a90a0ddb3da970
 19--- /dev/null
 20+++ b/_posts/2019-03-07-ansible-part-1.md
 21@@ -0,0 +1,100 @@
 22+---
 23+layout: post
 24+title:  "Automating desktop setup with ansible-pull part 1"
 25+date:   2019-03-07
 26+tags: ['ansible', 'ansible-pull', 'linux', 'fedora']
 27+---
 28+
 29+Every time that I do a clean install on my machine it takes a few hours
 30+till I get to point where I was before formatting it, install all
 31+packages, select themes, icons, fonts, install IDEs, extensions and so
 32+on. After doing it a few times I came to the conclusion (
 33+[genius](https://i.imgur.com/BtWuQgT.png)) that It would be nice to
 34+automate this chore. And as a result, I could tinker a little more with
 35+my system and not be afraid of spending a weekend reinstalling
 36+everything (which have happened more time that I'd like)
 37+
 38+So after a few attempts using python and bash, I couldn't get something 
 39+that scales and ended with many files and keep the files organized and
 40+concise turned to be more tedious than the setup itself. So it comes
 41+[Ansible](https://www.ansible.com/). It is an enterprise-grade software
 42+used to automate tasks. It has many features I can be really helpful as
 43+a sysadmin but what we gonna focus here is cliente side of thing using
 44+[Ansible Pull](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#ansible-pull)
 45+and
 46+[Playbooks](https://docs.ansible.com/ansible/latest/user_guide/playbooks.html)
 47+as better describe:
 48+
 49+> Ansible-Pull is used to up a remote copy of ansible on each managed 
 50+> node, each set to run via cron and update playbook source via a source
 51+> repository. This inverts the default push architecture of ansible into
 52+> a pull architecture, which has near-limitless scaling potential.
 53+
 54+> Playbooks are Ansible’s configuration, deployment, and orchestration 
 55+> language. They can describe a policy you want your remote systems to
 56+> enforce, or a set of steps in a general IT process.
 57+
 58+So what we're gonna do is pull a playbook from a git account a run on
 59+the host, that playbook will have the tasks that we need to setup our
 60+machine.
 61+
 62+To run it locally first we need localhost to all hosts list, to do so we
 63+only the following text to `/etc/ansible/hosts`:
 64+
 65+{% highlight text %} 
 66+[all] 
 67+localhost 
 68+{% endhighlight %}
 69+
 70+As an experiment we're gonna make tasks to install vim. Currently, I
 71+using
 72+[Fedora](https://getfedora.org/) thus we going to use
 73+[dnf modeule](https://docs.ansible.com/ansible/latest/modules/dnf_module.html)
 74+to install packages
 75+
 76+The playbook to install is quite simple:
 77+
 78+{% highlight yml %}
 79+# main.yml
 80+- hosts: all tasks:
 81+     - name: install vim
 82+       dnf:
 83+         name: vim
 84+         state: latest
 85+{% endhighlight %}
 86+
 87+Fist `hosts:` it is required and it has to match our hosts so we are
 88+able to run that playbook. Then `tasks:` which is a list of task that
 89+the playbook will perform that in this case will be `dnf install` for
 90+the package vim.
 91+
 92+Ansible pull requires a repository but for the first example I want to
 93+keep it simple so we will use `ansible-playbook` commando to run
 94+`main.yml` direct from disk, do to so just run the following command:
 95+
 96+{% highlight bash %}
 97+sudo ansible-playbook --connection=local main.yml
 98+{% endhighlight %}
 99+
100+After a few seconds, vim will be installed on your machine.
101+{% highlight bash %}
102+PLAY [all] *************************************************************
103+
104+TASK [Gathering Facts] *************************************************
105+ok: [localhost]
106+
107+TASK [install vim] *****************************************************
108+ok: [localhost]
109+
110+PLAY RECAP *************************************************************
111+localhost                  : ok=2    changed=0    unreachable=0    failed=0  
112+{% endhighlight %}
113+ 
114+This is the first step, next part we shall create a more complex
115+playbook and setup repo and actually use `ansible-pull`
116+
117+
118+
119+ 
120+
121+