A
host_vars, group_vars - туда лучше, они сделаны именно для этого
Есть в inventory запись про сервер oraclework2
в директории host_vars создал файл oraclework2.yml
файл oraclework2.yml выглядит так:
—- (это 3 минуса)
testvar:my_test_var
в плей буке я черезdebug смотрю:
- "inventory_hostname!!! '{{ hostvars[oraclework2][testvar] }}' " -и получаю ошибку:
TASK [Gathering Facts] ******************************************************************************************************************************************************************************Что я делаю не так?
ok: [oraclework2]
TASK [configureapache2test : Display all variables/facts known for a host] **************************************************************************************************************************
fatal: [oraclework2]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'oraclework2' is undefined\n\nThe error appears to be in '/home/alexei/ansible/musin/ansible/roles/configureapache2test/tasks/main.yaml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Display all variables/facts known for a host\n ^ here\n"}