Return to Snippet

Revision: 67477
at September 26, 2014 17:48 by alces

Initial Code
from fabric.api import env, hide, run, task
import re

env.user = 'root'

def tz_up():
	upd = []
	with hide('output'):
		for pkg in run('rpm -qa').split('\n'):
			if'^tzdata-', pkg): upd.append(re.sub('-\d.*$', '', pkg))
		if upd:
			run('yum update -q -y ' + ' '.join(upd))
			run('cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime')

Initial URL

Initial Description

1.  save the snippet as **

2.  and run:

**$ fab -H myhost1,myhost2...**

or set *env.roledefs['myrole'] = ['myhost1', 'myhost2', ...]* in ** and run this way:

**$ fab -R myrole**

Initial Title
Update timezone data on RedHat-like servers using fabric

Initial Tags

Initial Language