Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    OTTER - Capture Logs from block execution and assign to variables ?

    Scheduled Pinned Locked Moved Support
    4 Posts 2 Posters 8 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      philippe.camelio_3885
      last edited by

      Hello

      I am looking a way to get catch values from the log of a block execution in order and assign to variables for a second block / module.

      Exemple:
      Otter Orchestration to create VM.
      The name and its IP adress are dynamically created by the ansible script.

      ##AH:UseTextMode
      ##AH:Description Deploiement d'une VM à partird'un template
      set $octet2=100;
      set $octet3=4;
      set $YML=linux.yml;
      set $template=GI-DCS-UBUNTU-20.04.1-20210121
      
      for server ANSIBLE-MASTER
      {
          # Loop
          foreach $VM in @Range(1, 2)
          {
              call ANSIBLE::BM-AnsiblePlayBook
              (
                  PLAYBOOK: vmware,
                  EXTRAVARS: %(octet2:$octet2,octet3:$octet3,template:$template,annotation:$annotation'),
                  YML: $YML,
                  Role: NON
              );
          }
      }
      

      The ANSIBLE::BM-Playbook module returns the log:

      PLAY [127.0.0.1] ***************************************************************
      TASK [Definition du nom de la VM et de son IP] *********************************
      changed: [127.0.0.1]
      TASK [set_fact] ****************************************************************
      ok: [127.0.0.1]
      TASK [set_fact] ****************************************************************
      ok: [127.0.0.1]
      TASK [set_fact] ****************************************************************
      ok: [127.0.0.1]
      TASK [set_fact] ****************************************************************
      ok: [127.0.0.1]
      TASK [set_fact] ****************************************************************
      ok: [127.0.0.1]
      TASK [Creation de la VM VM004011 avec IP 10.100.4.11] **************************
      changed: [127.0.0.1]
      PLAY RECAP *********************************************************************
      127.0.0.1                  : ok=7    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
      

      Is it possible to get the VM Name (VM004001) and the IP (10.100.4.11) to pass them to some module in the same Otter Orchestration Job ?

      call ANSIBLE::BM-AnsiblePlayBook
      call SomeOtterModule ($VM,$IP)
      

      Thanks
      Philippe

      atrippA 1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer @philippe.camelio_3885
        last edited by

        @philippe-camelio_3885 said in OTTER - Capture Logs from block execution and assign to variables ?:

        The ANSIBLE::BM-Playbook module returns the log:

        By this, I assume you mean, writes to the Otter execution log, either via Log-Information or an execute process? You might have to do this via PSExec, write the logs to text, and parse it out that way using a regular expression...

        At this time, there's no way to read entries from the log during a live execution.

        Best,
        Alana

        1 Reply Last reply Reply Quote 0
        • P Offline
          philippe.camelio_3885
          last edited by

          OK
          I understand I have to manage this at the script level (SHExec ou PSExec).
          I hoped I could do it inside Otter Script, something like :

          SHExec >>
          Some command
          >>
          (
            OutputLog: $MyOutput
          );
          

          Thanks you @atripp

          atrippA 1 Reply Last reply Reply Quote 1
          • atrippA Offline
            atripp inedo-engineer @philippe.camelio_3885
            last edited by

            @philippe-camelio_3885 oh i see; you mean, capture the output of a process or script execution into a variable or something.

            Definitely something to consider as an enhancement, I think. That wouldnt' be too bad (though the variable could get huge, and rutnime variables raen't realy designed for large amounts of text like that)

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post
            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation