Dependency cycles with apt module
I'm trying to write a manifest that performs a bunch of package installs, and then installs and starts an instance of postgres. However, before I install any packages, I must make sure the apt-get repositories are up to date. I've reduced my issue to the following:
stage { 'first':
before => Stage['main']
}
class { '::apt':
always_apt_update => true,
stage => first
}
class { 'postgresql::globals':
manage_package_repo => true
}
->
class { 'postgresql::server': }
I have also tried replacing the ::apt class declaration with:
class { 'apt::update':
stage => first
}
Both produce dependency cycles, presumably because the Postgres module internally uses apt::update:
==> default: (Anchor[apt_key ACCC4CF8 present] => Apt::Key[Add key: ACCC4CF8 from Apt::Source apt.postgresql.org] => File[apt.postgresql.org.list] => Exec[apt_update] => Class[Apt::Update] => Stage[init] => Stage[main] => Class[Postgresql::Repo::Apt_postgresql_org] => Apt::Source[apt.postgresql.org] => File[apt.postgresql.org.list])
What would be the most idiomatic way of solving such dependency issues, considering I need to install Postgres with manage_package_repo == true and need to perform an apt-get update first of all (and would much rather not declare an exec)?