Skip to content

Commit

Permalink
Prefer a dictionary to ternary logic
Browse files Browse the repository at this point in the history
The dictionary can handle more than two cases (should that ever be
required) and is cleaner.
  • Loading branch information
jsf9k committed Jun 17, 2024
1 parent 8d63ed9 commit 8ce82fc
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
10 changes: 9 additions & 1 deletion vars/Amazon.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
# A dictionary whose keys are values of the Ansible fact
# ansible_architecture and whose values are processor architecture for
# which CloudWatch Agent is to be installed, as specified in the
# CloudWatch Agent package filename
architectures:
aarch64: arm64
x86_64: amd64

# The Amazon CloudWatch Agent URL
url: https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/{{ 'amd64' if ansible_architecture == 'x86_64' else 'arm64' }}/latest/amazon-cloudwatch-agent.rpm
url: https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/{{ architectures[ansible_architecture] }}/latest/amazon-cloudwatch-agent.rpm
10 changes: 9 additions & 1 deletion vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
# A dictionary whose keys are values of the Ansible fact
# ansible_architecture and whose values are processor architecture for
# which CloudWatch Agent is to be installed, as specified in the
# CloudWatch Agent package filename
architectures:
aarch64: arm64
x86_64: amd64

# The Amazon CloudWatch Agent URL
url: https://s3.amazonaws.com/amazoncloudwatch-agent/debian/{{ 'amd64' if ansible_architecture == 'x86_64' else 'arm64' }}/latest/amazon-cloudwatch-agent.deb
url: https://s3.amazonaws.com/amazoncloudwatch-agent/debian/{{ architectures[ansible_architecture] }}/latest/amazon-cloudwatch-agent.deb
10 changes: 9 additions & 1 deletion vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
# A dictionary whose keys are values of the Ansible fact
# ansible_architecture and whose values are processor architecture for
# which CloudWatch Agent is to be installed, as specified in the
# CloudWatch Agent package filename
architectures:
aarch64: arm64
x86_64: amd64

# The Amazon CloudWatch Agent URL
url: https://s3.amazonaws.com/amazoncloudwatch-agent/redhat/{{ 'amd64' if ansible_architecture == 'x86_64' else 'arm64' }}/latest/amazon-cloudwatch-agent.rpm
url: https://s3.amazonaws.com/amazoncloudwatch-agent/redhat/{{ architectures[ansible_architecture] }}/latest/amazon-cloudwatch-agent.rpm
10 changes: 9 additions & 1 deletion vars/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
# A dictionary whose keys are values of the Ansible fact
# ansible_architecture and whose values are processor architecture for
# which CloudWatch Agent is to be installed, as specified in the
# CloudWatch Agent package filename
architectures:
aarch64: arm64
x86_64: amd64

# The Amazon CloudWatch Agent URL
url: https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/{{ 'amd64' if ansible_architecture == 'x86_64' else 'arm64' }}/latest/amazon-cloudwatch-agent.deb
url: https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/{{ architectures[ansible_architecture] }}/latest/amazon-cloudwatch-agent.deb

0 comments on commit 8ce82fc

Please sign in to comment.