Forum Discussion
Importing a pre-exisiting iRule into an existing virtual server using TMSH or Bash
Hello,
I'm trying to import a pre-written iRule, in a text file, into a virtual server that I've already created using TMSH. Looking through the TMSH reference guide, I noticed that the only options they give is to create an iRule using the editor in TMSH.
Has anyone tried and been successful in importing an iRule?
Thanks in advance.
10 Replies
- samstep
Cirrocumulus
The best thing to do is to use tmsh sys config merge function, for which you need to make sure the text of irule in the file start from "ltm rule ..." e.g:
ltm rule hello_world { when RULE_INIT { log local0. "HELLO WORLD!" } }e.g. save this in hello_world.txt file, now you can verify it and "load merge" it:
First verify:
tmsh load sys config verify file hello_world.txt merge Validating configuration... hello_world.txtnow merge for real:
tmsh load sys config file hello_world.txt merge Loading configuration... hello_world.tclThat's it!
- samstep
Cirrocumulus
Hi vvc, you are probably running the tmsh command in a wrong order? make sure the "file " are used together - otherwise you would get the "unknown property" error.
try this:
tmsh load sys config merge verify file myfile.txtRegards, Sam
- nitass_89166
Noctilucent
do the files upload into the F5 as .tcl files? As in, after a successful upload/merge of the .txt file, can I call it as a .tcl file?
you can use whatever file extension you want.
- vvc5042_164605
Nimbostratus
Sorry, I think I was unclear. My trouble is that once I uploaded my tcl script as a .txt file, how do i open it? I began my script in the .txt as cli script VS_name.tcl{ .... } merge it successfully and then try to run it using run cli script VS_name.tcl or run cli script VS_name.txt both returns The requested script (/Common/VS_procs.tcl or .txt) was not found. So now i've uploaded the script but not able to open it.
- nitass
Employee
do the files upload into the F5 as .tcl files? As in, after a successful upload/merge of the .txt file, can I call it as a .tcl file?
you can use whatever file extension you want.
- vvc5042_164605
Nimbostratus
Sorry, I think I was unclear. My trouble is that once I uploaded my tcl script as a .txt file, how do i open it? I began my script in the .txt as cli script VS_name.tcl{ .... } merge it successfully and then try to run it using run cli script VS_name.tcl or run cli script VS_name.txt both returns The requested script (/Common/VS_procs.tcl or .txt) was not found. So now i've uploaded the script but not able to open it.
- nitass
Employee
I began my script in the .txt as
cli script VS_name.tcl{
....
}
i thought you are importing configuration (not tmsh scripting).
the following is an example when importing from terminal. anyway, configuration formatting is same.
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule test 01020036:3: The requested iRule (test) was not found. root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) load sys config from-terminal merge Enter configuration. Press CTRL-D to submit or CTRL-C to cancel. ltm rule test { when CLIENT_ACCEPTED { log local0. "" } } Loading configuration... root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule test ltm rule test { when CLIENT_ACCEPTED { log local0. "" } }by the way, do not forget to save (tmsh save sys config) after importing.
- vvc5042_164605
Nimbostratus
Hi, thanks for the reply and yes that was my original question with the iRules. But I am trying the same method with a tmsh script, as in uploading a tmsh script from a .txt file to the F5 using the same method as I was uploading the iRule.
- nitass_89166
Noctilucent
I began my script in the .txt as
cli script VS_name.tcl{
....
}
i thought you are importing configuration (not tmsh scripting).
the following is an example when importing from terminal. anyway, configuration formatting is same.
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule test 01020036:3: The requested iRule (test) was not found. root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) load sys config from-terminal merge Enter configuration. Press CTRL-D to submit or CTRL-C to cancel. ltm rule test { when CLIENT_ACCEPTED { log local0. "" } } Loading configuration... root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule test ltm rule test { when CLIENT_ACCEPTED { log local0. "" } }by the way, do not forget to save (tmsh save sys config) after importing.
- vvc5042_164605
Nimbostratus
Hi, thanks for the reply and yes that was my original question with the iRules. But I am trying the same method with a tmsh script, as in uploading a tmsh script from a .txt file to the F5 using the same method as I was uploading the iRule.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com