ERROR! this task 'apt_repository' has extra params

pyprism picture pyprism · Apr 30, 2016 · Viewed 11.6k times · Source

For the first time I am trying to use Ansible . When I tried to run a playbook I got this error:

ERROR! this task 'apt_repository' has extra params, which is only allowed in the following modules: command, shell, script, include, include_vars, add_host, group_by, set_fact, raw, meta

The error appears to have been in '/home/prism/Desktop/ansible/basic_package/main.yml': line 9, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  - name: "Add Webupd8 ppa for youtube-dl"
    ^ here

main.yml :

---
- hosts: all
  remote_user: root

  tasks:
  - name: "Upgrade the whole system"
    apt: upgrade=dist update_cache=yes

  - name: "Add Webupd8 ppa for youtube-dl"
    apt_repository: repo ='ppa:nilarimogard/webupd8'

  - name: "Install basic package"
    apt: name={{ item }} state=installed
    with_items:
      - libffi-dev
      - vnstat
      - youtube-dl
      - finger
      - htop
      - python3-dev
      - axel
      - curl
      - fail2ban
      - python-dev
      - sendmail
      - git
      - python-software-properties
      - software-properties-common
      - python-pip
      - nethogs
      - unzip
      - nmap

Answer

RaviTezu picture RaviTezu · Apr 30, 2016

Looks like you have an extra space after repo parameter in the apt_repository task. Use the below code:

apt_repository: repo='ppa:nilarimogard/webupd8'