1

Trying to figure out the best way to go about determining if a linux instance is Amazon Linux 2 or Red Hat Enterprise Linux 7.

I was looking at the ConditionArchitecture test, however, it does not seem to get granular enough. The other route would be to use ConditionPathExist and try and find a unique path between AL2 and RHEL7.

[Unit]
Description=CloudPassage Halo Agent Configuration
After=network-online.target network.service
Before=cphalod.service
ConditionFileNotEmpty=!/opt/cloudpassage/data/store.db.vector

[Service]
Type=oneshot
ExecStart=/opt/cloudpassage/bin/configure --agent-key=XXXXXXXXXXXXXXXXXXXXXX --tag=XXX-XXX-XXX --proxy=proxy:3128 --dns=false

[Install]
WantedBy=multi-user.target

I basically want to add a condition statement in the Service section of the unit final, saying if AL2 use one agent-key and tag, then if it's RHEL7 use a different agent-key and tag. Has anyone done anything similar? I've tried searching around SO, but I didn't see anything for my any scenario similar to mine. If there is a better way to go about it instead of in the unit file, I'm open to suggestions.

Isaiah
  • 169
  • 1
  • 2
  • 10

0 Answers0