getting error while installing mongoDB on remote ubuntu server via ansible

13 views
Skip to first unread message

Vidyashankar Kandgal

unread,
Jun 4, 2019, 1:00:41 PM6/4/19
to Ansible Development
1. For Playbook implemented see below:

# Install mongodb 
---
- hosts: server
  tasks:
  - name: Add mongo ppa key
    sudo: yes
    apt_key: >
      keyserver=hkp://keyserver.ubuntu.com:80
      id=7F0CEB10
      state=present
  - name: Add mongo sources list
    sudo: yes
    lineinfile: >
      line="deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse"
      dest=/etc/apt/sources.list.d/mongodb.list
      state=present
      create=yes
  - name: Install mongo
    sudo: yes
    apt: >
      name=mongodb-org
      state=latest
      update_cache=yes
 
2. Getting below error on running the above playbook while installing mongoDB on remote server.


TASK [Install mongo] ***************************************************************************************************************************************************************************************
 [WARNING]: Updating cache and auto-installing missing dependency: python-apt

fatal: [10.0.2.12]: FAILED! => {"changed": false, "cmd": "apt-get update", "msg": "E: Malformed entry 2 in list file /etc/apt/sources.list.d/mongodb.list (Component)\nE: The list of sources could not be read.", "rc": 100, "stderr": "E: Malformed entry 2 in list file /etc/apt/sources.list.d/mongodb.list (Component)\nE: The list of sources could not be read.\n", "stderr_lines": ["E: Malformed entry 2 in list file /etc/apt/sources.list.d/mongodb.list (Component)", "E: The list of sources could not be read."], "stdout": "", "stdout_lines": []}

PLAY RECAP *************************************************************************************************************************************************************************************************
10.0.2.12                  : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Ronald Lawhorn

unread,
Jun 6, 2019, 12:13:08 AM6/6/19
to Ansible Development
It looks like the issue is with the list apt uses to retrieve sources....

Malformed entry 2 in list file /etc/apt/sources.list.d/mongodb.list (Component)\nE: The list of sources could not be read.

You may have to template in the file if it's not present on the target.

Hope that helps
Reply all
Reply to author
Forward
0 new messages