mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
Introduce an ansible_version dict as runner variable
Given the version: "1.6 (ansible_version_var14499e8bf3
) last updated 2014/03/21 17:07:50 (GMT +200)" We get the special variable: "ansible_version": { "full": "1.6", "major": 1, "minor": 6, "revision": 0, "string": "1.6 (ansible_version_var14499e8bf3
) last updated 2014/03/21 17:07:50 (GMT +200)" } modified: lib/ansible/playbook/__init__.py modified: lib/ansible/runner/__init__.py modified: lib/ansible/utils/__init__.py
This commit is contained in:
parent
db90f308ca
commit
d240e2b9fb
3 changed files with 30 additions and 0 deletions
|
@ -177,6 +177,8 @@ class PlayBook(object):
|
|||
ansible.callbacks.load_callback_plugins()
|
||||
ansible.callbacks.set_playbook(self.callbacks, self)
|
||||
|
||||
self._ansible_version = utils.version_info(gitinfo=True)
|
||||
|
||||
# *****************************************************
|
||||
|
||||
def _load_playbook_from_file(self, path, vars={}):
|
||||
|
@ -371,6 +373,7 @@ class PlayBook(object):
|
|||
)
|
||||
|
||||
runner.module_vars.update({'play_hosts': hosts})
|
||||
runner.module_vars.update({'ansible_version': self._ansible_version})
|
||||
|
||||
if task.async_seconds == 0:
|
||||
results = runner.run()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue