Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: ansible-galaxy minus to underscore #12

Merged
merged 6 commits into from
Aug 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
language: python
python:
python:
- "2.7"
- "3.6"

Expand All @@ -24,14 +24,16 @@ install:
- ansible --version

# Link github repo to ansible-galaxy name
- ln -s $PWD ../while-true-do.nginx
- ln -s $PWD ../while_true_do.nginx

# Run the tests
script:
- chmod +x tests/test-ansible.sh
- tests/test-ansible.sh
- chmod +x tests/test-spelling.sh
- tests/test-spelling.sh
- chmod +x tests/test-whitespace.sh
- tests/test-whitespace.sh

notifications:
webhooks:
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ This role is needed to setup nginx.

## Installation

Install from [Ansible Galaxy](https://galaxy.ansible.com/while-true-do/nginx)
Install from [Ansible Galaxy](https://galaxy.ansible.com/while_true_do/nginx)

```
ansible-galaxy install while-true-do.nginx
ansible-galaxy install while_true_do.nginx
```

Install from [Github](https://github.com/while-true-do/ansible-role-nginx)

```
git clone https://github.com/while-true-do/ansible-role-nginx.git while-true-do.nginx
git clone https://github.com/while-true-do/ansible-role-nginx.git while_true_do.nginx
```

## Requirements
Expand All @@ -38,7 +38,7 @@ Used Modules:

This role depends on the below roles. You have to install them:

- [repo-epel](https://github.com/while-true-do/ansible-role-repo-epel)
- [while_true_do.repo_epel](https://github.com/while-true-do/ansible-role-repo-epel)

```
ansible-galaxy install -r requirements.yml
Expand Down Expand Up @@ -97,17 +97,17 @@ wtd_nginx_proxy_cache_path: ""
Simple Example:

```yaml
- hosts: servers
- hosts: servers
roles:
- { role: while-true-do.nginx }
- { role: while_true_do.nginx }
```

Advanced Example:

```yaml
- hosts: servers
- hosts: servers
roles:
- { role: while-true-do.nginx, wtd_nginx_worker_processes: "8", wtd_nginx_tcp_nopush: "on" }
- { role: while_true_do.nginx, wtd_nginx_worker_processes: "8", wtd_nginx_tcp_nopush: "on" }
```

## Testing
Expand All @@ -124,7 +124,7 @@ bash ./tests/test-ansible.sh
## Contribute / Bugs

Thank you so much for considering to contribute. Every contribution helps us.
We are really happy, when somebody is joining the hard work. Please have a look
We are really happy, when somebody is joining the hard work. Please have a look
at the links first.

- [Contribution Guidelines](./docs/CONTRIBUTING.md)
Expand Down
3 changes: 1 addition & 2 deletions docs/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Code of Conduct
| While True Do Code of Conduct

This guideline is only a snapshot. Please have a look [here](https://github.com/while-true-do/community/docs/) to check the latest version.
This guideline is only a snapshot. Please have a look [here](https://github.com/while-true-do/community/tree/master/docs) to check the latest version.

## Welcome

Expand Down Expand Up @@ -32,7 +32,6 @@ Examples of behaviour that contributes to creating a positive environment:

Examples of unacceptable behaviour by participants:


- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
Expand Down
12 changes: 6 additions & 6 deletions docs/COMMIT_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--
Please have a look at the contribution guidelines and pull request template first.

https://github.com/while-true-do/community/docs/CONTRIBUTING.md
https://github.com/while-true-do/community/docs/PULL_REQUEST_TEMPLATE.md
https://github.com/while-true-do/community/blob/master/docs/CONTRIBUTING.md
https://github.com/while-true-do/community/blob/master/docs/PULL_REQUEST_TEMPLATE.md

Nice to read:

Expand All @@ -11,11 +11,11 @@ https://chris.beams.io/posts/git-commit/

# Commit Types

- Fix: is solving an issue/problem
- Rework: is refactoring something existing for stability or performance
- Fix: Is solving an issue/problem
- Rework: Is refactoring something existing for stability or performance
- Add: Is adding a feature or enhancing an existing one
- Update: Mostly for updating documentation or dependencies
- Polish: Something which is "finishing" a work
- Polish: Something which is "the finishing touch"
- Remove: If a feature/function is entirely dropped

# Commit Template
Expand All @@ -32,7 +32,7 @@ Further paragraphs come after blank lines, if needed.
- Bullet points are okay, too.
- A hyphen or asterisk is used for the bullet, preceded by a single space and can
be wrapped around.

- Resolves: #12
- See also: #33, #44
```
5 changes: 2 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Contribution Code
| While True Do Contribution Guidelines


This guideline is only a snapshot. Please have a look [here](https://github.com/while-true-do/community/docs/) to check the latest version.
This guideline is only a snapshot. Please have a look [here](https://github.com/while-true-do/community/blob/master/docs/CONTRIBUTING.md) to check the latest version.

## Welcome

Expand All @@ -17,7 +16,7 @@ In this document you can find some guidance, how you can take care of bugs, subm
- [Submit Changes and Pull Requests](#Submit-Changes-and-Pull-Requests)
- [Documentation](#Documentation)
- [Testing](#Testing)

## Resources

- Documents: <https://github.com/while-true-do/community/>
Expand Down
6 changes: 4 additions & 2 deletions docs/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!--
If this is your first report, please have a look at the contribution guidelines first.

https://github.com/while-true-do/community/docs/CONTRIBUTING.md
https://github.com/while-true-do/community/blob/master/docs/CONTRIBUTING.md
-->

### Type of Report

Expand All @@ -20,4 +22,4 @@ https://github.com/while-true-do/community/docs/CONTRIBUTING.md

### Attachments

<!-- Please attach everything, what can help to understand the issue like screenshots, code snippets, error codes, animations, etc. -->
<!-- Please attach everything, that can help to understand the issue like screenshots, code snippets, error codes, animations, etc. -->
10 changes: 8 additions & 2 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<!--
Please have a look at the contribution guidelines and commit template first.

https://github.com/while-true-do/community/docs/CONTRIBUTING.md
https://github.com/while-true-do/community/docs/COMMIT_TEMPLATE.md
https://github.com/while-true-do/community/blob/master/docs/CONTRIBUTING.md
https://github.com/while-true-do/community/blob/master/docs/COMMIT_TEMPLATE.md
-->

# Subject of max. 50 characters

<!--
Further paragraphs come after blank lines, if needed.

- Bullet points are okay, too
- A hyphen or asterisk is used for the bullet, preceded by a single space.
-->

## Reference

<!--
Please be aware, that every pull-request/merge-request for released (stable) repositories needs an issue.
-->

- Resolves: #12, #13
- See also: #33, #44

## (Optional) People

<!--
@mentions of somebody who was involved or should be involved.
@mentions of the person or team responsible for reviewing proposed changes.
Expand Down
3 changes: 2 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
dependencies:
- while-true-do.repo-epel
- while_true_do.repo_epel

galaxy_info:
role_name: nginx
author: while-true-do.org
description: A role to install and configure nginx.
company: while-true-do.org
Expand Down
4 changes: 2 additions & 2 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
# Install while-true-do.repo-epel from galaxy
- src: while-true-do.repo-epel
# Install while_true_do.repo_epel from galaxy
- src: while_true_do.repo_epel
59 changes: 32 additions & 27 deletions tests/test-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,58 @@
# Generic test script for ansible roles.

# Variables
WTD_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WTD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WTD_COLOR_BLUE='\e[1;34m'
WTD_COLOR_GREEN='\e[1;32m'
WTD_COLOR_RED='\e[1;31m'
WTD_COLOR_OFF='\e[0m'
WTD_HR_LINE="****************************************"

# Script
printf "$WTD_COLOR_BLUE
**************************************** \n\
*** Ansible Testing *** \n\
**************************************** \n\
$WTD_COLOR_OFF"
printf "%b" "$WTD_COLOR_BLUE"
printf "%s\\n" "$WTD_HR_LINE"
printf "*** %s ***\\n" "Ansible Testing"
printf "%s\\n" "$WTD_HR_LINE"
printf "%b" "$WTD_COLOR_OFF"

printf "*** Step 1: Create valid ansible.cfg *** \n"
printf "*** Step 1: Create valid ansible.cfg ***\\n"
printf '[defaults]\nroles_path=../' > "$WTD_SCRIPT_DIR/../ansible.cfg"
printf "**************************************** \n"
printf "%s\\n" "$WTD_HR_LINE"

printf "*** Step 2: Install Dependencies *** \n"
if [ -f $WTD_SCRIPT_DIR/../requirements.yml ]; then
printf "*** Step 2: Install Dependencies ***\\n"
if [ -f "$WTD_SCRIPT_DIR/../requirements.yml" ]; then
ansible-galaxy install -v -r "$WTD_SCRIPT_DIR/../requirements.yml"
fi
printf "**************************************** \n"
printf "%s\\n" "$WTD_HR_LINE"

printf "*** Step 3: Syntax Check *** \n"
printf "*** Step 3: Syntax Check ***\\n"
ansible-playbook "$WTD_SCRIPT_DIR/test.yml" -i "$WTD_SCRIPT_DIR/inventory" -vv --syntax-check || WTD_ERR=true
printf "**************************************** \n"
printf "%s\\n" "$WTD_HR_LINE"

printf "*** Step 4: Linting *** \n"
printf "*** Step 4: Linting ***\\n"
ansible-lint -Rv "$WTD_SCRIPT_DIR/test.yml" || WTD_ERR=true
printf "**************************************** \n"
printf "%s\\n" "$WTD_HR_LINE"

printf "*** Step 5: Clean Up *** \n"
printf "*** Step 5: Clean Up ***\\n"
rm -v "$WTD_SCRIPT_DIR/../ansible.cfg"
printf "**************************************** \n"
printf "%s\\n" "$WTD_HR_LINE"

if [ $WTD_ERR ]; then
printf "$WTD_COLOR_RED
**************************************** \n\
*** Error occured - Tests failed *** \n\
**************************************** \n\
$WTD_COLOR_OFF"
printf "\\n"
printf "%b" "$WTD_COLOR_RED"
printf "%s\\n" "$WTD_HR_LINE"
printf "*** %s ***\\n" \
"Error occured - Tests failed"
printf "%s\\n" "$WTD_HR_LINE"
printf "%b" "$WTD_COLOR_OFF"
exit 1
else
printf "$WTD_COLOR_GREEN
**************************************** \n\
*** Tests successful *** \n\
**************************************** \n\
$WTD_COLOR_OFF"
printf "\\n"
printf "%b" "$WTD_COLOR_GREEN"
printf "%s\\n" "$WTD_HR_LINE"
printf "*** %s ***\\n" \
"Tests successful"
printf "%s\\n" "$WTD_HR_LINE"
printf "%b" "$WTD_COLOR_OFF"
exit 0
fi
50 changes: 27 additions & 23 deletions tests/test-spelling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,43 @@
# Generic test script for Spellchecking markdown files.

# Variables
WTD_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WTD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WTD_COLOR_BLUE='\e[1;34m'
WTD_COLOR_GREEN='\e[1;32m'
WTD_COLOR_RED='\e[1;31m'
WTD_COLOR_OFF='\e[0m'
WTD_HR_LINE="****************************************"

# Script
printf "$WTD_COLOR_BLUE
**************************************** \n\
*** Spell Checking *** \n\
**************************************** \n\
$WTD_COLOR_OFF"
printf "%b" "$WTD_COLOR_BLUE"
printf "%s\\n" "$WTD_HR_LINE"
printf "*** %s ***\\n" "Spell Checking"
printf "%s\\n" "$WTD_HR_LINE"
printf "%b" "$WTD_COLOR_OFF"

BADWORDS=$(sed '/^```/,/^```/d' "$WTD_SCRIPT_DIR/../README.md" | aspell --lang=en --encoding=utf-8\
--personal="$WTD_SCRIPT_DIR/.aspell.en.pws" list)
BADWORDS=$(sed "/^\`\`\`/,/^\`\`\`/d" "$WTD_SCRIPT_DIR/../README.md" | aspell --lang=en --encoding=utf-8 \
--personal="$WTD_SCRIPT_DIR/.aspell.en.pws" list)

BADWORDS_COUNT=$(echo $BADWORDS | wc -w)
BADWORDS_COUNT=$(echo "$BADWORDS" | wc -w)

if [ $BADWORDS_COUNT -gt 0 ]; then
printf "$WTD_COLOR_RED
Error occured - Found $BADWORDS_COUNT bad word(s) \n\
\n\
Bad Words: \n\
$BADWORDS \n\
\n\
**************************************** \n\
$WTD_COLOR_OFF"
if [ "$BADWORDS_COUNT" -gt 0 ]; then
printf "\\n"
printf "%b" "$WTD_COLOR_RED"
printf "%s\\n" \
"Error occured - Found $BADWORDS_COUNT bad word(s)"
printf "\\n"
printf "%s\\n" "Bad Words:"
printf "%s\\n" "$BADWORDS"
printf "\\n"
printf "%s\\n" "$WTD_HR_LINE"
printf "%b" "$WTD_COLOR_OFF"
exit 1;
else
printf "$WTD_COLOR_GREEN
**************************************** \n\
*** Spellchecking successful *** \n\
**************************************** \n\
$WTD_COLOR_OFF"
printf "\\n"
printf "%b" "$WTD_COLOR_GREEN"
printf "%s\\n" "$WTD_HR_LINE"
printf "*** %s ***\\n" "Spellchecking successful"
printf "%s\\n" "$WTD_HR_LINE"
printf "%b" "$WTD_COLOR_OFF"
exit 0;
fi
Loading