Report this

What is the reason for this report?

how to create a ansible play book for below CLI prompt running in EC2 instance. i need to execute cli commands in sequence

Posted on August 18, 2021

[2021-08-18 10:55:59 admin@cmoulaniEMS: ~ ]# ssh -p 8122 admin@10.52.23.67 Password authentication Password:

Insight

Insight Command Line Interface Date: Wed Aug 18 10:56:08 IST 2021

find target instances find target instances

    Target                 : TGMS
    Target Version         : ~
    Target Instance        : TGMS
    Target Instance Version: ~

    Target                 : TMS
    Target Version         : ~
    Target Instance        : TMS
    Target Instance Version: ~

    Target                 : PSX
    Target Version         : V14.00.00
    Target Instance        : cmoulanipsxmaster
    Target Instance Version: V14.00.00A019

    Target                 : PSX
    Target Version         : V14.00.00
    Target Instance        : vivekpsxslave
    Target Instance Version: V14.00.00R000

    Target                 : PSX
    Target Version         : V14.00.00
    Target Instance        : stipsxslave
    Target Instance Version: V14.00.00R000

    Target                 : PSX
    Target Version         : V14.00.00
    Target Instance        : stipsxmaster
    Target Instance Version: V14.00.00R000

    Target                 : PSX
    Target Version         : V14.00.00
    Target Instance        : cmoulanipsxslave
    Target Instance Version: V14.00.00A019

    Target                 : PSX
    Target Version         : V14.00.00
    Target Instance        : vivekpsxmaster
    Target Instance Version: V14.00.00R000

Result: Ok

s t i stipsxmaster s t i stipsxmaster

Result: Ok

PSX:V14.00.00R000:stipsxmaster> update STI_Server_Device STI_Server_Device_Id 123 Max_Connection 5 update STI_Server_Device STI_Server_Device_Id 123 Max_Connection 5

Result: Ok PSX:V14.00.00R000:stipsxmaster>



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

It is not very clear what commands exactly you need to run, but you could use the Ansible Shell module to run specific shell commands on your hosts.

Here is an example:

---
  - name: Shell Examples
    hosts: some_servers
    tasks:

    - name: Name of your task
      shell:
         " ls -lrt /var "
      register: lsout
      tags: lsout
      
    - debug: msg="{{displaylist.stdout_lines}}"

You can add more tasks depending on your needs.

Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.