gabrielgio.me @ ffef59e04b636518b06e2e5755caf9116c838620

 1diff --git a/_posts/2019-04-22-ansible-part-2.md b/_posts/2019-04-22-ansible-part-2.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..b6a06d74a503ed7d563a64dec710d8c5731be077
 4--- /dev/null
 5+++ b/_posts/2019-04-22-ansible-part-2.md
 6@@ -0,0 +1,53 @@
 7+---
 8+layout: post
 9+title:  "Automating desktop setup with ansible-pull part-2"
10+date:   2019-03-07
11+tags: ['ansible', 'ansible-pull', 'linux', 'fedora']
12+---
13+
14+[See part 1]({% post_url 2019-03-07-ansible-part-1 %})
15+
16+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.
17+
18+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 task and the `.vimrc` file.
19+
20+In the `.vimrc` add your own configuration, you can see mine [over here](https://github.com/gabrielgio/homestation/blob/241b27285d8cba8548277f3508e097439831a6eb/config/.vimrc), it is pretty simple as I don't use it but for simple text editing (like this post) so you can start with it if you don't have one.
21+
22+The `yml` file will have two tasks, one is to install vim itself, it identical as it in the part 1.
23+
24+{% highlight yml %}
25+# main.yml
26+---
27+- name: install vim
28+  dnf:
29+    name: vim
30+    state: latest
31+{% endhighlight %}
32+
33+Then we add the task to copy `.vimrc` file to your `$HOME`, for it we shall use [copy module](https://docs.ansible.com/ansible/latest/modules/copy_module.html):
34+
35+{% highlight yml %}
36+---
37+- name: copy vimrc file
38+  copy:
39+    src: config/.vimrc
40+    dest: ~/
41+    mode: 0644
42+{% endhighlight %}
43+
44+After adding those two files your repository will be something [like this](https://github.com/gabrielgio/homestation/tree/debcf3458df511aef9f7dca0cb73f6cf6baddd5d).
45+
46+And now we just need to run `ansible-pull` command
47+
48+{% highlight bash %}
49+ansible-pull -U <YOUR_REPO> -i all main.yml #you may need run it as a sudo
50+{% endhighlight %} 
51+
52+The `-i` option it is a list of hosts. Remember `man` is your best friend take a look at `man ansible-pull` to know more about the params.
53+
54+The best part if you want to test quickly you can just run my sample and see the result:
55+{% highlight bash %}
56+ansible-pull -U https://github.com/gabrielgio/homestation.git -C debcf3458df511aef9f7dca0cb73f6cf6baddd5d -i all main.yml
57+{% endhighlight %}
58+
59+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,thus you just push something to your repository and after a few minutes no only your machine but all machine that have it setup will receive an update, you can use it as a simple way to install software, update machines or even distribute tools company-wise.