0

I keep getting this error when i want to run my ansible playbook to install promtail on my instances.

#This is my playbook

  • hosts: all roles:
    • role: patrickjahns.promtail vars: promtail_config_scrape_configs: - job_name: system static_configs: - targets: - localhost labels: job: varlogs path: /var/log/*log

[WARNING]: Unable to parse /home/emediong/dynamic-inventory/roles/inventory.txt as an inventory source [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' ERROR! the role 'patrickjahns.promtail' was not found in /home/emediong/dynamic-inventory/roles/roles:/home/emediong/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/emediong/dynamic-inventory/roles

The error appears to be in '/home/emediong/dynamic-inventory/roles/promtail.yml': line 4, column 7, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

roles: - role: patrickjahns.promtail ^ here

tlo
  • 1,571
  • 1
  • 25
  • 38

1 Answers1

2

I recreated your issue. You need to install the role with ansible-galaxy using the below command before you can run the playbook.

ansible-galaxy install patrickjahns.promtail

Testing

Before installing (same error):

The error appears to be in 'test.yml': line 4, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
    - role: patrickjahns.promtail
      ^ here

After installing (it works!):

 ____________ 
< PLAY [all] >
 ------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

skipping: no hosts matched
 ____________ 
< PLAY RECAP >
 ------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
plait
  • 21
  • 2