Files
RsyslogAutomate/automateRsync.py
2024-04-16 09:45:21 +02:00

15 lines
480 B
Python

#/usr/bin/python3
import os
def rsyncConection(src, dest, user, host):
ssh = "'ssh -i ~/.ssh/id_rsa'"
conn = f"rsync -rvpog --times --atimes --update --delete -e 'ssh -i ~/.ssh/id_rsa' {src} {user}@{host}:{dest}"
os.system(conn)
if __name__ == "__main__":
src = "/etc/rsyslog.conf"
dest = "/etc/rsyslog.conf"
user = "splunk"
hosts = ["10.218.7.217", "10.218.7.218", "10.218.7.219"]
for host in hosts:
rsyncConection(src, dest, user, host)