简体   繁体   中英

Puppet compare ini file between server and agent

its possible to compare ini file before copy to agent ? for example I have sys.ini file on different agents:

Agent-1:
sys.ini
---ip:x.x.x.1

Agent-2:
sys.ini
---ip:x.x.x.2

Now I want add new line to the sys.ini on the Puppet Server like:

> sys.ini
> ---ip:x.x.x.x
> ---name:x.x.x.x

I want to add only the NAME to the sys.ini on agent-1 and 2, is that possible ? Not to override the whole sys.ini on agents.

thanks in advance

Regards, Andy

Sounds like you want to ensure a line exists within a file without replacing or managing the entire contents of the file.

You can do this with the file_line resource from the puppetlabs/stdlib module. https://forge.puppet.com/puppetlabs/stdlib#file_line

file_line { 'name_line':
  path => 'sys.ini',
  line => '---name:whatever',
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM