Ansible - Error - stderr: E: There are problems and -y was used without --force-yes
In case your tasks is to install some packages and it errors out as below

  

- name: Install linux-headers
  apt: pkg={{item}} 
       state=installed 
       install_recommends=yes 
       update_cache=yes
  with_items: 
      - linux-headers-generic
      - dkms
  sudo: yes




failed: [parallelsUbuntu] => (item=linux-headers-generic,dkms) => {"failed": true, "item": "linux-headers-generic,dkms"}
stderr: E: There are problems and -y was used without --force-yes

stdout: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  cpp fakeroot gcc libfakeroot linux-headers-3.13.0-63
  linux-headers-3.13.0-63-generic patch
Suggested packages:
  cpp-doc dpkg-dev debhelper gcc-multilib manpages-dev autoconf automake1.9
  libtool flex bison gdb gcc-doc diffutils-doc
The following NEW packages will be installed:
  cpp dkms fakeroot gcc libfakeroot linux-headers-3.13.0-63
  linux-headers-3.13.0-63-generic linux-headers-generic patch
0 upgraded, 9 newly installed, 0 to remove and 17 not upgraded.
Need to get 0 B/9846 kB of archives.
After this operation, 78.0 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  cpp gcc patch dkms libfakeroot fakeroot linux-headers-3.13.0-63
  linux-headers-3.13.0-63-generic linux-headers-generic

msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"   install 'linux-headers-generic' 'dkms'' failed: E: There are problems and -y was used without --force-yes


FATAL: all hosts have already failed -- aborting

Solution

The solution is to just add the option of force=yes

  
apt: pkg={{item}} 
       state=installed 
       install_recommends=yes 
       update_cache=yes
       force=yes


which is equivalent to what we would have done manually on the terminal

  
sudo apt-get install some-deb -y --force-yes


Every time I use Ansible my admiration for it only increases, how well advanced concepts have been implemented in such simple ways!

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna Veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Start Work With Me

Contact Us
Venu Murthy
+91 9886782890
WorldWide

CC. Powered by Blogger.

Twitter




Punch Line

“Excellence is never an accident. It is always the result of high intention, sincere effort, and intelligent execution.... ― Aristotle

Join My Professional Network







Feature Post

Featured Post

We wasted 3 months on Area 51 - Stackexchange

In the light of wanting a discussion forum to nurture the science of PLRT, we placed a proposal on StackExchange.  But very soon reali...

Statistik

Search This Blog

Providing Solutions For Life

Stack Overflow

Stack Overflow

Github

Author Details

Hey there, We are Blossom Themes! We are trying to provide you the new way to look and use the blogger templates. Our designers are working hard and pushing the boundaries of possibilities to widen the horizon of the regular templates and provide high quality blogger templates to all hardworking bloggers!

Popular Posts