Created
April 19, 2024 13:53
-
-
Save mturnaviotov/b64516cdc63c48af76dc5547511f543e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#check role | |
--- | |
- name: Python version check | |
raw: python -V 2>&1 | tr -d "Ppython. " | |
register: py_version | |
- name: Set Python version fact | |
set_fact: | |
py_ver: "{{ py_version.stdout | int }}" | |
- name: Add host to targets if Python suppots Ansible | |
add_host: | |
name: "{{ inventory_hostname }}" | |
groups: targets | |
when: (hostvars[inventory_hostname].py_ver | int) > 259 | |
- debug: | |
msg="{{ py_version.stdout | int > 259 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#main: | |
--- | |
- name: Check pre requisites | |
hosts: preflight | |
gather_facts: no | |
any_errors_fatal: no | |
#ignore_unreachable: true | |
#serial: "25%" | |
roles: | |
- check_python |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment