I'm learning how to use ansible and am writing a playbook for my local desktop.
I'm using the atom editor and have linter installed. I'm not getting any error whilst writing, but then when I execute the playbook I get the error "The offending line appears to be"
Here's my current Playbook:
---
- hosts: localhost
tasks:
- name: Install .deb packages from the internet.
apt:
deb:
- https://packagecloud.io/AtomEditor/atom/any/
- https://updates.signal.org/desktop/apt
- http://ppa.launchpad.net/webupd8team/brackets/ubuntu
- http://ppa.launchpad.net/nextcloud-devs/client/ubuntu
- http://repository.spotify.com stable non-free
- http://download.xnview.com/XnConvert-linux-x64.deb
- https://updates.signal.org/desktop/apt xenial main
- name: Install a list of packages
update_cache: yes
apt:
pkg:
- AtomEditor
- brackets
- calibre
- chromium-browser
- filezilla
- firefox-locale-de
- gimp
- gparted
- gscan2pdf
- gstreamer1.0-pulseaudio
- keepassxc
- nextcloud-client
- nextcloud-client-nautilus
- pdfshuffler
- python-nautilus
- spotify
- tipp10
- vlc
- XnConvert
- name: no tracking
become: true
vars:
packages_absent:
- apport
- gnome-intial-setup
- ubuntu-web-launchers
- name: Remove useless packages from the cache
apt:
autoclean: yes
- name: Remove dependencies that are no longer required
apt:
autoremove: yes
Then my terminal tells me:
The offending line appears to be:
tasks:
- name: no tracking
^ here
I know it's a beginners question and probably there are many more problems in my playbook. But I'm happy for any help.
Best Answer
Pay attention to indentation for parameters:
Looks like the
deb:
parameter (and the rest of its section) needs greater indentation. Thus instead of,add some indentation to
deb:
to make it a parameter,Without indentation Ansible won't understand
deb:
to be a parameter of theapt:
module; rather it will try to make sense of it as a directive affecting howapt:
is used (so likenotify:
,become:
,ignore_errors:
etc)the same for
update_cache:
so instead of,move
update_cache:
withinapt:
and indent it,similarly,
and finally I don't understand what you're trying to do with the 'no tracking' part; I'm not aware of a
vars:
module. Maybe you want to remove those packages if present, in which case see the documentation for theapt:
module, esp. the 'Remove "foo" package' example.