Skip to content

Commit

Permalink
Use file_line instead of sed
Browse files Browse the repository at this point in the history
  • Loading branch information
damonmaria committed Apr 2, 2020
1 parent 3c035a4 commit 5af797c
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,12 @@
}
~> Service['docker']
$config_toml = '/etc/nvidia-container-runtime/config.toml'
Package['nvidia-docker2']
-> exec { 'uncomment-swarm-resource':
command => "/bin/sed -i '/swarm-resource = \"DOCKER_RESOURCE_GPU\"/s/^#//g' ${config_toml}",
onlyif => "/bin/grep '#swarm-resource' ${config_toml}",
-> file_line { 'uncomment-swarm-resource':
path => '/etc/nvidia-container-runtime/config.toml',
line => 'swarm-resource = "DOCKER_RESOURCE_GPU"',
match => '^#?swarm-resource',
}
~> Service['docker']
# Toml.lns seems broken
# -> augeas { 'config.toml':
# lens => 'Toml.lns',
# incl => '/etc/nvidia-container-runtime/config.toml',
# changes => [
# 'set entry[. = "swarm-resource"] swarm-resource',
# 'set entry[. = "swarm-resource"]/string DOCKER_RESOURCE_GPU',
# ],
# }
}

0 comments on commit 5af797c

Please sign in to comment.