Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Remove dependency on bash #265

@kljensen

Description

@kljensen

I am using this project on OpenBSD target systems where bash is not installed in the default system. /bin/bash is used in two places in the code base. One is the selinux specific code and the other is in hardening.yaml on line 11. Bash is used to get the ssh version

I'd like to eliminate the dependency on bash or perhaps get the ssh version in a POSIX compliant manner.

The q command in sed can set an exit code, but not on OpenBSD. It wasn't obvious to me how to remove this dependency, otherwise I would have submitted a pull request. I imagine that Ansible, which of course is using python, would be able to do this without reliance on bash. The ksh shell on OpenBSD does not support set -o pipefail.

Not that this is helpful, but in the absence of bash, this is the exception that is raised

fatal: [myhost]: FAILED! => {
    "changed": false,
    "cmd": "/bin/bash -c 'set -o pipefail && ssh -V 2>&1 | sed -r '\"'\"'s/.*_([0-9]*\\.[0-9]).*/\\1/g'\"'\"''",
    "invocation": {
        "module_args": {
            "_raw_params": "set -o pipefail && ssh -V 2>&1 | sed -r 's/.*_([0-9]*\\.[0-9]).*/\\1/g'",
            "_uses_shell": true,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": "/bin/bash",
            "removes": null,
            "stdin": null,
            "warn": true
        }
    },
    "msg": "[Errno 2] No such file or directory",
    "rc": 2
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions