forked from butangero/auto_rotate_aws_keys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_rotate_aws_keys.playbook.yml
39 lines (34 loc) · 1.1 KB
/
auto_rotate_aws_keys.playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
######################################################################################
# Installs packages and configuration
# to automatically rotate your AWS key daily
# NOTE - later scale this back to monthly
# NOTE - assumes you already have aws credentials
# NOTE - assumes you already have ansible installed, otherwise playbook wouldn't run
######################################################################################
- name: Set up automatic aws key rotation
gather_facts: True
hosts: localhost
connection: local
vars:
pip_install:
- awscli
- boto
- boto3
- botocore
- aws-rotate
tasks:
- name: Install Packages via pip
pip:
name: "{{ item }}"
state: latest
extra_args: --upgrade --user
with_items:
- "{{ pip_install }}"
- name: Copy launchd template to ~/Library/LaunchAgents
template:
src: com.tsmith.aws-rotate-keys.plist.j2
dest: ~/Library/LaunchAgents/com.tsmith.aws-rotate-keys.plist
mode: 0644
- name: exec launchctl to kick it off
shell: launchctl load com.tsmith.aws-rotate-keys.plist