Ansible
General
Bootstrapping
Any tips on how to improve this would be appreciated
The scenario. You boot up a VPS and only have root access over SSH. You're told to turn off root access over SSH, so how do you setup ansible to be in a position to rerun without root?
Step 1
Create a bootstrap.yml
playbook. Use this to create a privileged user and add your SSH key.
Here's what the bootstrap role consists of ...
Step 2
This is your main playbook you run as the user you create in bootstrap.yml
, then you elevate permissions using become: true
where required.
Use --ask-become-pass
so you can become root when required.
Inventory
Tips and tricks used in my ansible inventories.
Terraform
My ansible inventory is dynamically generated from Terraform. You can see how that works over at Generating Ansible Inventory page in Terraform.
Variables
Something for me as I keep forgetting. Being able to set variables on a host in an inventory. I typically use these in conjunction with Terraform.
Last updated