Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral


Questions and Answers

Loading... Loading...

I am just starting to look at using iApps, and I have a couple of questions.

First, is there any documentation on how to create, list and modify an application using tmsh e.g. I want to deploy a template to an application through tmsh not the gui?

Second item, I have looked at several of the prebuilt templates and they are close to how we deploy our current applications in LTM/WA today. I will be looking at creating my own templates and using the based templates as starting points. My question is even with customizations there will be times when a specific application requires an extra iRule or possibly a setting tweak that is not covered in the iApp template. Is it allowed to say modify a virtual server that is created from an iApp by adding the extra rule? What are the downside of doing this? Should I just create the whole configuration manually?

4 Answer(s):

Hey Mark,
First, is there any documentation on how to create, list and modify an application using tmsh e.g. I want to deploy a template to an application through tmsh not the gui?

I'm not quite sure I understand precisely what you're asking, but I believe the answer is "yes". I think you're asking whether you can deploy an application service using a template via tmsh and make changes to it. You do this using commands like:

# create sys app service foo template bar variables add { foo { value bar } }

As might be expected, you can modify the resulting service using the "modify" form of the above command. Both create and modify will cause the implementation script of the iApp to execute - you can also get that to run by using the "execute-action" form of "modify" and supplying "definition" as the action name. One thing to be aware of: iApps are created in their own folders (named after the service with ".app" appended) along with all of the objects that they manage. This is important for any "modify" and "list" commands you might want to perform on the service (or any objects it owns) as they'll be under that folder (you don't need to specify the folder with "create" - it'll take care of it automatically). You can see the full documentation for this family of commands via "help sys app service".

If instead, you were asking whether you can manage templates themselves (and not services created using a template) the answer is also yes - see "help sys app template" for the details of that command. If you do go that route, a few things you might be interested in are:

# modify cli preference tcl-syntax-highlighting enabled
# modify cli preference editor vi
# modify cli preference confirm-edit disabled

That's how I have my template editing environment configured. (You can also choose nano for an editor there too if you don't like vim, but then you won't get syntax highlighting).

And while I'm elucidating about managing templates and application services from the CLI, you should also be aware of two more things. First, you can use "cli scripts" (tmsh TCL scripts) from within iApps to promote code reuse. See "help cli scripts" for how those work. Secondly, if you want to work with APL scripts (APL is the presentation language used for iApps) see "help sys app apl-scripts".

Is it allowed to say modify a virtual server that is created from an iApp by adding the extra rule? What are the downside of doing this? Should I just create the whole configuration manually?

Are you referring to an iApp modifying an existing object that it didn't create? If so, the answer is that while it can, this isn't recommended. The reason for that is that iApps typically "own" all the objects that they need to manage, but this only happens if they create them. You can run tmsh::modify in your implementation script and that'll work, but if the object you modify is ever removed your iApp will begin to fail when it tries to execute. Also, you can get into a situation where changes are inadvertently made outside of the iApp to that object, and every time you rerun the iApp it gets changed back. So you can do it, but I don't recommend it.

You might have meant whether an object created by an iApp can/should be modified outside of the iApp. The answer to that is also that while you can, it's not recommended. When an iApp creates an object, it owns it, and by default you cannot modify it outside of the iApp. However, there is a "strict-updates" parameter for iApp services that when disabled, allows outside edits to its objects. The trouble there is that doing so can lead to unexpected issues - most likely what'll happen is you'll make your changes, and things will be good - and then at a later date you'll re-enter the service's template and make an adjustment and resubmit it - and your manual changes will disappear. It really depends on how the template was written and what sort of change you made - but believe me that unexpected things can happen.

What I recommend doing in such a situation is to "fork" the template - make a copy of it, and then modify the template's source to do what you want. Then you don't have to worry about true-ups and unexpected changes.

Cheers,
-Brent
Thanks Brent you did answer my questions.

My second question was this kind of scenerio - create an application app1 from say the f5.http template. Then for a specific application reason I need to add an iRule to the virtual server. The issue is the f5.http template does not have a way to add a user created iRule to the virtual server. I guess the key will be to create a template that has 90% of what I need and to add to the template that ability to add any additional iRules I need. Our standard http virtual gets 3 to 4 iRules added each.

Mark
Associating iRules with virtual servers that are managed by iApps is something that we've heard from the field before and so we've begun to integrate support for this right into the templates. That's the best fix for this situation, but I don't think the f5.http template has support yet. I'll look into that.

For now, I recommend that you not assign the iRules by hand after disabling strictness. If you do go that route, make sure that you test what happens if you re-enable strictness and make a change through the template to your existing application service. The behavior you see will depend upon the template.

Like I pointed out yesterday, it's usually not too much work to make a copy of a template and make some slight adjustments to it (like assigning iRules) so that you don't have to disable strictness. If you try that out, feel free to let us know if you run into any trouble or have any questions and we'll help you along.
There is a good example of adding the ability to attach arbitrary iRules to HTTP servers on DevCentral, here:

https://devcentral.f5.com/wiki/iApp.HTTP-with-Arbitrary-iRule-Addition.ashx

Your answer:

You must be logged in to reply. You can login here.