0

Fairly long time reader, first time poster. I am not a scripter (yet) but I understand/know some basics. Not all the basics, but some.

I've been doing lots of searching but have not found my particular case just yet.

What I'm doing is writing up a script to send multiple rpm files to multiple systems, then remotely executing the rpm installation command and repeat on to the next system.

I have a plain text file that contains a list of the systems (sites.txt). The list of systems are laid out like this in the file:

0123 aa0123

4567 aa4567

8910 aa8910

etc...

I want to use this list to pass to the SCP/SSH commands to send the RPM files, then to execute the rpm installation. But I'm not exactly sure how to go about getting the same command to repeat until the list of systems (sites.txt) has run through.

To give more of an idea of what I'm trying to do, here is what I have in the script so far:

for i in cat /tmp/sites.txt | awk '{print $2}' do REG='expr substr $i'

(Is this needed?)

scp /remote/install/* $i:/remote/install; ssh $i "rpm -U /remote/install/*'

Thats what I've got so far.

Any help/advise would be greatly appreciated as I'm not very strong with scripting.

Thanks!

TristanK
  • 8,953
  • 2
  • 27
  • 39
talmag
  • 1
  • 2

1 Answers1

3

Create a yum repo out of that package directory. Share it with http or ftp.

On the hosts, install this yum repo, perhaps call it local. Install and update only these packages: yum --disablerepo='*' --enablerepo=local update '*'

For doing it on many hosts, use automation software. Ansible is very good at just ssh into a box and doing things, in parallel, with decent error handling. This would be a two task Ansible play.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32