Search code examples
ansiblesystemd

Can anyone see what I am doing wrong in the ansible playbook?


Got the following odd error with ansible lint and I can't for the life of me figure out what we did wrong, it's probably something incredibly stupid but there you go.

ansible-lint -p disable-beats.yml

Couldn't parse task at disable-beats.yml:5 (conflicting action statements: systemd, __line__
     

The error appears to be in '<unicode string>': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

(could not open file to display line))
{ 'name': 'disable auditbeats',
  'skipped_rules': [],
  'systemd': { '__file__': 'disable-beats.yml',
               '__line__': 7,
               'enabled': False,
               'name': 'auditbeat'}}

the following is the contents of the file checked with linter:

---
- hosts: linuxservers
  tasks:

    - name: disable auditbeats
      systemd:
        name: auditbeat
        enabled: no
 

Solution

  • That's a known issue with ansible-lint; upgrading to a more recent version such as 5.0.12 will make that go away. If it doesn't for your case, you can either comment on that issue or open a regression at which time you should provide the versions you are using