Question
Phillip Wu · Dec 4, 2022

Ansible module for IRIS session

Hi,

For a Linux host, has anyone developed an Ansible module that will start a session to IRIS and send commands?

What I am after is something like this:

1. Supply

    Username

    Password

    Commands <- list

    Prompt <- from session command

 2. Send back the output from the session

If so please advise where I can download the module?

Product version: IRIS 2022.1
0
0 100
Discussion (4)1
Log in or sign up to continue

The hardest part of this is a login and password, and I would recommend configuring OS-based Authorization for %Service_Terminal, so, it will not require login and password. Everything else is quite simple if your script is not supposed to answer questions there.  

cat commands.txt | iris session iris > output.log

and, the content of commands.txt, is something like this

write "hello world"
write "I'm: ", $username
halt

Important to finish the script with halt command, and if you still wish to keep login and password, the first two lines should contain login and password

irisowner@ca22f45b16b1:~/temp$ cat commands.txt 
_SYSTEM
SYS
 write "hello world"
 write "I'm: ", $username
 halt
irisowner@ca22f45b16b1:~/temp$ cat commands.txt | iris session iris 

Node: ca22f45b16b1, Instance: IRIS 

Username: 
Password: 
USER>
hello world
USER>
I'm: _SYSTEM
USER>

Well, I've asked about it through the ideas portal, and you mentioned some flexibility

It's ObjectScript, so, it has some flexibility. The only issue is login and password, and using OS-based auth, is a good way to solve this, obviously if OS-level is protected enough.

For instance, you can raise issues just by terminating the process with an exit code higher than 0 with $system.Process.Terminate

irisowner@ca22f45b16b1:~/temp$ cat commands.txt 
_SYSTEM
SYS
 write "hello world"
 write "I'm: ", $username
 if $g(condition,1) Do $system.Process.Terminate(,2)
 write "terminated?"
 halt
irisowner@ca22f45b16b1:~/temp$ cat commands.txt | iris session iris; echo Status: $?

Node: ca22f45b16b1, Instance: IRIS 

Username: 
Password: 
USER>
hello world
USER>
I'm: _SYSTEM
USER>
Status: 2

If you call some InterSystems internal interactive tools. So, most such tools have non-interactive endpoints, so, you can call them directly, and no interactivity is needed.

Thanks for the suggestion.

You mentioned "InterSystems internal interactive tools. So, most such tools have non-interactive endpoints".

Could you please provide an example?
Is there a listing of all such "tools"?

I don't see anything like the list of all available tools in the Documentation. Just from experience, tools like this, not complete list (in %SYS namespace)

  • Do ^Integirty
  • Do ^DATABASE
  • Do ^JOURNAL
  • Do ^MIRROR

Managed to find, something here