I'm working on a linux server right now and have a list of servers I would like to do control using salt-stack(a DSC tool) While working on my linux+ I came across a really neat command -- xargs I've been using it to simplify a lot of my linux administration life, however I cam into an issue with it and I'm wondering if there is an easy fix for this
I'm tracking down some ntp issues across our enviornment, but the problem is the list of servers I have do not have the FQDN attached in the data set. Unfortunately salt needs the fqdn in order to see the device, otherwise it errors out every time. Now I could drop the list into notepad++ and tack on the .servers.fakefqdn.com that way but I'm wondering if there is a way to do this in the command itself
Here is my current command:
cat servers | xargs -I % sudo salt % cmd.run 'date'
Is it possible to do something like:
cat servers | xargs -I % sudo salt %+.servers.fakefqdn.com cmd.run 'date'
so if my list of servers where:
Bobsburgers
SouthPark
RickAndMorty
end goal of the xargs command would run these commands:
salt Bobsburgers.servers.fakefqdn.com cmd.run 'date'
salt SouthPark.servers.fakefqdn.com cmd.run 'date'
salt RickAndMorty.servers.fakefqdn.com cmd.run 'date'
for server in $(< servers); do echo salt ${server}.servers.fakefqdn.com cmd.run 'date'; done