如何修复“ msg”:“在剧本中列出文件/etc/apt/sources.list.d/pkg_jenkins_io_debian_stable.list”

时间:2019-02-08 11:24:17

标签: ubuntu ansible

我正在使用ansible(剧本)部署jenkins,并使用

将Jenkins存储库添加到系统中时

我已经尝试过使用google,github进行过一些查询,但是找不到确切答案

E: Malformed entry 1 in list file /etc/apt/sources.list.d/sbt.list (Suite)`

- name: update the software repo
  apt:
    name: '*'
    update_cache: yes
    cache_valid_time: 86400

    # - name: install java from repo in ubuntu
    #apt_repository: 
    # repo: ppa:openjdk-r/ppa
    #state: present

- name: install dependencies
  package:
    name: "{{ item }}"
    state: latest
  with_items:
     - openjdk-8-jdk
     - git
     - wget

- name: importing the GPG keys of  jenkins repo
  apt_key:
    url: https://pkg.jenkins.io/debian-stable/jenkins.io.key
    state: present

- name:  adding jenkins repo to the remote system
  apt_repository:
    repo: 'deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
    state: present

- name: install jenkins
  package:
    name: "{{ item }}"
    state: latest

实际输出为

ctrlnode@ip-xxx-xx-xx-xxx:~/ansiblelearn$ ansible-playbook jenkins.yml -vv -K
ansible-playbook 2.7.6
  config file = /home/ctrlnode/ansiblelearn/ansible.cfg
  configured module search path = [u'/home/ctrlnode/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Using /home/ctrlnode/ansiblelearn/ansible.cfg as config file
SUDO password: 
/etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected

PLAYBOOK: jenkins.yml ***************************************************************************************************************************************************************************
1 plays in jenkins.yml

PLAY [Install jenkins] **************************************************************************************************************************************************************************
META: ran handlers

TASK [update the software repo] *****************************************************************************************************************************************************************
task path: /home/ctrlnode/ansiblelearn/jenkins.yml:10
fatal: [db1]: FAILED! => {"changed": false, "msg": "E:Malformed entry 1 in list file /etc/apt/sources.list.d/pkg_jenkins_io_debian_stable.list (absolute Suite Component), E:The list of sources could not be read."}
    to retry, use: --limit @/home/ctrlnode/ansiblelearn/jenkins.retry

PLAY RECAP **************************************************************************************************************************************************************************************
db1                        : ok=0    changed=0    unreachable=0    failed=1 

1 个答案:

答案 0 :(得分:0)

错误提示:

  

...“ E:列表文件etc / apt / sources.list.d / pkg_jenkins_io_debian_stable.list(绝对套件组件)中格式错误的条目1,E:无法读取源列表。”

删除文件etc / apt / sources.list.d / pkg_jenkins_io_debian_stable.list

删除重定向。

- name:  adding jenkins repo to the remote system
  apt_repository:
    repo: 'deb http://pkg.jenkins.io/debian-stable binary/'
    state: present

Jenkins Debian packages显示该行

deb https://pkg.jenkins.io/debian-stable binary/