Permission denied when executing module using ansible on host machine

0 votes

through ansible sever executing module on host ,but for all command it's shows permission denied .

| FAILED! => {

    "ansible_facts": {

        "discovered_interpreter_python": "/usr/bin/python"

    },

    "changed": false,

    "cmd": "apt-get update",

    "msg": "E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)",

    "rc": 100,

    "stderr": "E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)\n",

    "stderr_lines": [

        "E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)",

        "E: Unable to lock directory /var/lib/apt/lists/",

        "W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)",

        "W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)"

    ],

    "stdout": "Reading package lists...\n",

    "stdout_lines": [

        "Reading package lists..."

    ]

}
May 3, 2020 in DevOps & Agile by Shamsher
• 120 points
675 views

1 answer to this question.

0 votes

Hi@Shamsher,

This error usually occurs when their is no valid public key set for the target server. First check whether you have valid public and private key generated for the user which you are using. Keep public key in target server and private key in control server. After that get the path for private key and configure it in ansible.cfg file.

answered May 28, 2020 by MD
• 95,140 points

Related Questions In DevOps & Agile

+6 votes
5 answers

can't remove SSIS variables using remove method on PowerShell

you're missing the additional $environment.Alter() after your ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by ajs3033
• 7,280 points
561 views
0 votes
1 answer

What OS is Jenkins installed on Azure Virtual Machine?

Under Managed Jenkins there's a section called ...READ MORE

answered Apr 4, 2018 in DevOps & Agile by DareDev
• 6,890 points
149 views
+13 votes
2 answers
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,027 views
+2 votes
1 answer
0 votes
1 answer

Jenkins instance when opened using public address of AWS is giving permission denied

Hi@Kavita, You need to create a rule in ...READ MORE

answered Oct 7, 2020 in DevOps & Agile by MD
• 95,140 points
332 views
0 votes
1 answer

Why does CPU% goes beyond 600% while using cadvisor?

Hi@Isabel, I don't know about container advisor tool, ...READ MORE

answered May 5, 2020 in DevOps & Agile by MD
• 95,140 points
667 views