ansible-role 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48e3658dd970690e8ce5b234e26952eb65e27a4f
4
- data.tar.gz: bd1f9cd75e037ff472e35bef3f3f0238f65e2b9f
3
+ metadata.gz: be87bffbde98bdedefd9484f1eeab58abbfd7741
4
+ data.tar.gz: d1473384723811a1ffa6678b9418075129df465d
5
5
  SHA512:
6
- metadata.gz: b045b4d110bae1efd69b31a44378e4c63bc0277676b9069b1ce90da1819de16099d15e5a07855820ff0059021b67e9dace36d63415864195a9c0e7c3791af633
7
- data.tar.gz: 5c5e6217a12f8b3785315203949d62dbdfec635941ddb4df052d89c90fe0671e7a0dbd9f060b06c25624f55efeb0023243306b53a4eb7f344cba4b33bda92c3a
6
+ metadata.gz: 9e4d9cef73c5fb61212aa872ac41f07d113c3ce5de33f8720b5a67094e7a6906d7571e094c36a29d6580c56f726136ff218555f831e9a148d5f53bb6f1b108a4
7
+ data.tar.gz: 6f44911d8912c80744a8add693afe2137b94dfa0a5e6af6a4095913e763c590521e6e10c3d092259e540b34ee34d7de433197ee2411405f7c56a8333a10c9944
data/README.md CHANGED
@@ -4,11 +4,10 @@
4
4
  [![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/gem-ansible-role.svg)](https://github.com/weareinteractive/gem-ansible-role)
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
-
8
- > Ansible role command line tool for.
7
+ > Small commandline tool to help with ansible roles.
9
8
  >
10
- > * Initialize a new Ansible role
11
- > * Re-Generating README.md
9
+ > * `init`: Initialize new ansible roles
10
+ > * `docgen`: Re-Generate README.md
12
11
 
13
12
  ## Installation
14
13
 
@@ -28,12 +27,12 @@ Commands:
28
27
 
29
28
  ### Init
30
29
 
31
- `ansible-role init` generates a role skeleton including:
30
+ Initialize a new role including:
32
31
 
33
32
  * [`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
33
+ * [`Vagrant`](https://www.vagrantup.com/): for local testing
34
+ * [`clog-cli`](https://github.com/clog-tool/clog-cli): for generating CHANGELOG
35
+ * [`.editorconfig`](http://editorconfig.org/): for consistent coding stlye
37
36
 
38
37
  ```bash
39
38
  $ mkdir my-role
@@ -48,13 +47,13 @@ To generate your role, please give me some info about:
48
47
 
49
48
  • Role
50
49
  Name [my-role]: my-role
51
- Description [Best role ever!]: My best role ever!
52
- Category [development]: system
50
+ Description [Best role ever!]: My best role ever
51
+ Category [development]: demo
53
52
  Min ansible version [2.0]: 2.0
54
53
 
55
54
  • GitHub
56
55
  User/Organization [franklin]: weareinteractive
57
- Repository [barfoo]: ansible-my-role
56
+ Repository [my-role]: ansible-my-role
58
57
 
59
58
  exist
60
59
  create .clog.toml
@@ -65,6 +64,7 @@ To generate your role, please give me some info about:
65
64
  create LICENSE
66
65
  create Vagrantfile
67
66
  create defaults/main.yml
67
+ create files
68
68
  create handlers/main.yml
69
69
  create meta/main.yml
70
70
  create meta/readme.yml
@@ -75,21 +75,18 @@ To generate your role, please give me some info about:
75
75
  create tasks/service.yml
76
76
  create templates/etc/my-role.conf.j2
77
77
  create tests/main.yml
78
+ create tests/run.sh
78
79
  create vars/main.yml
79
80
  create README.md
80
81
  ```
81
82
 
82
- ### Docgen
83
-
84
- `ansible-role docgen` generates a `README.md` file frrom `meta/readme.yml` and your role files:
83
+ See [weareinteractive.unison](https://github.com/weareinteractive/ansible-unison) for example.
85
84
 
86
- ```bash
87
- $ cd my-role
88
- $ ansible-role docgen
85
+ ### Docgen
89
86
 
90
- ```
87
+ `docgen` reads meta data from `meta/main.yml` and a `meta/readme.yml` as well as code from your role files.
91
88
 
92
- You can configure the generated README through these variables:
89
+ The `meta/readme.yml` might look like:
93
90
 
94
91
  ```yaml
95
92
  ---
@@ -102,17 +99,34 @@ badges: |
102
99
  [![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/ansible-my-role.svg)](https://github.com/weareinteractive/ansible-my-role)
103
100
  [![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-my-role.svg)](https://github.com/weareinteractive/ansible-my-role)
104
101
  description: |
105
- > * installs foo
106
- > * configures foo
102
+ > * installs my-role
103
+ > * configures my-role
107
104
  after_dependencies: |
108
- * foo dependency
109
- * bar dependency
105
+ * dependency a
106
+ * dependency b
110
107
  after_handlers: |
111
- ## Rules
108
+ ## A new section after the handler section
109
+
110
+ Lorem ipsum dolor sit atem ...
111
+ after_usage: |
112
+ ## A new section after the usage section
112
113
 
113
- Some other important section...
114
+ Lorem ipsum dolor sit atem ...
114
115
  ```
115
116
 
117
+ To re-generate the `README.md` file run:
118
+
119
+ ```bash
120
+ $ mkdir my-role
121
+ $ cd my-role
122
+ $ ansble-docgen
123
+ conflict README.md
124
+ Overwrite /path/to/my-role/README.md? (enter "h" for help) [Ynaqdh] y
125
+ force README.md
126
+ ```
127
+
128
+ See [weareinteractive.unison](https://github.com/weareinteractive/ansible-unison) for example.
129
+
116
130
  ## Contributing
117
131
  In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
118
132
 
@@ -3,6 +3,7 @@ require "git"
3
3
  require "thor"
4
4
  require "yaml"
5
5
  require "ostruct"
6
+ require "fileutils"
6
7
 
7
8
  module Ansible
8
9
  module Role
@@ -51,6 +52,9 @@ module Ansible
51
52
  # render templates
52
53
  directory "templates/ansible/role/init", Dir.getwd
53
54
 
55
+ # set mode
56
+ FileUtils.chmod("a+x", "tests/run.sh")
57
+
54
58
  # generate docs
55
59
  docgen
56
60
 
@@ -1,5 +1,5 @@
1
1
  module Ansible
2
2
  module Role
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -55,6 +55,7 @@ This is an example playbook:
55
55
  <%= @data[:files][:tests][:main] %>
56
56
  ```
57
57
 
58
+ <% if @data[:meta][:readme]["after_usage"] %><%= @data[:meta][:readme]["after_usage"] %><% end %>
58
59
  ## Testing
59
60
 
60
61
  ```shell
@@ -2,38 +2,15 @@
2
2
  language: python
3
3
  python: "2.7"
4
4
 
5
- # Use the new container infrastructure
6
- sudo: false
5
+ sudo: required
7
6
 
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] %>
7
+ before_install:
8
+ - docker pull franklinkim/ansible:ubuntu-trusty
9
+ - docker pull franklinkim/ansible:ubuntu-precise
29
10
 
30
11
  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
12
+ - docker run -v $(pwd):/opt/ansible franklinkim/ansible:ubuntu-trusty tests/run.sh
13
+ - docker run -v $(pwd):/opt/ansible franklinkim/ansible:ubuntu-precise tests/run.sh
37
14
 
38
15
  notifications:
39
16
  webhooks: https://galaxy.ansible.com/api/v1/notifications/
@@ -17,7 +17,7 @@ Vagrant.configure("2") do |config|
17
17
  # information on available options.
18
18
  config.vm.provision "ansible" do |ansible|
19
19
  ansible.playbook = "tests/main.yml"
20
- ansible.verbose = 'vv'
20
+ ansible.verbose = 'vvvv'
21
21
  ansible.sudo = true
22
22
  end
23
23
  end
@@ -1,5 +1,4 @@
1
1
  ---
2
-
3
2
  # package name (version)
4
3
  <%= @data[:var_name] %>_package: <%= @data[:name] %>
5
4
  # service name
@@ -1,5 +1,4 @@
1
1
  ---
2
-
3
2
  - name: restart <%= @data[:name] %>
4
3
  service:
5
4
  name: "{{ <%= @data[:var_name] %>_service_name }}"
@@ -1,112 +1,141 @@
1
1
  ---
2
-
3
2
  galaxy_info:
4
3
  author: <%= @data[:author] %>
5
4
  company: <%= @data[:company] %>
6
5
  description: <%= @data[:description] %>
7
6
  min_ansible_version: <%= @data[:min_ansible_version] %>
8
7
  license: MIT
8
+ # Optionally specify the branch Galaxy will use when accessing the GitHub
9
+ # repo for this role. During role install, if no tags are available,
10
+ # Galaxy will use this branch. During import Galaxy will access files on
11
+ # this branch. If travis integration is cofigured, only notification for this
12
+ # branch will be accepted. Otherwise, in all cases, the repo's default branch
13
+ # (usually master) will be used.
14
+ github_branch: master
9
15
  #
10
16
  # Below are all platforms currently available. Just uncomment
11
17
  # the ones that apply to your role. If you don't see your
12
18
  # platform on this list, let us know and we'll get it added!
13
19
  #
14
20
  platforms:
15
- # - name: EL
16
- # versions:
17
- # - all
18
- # - 5
19
- # - 6
20
- # - name: GenericUNIX
21
- # versions:
22
- # - all
23
- # - any
24
- # - name: Fedora
25
- # versions:
26
- # - all
27
- # - 16
28
- # - 17
29
- # - 18
30
- # - 19
31
- # - 20
32
- # - name: opensuse
33
- # versions:
34
- # - all
35
- # - 12.1
36
- # - 12.2
37
- # - 12.3
38
- # - 13.1
39
- # - 13.2
40
- # - name: GenericBSD
41
- # versions:
42
- # - all
43
- # - any
44
- # - name: FreeBSD
45
- # versions:
46
- # - all
47
- # - 8.0
48
- # - 8.1
49
- # - 8.2
50
- # - 8.3
51
- # - 8.4
52
- # - 9.0
53
- # - 9.1
54
- # - 9.1
55
- # - 9.2
56
- # - name: Ubuntu
57
- # versions:
58
- # - all
59
- # - lucid
60
- # - maverick
61
- # - natty
62
- # - oneiric
63
- # - precise
64
- # - quantal
65
- # - raring
66
- # - saucy
67
- # - trusty
68
- # - name: SLES
69
- # versions:
70
- # - all
71
- # - 10SP3
72
- # - 10SP4
73
- # - 11
74
- # - 11SP1
75
- # - 11SP2
76
- # - 11SP3
77
- # - name: GenericLinux
78
- # versions:
79
- # - all
80
- # - any
81
- # - name: Debian
82
- # versions:
83
- # - all
84
- # - etch
85
- # - lenny
86
- # - squeeze
87
- # - wheezy
21
+ #- name: EL
22
+ # versions:
23
+ # - all
24
+ # - 5
25
+ # - 6
26
+ # - 7
27
+ #- name: GenericUNIX
28
+ # versions:
29
+ # - all
30
+ # - any
31
+ #- name: Solaris
32
+ # versions:
33
+ # - all
34
+ # - 10
35
+ # - 11.0
36
+ # - 11.1
37
+ # - 11.2
38
+ # - 11.3
39
+ #- name: Fedora
40
+ # versions:
41
+ # - all
42
+ # - 16
43
+ # - 17
44
+ # - 18
45
+ # - 19
46
+ # - 20
47
+ # - 21
48
+ # - 22
49
+ # - 23
50
+ #- name: Windows
51
+ # versions:
52
+ # - all
53
+ # - 2012R2
54
+ #- name: SmartOS
55
+ # versions:
56
+ # - all
57
+ # - any
58
+ #- name: opensuse
59
+ # versions:
60
+ # - all
61
+ # - 12.1
62
+ # - 12.2
63
+ # - 12.3
64
+ # - 13.1
65
+ # - 13.2
66
+ #- name: Amazon
67
+ # versions:
68
+ # - all
69
+ # - 2013.03
70
+ # - 2013.09
71
+ #- name: GenericBSD
72
+ # versions:
73
+ # - all
74
+ # - any
75
+ #- name: FreeBSD
76
+ # versions:
77
+ # - all
78
+ # - 10.0
79
+ # - 10.1
80
+ # - 10.2
81
+ # - 8.0
82
+ # - 8.1
83
+ # - 8.2
84
+ # - 8.3
85
+ # - 8.4
86
+ # - 9.0
87
+ # - 9.1
88
+ # - 9.1
89
+ # - 9.2
90
+ # - 9.3
91
+ #- name: Ubuntu
92
+ # versions:
93
+ # - all
94
+ # - lucid
95
+ # - maverick
96
+ # - natty
97
+ # - oneiric
98
+ # - precise
99
+ # - quantal
100
+ # - raring
101
+ # - saucy
102
+ # - trusty
103
+ # - utopic
104
+ # - vivid
105
+ # - wily
106
+ #- name: SLES
107
+ # versions:
108
+ # - all
109
+ # - 10SP3
110
+ # - 10SP4
111
+ # - 11
112
+ # - 11SP1
113
+ # - 11SP2
114
+ # - 11SP3
115
+ #- name: GenericLinux
116
+ # versions:
117
+ # - all
118
+ # - any
119
+ #- name: Debian
120
+ # versions:
121
+ # - all
122
+ # - etch
123
+ # - jessie
124
+ # - lenny
125
+ # - squeeze
126
+ # - wheezy categories:
88
127
  #
89
- # The number of tags imported by Galaxy is limited to 20,
90
- # and tag values containing non-alphanumeric characters will be ignored.
91
- # Tag values containing a : will be split into multiple tags.
92
- # The tag cloud:ec2, for example, will become two tags: cloud and ec2.
128
+ # List tags for your role here, one per line. A tag is
129
+ # a keyword that describes and categorizes the role.
130
+ # Users find roles by searching for tags. Be sure to
131
+ # remove the '[]' above if you add tags to this list.
93
132
  #
133
+ # NOTE: A tag is limited to a single word comprised of
134
+ # alphanumeric characters. Maximum 20 tags per role.
94
135
  galaxy_tags:
95
- # - cloud
96
- # - ec2
97
- # - gce
98
- # - rax
99
- # - database
100
- # - nosql
101
- # - sql
102
- # - development
103
- # - monitoring
104
- # - networking
105
- # - packaging
106
- # - system
107
- # - web
136
+ - <%= @data[:category] %>
137
+ # List your role dependencies here, one per line. Only
138
+ # dependencies available via galaxy should be listed here.
139
+ # Be sure to remove the '[]' above if you add dependencies
140
+ # to this list.
108
141
  dependencies: []
109
- # List your role dependencies here, one per line. Only
110
- # dependencies available via galaxy should be listed here.
111
- # Be sure to remove the '[]' above if you add dependencies
112
- # to this list.
@@ -1,5 +1,4 @@
1
1
  ---
2
-
3
2
  galaxy_name: <%= @data[:role_name] %>
4
3
  github_user: <%= @data[:github_user] %>
5
4
  github_name: <%= @data[:github_name] %>
@@ -14,8 +13,13 @@ description: |
14
13
  > * manages <%= @data[:name] %>
15
14
  > * configures service
16
15
  after_dependencies: |
17
- * foo dependency
16
+ * dependency a
17
+ * dependency b
18
18
  after_handlers: |
19
- ## Another Section
19
+ ## A new section after the handler section
20
+
21
+ Lorem ipsum dolor sit atem ...
22
+ after_usage: |
23
+ ## A new section after the usage section
20
24
 
21
25
  Lorem ipsum dolor sit atem ...
@@ -1,5 +1,4 @@
1
1
  ---
2
-
3
2
  - hosts: all
4
3
  roles:
5
4
  - <%= @data[:role_name] %>
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+
3
+ # define variables
4
+ ROLE_NAME=<%= @data[:role_name] %>
5
+
6
+ # create role symnlink
7
+ ln -s $(pwd) /usr/share/ansible/roles/$ROLE_NAME
8
+
9
+ # echo 'installing dependencies'
10
+ # apt-get update
11
+ # apt-get install -qq ...
12
+
13
+ echo 'checking version'
14
+ ansible --version
15
+
16
+ echo 'checking syntax'
17
+ ansible-playbook -vvvv -i 'localhost,' -c local $(pwd)/tests/main.yml --syntax-check
18
+
19
+ echo 'running playbook'
20
+ ansible-playbook -vvvv -i 'localhost,' -c local $(pwd)/tests/main.yml
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - franklin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2016-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -109,6 +109,7 @@ files:
109
109
  - templates/ansible/role/init/tasks/service.yml.tt
110
110
  - templates/ansible/role/init/templates/etc/%name%.conf.j2
111
111
  - templates/ansible/role/init/tests/main.yml.tt
112
+ - templates/ansible/role/init/tests/run.sh.tt
112
113
  - templates/ansible/role/init/vars/main.yml
113
114
  homepage: https://github.com/weareinteractive/gem-ansible-role
114
115
  licenses: