2016-04-30 308 views
0

我第一次尝试使用Ansible。当我试图运行一个剧本,我得到这个错误:错误!这个任务'apt_repository'有额外的参数

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 

回答

4

看起来你在apt_repository任务回购参数后的额外空间。使用以下代码:

apt_repository: repo='ppa:nilarimogard/webupd8' 
相关问题