Skip to content

Commit b67f68b

Browse files
Removed hard coded values and 'namespaced' the variables
1 parent 3fda557 commit b67f68b

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

defaults/main.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ required_packages:
55
- { package: boto, version: "2.42.0" }
66

77
# AWS credentials for the IAM user (alternatively can be set up as environment variables)
8-
aws:
8+
ast__aws:
99
access_key: CHANGEME
1010
secret_key: CHANGEME
1111

1212
# EC2 info about your servers region
13-
ec2_region_name: CHANGEME
14-
ec2_region_endpoint: CHANGEME
13+
ast__ec2_region_name: CHANGEME
14+
ast__ec2_region_endpoint: CHANGEME
1515

1616
# Tag of the EBS volume you want to take the snapshots of
17-
tag_name: MakeSnapshot
18-
tag_value: True
17+
ast__tag_name: MakeSnapshot
18+
ast__tag_value: True
1919

2020
# Number of snapshots to keep (the older ones are going to be deleted
2121
# since they cost money).
22-
keep_day: 5
23-
keep_week: 5
24-
keep_month: 11
22+
ast__keep_day: 5
23+
ast__keep_week: 5
24+
ast__keep_month: 11
2525

2626
# ARN of the SNS topic (optional)
27-
notification_topic_arn:
27+
ast__notification_topic_arn:
2828

2929
# Path to the log for this script
30-
log_file: /tmp/makesnapshots.log
30+
ast__log_file: /tmp/aws-make-snapshots.log

templates/config.j2

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
config = {
22

33
# AWS credentials for the IAM user (alternatively can be set up as environment variables)
4-
'aws_access_key': '{{ aws.access_key }}',
5-
'aws_secret_key': '{{ aws.secret_key }}',
4+
'aws_access_key': '{{ ast__aws.access_key }}',
5+
'aws_secret_key': '{{ ast__aws.secret_key }}',
66

77
# EC2 info about your server's region
8-
'ec2_region_name': '{{ ec2_region_name }}',
9-
'ec2_region_endpoint': '{{ ec2_region_endpoint }}',
8+
'ec2_region_name': '{{ ast__ec2_region_name }}',
9+
'ec2_region_endpoint': '{{ ast__ec2_region_endpoint }}',
1010

1111
# Tag of the EBS volume you want to take the snapshots of
12-
'tag_name': 'MakeSnapshot',
13-
'tag_value': 'True',
12+
'tag_name': '{{ ast__tag_name }}',
13+
'tag_value': '{{ ast__tag_value }}',
1414

1515
# Number of snapshots to keep (the older ones are going to be deleted,
1616
# since they cost money).
17-
'keep_day': 5,
18-
'keep_week': 5,
19-
'keep_month': 11,
17+
'keep_day': {{ ast__keep_day }},
18+
'keep_week': {{ ast__keep_week }},
19+
'keep_month': {{ ast__keep_month }},
2020

2121
# Path to the log for this script
22-
'log_file': '{{ log_file }}',
22+
'log_file': '{{ ast__log_file }}',
2323

2424
# ARN of the SNS topic (optional)
25-
{% if notification_topic_arn is defined %}
26-
'arn': '{{ notification_topic_arn }}',
25+
{% if ast__notification_topic_arn is defined %}
26+
'arn': '{{ ast__notification_topic_arn }}',
2727
{% endif %}
2828

2929
# Proxy config (optional)

0 commit comments

Comments
 (0)