Skip to content

Commit 8df2cbf

Browse files
committed
Add task to install awscli
1 parent 0434ece commit 8df2cbf

File tree

9 files changed

+108
-41
lines changed

9 files changed

+108
-41
lines changed

.travis.yml

+24-11
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
11
---
2-
language: python
3-
python: "2.7"
2+
sudo: required
3+
dist: trusty
44

5-
# Use the new container infrastructure
6-
sudo: false
5+
language: generic
76

8-
# Install ansible
9-
addons:
10-
apt:
11-
packages:
12-
- python-pip
7+
before_install:
8+
- sudo apt-get -qq update
9+
- sudo apt-get install -y python python-pip
1310

1411
install:
1512
# Install ansible
16-
- pip install ansible
13+
- sudo pip install ansible
1714

1815
# Check ansible version
1916
- ansible --version
2017

2118
# Create ansible.cfg with correct roles_path
2219
- printf '[defaults]\nroles_path=../' >ansible.cfg
2320

21+
# Install role dependencies
22+
- ansible-galaxy install kbrebanov.pip
23+
2424
script:
2525
# Basic role syntax check
2626
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
2727

28+
# Run the role/playbook with ansible-playbook
29+
- ansible-playbook tests/test.yml -i tests/inventory --connection=local --become
30+
31+
# Run the role/playbook again, checking to make sure it's idempotent
32+
- >
33+
ansible-playbook tests/test.yml -i tests/inventory --connection=local --become
34+
| grep -q 'changed=0.*failed=0'
35+
&& (echo 'Idempotence test: pass' && exit 0)
36+
|| (echo 'Idempotence test: fail' && exit 1)
37+
38+
# Playbook specific tests
39+
# ...
40+
2841
notifications:
29-
webhooks: https://galaxy.ansible.com/api/v1/notifications/
42+
webhooks: https://galaxy.ansible.com/api/v1/notifications/

LICENSE

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2015, Kevin Brebanov
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+

README.md

+17-12
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1-
Role Name
2-
=========
1+
awscli
2+
======
33

4-
A brief description of the role goes here.
4+
[![Build Status](https://travis-ci.org/kbrebanov/ansible-awscli.svg?branch=master)](https://travis-ci.org/kbrebanov/ansible-awscli)
5+
6+
Installs awscli
57

68
Requirements
79
------------
810

9-
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
11+
This role requires Ansible 1.4 or higher.
1012

1113
Role Variables
1214
--------------
1315

14-
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
16+
| Name | Default | Description |
17+
|----------------|---------|-------------------------------------|
18+
| awscli_version | 1.10.4 | Default installed version of awscli |
1519

1620
Dependencies
1721
------------
1822

19-
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
23+
- kbrebanov.pip
2024

2125
Example Playbook
2226
----------------
2327

24-
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
25-
26-
- hosts: servers
27-
roles:
28-
- { role: username.rolename, x: 42 }
28+
Install awscli
29+
```
30+
- hosts: all
31+
roles:
32+
- kbrebanov.awscli
33+
```
2934

3035
License
3136
-------
@@ -35,4 +40,4 @@ BSD
3540
Author Information
3641
------------------
3742

38-
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
43+
Kevin Brebanov

defaults/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
---
22
# defaults file for awscli
3+
4+
awscli_version: 1.10.4

meta/main.yml

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
galaxy_info:
2-
author: your name
3-
description:
4-
company: your company (optional)
5-
2+
author: Kevin Brebanov
3+
description: Installs awscli
4+
company:
5+
66
# If the issue tracker for your role is not on github, uncomment the
77
# next line and provide a value
88
# issue_tracker_url: http://example.com/issue/tracker
9-
9+
1010
# Some suggested licenses:
1111
# - BSD (default)
1212
# - MIT
1313
# - GPLv2
1414
# - GPLv3
1515
# - Apache
1616
# - CC-BY
17-
license: license (GPLv2, CC-BY, etc)
18-
19-
min_ansible_version: 1.2
17+
license: BSD
18+
19+
min_ansible_version: 1.4
2020

2121
# Optionally specify the branch Galaxy will use when accessing the GitHub
2222
# repo for this role. During role install, if no tags are available,
2323
# Galaxy will use this branch. During import Galaxy will access files on
2424
# this branch. If travis integration is cofigured, only notification for this
2525
# branch will be accepted. Otherwise, in all cases, the repo's default branch
2626
# (usually master) will be used.
27-
#github_branch:
28-
27+
github_branch: master
28+
2929
#
3030
# Below are all platforms currently available. Just uncomment
3131
# the ones that apply to your role. If you don't see your
3232
# platform on this list, let us know and we'll get it added!
3333
#
34-
#platforms:
34+
platforms:
3535
#- name: EL
3636
# versions:
3737
# - all
@@ -102,8 +102,8 @@ galaxy_info:
102102
# - 9.1
103103
# - 9.2
104104
# - 9.3
105-
#- name: Ubuntu
106-
# versions:
105+
- name: Ubuntu
106+
versions:
107107
# - all
108108
# - lucid
109109
# - maverick
@@ -113,7 +113,7 @@ galaxy_info:
113113
# - quantal
114114
# - raring
115115
# - saucy
116-
# - trusty
116+
- trusty
117117
# - utopic
118118
# - vivid
119119
# - wily
@@ -138,8 +138,10 @@ galaxy_info:
138138
# - lenny
139139
# - squeeze
140140
# - wheezy
141-
142-
galaxy_tags: []
141+
142+
galaxy_tags:
143+
- cloud
144+
- system
143145
# List tags for your role here, one per line. A tag is
144146
# a keyword that describes and categorizes the role.
145147
# Users find roles by searching for tags. Be sure to
@@ -151,4 +153,4 @@ galaxy_info:
151153
dependencies: []
152154
# List your role dependencies here, one per line.
153155
# Be sure to remove the '[]' above if you add dependencies
154-
# to this list.
156+
# to this list.

tasks/Ubuntu.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# tasks file for awscli (Ubuntu specific)

tasks/main.yml

+17
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
11
---
22
# tasks file for awscli
3+
4+
- name: Include distribution specific variables
5+
include_vars: "{{ ansible_distribution }}.yml"
6+
tags:
7+
- awscli
8+
9+
- include: Ubuntu.yml
10+
when: ansible_distribution == "Ubuntu"
11+
tags:
12+
- awscli
13+
14+
- name: Install awscli
15+
pip:
16+
name: awscli
17+
version: "{{ awscli_version }}"
18+
tags:
19+
- awscli

tests/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
- hosts: localhost
33
remote_user: root
44
roles:
5-
- awscli
5+
- ansible-awscli

vars/Ubuntu.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# vars file for awscli (Ubuntu specific)

0 commit comments

Comments
 (0)