/ Published in: Python

Usage:
1. save the snippet as *fabfile.py*
2. and run:
**$ fab -H myhost1,myhost2...**
or set *env.roledefs['myrole'] = ['myhost1', 'myhost2', ...]* in *fabfile.py* and run this way:
**$ fab -R myrole**
1. save the snippet as *fabfile.py*
2. and run:
**$ fab -H myhost1,myhost2...**
or set *env.roledefs['myrole'] = ['myhost1', 'myhost2', ...]* in *fabfile.py* and run this way:
**$ fab -R myrole**
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
from fabric.api import env, hide, run, task import re env.user = 'root' @task(default=True) def tz_up(): upd = [] with hide('output'): for pkg in run('rpm -qa').split('\n'): if re.search('^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')
URL: fab_yum_up_tzdata
Comments
