AnsibleUndefinedVariable: 'ansible.parsing.yaml.objects.AnsibleUnicode object' has no attribute 'h'
BirkhoffLee opened this issue · 4 comments
BirkhoffLee commented
Playbook config:
- hosts: all
become: true
debugger: on_failed
roles:
- role: m3nu.ansible_role_borgbackup
borg_encryption_passphrase: 70E348BE-B802-4ED3-AB3E-710CA8925398
borg_repository: ssh://12345@usw-1234.rsync.net/./backup/vultr/instance-1
borgmatic_hooks: https://hc-ping.com/a-b-c-d
borg_exclude_patterns:
- '*.pyc'
- '~/*/.cache'
- '.DS_Store'
- '/var/lib/lxcfs/'
- '/var/cache/*'
- '/var/tmp/*'
- '/home/*/.cache/*'
- '/root/.cache/*'
- '/var/lib/yum/yumdb'
borg_remote_path: borg1
borg_source_directories:
- '/etc'
- '/home'
- '/root'
- '/var'
- '/srv'
borg_retention_policy:
keep_daily: 3
keep_weekly: 2
keep_monthly: 2
keep_yearly: 2
Partial logs:
TASK [m3nu.ansible_role_borgbackup : Set Repository Fact] **********************
skipping: [instance-1]
TASK [m3nu.ansible_role_borgbackup : Ensures /etc/borgmatic exists] ************
ok: [instance-1]
TASK [m3nu.ansible_role_borgbackup : Add Borgmatic Configuration] **************
fatal: [instance-1]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.parsing.yaml.objects.AnsibleUnicode object' has no attribute 'h'"}
Running on CentOS 7 x64.
$ ansible-playbook --version
ansible-playbook 2.10.3
config file = /Users/birkhofflee/.ansible.cfg
configured module search path = ['/Users/birkhofflee/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.10.4/libexec/lib/python3.9/site-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.1 (default, Feb 13 2021, 13:16:42) [Clang 12.0.0 (clang-1200.0.32.29)]
I have tried both the version on Ansible Galaxy and here master branch of this repo. Please shed some light on this issue. Thanks
m3nu commented
You probably want to escape borg_repository
and borgmatic_hooks
. Else it's not valid YAML and thus the error.
m3nu commented
See also http://www.yamllint.com
BirkhoffLee commented
Thanks @m3nu .
---
- hosts: all
become: true
debugger: on_failed
roles:
- role: m3nu.ansible_role_borgbackup
borg_encryption_passphrase: x-x-x-x-x
borg_repository: "ssh://x@x-x.rsync.net/./x"
borgmatic_hooks: "https://hc-ping.com/x-x-x-x-x"
borg_exclude_patterns:
- '*.pyc'
- '~/*/.cache'
- '.DS_Store'
- '/var/lib/lxcfs/'
- '/var/cache/*'
- '/var/tmp/*'
- '/home/*/.cache/*'
- '/root/.cache/*'
- '/var/lib/yum/yumdb'
borg_remote_path: borg1
borg_source_directories:
- '/etc'
- '/home'
- '/root'
- '/var'
- '/srv'
borg_retention_policy:
keep_daily: 3
keep_weekly: 2
keep_monthly: 2
keep_yearly: 2
yamllint playbook.yml
produces no output. Ansible run still fails:
TASK [m3nu.ansible_role_borgbackup : Add Borgmatic Configuration] ********************************************
fatal: [instance-1]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.parsing.yaml.objects.AnsibleUnicode object' has no attribute 'h'"}
[instance-1] TASK: m3nu.ansible_role_borgbackup : Add Borgmatic Configuration (debug)>
BirkhoffLee commented
should be
borgmatic_hooks:
healthchecks: 'https://hc-ping.com/a-b-c-d'
instead of
borgmatic_hooks: https://hc-ping.com/a-b-c-d