aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-05-15 15:34:36 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-05-15 15:34:36 +0200
commit231f2cb2205988cf87062bc9f595307af1ed827f (patch)
treef1094bf50677abed5266feb17c65240a45d7a387 /content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html
parent46e6b5fa84b1ec6e08f124c478909ec745562214 (diff)
downloadmacroblog.rs-231f2cb2205988cf87062bc9f595307af1ed827f.tar.gz
macroblog.rs-231f2cb2205988cf87062bc9f595307af1ed827f.tar.bz2
macroblog.rs-231f2cb2205988cf87062bc9f595307af1ed827f.zip
feat: Add missing blog post
Add the missing blog post from my hugo blog. Also add a locustfile so I can do some stress test locally.
Diffstat (limited to 'content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html')
-rw-r--r--content/posts/2019-04-22Automating_desktop_setup_with_ansible-pull_part-2.html70
1 files changed, 70 insertions, 0 deletions
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>