Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap ansible command in OS detection script #274

Closed
azarouski opened this issue Nov 23, 2023 · 2 comments · Fixed by #276
Closed

Wrap ansible command in OS detection script #274

azarouski opened this issue Nov 23, 2023 · 2 comments · Fixed by #276
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@azarouski
Copy link
Contributor

Let's add a script that will automatically detect server OS and select appropriate yaml file for ansible.

@azarouski azarouski added the enhancement New feature or request label Nov 23, 2023
@azarouski azarouski linked a pull request Nov 24, 2023 that will close this issue
@azarouski azarouski added this to the 2.6.1 milestone Nov 24, 2023
@azarouski
Copy link
Contributor Author

To check this issue you need to try to run ansible on inappropriate systems e.g.

on linux server run:

ansible-playbook -vvv -i hosts mac-devices.yml

on mac server run:

ansible-playbook -vvv -i hosts devices.yml

The ansible script is supposed to exit with an error and not make any changes to the system.
OS version is not compatible!

@azarouski azarouski self-assigned this Nov 24, 2023
@azarouski azarouski reopened this Nov 24, 2023
@dhreben
Copy link
Contributor

dhreben commented Nov 27, 2023

Verified.

Linux:

ansible-playbook -vvv -i hosts mac-devices.yml

fatal: [localhost]: FAILED! => {
    "assertion": "os.stdout is search(\"Darwin\")",
    "changed": false,
    "evaluated_to": false,
    "msg": "OS version is not compatible!"

Mac:

ansible-playbook -vvv -i hosts devices.yml

fatal: [localhost]: FAILED! => {
    "assertion": "os.stdout is search(\"Linux\")",
    "changed": false,
    "evaluated_to": false,
    "msg": "OS version is not compatible!"

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants