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.
I believe #3 https://docs.ansible.com/ansible/latest/user_guide/index.html 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 2.10.4
Now would go step by step.
It was really fun to follow this along: #4 https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html#intro-getting-started
Strengthen up my terminology: #5 https://docs.ansible.com/ansible/latest/user_guide/basic_concepts.html#basic-concepts
Learning to work with inventories: #6 https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#intro-inventory
I just skimmed through this #6 and #7 https://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html#intro-adhoc
Already feeling a bit comfortable with Ansible, let’s read the core now. #8 https://docs.ansible.com/ansible/latest/user_guide/index.html#writing-tasks-plays-and-playbooks
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 https://github.com/Fueled/django-init
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!