Ansible – Live Learning Notes

Hey! It’s time for Ansible. I was introduced to Ansible around 2 years ago In-This-Post and now is the time when I actually have to use it first time to integrate it in my test project, to automate the process of entire manual setup I did on the server since past week. It appears to be fun, let’s see how it unfolds.

These are my usual learning notes, where my language remains free thoughts flowing with lots of links, and you may find it difficult to go through as my objective is to just quickly capture my path in the process of learning Ansible, that’s it.

First, I went to recapitulate what I know of Ansible from my previous post #1: A quick intro to ansible. Okay. Let’s dive into their official docs now #2

I believe #3 is just sufficient to learn Ansible. Amazing and huge! Let’s spend some time on it.

I am not reading everything in that #3 . First, installing it (in a python virtual environment)

pip install ansible
ansible --version

Now would go step by step.

It was really fun to follow this along: #4

Strengthen up my terminology: #5

Learning to work with inventories: #6

I just skimmed through this #6 and #7

Already feeling a bit comfortable with Ansible, let’s read the core now. #8

There are total 15 links in this topic of #8. All seems to be important. I am reading through them one by one.

Okay, so this is huge. Again just skimming through it, mainly would focus on “Roles”.

Fine! Done with the reading. It is time to automate the entire manual setup I did on the server using Ansible. Let’s see how long it takes to actually do that. No more reading is required for now. In case I stuck somewhere while implementing the automation, I can refer their official docs and internet always for that specific requirements.

Following are the tasks that I aim to automate on my Ubuntu20.04 instance:

  • Update and upgrade OS package manager (apt for ubuntu)
  • Setup project data and dependencies
    • Get my code (latest updated) on the server
    • Create python virtual env
    • Install development requirements
    • Set environment variables
  • Setup PostgreSQL
  • Setup Redis
  • Setup Celery
  • Setup uWSGI
  • Setup NginX
  • Setup certbot

Quite a list. Isn’t it? I think directly running my ansible playbook for these automation might end up doing something unexpected on the instance. So I think better is to run my playbook across a vagrant VM on my local machine first. For that I would first have to learn vagrant (never used it before).

I would write another post for sharing my experience of learning vagrant. Update: It is now live here #9 Vagrant Quickstart – Live Learning Notes

Now, I can start writing my Ansible-playbook for these automations and run it against this vagrant VM without worries. I am going to refer not copy this project’s provisioner directory as it meets my requirements #10

After writing my playbook, I’ll either attach the code here in this post, or would give the link to a GitHub gist or something.

Thanks for following up so far!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s