Open ryran opened 8 years ago
Conversation that will provide some details:
<jsantos> hey Ryan, when you have a minute, the guys here are asking me if there's the
possibility of doing something like the subscription-manager plugin that vagrant has
(basically you can indicate to a VM that is about to get instantiated, the
subscription-manager info so you have it already subscribed when available)
<rsaw> yeah it's totally possible. virt-builder has some options for it but
subscription-manager operations are all sooooooo damn slow that I didn't bother to
include it.
<jsantos> interesting.... adding it shouldn't be too hard
<rsaw> there's an undocumented feature of upvm where if it finds a ~/bin/reg file on
your system, it copies that into the VM as "/root/register.sh"; however it doesn't run it.
<jsantos> yeah but since virt-builder already has some thingies, wouldn't it be best to
(if I wished to add it), add it to builder.py?
<rsaw> I have a ~/bin/reg script on my system that includes activation keys for rhsm &
rhn and so all my new vms aren't registered but as soon as I want to register one all I
have to do is run the /root/register.sh
<rsaw> I mean you can pass upvm virt-builder options even if upvm doesn't implement
them. you can do:
upvm -B=--sm-register --B=--sm-credentials=rhnuser:password:MYPASS --B=--sm-attach=auto
<rsaw> but I think it's really dumb ... upvm is all about spinning up VMs quickly. if you
do that, you're going to expect the virt-builder appliance (which only has like 512 M of
ram) to run those rhsm commands ... which take crazy long on normal systems
What about using ansible to handle registrations after starting the machine? You have SSH key already in place so you need to have only a playbook that will do the registration and I think some playbook for this must already exist.
What about using ansible to handle registrations after starting the machine? You have SSH key already in place so you need to have only a playbook that will do the registration and I think some playbook for this must already exist.
Thanks for the feedback Ondrej. I agree that ansible's great and of course you can do any of this stuff with ansible .. that's a given .. but I'm not going to force that on anyone as part of the upvm package. The goal is to make this as self-contained and easily-accessible (lowest common denominator) as possible. Right this moment, for choices you could do any of the following:
upvm -B=--sm-register --B=--sm-credentials=rhnuser:password:MYPASS --B=--sm-attach=auto
upvm --run /localpath/script
upvm --run-command 'subscription-manager register xxxx...'
upvm --firstboot /localpath/script
upvm --firstboot-command 'subscription-manager register xxxx...'
So honestly I guess I opened this up as a question, but I clearly have pretty strong feelings about it ... in that I don't think there's really anything else I need to add. (I could of course add the virt-builder --sm...
options directly to upvm if people want them so you don't have to do --B=
.)
Personally, I don't ever register any of my new RHEL VMs up front, since I have them pointing to yum repos on our internal corporate network. That said, I have a script that upvm automatically drops into
/root
-- this script makes it easy for me to register in the future ... it autodetects RHEL version to use RHN classic or RHSM as needed without prompting for credentials and then usesrhn-channel
orsubscription-manager repos
commands to attach only the repos I want.I understand some people might instead want
upvm
to register their machines right off the bat, so I need to decide how best to implement that.Of course
virt-builder
has its own options for RHSM. Could use that. Could also just prompt for RHN credentials or activation-keys and optionally save to local user config file... I'll give it some thought.