Код: Выделить всё
- name: Fetch image info for preexisting copy of {{ fully_qualified_image }}
community.docker.docker_image_info:
name: "{{ fully_qualified_image }}"
register: preexisting_image_info
failed_when: false
vars:
# ansible_python_interpreter_docker points to a python venv containing the necessary
# docker lib
ansible_python_interpreter: "{{ ansible_python_interpreter_docker }}"
Поэтому я попытался сделать это в Group_vars/all/vars.yml :
Код: Выделить всё
ansible_python_interpreter_docker: "{{ ansible_python_interpreter }}"
Код: Выделить всё
...
Error was a , original message: An unhandled exception occurred while templating '{{ ansible_python_interpreter }}'.
Error was a , original message: An unhandled exception occurred while templating '{{ ansible_python_interpreter_docker }}'.
Error was a , original message: recursive loop detected in template string: {{ ansible_python_interpreter_docker }}"}
Код: Выделить всё
---
- hosts: host-with-system-docker,host-with-venv-docker
gather_facts: true
tasks:
- block:
- name: do a docker thing with system python
debug:
msg: "{{ ansible_python_interpreter }}"
when: ansible_python_interpreter_docker is not defined
- name: do a docker thing with docker specific python
debug:
msg: "{{ ansible_python_interpreter }}"
vars:
ansible_python_interpreter: "{{ ansible_python_interpreter_docker }}"
when: ansible_python_interpreter_docker is defined
- debug:
msg: "YAY"
Подробнее здесь: https://stackoverflow.com/questions/793 ... ed-on-host
Мобильная версия