-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Tompage1994/initial-collection
Set up base collection
- Loading branch information
Showing
12 changed files
with
322 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# How to Contribute | ||
|
||
We welcome contributions from the community. Here are a few ways you can help us improve. | ||
|
||
## Open an Issue | ||
|
||
If you see something you'd like changed, but aren't sure how to change it, submit an issue describing what you'd like to see. | ||
|
||
## Submit a Pull Request | ||
|
||
If you feel like getting your hands dirty, feel free to make the change yourself. Here's how: | ||
|
||
1. Fork the repo on Github, and then clone it locally. | ||
2. Create a branch named appropriately for the change you are going to make. | ||
3. Make your code change. | ||
4. If you are creating a new role, please add a tests for it for use in a github action if possible. | ||
5. Push your code change up to your forked repo. | ||
6. Open a Pull Request to merge your changes to this repo. The comment box will be filled in automatically via a template. | ||
7. All Pull Requests will be subject to Ansible and Yaml Linting checks. Please make sure that your code complies and fix any warnings that arise. These are Checks that apear at the bottom of your Pull Request. | ||
8. All Pull requests are subject to Testing against being used in tower. As above there is a check at the bottom of your pull request for this named integration. | ||
|
||
See [Using Pull Requests](https://help.github.com/articles/using-pull-requests/) got more information on how to use GitHub PRs. | ||
|
||
For an in depth guide on how to contribute see [this article](https://opensource.com/article/19/7/create-pull-request-github) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
### What does this PR do? | ||
Brief explanation of the code or documentation change you've made | ||
|
||
### How should this be tested? | ||
Automated tests are preferred, but not always doable - especially for infrastructure. Include commands to run your new feature, and also post-run commands to validate that it worked. (please use code blocks to format code samples) | ||
|
||
### Is there a relevant Issue open for this? | ||
Provide a link to any open issues that describe the problem you are solving. | ||
resolves #<number> | ||
|
||
### Other Relevant info, PRs, etc. | ||
Please provide link to other PRs that may be related (blocking, resolves, etc. etc.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
exclude_paths: | ||
- ./roles/master_role_example | ||
parseable: true | ||
use_default_rules: true | ||
verbosity: 1 | ||
skip_list: | ||
# [E204]: "Lines should be no longer than 160 chars" | ||
# (Disabled in June 2020) | ||
- '204' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
# 80 chars should be enough, but don't fail if a line is longer | ||
line-length: disable | ||
colons: disable | ||
indentation: | ||
level: warning | ||
indent-sequences: consistent | ||
truthy: | ||
allowed-values: | ||
- 'True' | ||
- 'False' | ||
- 'true' | ||
- 'false' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
- name: release collection | ||
hosts: localhost | ||
gather_facts: no | ||
connection: local | ||
vars: | ||
collection_namespace: "{{ namespace | lower | regex_replace('-','_') }}" | ||
collection_name: tower_utilities | ||
collection_version: "{{ github_tag.split('/')[-1] | regex_search('(\\d.\\d.\\d.*)') }}" | ||
collection_repo: undef | ||
api_key: undef | ||
repo_base_dir: "{{ playbook_dir }}/../.." | ||
|
||
tasks: | ||
- name: create galaxy.yml | ||
template: | ||
src: "{{ repo_base_dir }}/galaxy.yml.j2" | ||
dest: "{{ repo_base_dir }}/galaxy.yml" | ||
|
||
- name: build collection | ||
command: | ||
cmd: ansible-galaxy collection build | ||
chdir: "{{ repo_base_dir }}" | ||
creates: "{{ repo_base_dir }}/{{ collection_namespace }}-{{ collection_name }}-{{ collection_version }}.tar.gz" | ||
tags: build | ||
|
||
- name: install collection | ||
command: | ||
cmd: "ansible-galaxy collection install {{ collection_namespace }}-{{ collection_name }}-{{ collection_version }}.tar.gz -p ~/.ansible/collections/" | ||
chdir: "{{ repo_base_dir }}" | ||
tags: install | ||
|
||
- name: publish collection | ||
command: | ||
cmd: "ansible-galaxy collection publish --api-key={{ api_key }} {{ collection_namespace }}-{{ collection_name }}-{{ collection_version }}.tar.gz" | ||
chdir: "{{ repo_base_dir }}" | ||
tags: publish | ||
|
||
- name: git cleanup | ||
command: | ||
cmd: git reset --hard | ||
tags: cleanup | ||
|
||
- name: remove galaxy.yml | ||
file: | ||
path: "{{ repo_base_dir }}/galaxy.yml" | ||
state: absent | ||
tags: cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Ansible Lint # feel free to pick your own name | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
yaml_lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: yaml-lint | ||
uses: ibiqlik/action-yamllint@master | ||
with: | ||
# File(s) or Directory, separate by space if multiple files or folder are specified | ||
file_or_dir: roles/* | ||
# Path to custom configuration | ||
config_file: .github/workflow-config/.yamllint.yml | ||
# Custom configuration (as YAML source) | ||
# config_data: # optional | ||
# Format for parsing output [parsable,standard,colored,auto] | ||
# format: # optional, default is colored | ||
# Return non-zero exit code on warnings as well as errors | ||
# strict: # optional, default is false | ||
|
||
ansible_lint: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Important: This sets up your GITHUB_WORKSPACE environment variable | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Collections | ||
run: | | ||
sudo apt install software-properties-common | ||
sudo apt-add-repository --yes --update ppa:ansible/ansible | ||
sudo apt install ansible | ||
- name: Lint Ansible Playbook | ||
# replace "master" with any valid ref | ||
uses: ansible/ansible-lint-action@master | ||
with: | ||
# [required] | ||
# Paths to ansible files (i.e., playbooks, tasks, handlers etc..) | ||
# or valid Ansible directories according to the Ansible role | ||
# directory structure. | ||
# If you want to lint multiple ansible files, use the following syntax | ||
# targets: | | ||
# playbook_1.yml | ||
# playbook_2.yml | ||
targets: | | ||
roles/* | ||
playbooks | ||
# [optional] | ||
# Arguments to override a package and its version to be set explicitly. | ||
# Must follow the example syntax. | ||
override-deps: | | ||
ansible==2.9 | ||
ansible-lint==4.2.0 | ||
# [optional] | ||
# Arguments to be passed to the ansible-lint | ||
|
||
# Options: | ||
# -q quieter, although not silent output | ||
# -p parseable output in the format of pep8 | ||
# --parseable-severity parseable output including severity of rule | ||
# -r RULESDIR specify one or more rules directories using one or | ||
# more -r arguments. Any -r flags override the default | ||
# rules in ansiblelint/rules, unless -R is also used. | ||
# -R Use default rules in ansiblelint/rules in addition to | ||
# any extra | ||
# rules directories specified with -r. There is no need | ||
# to specify this if no -r flags are used | ||
# -t TAGS only check rules whose id/tags match these values | ||
# -x SKIP_LIST only check rules whose id/tags do not match these | ||
# values | ||
# --nocolor disable colored output | ||
# --exclude=EXCLUDE_PATHS | ||
# path to directories or files to skip. This option is | ||
# repeatable. | ||
# -c C Specify configuration file to use. Defaults to ".ansible-lint" | ||
args: "-c .github/workflow-config/.ansiblelint.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: galaxy-release | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
env: | ||
ANSIBLE_FORCE_COLOR: 1 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install ansible-base | ||
run: pip install ansible | ||
|
||
- name: Publish to galaxy | ||
run: ansible-playbook .github/workflow-config/release.yml | ||
-e namespace=${{ github.repository_owner }} | ||
-e github_tag=${{ github.ref }} | ||
-e api_key=${{ secrets.ANSIBLE_GALAXY_APIKEY }} | ||
-e collection_repo=https://github.com/${{ github.repository }} | ||
--skip-tags=install,cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Ignore PyCache and compiled python | ||
**/__pycache__/** | ||
*.pyc | ||
|
||
# ignore all logs | ||
*.log | ||
*.vscode | ||
|
||
# ignore all ansible retries | ||
*.retry | ||
|
||
# Ignore any included collections | ||
collections/* | ||
!collections/requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,47 @@ | ||
# Tower Utilities | ||
# Redhat Communties of Practice Tower Utilities Collection | ||
|
||
![Ansible Lint](https://github.com/redhat-cop/tower_utilities/workflows/Ansible%20Lint/badge.svg) | ||
![Galaxy Release](https://github.com/redhat-cop/tower_utilities/workflows/galaxy-release/badge.svg) | ||
<!-- Further CI badges go here as above --> | ||
|
||
This ansible collection includes a number of roles which can be useful for installing and managing AWX or Ansible Tower. | ||
|
||
## Included content | ||
|
||
Click the `Content` button to see the list of content included in this collection. | ||
|
||
## Installing this collection | ||
|
||
You can install the redhat_cop tower_utilities collection with the Ansible Galaxy CLI: | ||
|
||
ansible-galaxy collection install redhat_cop.tower_utilities | ||
|
||
You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: | ||
|
||
```yaml | ||
--- | ||
collections: | ||
- name: redhat_cop.tower_utilities | ||
# If you need a specific version of the collection, you can specify like this: | ||
# version: ... | ||
``` | ||
## Using this collection | ||
|
||
### See Also: | ||
|
||
* [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details. | ||
|
||
## Release and Upgrade Notes | ||
|
||
## Roadmap | ||
|
||
## Contributing to this collection | ||
|
||
We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [Tower Utilities collection repository](https://github.com/redhat-cop/tower_utilities). | ||
More information about contributing can be found in our [Contribution Guidelines.](https://github.com/redhat-cop/tower_utilities/blob/devel/.github/CONTRIBUTING.md) | ||
|
||
## Licensing | ||
|
||
GNU General Public License v3.0 or later. | ||
|
||
See [LICENCE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
## Contributor's Guidelines | ||
|
||
- All YAML files named with '.yml' extension | ||
- Use spaces around jinja variables. {{ var }} over {{var}} | ||
- Variables that are internal to the role should be lowercase | ||
- Keep roles self contained - Roles should avoid including tasks from other roles when possible | ||
- Plays should do nothing more than include a list of roles except where pre_tasks and post_tasks are required when possible | ||
- Separators - Use underscores (e.g. my_role my_playbook) not dashes (my-role) | ||
- Paths - When defining paths, do not include trailing slashes (e.g. my_path: /foo not my_path: /foo/). When concatenating paths, follow the same convention (e.g. {{ my_path }}/bar not {{ my_path }}bar) | ||
- Indentation - Use 2 spaces for each indent | ||
- `vars/` vs `defaults/` - if you have variables that don't need to change or be overridden by user, put those in `vars/` and those that a user would likely override, put those under `defaults/` directory. | ||
- All playbooks/roles should be focused on compatibility with Ansible Tower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
namespace: {{ collection_namespace }} | ||
name: {{ collection_name }} | ||
version: {{ collection_version }} | ||
description: A collection of utility roles for usage with Ansible Tower | ||
readme: README.md | ||
authors: | ||
- Jonathan Lozada De La Matta @jlozadad | ||
- Kedar Kulkarni @kedark3 | ||
- Tom Page @Tompage1994 | ||
- Sean Sullivan @sean-m-sullivan | ||
repository: {{ collection_repo }} | ||
issues: {{ collection_repo }}/issues | ||
build_ignore: | ||
- galaxy.yml.j2 | ||
- release.yml | ||
- .github | ||
license: | ||
- GPL-3.0-or-later | ||
tags: | ||
- tower | ||
- collection | ||
- utilities | ||
- utils | ||
- tower_utilities | ||
- tower_utils | ||
dependencies: {} |
Empty file.