Answer the question
In order to leave comments, you need to log in
How to change the value of variables in Ansible during the execution of tasks?
Good day to all.
Task: declare a variable at the beginning of the playbook and change its value as it is executed, example
---
- name: all hosts release
hosts: all
vars:
release: none
tasks:
- debug:
msg: "current release = {{ release }}"
- name: присвоить переменной значение из файла или из другой переменной
что_здесь_должно_быть: release = {{lookup('file','/env/service_account_checker/prod/version')}} <- это не работает
- debug:
msg: "new release = {{ release }}"
Answer the question
In order to leave comments, you need to log in
Why does this sound so stupid?
You would lose its main advantage in the form of idempotency and in general your task is clearly not for the ansible and you have little understanding of what you are doing
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question