Skip to content

Commit 70a4680

Browse files
committed
First commit
0 parents  commit 70a4680

File tree

6 files changed

+113
-0
lines changed

6 files changed

+113
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.vagrant
2+
playbook.retry

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
aptoma.aws-codedeploy
2+
=========
3+
4+
Installs AWS CodeDeploy Agent
5+
6+
### Adding it to your Playbook
7+
8+
Add these lines to your role file:
9+
10+
```yaml
11+
- src: [email protected]:aptoma/ansible-aws-codedeploy
12+
scm: git
13+
version: 0.1.0
14+
name: aptoma.aws-codedeploy
15+
```
16+
17+
Run `ansible-galaxy install -r {your role file}` then add it to your roles list:
18+
19+
```yaml
20+
roles:
21+
- role: aptoma.aws-codedeploy
22+
```
23+
24+
### Testing
25+
26+
Install depedencies
27+
28+
pip install molecule
29+
pip install python-vagrant
30+
31+
Run test
32+
33+
molecule test
34+
35+
SSH to vagrant created by molecule
36+
37+
molecule login

Vagrantfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
VAGRANTFILE_API_VERSION = '2'
2+
Vagrant.require_version '>= 1.7.0'
3+
4+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
5+
vagrant_root = File.dirname(__FILE__)
6+
ENV['ANSIBLE_ROLES_PATH'] = "#{vagrant_root}/.."
7+
8+
config.vm.box = "ubuntu/xenial64"
9+
# Install python
10+
config.vm.provision "install python", type: "shell" do |s|
11+
s.inline = "sudo apt-get -y install python-minimal"
12+
end
13+
14+
# Run core
15+
config.vm.provision "role-test", type: "ansible" do |ansible|
16+
ansible.verbose = "v"
17+
ansible.playbook = "playbook.yml"
18+
end
19+
end

meta/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
galaxy_info:
2+
author: Martin Jonsson
3+
description: Install AWS CodeDeploy Agent
4+
company: Aptoma
5+
6+
license: MIT
7+
8+
min_ansible_version: 1.2
9+
10+
platforms:
11+
- name: Ubuntu
12+
versions:
13+
- xenial
14+
15+
galaxy_tags:
16+
- amazon
17+
- aws
18+
- codedeploy
19+
20+
dependencies: []

playbook.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- hosts: all
3+
roles:
4+
- role: ansible-aws-codedeploy

tasks/main.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
# tasks file for aptoma.aws-codedeploy
3+
- name: Install Packages
4+
become: true
5+
apt:
6+
state: latest
7+
name: "{{ item }}"
8+
update_cache: yes
9+
with_items:
10+
- ruby
11+
12+
- name: Get Instance Metadata
13+
action: ec2_facts
14+
register: ec2_facts
15+
16+
## Default region to use for download when running locally or non ec2 instance
17+
- set_fact: region=eu-central-1
18+
when: ec2_facts.ansible_ec2_placement_region is undefined
19+
20+
- set_fact: region={{ ec2_facts.ansible_ec2_placement_region }}
21+
when: ec2_facts.ansible_ec2_placement_region is defined
22+
23+
- name: Download CodeDeploy Agent
24+
get_url:
25+
url: "https://aws-codedeploy-{{ region }}.s3.amazonaws.com/latest/install"
26+
dest: /tmp/codedeploy-install
27+
mode: 0755
28+
29+
- name: Codedeploy Install
30+
become: true
31+
command: /tmp/codedeploy-install auto

0 commit comments

Comments
 (0)