A new security patch has been released to further address CVE-2022-27924.
This issue has been ranked as High by the Zimbra Team and we recommend that you use the most recent release available to avoid any issues.
https://blog.zimbra.com/2022/05/new-zimbra-security-patches-9-0-0-patch-24-1-and-8-8-15-patch-31-1/ (May 10th 2022)

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.
Xamaa
Posts: 1
Joined: Sun May 01, 2022 8:14 am

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

Postby Xamaa » Sun May 01, 2022 8:27 am

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. 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!


Return to “Developers”

Who is online

Users browsing this forum: No registered users and 4 guests