Skip to content

Instantly share code, notes, and snippets.

@mturnaviotov
Created April 19, 2024 13:53
Show Gist options
  • Save mturnaviotov/b64516cdc63c48af76dc5547511f543e to your computer and use it in GitHub Desktop.
Save mturnaviotov/b64516cdc63c48af76dc5547511f543e to your computer and use it in GitHub Desktop.
#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 }}"
#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