New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Edit a file in 16VPSs
Hi,
I have 16VPSs in the same dedicated server and I have 1 file in the documents folder in all 16VPSs
The file is exacly the same in every VPS, I edit it very often and to edit it I waste a great amount of time conecting in each one of them and etc etc
I was wondering if there's a faster and easier way to do it.
If you have a suggestion please ay it
Thanks!
Comments
Ancible recipe.
Or
SaltStack deploy.
Or
Many SSH clients allow you to execute a snippet of code on many servers.
Is there any tut for it? I googled and found nothing :S
Could even do an sed one liner in a for loop.
for i in $(cat serverlist); do ssh root@$i sed -i 's/old/new/g' filename; done
Maybe make all vps download the file on daily basis from 1 server. You probably could script this in python.
from the above response lets assume you can't be arsed to work out how something like salt works?
Why not point all of your servers at a single copy of the file on a network share, or cron the VMs to check for a new file via http every minute or two?
This , its simple and will work just fine , I would use wget though.
or rsync
Ansible - then all you need is SSH and a playbook and you're away.
Um, or just a local nfs mount...edit in one place, every vps sees the same file mmediately, no scripting needed.
terminator > broadcast all
https://launchpad.net/terminator
will do.
it will basically broadcast everything you write to all 16 connected ssh terminals.
Simple:
Step 1:
Step 2:
1.1.1.1
2.2.2.2
3.3.3.3
4.4.4.4
Step 3:
Step 4:
https://gist.github.com/martip07/9b3e67c2c8a3d64375c1
After that do a simple "chmod +x sync_server.sh" and run it with "sh sync_server.sh".
And thats all I recomend you to test it with simple files before do it on production.
Rsync the files from a central server.
I have never been more happier to use pssh.
I second this approach. If you want to push the files frequently by having SSH key so you won't have to write passwords.
Yap it works only for one line.
https://fedorahosted.org/func/
Do you not have access to the node level? I would push it via ssh with key access, as recommended above.
I forgot to mencione that I'm kind of nooby in this area.... And I'm trying to figure out what you are trying to say
Give me some hours and I will post something that will really help you.
Can you send me a link via PM when you do please?
Thanks a lot!
Basically, you have 2 choices: push or pull. Either way will work just fine. Personally, playing with multiple servers, I would go with the push option, using Ansible for example. Granted that it's a bit of overkill for this particular job at hand, but worth the learning curve if you have 16 servers. SaltStack or Chef will work, too, but you will find more support/tutorials online for Ansible.
Ya ansible works but read all he said he is new in someway here. So ansible may not be a good idea right now.
Driving home, in 2 houra or less you will get your tutorial hope it helpa you.
@francis2
cehck PM