Mercurial > code > home > repos > infra
comparison system.py @ 130:168bc1c44e6f
stop telling arm machines to get i386 pkgs
author | drewp@bigasterisk.com |
---|---|
date | Wed, 21 Dec 2022 13:09:32 -0800 |
parents | fe3ae7c95e65 |
children | 706d861f6d95 |
comparison
equal
deleted
inserted
replaced
129:84701dafa7c3 | 130:168bc1c44e6f |
---|---|
1 import os | 1 import os |
2 | 2 |
3 from pyinfra import host | 3 from pyinfra import host |
4 from pyinfra.facts.server import LinuxDistribution | 4 from pyinfra.facts.server import LinuxDistribution |
5 from pyinfra.facts.files import FindFiles | 5 from pyinfra.facts.files import FindFiles |
6 from pyinfra.facts.server import Arch | |
6 from pyinfra.operations import apt, files, server, systemd | 7 from pyinfra.operations import apt, files, server, systemd |
7 | 8 |
8 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] | 9 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] |
9 | 10 |
10 TZ = 'America/Los_Angeles' | 11 TZ = 'America/Los_Angeles' |
14 def timezone(): | 15 def timezone(): |
15 files.link(path='/etc/localtime', target=f'/usr/share/zoneinfo/{TZ}') | 16 files.link(path='/etc/localtime', target=f'/usr/share/zoneinfo/{TZ}') |
16 files.replace(path='/etc/timezone', text='.*', replace=TZ) | 17 files.replace(path='/etc/timezone', text='.*', replace=TZ) |
17 | 18 |
18 def apt_sources(): | 19 def apt_sources(): |
19 server.shell(commands=['dpkg --add-architecture i386']) | 20 if host.get_fact(Arch) == 'x86_64': |
21 server.shell(commands=['dpkg --add-architecture i386']) | |
20 | 22 |
21 files.template(src='templates/sources.list.j2', dest='/etc/apt/sources.list.j2') | 23 files.template(src='templates/sources.list.j2', dest='/etc/apt/sources.list.j2') |
22 if host.get_fact(FindFiles, '/etc/apt/sources.list.d/', quote_path=True): | 24 if host.get_fact(FindFiles, '/etc/apt/sources.list.d/', quote_path=True): |
23 raise SystemExit(f"new files in {host.name} /etc/apt/sources.list.d/ - please remove") | 25 raise SystemExit(f"new files in {host.name} /etc/apt/sources.list.d/ - please remove") |
24 apt.packages(update=True, | 26 apt.packages(update=True, |