I’m trying to figure out exactly how to put ansible into my overall job of maintaining servers. I’m getting pretty comfortable with ansible by itself, but I want to run this by the list so folks can point out where I’m being stupid.
My goal is to be able to create servers that match existing servers on demand. Say, our web team wants a temporary dev environment that matches our production web server environment. Here’s how I envision the cycle:
- Use ansible to gather information about the production server (this is done in advance) sufficient to create a clone. This includes making kickstart snippets for cobbler or equivalent.
- Use cobbler to create base install of OS on a virtual machine.
- Use ansible to add packages, configs, users etc…
- Use a backup/rsync/database-replication etc… to copy bulk user-data
- Test (nagios? jenkins? ???)
I’m making headway on gathering information about a server I might want to copy. I’m basically just running “shell: something > /tmp/something” and then using fetch followed by a local play to convert the fetched something into yaml I can later use as a vars file. I’ve got rpm list, pvs, vgs and pvs so far. I can also use ansible to organize that information and
Using cobbler seems pretty straight-forward so far. I have VMs popping up and down happily.
Using ansible to add packages & configs looks again, pretty straight forward if I already know what I want them to look like. I imagine low-low level stuff, like the disk layout and networking will be gathered from the existing server. The configurations of actively configured servers, like apache and sshd, will be managed in ansible with templates, so I don’t so much need to scrape a config out of an existing server, as it should already be there.
User /home dirs & other user data will be copied over in bulk. I currently use rsync & db replication for that.
Testing is an interesting question. A clone can’t be an exact copy or it will collide with the thing it’s a clone of. So, testing that server B actually acts like server A is mostly going to involve writing tests for things I know have failed. (The Host header in an HTTP request is my friend!). Anyway, that’s not really an ansible thing, though ansible could be used as a tool within those tests.
Once a server is running, ansible can keep the managed configs and various other things correct. The hard part is defining what is correct.
Again, I’m not really asking a specific question so much as laying out my understanding of how things should work so someone can bonk me on the head if I’m being stupid. If you read this and think “So, whats your question?” then great, thank you for your time. If you read this and think “No! You idiot, ansible already does XXXX” then you’re the one I want to hear from.
Thanks
-Dylan