Skip to content

Commit

Permalink
Merge pull request #196 from sean-m-sullivan/controller_change
Browse files Browse the repository at this point in the history
Controller changeover
  • Loading branch information
sean-m-sullivan authored Jul 5, 2021
2 parents ba85559 + 6e8359c commit 09ae247
Show file tree
Hide file tree
Showing 314 changed files with 3,155 additions and 3,892 deletions.
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Ensure you install the awx collections, so that roles and playbooks can be prope

Python's pre-commit tool can be installed, and hooks installed, to cleanup whitespace, newlines, and run yamllint and ansible-lint against your local changes before committing. This will help you avoid failures in the github workflows.

1. Create a local virtual environment for tower_configurations (suggested, its your system!)
1. Create a local virtual environment for controller_configurations (suggested, its your system!)
2. Use pip to install pre-commit in your environment of choice: `pip install pre-commit`
3. Install pre-commit hooks with `pre-commit install --install-hooks -c .github/workflow-config/.pre-commit-config.yml`
4. With hooks installed, they will be run automatically when you call `git commit`, blocking commit if any hooks fail.
Expand All @@ -28,12 +28,12 @@ If you feel like getting your hands dirty, feel free to make the change yourself
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 test for it in our [testing playbook.](https://github.com/redhat-cop/tower_configuration/blob/devel/playbooks/example_with_yaml/configure_tower.yml) by adding a new role entry and adding the appropriate yaml file with test data in the tower_configs directory.
4. If you are creating a new role, please add a test for it in our [testing playbook.](https://github.com/redhat-cop/controller_configuration/blob/devel/playbooks/example_with_yaml/configure_controller.yml) by adding a new role entry and adding the appropriate yaml file with test data in the controller_configs directory.
5. Add a changelog fragment in `changelogs/fragments` as per https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs
6. Push your code change up to your forked repo.
7. Open a Pull Request to merge your changes to this repo. The comment box will be filled in automatically via a template.
8. 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.
9. 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.
9. All Pull requests are subject to Testing against being used in controller. 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.

Expand Down
19 changes: 10 additions & 9 deletions .github/workflow-config/kube/awx_def.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ metadata:
name: awx
spec:
deployment_type: awx
tower_replicas: 1
tower_admin_user: admin
tower_admin_password_secret: awx-admin-password
tower_broadcast_websocket_secret: password
tower_ingress_type: Ingress
tower_create_preload_data: true
replicas: 1
admin_user: admin
admin_password_secret: awx-admin-password
service_type: nodeport
# broadcastWebsocketSecret: password
ingress_type: Ingress
create_preload_data: true
development_mode: true
# tower_image: ansible/awx:19.0.0 # replace this with desired image
# image: ansible/awx:19.0.0 # replace this with desired image
# these requirements are best guess, may change in the future.
tower_web_resource_requirements:
web_resource_requirements:
requests:
cpu: 250m
limits:
cpu: 300m
tower_task_resource_requirements:
task_resource_requirements:
requests:
cpu: 250m
limits:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflow-config/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
connection: local
vars:
collection_namespace: "{{ namespace | lower | regex_replace('-','_') }}"
collection_name: tower_configuration
collection_name: controller_configuration
collection_version: "{{ github_tag.split('/')[-1] | regex_search('(\\d.\\d.\\d.*)') }}"
collection_repo: undef
api_key: undef
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/testing_minikube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
run: pip install -r .github/requirements.txt

- name: Setup Minikube
uses: manusa/actions-setup-minikube@v2.3.1
uses: manusa/actions-setup-minikube@v2.4.2
with:
minikube version: 'v1.18.1'
kubernetes version: 'v1.20.2'
minikube version: 'v1.21.0'
kubernetes version: 'v1.20.7'
start args: '--addons=ingress'

- name: Start AWX operator
run: minikube kubectl -- apply -f https://raw.githubusercontent.com/ansible/awx-operator/0.9.0/deploy/awx-operator.yaml
run: minikube kubectl -- apply -f https://raw.githubusercontent.com/ansible/awx-operator/0.12.0/deploy/awx-operator.yaml

- name: Wait / Sleep
uses: jakejarvis/wait-action@v0.1.0
Expand Down Expand Up @@ -76,8 +76,8 @@ jobs:
run: echo "Service password is ${{ steps.service-password.outputs.SERVICEPASSWORD }}"

- name: "Perform playbook tests"
run: ansible-playbook playbooks/configure_tower.yml -e tower_hostname=${{ steps.service-url.outputs.SERVICEURL }}
run: ansible-playbook playbooks/configure_controller.yml -e controller_hostname=${{ steps.service-url.outputs.SERVICEURL }}

- name: "Perform export model playbook tests"
run: ansible-playbook playbooks/configure_tower_export_model.yml -e tower_hostname=${{ steps.service-url.outputs.SERVICEURL }}
run: ansible-playbook playbooks/configure_controller_export_model.yml -e controller_hostname=${{ steps.service-url.outputs.SERVICEURL }}
...
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
============================================
redhat_cop.tower_configuration Release Notes
redhat_cop.controller_configuration Release Notes
============================================

.. contents:: Topics
Expand Down
64 changes: 32 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Red Hat Communties of Practice Tower Configuration Collection
# Red Hat Communties of Practice Controller Configuration Collection

![Ansible Lint](https://github.com/redhat-cop/tower_configuration/workflows/Ansible%20Lint/badge.svg)
![Galaxy Release](https://github.com/redhat-cop/tower_configuration/workflows/galaxy-release/badge.svg)
![Ansible Lint](https://github.com/redhat-cop/controller_configuration/workflows/Ansible%20Lint/badge.svg)
![Galaxy Release](https://github.com/redhat-cop/controller_configuration/workflows/galaxy-release/badge.svg)
<!-- Further CI badges go here as above -->

This Ansible collection allows for easy interaction with an AWX or Ansible Tower server via Ansible roles using the AWX/Tower collection modules.
This Ansible collection allows for easy interaction with an AWX or Ansible Controller server via Ansible roles using the AWX/Controller collection modules.

# REQUIREMENTS
The AWX.AWX OR ANSIBLE.TOWER collections MUST be installed in order for this collection to work. It is recomended they be invoked in the playbook in the following way.

```yaml
---
- name: Playbook to configure ansible tower post installation
- name: Playbook to configure ansible controller post installation
hosts: localhost
connection: local
vars:
tower_validate_certs: false
controller_validate_certs: false
collections:
- ansible.tower
- awx.awx
```
## Included content
Expand All @@ -26,54 +26,54 @@ Click the `Content` button to see the list of content included in this collectio

## Installing this collection

You can install the redhat_cop tower_configuration collection with the Ansible Galaxy CLI:
You can install the redhat_cop controller_configuration collection with the Ansible Galaxy CLI:

ansible-galaxy collection install redhat_cop.tower_configuration
ansible-galaxy collection install redhat_cop.controller_configuration

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_configuration
- name: redhat_cop.controller_configuration
# If you need a specific version of the collection, you can specify like this:
# version: ...
```

## Using this collection
The awx.awx or ansible.tower collection must be invoked in the playbook in order for ansible to pick up the correct modules to use.
The awx.awx or ansible.controller collection must be invoked in the playbook in order for ansible to pick up the correct modules to use.

Otherwise it will look for the modules only in your base installation. If there are errors complaining about "couldn't resolve module/action" this is the most likely cause.

```yaml
- name: Playbook to configure ansible tower post installation
- name: Playbook to configure ansible controller post installation
hosts: localhost
connection: local
vars:
tower_validate_certs: false
controller_validate_certs: false
collections:
- awx.awx
```

Define following vars here, or in `tower_configs/tower_auth.yml`
`tower_hostname: ansible-tower-web-svc-test-project.example.com`
Define following vars here, or in `controller_configs/controller_auth.yml`
`controller_hostname: ansible-controller-web-svc-test-project.example.com`

You can also specify authentication by a combination of either:

- `tower_hostname`, `tower_username`, `tower_password`
- `tower_hostname`, `tower_oauthtoken`
- `controller_hostname`, `controller_username`, `controller_password`
- `controller_hostname`, `controller_oauthtoken`

The OAuth2 token is the preferred method. You can obtain the token through the prefered `tower_token` module, or through the
The OAuth2 token is the preferred method. You can obtain the token through the prefered `controller_token` module, or through the
AWX CLI [login](https://docs.ansible.com/ansible-tower/latest/html/towercli/reference.html#awx-login)
command.

These can be specified via (from highest to lowest precedence):

- direct role variables as mentioned above
- environment variables (most useful when running against localhost)
- a config file path specified by the `tower_config_file` parameter
- a config file at `~/.tower_cli.cfg`
- a config file at `/etc/tower/tower_cli.cfg`
- a config file path specified by the `controller_config_file` parameter
- a config file at `~/.controller_cli.cfg`
- a config file at `/etc/controller/controller_cli.cfg`

Config file syntax looks like this:

Expand All @@ -84,22 +84,22 @@ verify_ssl = true
oauth_token = LEdCpKVKc4znzffcpQL5vLG8oyeku6
```

Tower token module would be invoked with this code:
Controller token module would be invoked with this code:
```yaml
- name: Create a new token using tower username/password
awx.awx.tower_token:
description: 'Creating token to test tower jobs'
- name: Create a new token using controller username/password
awx.awx.token:
description: 'Creating token to test controller jobs'
scope: "write"
state: present
tower_host: "{{ tower_hostname }}"
tower_username: "{{ tower_username }}"
tower_password: "{{ tower_password }}"
controller_host: "{{ controller_hostname }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
```

### Tower Export
### Controller Export
The awx command line can export json that is compatable with this collection.
More details can be found [here](playbooks/tower_configs_export_model/README.md)
More details can be found [here](playbooks/controller_configs_export_model/README.md)

### See Also:

Expand All @@ -113,8 +113,8 @@ Adding the ability to use direct output from the awx export command in the roles

## 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 Configuration collection repository](https://github.com/redhat-cop/tower_configuration).
More information about contributing can be found in our [Contribution Guidelines.](https://github.com/redhat-cop/tower_configuration/blob/devel/.github/CONTRIBUTING.md)
We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [Controller Configuration collection repository](https://github.com/redhat-cop/controller_configuration).
More information about contributing can be found in our [Contribution Guidelines.](https://github.com/redhat-cop/controller_configuration/blob/devel/.github/CONTRIBUTING.md)

## Licensing

Expand Down
2 changes: 1 addition & 1 deletion changelogs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sections:
- Bugfixes
- - known_issues
- Known Issues
title: redhat_cop.tower_configuration
title: redhat_cop.controller_configuration
trivial_section_name: trivial
use_fqcn: true
...
10 changes: 10 additions & 0 deletions changelogs/fragments/controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
breaking_changes:
- All references to tower have been changed to Controller.
- Changed all module names to be in line with changes to awx.awx as of 19.2.1.
- Removed depreciated module options for notification Templates.
- Changed variable names for all objects from tower_* to controller_*.
minor_changes:
- All role tests have been converted to use one format.
- Additional module options have been added such as instance_groups and copy_from where applicable.
...
7 changes: 4 additions & 3 deletions galaxy.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace: {{ collection_namespace }}
name: {{ collection_name }}
version: {{ collection_version }}
description: A collection of roles to manage Ansible Tower
description: A collection of roles to manage Ansible Controller
readme: README.md
authors:
- Andrew Huffman
Expand All @@ -21,7 +21,8 @@ build_ignore:
license:
- GPL-3.0-or-later
tags:
- tower
- controller
- collection
- tower_configuration
- controller_configuration
- automation_platform
...
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tower_ad_hoc_command_defaults:
controller_ad_hoc_command_defaults:
fail_if_not_running: false
interval: 1
timeout: 10
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tower_ad_hoc_commands:
controller_ad_hoc_commands:
- job_type: run
inventory: localhost
credential: Demo Credential
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
tower_applications:
- name: tower_application-app1
controller_applications:
- name: controller_application-app1
organization: Satellite
authorization_grant_type: password
client_type: public
- name: tower_application-app2
- name: controller_application-app2
organization: Default
authorization_grant_type: authorization-code
client_type: confidential
description: Another application
redirect_uris:
- http://tower.com/api/v2/
- http://tower.com/api/v2/teams
- name: tower_application-app3
- name: controller_application-app3
organization: Default
authorization_grant_type: password
client_type: confidential
Expand Down
7 changes: 7 additions & 0 deletions playbooks/configs/controller_auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# User may add tower auth creds to this file and encrypt it using `ansible-vault`
---
# controller_hostname: ansible-tower-web-svc-test-project.example.com
controller_username: admin
controller_password: password
controller_validate_certs: false
...
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Commented out content is serving as example for you to add new content.
tower_credential_input_sources:
controller_credential_input_sources:
- source_credential: cyberark
target_credential: gitlab
input_field_name: password
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tower_credential_types:
controller_credential_types:
- name: REST API Credential
description: REST API Credential
kind: cloud
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Commented out content is serving as example for you to add new content.
tower_credentials:
controller_credentials:
- credential_type: Red Hat Virtualization
name: admin@internal-RHVM-01
description: infra-rhvm-01 creds for inventory sources.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tower_execution_environments:
controller_execution_environments:
- name: "My EE"
image: quay.io/ansible/awx-ee
pull: always
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tower_groups:
controller_groups:
- name: group1
inventory: satlab-admin-inventory
variables:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tower_hosts:
controller_hosts:
- name: localhost
inventory: localhost
variables:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
tower_instance_groups:
controller_instance_groups:
- name: test_instance_group
...
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Commented out content is serving as example for you to add new content.
tower_inventories:
controller_inventories:
- name: localhost
description: inventory for localhost
organization: Satellite
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
tower_inventory_sources:
controller_inventory_sources:
- name: RHVM-01
source: scm
source_project: Test Inventory source project
Expand Down
Loading

0 comments on commit 09ae247

Please sign in to comment.