Get exactly data from "stdout" or "stdout_lines" with exact words of output

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
Xamaa
Posts: 1
Joined: Sun May 01, 2022 8:14 am

Get exactly data from "stdout" or "stdout_lines" with exact words of output

Post by Xamaa »

I have a task:

Code: Select all

- name: DELEGATED ADMIN ACCOUNTS - check, get and send to the file domain.list
  shell: /opt/zimbra/bin/zmprov -l gaaa -v zimbraIsDelegatedAdminAccount
And after this task I got output

Code: Select all

changed: [Shrrah] => {
    "changed": true,
    "cmd": [
        "sh",
        "/home/information_domain.sh"
    ],
    "delta": "0:00:02.495922",
    "end": "2022-03-29 10:25:16.936051",
    "invocation": {
        "module_args": {
            "_raw_params": "sh /home/information_domain.sh",
            "_uses_shell": false,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": false
        }
    },
    "msg": "",
    "rc": 0,
    "start": "2022-03-29 10:25:14.440129",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "# name admin@shrrah.esquimail.com\nzimbraIsDelegatedAdminAccount: FALSE\n\n# name prueba5@prueba5.com\n\n# name prueba7@prueba7.com\nzimbraIsDelegatedAdminAccount: TRUE\n\n# name prueba9@prueba9.com",
    "stdout_lines": [
        "# name admin@shrrah.esquimail.com",
        "zimbraIsDelegatedAdminAccount: FALSE",
        "",
        "# name prueba5@prueba5.com",
        "",
        "# name prueba7@prueba7.com",
        "zimbraIsDelegatedAdminAccount: TRUE",
        "",
        "# name prueba9@prueba9.com"
    ]
}
I need to get data with n# name prueba7@prueba7.com\nzimbralsDelegatedAdminAccount:TRUE from "stdout" or from "stdout_lines" in format:

Code: Select all

prueba7@prueba7.com zimbraIsDelegatedAdminAccount: TRUE
or

Code: Select all

prueba7@prueba7.com
zimbraIsDelegatedAdminAccount: TRUE
and send it to the file.txt renderforest mod apk. Number of lines can be different (one o more users with domain).

I have no idea how I can do this, is this possible? If you know could you please help with advice? Thank you!
Post Reply