gpt4 book ai didi

docker - 要求 apt::source 作为依赖项会出现语法错误

转载 作者:行者123 更新时间:2023-12-01 02:06:23 25 4
gpt4 key购买 nike

我需要在安装 docker 之前将 docker 源列表添加到 apt。

我有

apt::source { 'debian-jessie':
comment => 'This is the docker Debian jessie mirror',
location => 'http://apt.dockerproject.org/repo',
release => 'debian-jessie',
repos => 'main',
key_content => '58118E89F3A912897C070ADBF76221572C52609D',
key_server => 'keyserver.ubuntu.com',
ensure => present,
include_src => false,
include_deb => true,
}

哪个有效,而且
package {'docker-engine':
ensure => present,
before => Class['docker'],
}

仅在第二次运行后才有效(我使用 vagrant provision ,但这与问题无关)。

我想要的是通过指示 puppet 执行 apt::source 在第一次配置时使整个事情正常工作之前 docker-engine ,但是将其添加到 require不是有效的语法:
package {'docker-engine':
ensure => present,
before => Class['docker'],
require => [
Apt::source['debian-jessie'],
]
}

如何指定此依赖项?

文件的其余部分如下所示:
class { 'docker':
dns => '192.168.1.1',
manage_package => false,
use_upstream_package_source=> false,
# service_name => 'docker',
docker_command => 'docker',
package_name => 'docker-engine',
service_enable => true,
service_state => 'running',
extra_parameters => ["--insecure-registry=192.168.1.0/24"],
}

include 'docker'

file { "/lib/systemd/system/docker.service":
notify => Service["docker"],
ensure => present,
owner => "root",
group => "root",
mode => 0600,
source =>"puppet:///modules/docker/etc/systemd/system/docker.service"
} ~> Exec['systemctl-daemon-reload']

最佳答案

大写单词 source

require => Apt::Source['debian-jessie']

Puppet documentation状态:

The general form of a resource reference is:

  • The resource type, capitalized (every segment must be capitalized if the resource type includes a namespace separator [::])
  • An opening square bracket
  • The title of the resource as a string, or a comma-separated list of titles
  • A closing square bracket

关于docker - 要求 apt::source 作为依赖项会出现语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32243421/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com