Ao rodar o comando ansible-playbook provisioning.yml -i hosts -K ao final dessa aula, recebi o seguinte erro:
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each: JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML. did not find expected key
The error appears to be in '/home/alura/ansible/provisioning.yml': line 58, column 29, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
ansible.builtin.replace: path: '{{ wp_dir }}'/wp-config.php ^ here We could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value. For instance:
with_items: - {{ foo }}
Should be written as:
with_items: - "{{ foo }}"
Para resolver o problema a solução foi fazer o seguinte: Quando a variável estiver em uma string, é preciso retirar um aspa, por exemplo, em vez de ser desta forma:
src: '{{ wp_dir }}'/wp-config-sample.php
Deve ser desta forma:
src: '{{ wp_dir }}/wp-config-sample.php'
Após fazer essa alteração voltou a funcionar.