Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: pkg mirror, static xar configs #21

Merged
merged 4 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions group_vars/tcbsd_plcs/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ ansible_become: true
ansible_become_method: doas
ansible_python_interpreter: /usr/local/bin/python3

# FreeBSD packages are no longer required, beckhoff added py39-lxml again.
# freebsd packages are the standard internet packages for bsd
enable_freebsd_packages: false
# tcbsd packages are the latest packages for tcbsd from Beckhoff
enable_tcbsd_packages: false
# slac packages are a specific version-stamped mirror of tcbsd on the internal network
# this is required if you want control over your XAR version
enable_slac_packages: true

# psproxy and psntp are currently needed to get bsd and package updates while on the lcls cds networks
use_psproxy: true
# fixed XAR ensures you set up the PLC with a known runtime
# this requires a pkg mirror
# fixed XAR version should never be defined in a group file, only in a host file, to ensure no surprise updates
set_fixed_xar: true
#fixed_xar_version: 4026.3.55

# psproxy is needed to get freebsd and tcbsd packages
use_psproxy: false
# an ntp config is needed to get any packages at all, psntp is the internal service at lcls
use_psntp: true

# Dynamic AMS net id = set AMS net id to ip addr .1.1
Expand Down
16 changes: 14 additions & 2 deletions group_vars/tcbsd_vms/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ ansible_become_method: doas
ansible_become_password: 1 # TODO: vault
ansible_python_interpreter: /usr/local/bin/python3

# FreeBSD packages are no longer required, beckhoff added py39-lxml again.
# freebsd packages are the standard internet packages for bsd
enable_freebsd_packages: false
# tcbsd packages are the latest packages for tcbsd from Beckhoff
enable_tcbsd_packages: true
# slac packages are a specific version-stamped mirror of tcbsd on the internal network
# this is required if you want control over your XAR version
enable_slac_packages: false

# psproxy and psntp are currently needed to get bsd and package updates while on the lcls cds networks
# fixed XAR ensures you set up the PLC with a known runtime
# this requires a pkg mirror
# fixed XAR version should never be defined in a group file, only in a host file, to ensure no surprise updates
set_fixed_xar: false
#fixed_xar_version: 4026.3.55

# psproxy is needed to get freebsd and tcbsd packages
use_psproxy: false
# an ntp config is needed to get any packages at all, psntp is the internal service at lcls
use_psntp: false

# Dynamic AMS net id = set AMS net id to ip addr .1.1
Expand Down
119 changes: 0 additions & 119 deletions host_vars/plc-tmo-tmp-vac/vars.yml

This file was deleted.

19 changes: 16 additions & 3 deletions host_vars/plc-tst-bsd1/vars.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
---
ansible_host: plc-tst-bsd1
fixed_xar_version: 4026.3.55

# Uncomment any setting below and change it to override a default setting.
#ansible_user: Administrator
#ansible_become: true
#ansible_become_method: doas
#ansible_python_interpreter: /usr/local/bin/python3
#
## FreeBSD packages are no longer required, beckhoff added py39-lxml again.
## freebsd packages are the standard internet packages for bsd
#enable_freebsd_packages: false
## tcbsd packages are the latest packages for tcbsd from Beckhoff
#enable_tcbsd_packages: false
## slac packages are a specific version-stamped mirror of tcbsd on the internal network
## this is required if you want control over your XAR version
#enable_slac_packages: true
#
## psproxy and psntp are currently needed to get bsd and package updates while on the lcls cds networks
#use_psproxy: true
## fixed XAR ensures you set up the PLC with a known runtime
## this requires a pkg mirror
## fixed XAR version should never be defined in a group file, only in a host file, to ensure no surprise updates
#set_fixed_xar: true
##fixed_xar_version: 4026.3.55
#
## psproxy is needed to get freebsd and tcbsd packages
#use_psproxy: false
## an ntp config is needed to get any packages at all, psntp is the internal service at lcls
#use_psntp: true
#
## Dynamic AMS net id = set AMS net id to ip addr .1.1
Expand Down
19 changes: 16 additions & 3 deletions host_vars/plc-tst-bsd2/vars.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
---
ansible_host: plc-tst-bsd2
fixed_xar_version: 4026.3.55

# Uncomment any setting below and change it to override a default setting.
#ansible_user: Administrator
#ansible_become: true
#ansible_become_method: doas
#ansible_python_interpreter: /usr/local/bin/python3
#
## FreeBSD packages are no longer required, beckhoff added py39-lxml again.
## freebsd packages are the standard internet packages for bsd
#enable_freebsd_packages: false
## tcbsd packages are the latest packages for tcbsd from Beckhoff
#enable_tcbsd_packages: false
## slac packages are a specific version-stamped mirror of tcbsd on the internal network
## this is required if you want control over your XAR version
#enable_slac_packages: true
#
## psproxy and psntp are currently needed to get bsd and package updates while on the lcls cds networks
#use_psproxy: true
## fixed XAR ensures you set up the PLC with a known runtime
## this requires a pkg mirror
## fixed XAR version should never be defined in a group file, only in a host file, to ensure no surprise updates
#set_fixed_xar: true
##fixed_xar_version: 4026.3.55
#
## psproxy is needed to get freebsd and tcbsd packages
#use_psproxy: false
## an ntp config is needed to get any packages at all, psntp is the internal service at lcls
#use_psntp: true
#
## Dynamic AMS net id = set AMS net id to ip addr .1.1
Expand Down
20 changes: 18 additions & 2 deletions scripts/make_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ def get_netid(hostname: str) -> str:
return ipaddr + ".1.1"


def tcbsd_plcs_extra_vars() -> dict[str, str]:
"""
Assign a default static TwinCAT runtime (XAR) version for normal PLCs.

This default to the "normal latest known working" that we use.
It should be kept static for a PLC until there is a good reason
to update it.

The version number in this function should be updated when we decide
to support a new version.
"""
return {"fixed_xar_version": "4026.3.55"}


def tcbsd_vms_extra_vars(
hostname: str,
) -> dict[str, str]:
Expand Down Expand Up @@ -93,7 +107,7 @@ def write_host_vars(
fd.write("---\n")
fd.write(f"ansible_host: {hostname}\n")
for key, value in extra_vars.items():
fd.write(f"{key}: {value}")
fd.write(f"{key}: {value}\n")
fd.write(
"\n"
"# Uncomment any setting below and change it "
Expand All @@ -113,7 +127,9 @@ def main(hostname: str) -> int:
inventory_path=inventory_path,
groups_path=groups_path,
)
if group == "tcbsd_vms":
if group == "tcbsd_plcs":
extra_vars = tcbsd_plcs_extra_vars()
elif group == "tcbsd_vms":
extra_vars = tcbsd_vms_extra_vars(hostname)
else:
extra_vars = {}
Expand Down
Loading