Description
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: all
- Ruby: all
- Distribution: Ubuntu 20.04 (client)
- Module version: 3.0.0, 3.1.0
How to reproduce (e.g Puppet code you use)
class demo {
class { 'systemd':
manage_resolved => true,
resolved_ensure => 'stopped',
}
file { '/etc/resolv.conf':
ensure => 'file',
}
}
What are you seeing
Catalog compilation fails with with a duplicate resource declaration error.
What behaviour did you expect instead
File[/etc/resolv.conf]
should not be managed when systemd-resolved
is managed to the stopped
state.
Output log
Duplicate declaration: File[/etc/resolv.conf] is already declared at (.../modules/systemd/manifests/resolved.pp, line: 77); cannot redeclare (.../modules/demo/manifests/init.pp, line: 7) (file: .../modules/demo/spec/fixtures/modules/demo/manifests/init.pp, line: 7, column: 3) on node ...
Any additional information you'd like to impart
Just stopping systemd-resolved on a system that has had it configured completely breaks name resolution. Something else needs to manage /etc/resolv.conf afterward, or at least to update it once, but the module interferes with that.
For context, on domain-joined Ubuntu 20.04, systemd-resolved needs to be disabled in order for sssd to authenticate users against Active Directory.
Here is the RSpec test used to demonstrate the issue:
# frozen_string_literal: true
require 'spec_helper'
describe 'demo' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts.merge(systemd_internal_services: { 'systemd-resolved.service' => 'enabled' }) }
it { is_expected.to compile }
end
end
end