ansible-role 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.atomignore +2 -0
- data/.gitignore +2 -7
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +6 -1
- data/README.md +92 -5
- data/lib/ansible/role/cli.rb +3 -7
- data/lib/ansible/role/version.rb +1 -1
- data/templates/ansible/role/init/.clog.toml.tt +4 -0
- data/templates/ansible/role/init/.gitignore +2 -6
- data/templates/ansible/role/init/.travis.yml.tt +39 -0
- data/templates/ansible/role/init/files/.empty_directory +0 -0
- data/templates/ansible/role/init/meta/readme.yml.tt +6 -1
- data/templates/ansible/role/init/tests/main.yml.tt +0 -1
- metadata +6 -5
- data/templates/ansible/role/init/.travis.yml +0 -10
- data/templates/ansible/role/init/tests/run.sh.tt +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48e3658dd970690e8ce5b234e26952eb65e27a4f
|
4
|
+
data.tar.gz: bd1f9cd75e037ff472e35bef3f3f0238f65e2b9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b045b4d110bae1efd69b31a44378e4c63bc0277676b9069b1ce90da1819de16099d15e5a07855820ff0059021b67e9dace36d63415864195a9c0e7c3791af633
|
7
|
+
data.tar.gz: 5c5e6217a12f8b3785315203949d62dbdfec635941ddb4df052d89c90fe0671e7a0dbd9f060b06c25624f55efeb0023243306b53a4eb7f344cba4b33bda92c3a
|
data/.atomignore
ADDED
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
<a name="v1.0.0"></a>
|
2
|
+
## v1.0.0 (2016-02-18)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* remove sudo: yes from test ([bee6998e](https://github.com/weareinteractive/gem-ansible-role/commit/bee6998e061770d22a3308e060a3bb5e20294bcc))
|
8
|
+
* sync travis tests with ansible-galaxy init ([4ec83a74](https://github.com/weareinteractive/gem-ansible-role/commit/4ec83a741909d0073fbf99d21e99e8a5ed670292))
|
9
|
+
* **init:**
|
10
|
+
* add all variables to generated readme.yml ([75200e51](https://github.com/weareinteractive/gem-ansible-role/commit/75200e5132c17501875a9653a0ea37711715a456))
|
11
|
+
* remove galaxy user prompt due to galaxy's organization support ([e69f577a](https://github.com/weareinteractive/gem-ansible-role/commit/e69f577ad16355b3dbae86c560daa43ca230dc44))
|
12
|
+
* refactor ansible badge to new url ([cc49bba1](https://github.com/weareinteractive/gem-ansible-role/commit/cc49bba1a4c1f7729b33799e908b2dfdc7bf2f81))
|
13
|
+
* add files directory ([0798b907](https://github.com/weareinteractive/gem-ansible-role/commit/0798b907393ae38622b04703c3a62bd6cdf1d357))
|
14
|
+
* simpler gitignore ([958fbf33](https://github.com/weareinteractive/gem-ansible-role/commit/958fbf33c6dac82902d736c3b9c6fedc0fa84b5c))
|
15
|
+
|
16
|
+
|
17
|
+
|
1
18
|
<a name="v0.2.0"></a>
|
2
19
|
## v0.2.0 (2015-12-08)
|
3
20
|
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ansible-role (
|
4
|
+
ansible-role (0.2.0)
|
5
|
+
git
|
5
6
|
thor
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
11
|
+
git (1.2.9.1)
|
10
12
|
rake (10.4.2)
|
11
13
|
thor (0.19.1)
|
12
14
|
|
@@ -17,3 +19,6 @@ DEPENDENCIES
|
|
17
19
|
ansible-role!
|
18
20
|
bundler
|
19
21
|
rake
|
22
|
+
|
23
|
+
BUNDLED WITH
|
24
|
+
1.10.6
|
data/README.md
CHANGED
@@ -5,20 +5,20 @@
|
|
5
5
|
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/gem-ansible-role.svg)](https://github.com/weareinteractive/gem-ansible-role)
|
6
6
|
|
7
7
|
|
8
|
-
>
|
8
|
+
> Ansible role command line tool for.
|
9
9
|
>
|
10
|
-
> * Initialize new
|
11
|
-
> * Re-
|
10
|
+
> * Initialize a new Ansible role
|
11
|
+
> * Re-Generating README.md
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
-
```
|
15
|
+
```bash
|
16
16
|
$ gem install ansible-role
|
17
17
|
```
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
```
|
21
|
+
```bash
|
22
22
|
$ ansible-role
|
23
23
|
Commands:
|
24
24
|
ansible-role docgen # Generate README file
|
@@ -26,6 +26,93 @@ Commands:
|
|
26
26
|
ansible-role init # Initialize new role
|
27
27
|
```
|
28
28
|
|
29
|
+
### Init
|
30
|
+
|
31
|
+
`ansible-role init` generates a role skeleton including:
|
32
|
+
|
33
|
+
* [`Travis`](https://travis-ci.org): for testing
|
34
|
+
* [`Vagrant`](http://www.vagrantup.com): for local testing
|
35
|
+
* [`clog-cli`](https://github.com/clog-tool/clog-cli): for CHANGELOG generation
|
36
|
+
* [`.editorconfig`](http://editorconfig.org/): for consistent code
|
37
|
+
|
38
|
+
```bash
|
39
|
+
$ mkdir my-role
|
40
|
+
$ cd my-role
|
41
|
+
$ ansible-role init
|
42
|
+
|
43
|
+
To generate your role, please give me some info about:
|
44
|
+
|
45
|
+
• Author
|
46
|
+
Name [franklin <franklin@weareinteractive.com>]: franklin <franklin@weareinteractive.com
|
47
|
+
Company: We Are Interactive
|
48
|
+
|
49
|
+
• Role
|
50
|
+
Name [my-role]: my-role
|
51
|
+
Description [Best role ever!]: My best role ever!
|
52
|
+
Category [development]: system
|
53
|
+
Min ansible version [2.0]: 2.0
|
54
|
+
|
55
|
+
• GitHub
|
56
|
+
User/Organization [franklin]: weareinteractive
|
57
|
+
Repository [barfoo]: ansible-my-role
|
58
|
+
|
59
|
+
exist
|
60
|
+
create .clog.toml
|
61
|
+
create .editorconfig
|
62
|
+
create .gitignore
|
63
|
+
create .travis.yml
|
64
|
+
create CHANGELOG.md
|
65
|
+
create LICENSE
|
66
|
+
create Vagrantfile
|
67
|
+
create defaults/main.yml
|
68
|
+
create handlers/main.yml
|
69
|
+
create meta/main.yml
|
70
|
+
create meta/readme.yml
|
71
|
+
create tasks/config.yml
|
72
|
+
create tasks/install.yml
|
73
|
+
create tasks/main.yml
|
74
|
+
create tasks/manage.yml
|
75
|
+
create tasks/service.yml
|
76
|
+
create templates/etc/my-role.conf.j2
|
77
|
+
create tests/main.yml
|
78
|
+
create vars/main.yml
|
79
|
+
create README.md
|
80
|
+
```
|
81
|
+
|
82
|
+
### Docgen
|
83
|
+
|
84
|
+
`ansible-role docgen` generates a `README.md` file frrom `meta/readme.yml` and your role files:
|
85
|
+
|
86
|
+
```bash
|
87
|
+
$ cd my-role
|
88
|
+
$ ansible-role docgen
|
89
|
+
|
90
|
+
```
|
91
|
+
|
92
|
+
You can configure the generated README through these variables:
|
93
|
+
|
94
|
+
```yaml
|
95
|
+
---
|
96
|
+
galaxy_name: weareinteractive.my-role
|
97
|
+
github_user: weareinteractive
|
98
|
+
github_name: ansible-my-role
|
99
|
+
badges: |
|
100
|
+
[![Build Status](https://img.shields.io/travis/weareinteractive/ansible-my-role.svg)](https://travis-ci.org/weareinteractive/ansible-my-role)
|
101
|
+
[![Galaxy](http://img.shields.io/badge/galaxy-weareinteractive.my-role-blue.svg)](https://galaxy.ansible.com/weareinteractive/my-role)
|
102
|
+
[![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/ansible-my-role.svg)](https://github.com/weareinteractive/ansible-my-role)
|
103
|
+
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-my-role.svg)](https://github.com/weareinteractive/ansible-my-role)
|
104
|
+
description: |
|
105
|
+
> * installs foo
|
106
|
+
> * configures foo
|
107
|
+
after_dependencies: |
|
108
|
+
* foo dependency
|
109
|
+
* bar dependency
|
110
|
+
after_handlers: |
|
111
|
+
## Rules
|
112
|
+
|
113
|
+
Some other important section...
|
114
|
+
```
|
115
|
+
|
29
116
|
## Contributing
|
30
117
|
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
|
31
118
|
|
data/lib/ansible/role/cli.rb
CHANGED
@@ -36,21 +36,17 @@ module Ansible
|
|
36
36
|
@data[:name] = prompt " Name", "my-role", true
|
37
37
|
@data[:description] = prompt " Description", "Best role ever!", true
|
38
38
|
@data[:category] = prompt " Category", "development", true
|
39
|
-
@data[:min_ansible_version] = prompt " Min ansible version", "
|
39
|
+
@data[:min_ansible_version] = prompt " Min ansible version", "2.0", true
|
40
40
|
@data[:var_name] = @data[:name].sub("-", "_")
|
41
41
|
puts ""
|
42
42
|
|
43
43
|
say "• GitHub", :yellow
|
44
|
-
@data[:github_user] = prompt " User", g.config('user.name'), true
|
44
|
+
@data[:github_user] = prompt " User/Organization", g.config('user.name'), true
|
45
45
|
@data[:github_name] = prompt " Repository", File.basename(Dir.getwd)
|
46
46
|
@data[:github_path] = "#{@data[:github_user]}/#{@data[:github_name]}"
|
47
47
|
puts ""
|
48
48
|
|
49
|
-
|
50
|
-
@data[:galaxy_user] = prompt " User", ENV['username']
|
51
|
-
puts ""
|
52
|
-
|
53
|
-
@data[:role_name] = "#{@data[:galaxy_user]}.#{@data[:name]}"
|
49
|
+
@data[:role_name] = "#{@data[:github_user]}.#{@data[:name]}"
|
54
50
|
|
55
51
|
# render templates
|
56
52
|
directory "templates/ansible/role/init", Dir.getwd
|
data/lib/ansible/role/version.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
language: python
|
3
|
+
python: "2.7"
|
4
|
+
|
5
|
+
# Use the new container infrastructure
|
6
|
+
sudo: false
|
7
|
+
|
8
|
+
# Install ansible
|
9
|
+
addons:
|
10
|
+
apt:
|
11
|
+
packages:
|
12
|
+
- python-pip
|
13
|
+
|
14
|
+
install:
|
15
|
+
# Install ansible
|
16
|
+
- pip install ansible
|
17
|
+
|
18
|
+
# Check ansible version
|
19
|
+
- ansible --version
|
20
|
+
|
21
|
+
# Create inventory file
|
22
|
+
- printf 'localhost' > tests/inventory
|
23
|
+
|
24
|
+
# Create ansible.cfg with correct roles_path
|
25
|
+
- printf '[defaults]\nroles_path=../' > ansible.cfg
|
26
|
+
|
27
|
+
# Create role name symlink
|
28
|
+
- ln -s ./ ../<%= @data[:role_name] %>
|
29
|
+
|
30
|
+
script:
|
31
|
+
# Basic role syntax check
|
32
|
+
- ansible-playbook -i tests/inventory tests/main.yml --syntax-check
|
33
|
+
# TODO run ansible lint
|
34
|
+
# - ansible-lint -L tests/inventory
|
35
|
+
# Run test playbooke
|
36
|
+
- ansible-playbook -i tests/inventory tests/main.yml
|
37
|
+
|
38
|
+
notifications:
|
39
|
+
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
File without changes
|
@@ -5,7 +5,7 @@ github_user: <%= @data[:github_user] %>
|
|
5
5
|
github_name: <%= @data[:github_name] %>
|
6
6
|
badges: |
|
7
7
|
[![Build Status](https://img.shields.io/travis/<%= @data[:github_path] %>.svg)](https://travis-ci.org/<%= @data[:github_path] %>)
|
8
|
-
[![Galaxy](http://img.shields.io/badge/galaxy-<%= @data[:role_name] %>-blue.svg)](https://galaxy.ansible.com
|
8
|
+
[![Galaxy](http://img.shields.io/badge/galaxy-<%= @data[:role_name] %>-role-blue.svg)](https://galaxy.ansible.com/<%= @data[:github_user] %>/<%= @data[:name] %>)
|
9
9
|
[![GitHub Tags](https://img.shields.io/github/tag/<%= @data[:github_path] %>.svg)](https://github.com/<%= @data[:github_path] %>)
|
10
10
|
[![GitHub Stars](https://img.shields.io/github/stars/<%= @data[:github_path] %>.svg)](https://github.com/<%= @data[:github_path] %>)
|
11
11
|
description: |
|
@@ -13,4 +13,9 @@ description: |
|
|
13
13
|
> * configures <%= @data[:name] %>
|
14
14
|
> * manages <%= @data[:name] %>
|
15
15
|
> * configures service
|
16
|
+
after_dependencies: |
|
17
|
+
* foo dependency
|
18
|
+
after_handlers: |
|
19
|
+
## Another Section
|
16
20
|
|
21
|
+
Lorem ipsum dolor sit atem ...
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ansible-role
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- franklin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -74,6 +74,7 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".atomignore"
|
77
78
|
- ".clog.toml"
|
78
79
|
- ".editorconfig"
|
79
80
|
- ".gitignore"
|
@@ -92,11 +93,12 @@ files:
|
|
92
93
|
- templates/ansible/role/init/.clog.toml.tt
|
93
94
|
- templates/ansible/role/init/.editorconfig
|
94
95
|
- templates/ansible/role/init/.gitignore
|
95
|
-
- templates/ansible/role/init/.travis.yml
|
96
|
+
- templates/ansible/role/init/.travis.yml.tt
|
96
97
|
- templates/ansible/role/init/CHANGELOG.md
|
97
98
|
- templates/ansible/role/init/LICENSE.tt
|
98
99
|
- templates/ansible/role/init/Vagrantfile
|
99
100
|
- templates/ansible/role/init/defaults/main.yml.tt
|
101
|
+
- templates/ansible/role/init/files/.empty_directory
|
100
102
|
- templates/ansible/role/init/handlers/main.yml.tt
|
101
103
|
- templates/ansible/role/init/meta/main.yml.tt
|
102
104
|
- templates/ansible/role/init/meta/readme.yml.tt
|
@@ -107,7 +109,6 @@ files:
|
|
107
109
|
- templates/ansible/role/init/tasks/service.yml.tt
|
108
110
|
- templates/ansible/role/init/templates/etc/%name%.conf.j2
|
109
111
|
- templates/ansible/role/init/tests/main.yml.tt
|
110
|
-
- templates/ansible/role/init/tests/run.sh.tt
|
111
112
|
- templates/ansible/role/init/vars/main.yml
|
112
113
|
homepage: https://github.com/weareinteractive/gem-ansible-role
|
113
114
|
licenses:
|
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
132
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.5.1
|
133
134
|
signing_key:
|
134
135
|
specification_version: 4
|
135
136
|
summary: Command line snippets.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# define variables
|
4
|
-
ROLE_NAME=<%= @data[:role_name] %>
|
5
|
-
|
6
|
-
# install dependencies
|
7
|
-
# ansible-galaxy install galaxyuser.role_name
|
8
|
-
|
9
|
-
# create role symnlink
|
10
|
-
ln -s $(pwd) /usr/share/ansible/roles/$ROLE_NAME
|
11
|
-
|
12
|
-
# run test playbooks
|
13
|
-
ansible-playbook -vvvv -i 'localhost,' -c local $(pwd)/tests/main.yml
|