gitproxy
March 22, 2013
gitproxy:
http://skvidal.fedorapeople.org/misc/gitproxy
Dealing with a potential problem we were trying to figure out a way to proxy/redirect git:// calls from one server to another one. This is a fairly ridiculous script I hacked up in the wee-small hours of thursday morning after talking to+Sitaram Chamarty on #git for a while.
I fully expect this won’t work well under load but it does seem to function in my small tests here.
diffing two ini files
March 22, 2013
Ever need to diff 2 ini files but their sections and options aren’t in the right order?
Well, I do. I googled but I couldn’t find anything trivially available that did this.
I swear I wrote this once before but I couldn’t find it when I looked through my dirs of misc scripts so:
http://fedorapeople.org/cgit/skvidal/public_git/scripts.git/tree/inidiff
hope it is useful to someone.
async actions in ansible playbooks
March 7, 2013
A number of people have been surprised by this feature, even though it is documented, so I thought I’d mention it.
Ansible can run actions async. This means it connects to the client system, starts the process and disconnects.
In general you would want all your plays to be synchronous (do thing X, wait for it to be done/watch it, do thing Y).
However, there are times when what you want to do will take a VERY long time or could kill your ssh connection off.
An example is a yum update:
tasks:
- name: yum update
action: command yum -y update
That can take a long time, depending on what’s going on. You want to monitor what it does, but you don’t want a timeout or a reset ssh session/network to kill off that process.
So what do you do? You make it async:
tasks:
- name: yum update
action: command yum -y update
async: 7200
poll: 15
That means – run yum -y update – wait for up to 7200s and poll every 15s to check on the status of the action.
Here’s where we’re using it in fedora:
http://infrastructure.fedoraproject.org/cgit/ansible.git/tree/playbooks/package-update.yml#n11
However, this means if your ssh or network were to die – the yum update process would still run to completion.
But if your connection does die and you cannot check on the status of the job what do you do?
Well -you can connect to any system as the user who was running the job and look in ~/.ansible_async
there will be a file in there for each job that was being run. It may just be a place holder and empty (if the job is still running) or it made be filled with the results if the job is finished.
Pretty handy for a variety of tasks.
openstack and resizing qcow-based instances
February 21, 2013
So – the trick with resizing a qcow based instances is this:
1. either you have to resize the partitions in the initramfs of the instance (which is not yet available as something we can easily do, but we’re working on it
2. you have to resize the partition on the live instance and then reboot the instance.
Since 1 is going to take more time/testing – I went ahead to make 2 as painless as possible.
using the cloud-utils and ansible I came up with this:
http://skvidal.fedorapeople.org/misc/openstack-qcow-disk-resize.yml
Put in the hosts you want to run it against. It installs cloud-utils, resizes the partitions using growpart, reboots, waits for the instance to come back alive, then does the fs resizing.
I timed it – it took a total of 1m2s and that includes installing cloud-utils, waiting at minimum 10s for the instance to reboot and then resizing the actual fs.
The example I gave checks the values from growpart – so it won’t run more than once (and it won’t run if you cannot resize). So you can run this play over and over and not reboot it all the time. I’m thinking I’ll probably include this as a tasklist for a quick instance provisioning playbook.
1 step forward 2 steps back? openstack and img creation issues
February 20, 2013
dealing with image creation in all clouds is completely full of suck. I’d more or less come to terms on it with euca but now I’m trying to do the same thing with openstack and encountering some super-duper happy fun times.
I have a rhel6 img which works and boots – it is qcow2 based so it handles kernel updates, etc properly, yay. However it handles resizing the / filesystem exactly not at all.
If I make the rhel6 img an ami and upload kernel/ramdisk – it’ll resize (well dump it out) into a large filesystem – no problem – but it handles kernel updates not at all.
I would like to have both, I think I deserve to have both, i’ll be damned if any of my testing comes up with both. I’ve done a fair amount of googling and LOTS of things I’ve found say that the qcow2 or raw img should just work in either openstack essex or folsom but I am not having that experience.
Anyone have a suggestion?
hubris
February 19, 2013
Is thinking that because something is working well that it will continue to do so.
Silly me.
coprs and buildsystems and a question I was asked today.
February 1, 2013
Work continues on coprs but today someone asked me if I knew of a simpler buildsystem that would let them spin up a builder, stuff a bunch of packages at it, and return a pile of results.
I said well… ansible and mockremote could do it.
I started thinking about HOW that would work and realized I have all the pieces – but not a lot of motivation to put it together at the moment.
So I thought I’d tell folks how I would do it and maybe someone will:
1. write a playbook to spin up an instance in one of the public clouds using ansible and it’s ec2 module:
http://skvidal.fedorapeople.org/misc/ansible-euca-transient.yml
2. then provision the system with mock, a mockbuilder user and mockchain.
3. tell the user the ip the instance has
4. user submits jobs to it with:
mockremote.py -r chroot -b ip –destdir=/somewhere/ -c –recurse pkg1 pkg2 pkg3
5. user comes back whenever it feels like it
6. user runs a terminate playbook like:
http://infrastructure.fedoraproject.org/infra/ansible/files/copr/provision/terminatepb.yml
which shuts down the instance they had spun up.
I can see wrapping that whole thing in a single script or just letting the user do it a bit at a time. Either way – trivial to setup your own personal, temporary and pristine builder.