diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-03-26 18:51:56 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-03-28 14:24:44 +0300 |
commit | 24cb33db915bde9f242d4bb2c7deb1097c2205da (patch) | |
tree | 409dda827fa42008c2b1acc70baefc8a5d14ec28 | |
parent | a494e85a56ade45fd98d694b0bd09e4603e02d80 (diff) | |
download | eug-vs-xyz-24cb33db915bde9f242d4bb2c7deb1097c2205da.tar.gz |
blog: infrastructure management with ansible
-rw-r--r-- | blog/2022-03-26.md | 62 | ||||
-rw-r--r-- | blog/index.md | 1 | ||||
-rw-r--r-- | public/docker-on-rpi.jpg | bin | 0 -> 212401 bytes | |||
-rw-r--r-- | public/emoji/ansible.png | bin | 0 -> 51275 bytes | |||
-rw-r--r-- | public/pepe-smug.png | bin | 0 -> 57911 bytes |
5 files changed, 63 insertions, 0 deletions
diff --git a/blog/2022-03-26.md b/blog/2022-03-26.md new file mode 100644 index 0000000..f782bbb --- /dev/null +++ b/blog/2022-03-26.md @@ -0,0 +1,62 @@ +# Agent-less infrastructure management with Ansible :ansible: +As I explore new things and grow my homelab :raspberry-pi: infrastructure things start to get a little messy. I've reached the point where I should start using more advanced deployment strategy than just manually setting up servers via SSH or `rsync`-ing a bunch of files into them. The goal is to reach [Infrastructure as Code](https://en.wikipedia.org/wiki/Infrastructure_as_code). + +## But what about Docker? :whale: +[Docker](https://www.docker.com/) is an amazing tool that solves particularly nasty problem - isolating your application from environment and **reliably** running it on any platform. You just pack your application into the container and ship it anywhere you want! It makes your app **scalable**! + +I use Docker on my daily job and I can't imagine it otherwise. But here, in my tiny homelab (which is just one RaspberryPI :raspberry-pi: at this point), this is not world-class production problems, so it might be an overkill. + +Docker requires your servers to run a *daemon* - e.g extra software layer (and it's dependencies) between your applications and the metal. It will run in the background and make your fan work a bit louder :helicopter: in the upcoming summer nights to compensate for those extra couple degrees. + +![meme](/public/docker-on-rpi.jpg) + +## Introducting Ansible :ansible: +[Here it comes](https://ansible.com) - **agent-less** deployment tool that doesn't require your server to run anymore bullshit than good old Python :python: and open SSH port. + +In Ansible you define so called playbooks - `YAML` specs of your tasks. Then you just feed the `YAML` to `ansible-playbook` and voila! It's already SSHing into your machines and doing your job now! + +Ansible is not the tool you should learn, it's so simple that you can use it right away! + +## Examples from my infrastructure :raspberry-pi: +Ansible has a bunch of built-in convenience commands that make your life even more enjoyable. + +![meme](/public/pepe-smug.png) + +This is how easy it is to setup a cron-job: +```YAML + - name: Setup auto-renewing certificates + become: true + cron: + name: "Auto-renew certificates" + minute: "0" + hour: "12" + job: "/usr/bin/certbot renew --quiet" +``` + +Transferring files: +```YAML + - name: Copy nginx configuration + become: true + copy: + src: ./files/nginx/website + dest: /etc/nginx/sites-available +``` + +Installing packages: +```YAML + - name: Install build tools + apt: + pkg: + - gcc + - make + - cmake + - gnutls-dev + - uuid-dev +``` + +...and many many more. Check out source code of my playbooks here: + - https://git.eug-vs.xyz/eug-vs/infrastructure/ + +The notable ones are: + - Installing [taskd](https://git.eug-vs.xyz/eug-vs/infrastructure/tree/taskd.yaml) (migth be worth a separate post) + - Installing [git server along with cgit](https://git.eug-vs.xyz/eug-vs/infrastructure/tree/git-server.yaml) diff --git a/blog/index.md b/blog/index.md index 4e10ad6..a750bed 100644 --- a/blog/index.md +++ b/blog/index.md @@ -4,6 +4,7 @@ ### March +- [Agent-less infrastructure management with Ansible :ansible:](2022-03-26.md) - [Here comes my git server :fire:](2022-03-24.md) - [Жыве Беларусь! :belarus:](2022-03-17.md) diff --git a/public/docker-on-rpi.jpg b/public/docker-on-rpi.jpg Binary files differnew file mode 100644 index 0000000..fbfd8ed --- /dev/null +++ b/public/docker-on-rpi.jpg diff --git a/public/emoji/ansible.png b/public/emoji/ansible.png Binary files differnew file mode 100644 index 0000000..591746a --- /dev/null +++ b/public/emoji/ansible.png diff --git a/public/pepe-smug.png b/public/pepe-smug.png Binary files differnew file mode 100644 index 0000000..0cfa035 --- /dev/null +++ b/public/pepe-smug.png |