Installing packages with dependencies using puppet

9,771

Solution 1

You can try below manifest. The issue is that you have to add -f and --allow-unauthenticated options for apt-get to resolve the dependencies automatically and install them. Once these flags are added it is not necessary to add each and every dependent package to the package resource.

class mysql {
    package { ["mysql-server-5.5"]:
        ensure          => present,
        allowcdrom      => 'true',
        install_options => ['--allow-unauthenticated', '-f'],
    }
}

Solution 2

From what I see you are using Ubuntu and therefore the Apt package manager. The error you are encountering is due to installing a package that it cannot find the public key for the package.

This can be because:

  • You have a package source that does not contain the public keys.
  • You need to do apt-get update to update your sources before doing an install.
  • Or you need to manually import the key.

You have two possible solutions:

  • Import the key
  • Ignore the missing key
  • Or use the following in Puppet to configure Apt to ignore missing keys.

    class {'::apt': disable_keys: true}

The above require the PppetLabs Apt module.

I would check the first options before disabling keys. You don't give enough details to have a precise cause/solution but the above should get you in the right direction.

Share:
9,771

Related videos on Youtube

Yaalie
Author by

Yaalie

Updated on September 18, 2022

Comments

  • Yaalie
    Yaalie almost 2 years

    I am new to puppet, for the process of learning it I created Puppet Master and Puppet Slave setup and configured a mysql module to install mysql on Puppet client. Below is the manifest file.

    class mysql {
        package { ["mysql-server-5.5", "libaio1", "libdbd-mysql-perl", "libdbi-perl", "libhtml-template-perl", "libmysqlclient18", "mysql-client-5.5", "mysql-common", "mysql-server-core-5.5"]:
        ensure => present,
        allowcdrom => 'true',
        }
    }
    

    The package resource contains all the dependencies of mysql-server. But I am getting the below error.

    Building dependency tree...
    Reading state information...
    The following extra packages will be installed:
      mysql-common
    The following NEW packages will be installed:
      libmysqlclient18 mysql-common
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 738 kB of archives.
    After this operation, 3513 kB of additional disk space will be used.
    WARNING: The following packages cannot be authenticated!
      mysql-common libmysqlclient18
    E: There are problems and -y was used without --force-yes
    Error: /Stage[main]/Mysql/Package[libmysqlclient18]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install libmysqlclient18' returned 100: Reading package lists...
    

    I also tried adding install_options: "--force-yes" as mentioned in the error output, but still getting in to the same issue.

    Any help on this will be appreciated.

    • faker
      faker over 9 years
      Note: there is no need to specify all dependencies. Just specify the package you want to have and let apt worry about installing the dependencies for you.
  • ptman
    ptman over 9 years
    It's not necessary to add the dependent packages even without these options. It should be pointed out and emphasized that installing unauthenticated packages poses a security risk. A better idea is to fix the problem by installing the keys used to sign the packages.