Skip to content

Commit 0521779

Browse files
authored
Merge pull request #406 from sean-m-sullivan/option_update
update options on multiple roles
2 parents 7b81c7e + 7bd6c0d commit 0521779

File tree

37 files changed

+459
-737
lines changed

37 files changed

+459
-737
lines changed

.github/workflow-config/kube/awx-operator.yaml

Lines changed: 0 additions & 646 deletions
This file was deleted.

.github/workflow-config/kube/awx.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
apiVersion: awx.ansible.com/v1beta1
3+
kind: AWX
4+
metadata:
5+
name: awx
6+
spec:
7+
service_type: nodeport
8+
nodeport_port: 30080
9+
...

.github/workflow-config/kube/awx_def.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
5+
- github.com/ansible/awx-operator/config/default?ref=1.0.0
6+
- awx.yaml
7+
8+
# Set the image tags to match the git version from above
9+
images:
10+
- name: quay.io/ansible/awx-operator
11+
newTag: 1.0.0
12+
13+
# Specify a custom namespace in which to install AWX
14+
namespace: default
15+
...

.github/workflow-config/kube/namespace.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
# Find the latest tag here: https://github.com/ansible/awx-operator/releases
5+
- github.com/ansible/awx-operator/config/default?ref=1.0.0
6+
7+
# Set the image tags to match the git version from above
8+
images:
9+
- name: quay.io/ansible/awx-operator
10+
newTag: 1.0.0
11+
12+
# Specify a custom namespace in which to install AWX
13+
namespace: default
14+
...

.github/workflows/testing_minikube.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@ jobs:
88
name: Deploy Tower to Minikube and run tests
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Checkout awx operator
12-
uses: actions/checkout@v2
13-
with:
14-
repository: ansible/awx-operator
1511

1612
- name: Checkout
1713
uses: actions/checkout@v2
18-
with:
19-
path: controller_configuration
2014

2115
- name: "Install dependencies"
22-
run: pip install -r controller_configuration/.github/requirements.txt
16+
run: pip install -r .github/requirements.txt
2317

2418
- name: Setup Minikube
2519
uses: manusa/actions-setup-minikube@v2.4.2
@@ -35,17 +29,27 @@ jobs:
3529

3630
- name: Setup awx operator
3731
run: |
38-
minikube kubectl get deployments
3932
minikube kubectl create secret generic awx-admin-password -- --from-literal=password=password
4033
minikube addons enable ingress
4134
alias kubectl="minikube kubectl --"
42-
make deploy NAMESPACE=default
43-
kubectl apply -f controller_configuration/.github/workflow-config/kube/awx_def.yml
35+
36+
- name: kustomize awx operator
37+
working-directory: .github/workflow-config
38+
run: kustomize build . | kubectl apply -f -
4439

4540
- name: Wait / Sleep
4641
uses: jakejarvis/wait-action@v0.1.0
4742
with:
48-
time: '180s'
43+
time: '30s'
44+
45+
- name: kustomize awx
46+
working-directory: .github/workflow-config/kube
47+
run: kustomize build . | kubectl apply -f -
48+
49+
- name: Wait / Sleep
50+
uses: jakejarvis/wait-action@v0.1.0
51+
with:
52+
time: '30s'
4953

5054
- name: Check service URL
5155
uses: nick-invision/retry@v2
@@ -68,15 +72,9 @@ jobs:
6872
- name: Display Versions
6973
run: which python && pip --version && ansible --version
7074

71-
- name: Checkout
72-
uses: actions/checkout@v2
73-
7475
- name: "Install Galaxy dependencies"
7576
run: ansible-galaxy collection install -r .github/collections/requirements.yml
7677

77-
- name: Check service password
78-
run: echo "Service password is ${{ steps.service-password.outputs.SERVICEPASSWORD }}"
79-
8078
- name: "Perform playbook tests"
8179
run: ansible-playbook examples/configure_controller.yml -e controller_hostname=${{ steps.service-url.outputs.SERVICEURL }}
8280

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ Adding the ability to use direct output from the awx export command in the roles
160160
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).
161161
More information about contributing can be found in our [Contribution Guidelines.](https://github.com/redhat-cop/controller_configuration/blob/devel/.github/CONTRIBUTING.md)
162162

163+
## Code of Conduct
164+
165+
This collection follows the Ansible project's
166+
[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html).
167+
Please read and familiarize yourself with this document.
168+
163169
## Licensing
164170

165171
GNU General Public License v3.0 or later.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
minor_changes:
3+
- Update options on inventories, job templates, liscence, projects, schedules, and workflow_job_templates roles to match latest awx.awx release
4+
5+
major_changes:
6+
- Added instance role to add instances using the new awx.awx.instance module.
7+
...

examples/configs/instances.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
controller_instances:
3+
- hostname: my-instance.prod.example.com
4+
capacity_adjustment: 0.4
5+
...

examples/configs/inventories.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ controller_inventories:
1616
- name: RHVM-02
1717
organization: Satellite
1818
description: created by Ansible Playbook - for RHVM-02
19+
prevent_instance_group_fallback: true
1920
- name: Test Inventory - Smart
2021
organization: Default
2122
description: created by Ansible Playbook

examples/configs/schedule.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@ controller_schedules:
88
description: Another demonstration
99
unified_job_template: Demo Job Template
1010
rrule: "DTSTART:20200101T000000Z RRULE:FREQ=HOURLY;INTERVAL=3"
11+
execution_environment: My EE
12+
forks: 2
13+
instance_groups:
14+
- test_instance_group
15+
labels:
16+
- differential
17+
- differential2
18+
timeout: 165
1119
...

examples/configs/templates.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ controller_templates:
1616
verbosity: 2
1717
extra_vars:
1818
target_hosts: infra-ansible-tower-01.example.com
19+
ask_execution_environment_on_launch: true
20+
ask_forks_on_launch: true
21+
ask_instance_groups_on_launch: true
22+
ask_job_slice_count_on_launch: true
23+
ask_labels_on_launch: true
24+
ask_timeout_on_launch: true
25+
prevent_instance_group_fallback: true
1926
- name: Demo Job Template
2027
project: Test Project
2128
job_type: run
@@ -26,6 +33,14 @@ controller_templates:
2633
verbosity: 0
2734
inventory: localhost
2835
execution_environment: "My EE"
36+
ask_inventory_on_launch: true
37+
ask_execution_environment_on_launch: true
38+
ask_forks_on_launch: true
39+
ask_instance_groups_on_launch: true
40+
ask_job_slice_count_on_launch: true
41+
ask_labels_on_launch: true
42+
ask_timeout_on_launch: true
43+
prevent_instance_group_fallback: true
2944
survey_spec:
3045
name: ''
3146
description: ''

examples/configs/workflows.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ controller_workflows:
99
inventory:
1010
state: present
1111
limit:
12+
job_tags:
13+
- stuff
14+
- stuff2
15+
skip_tags:
16+
- stuff3
17+
ask_labels_on_launch: true
18+
ask_skip_tags_on_launch: true
1219
labels:
1320
- Prod
1421
scm_branch:
@@ -26,6 +33,12 @@ controller_workflows:
2633
- all_parents_must_converge: false
2734
identifier: node201
2835
unified_job_template: test-template-1
36+
instance_groups:
37+
- default
38+
labels:
39+
- differential
40+
- differential2
41+
timeout: 165
2942
notification_templates_started: []
3043
notification_templates_success: []
3144
notification_templates_error: []

examples/configure_controller.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@
4444
validate_certs: "{{ controller_validate_certs }}"
4545
register: result
4646
until: result.status == 200
47-
retries: 20
47+
retries: 10
4848
delay: 30
4949
ignore_errors: true
5050

51+
- name: "Show result of ping"
52+
ansible.builtin.debug:
53+
var: result
54+
5155
- name: Sleep for 60 seconds and allow awx to come up.
5256
ansible.builtin.wait_for:
5357
timeout: 60

roles/dispatch/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ controller_configuration_dispatcher_roles:
1515
- {role: inventory_source_update, var: controller_inventory_sources, tags: inventory_sources}
1616
- {role: execution_environments, var: controller_execution_environments, tags: execution_environments}
1717
- {role: applications, var: controller_applications, tags: applications}
18+
- {role: instances, var: controller_instances, tags: instances}
1819
- {role: instance_groups, var: controller_instance_groups, tags: instance_groups}
1920
- {role: project_update, var: controller_projects, tags: projects}
2021
- {role: hosts, var: controller_hosts, tags: hosts}

roles/instances/README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# controller_configuration.instances
2+
3+
## Description
4+
5+
An Ansible Role to create instances on Ansible Controller.
6+
7+
## Requirements
8+
9+
ansible-galaxy collection install -r tests/collections/requirements.yml to be installed
10+
Currently:
11+
awx.awx
12+
or
13+
ansible.controller
14+
15+
## Variables
16+
17+
### Authentication
18+
19+
|Variable Name|Default Value|Required|Description|Example|
20+
|:---|:---:|:---:|:---|:---|
21+
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
22+
|`controller_hostname`|""|yes|URL to the Ansible Controller Server.|127.0.0.1|
23+
|`controller_validate_certs`|`True`|no|Whether or not to validate the Ansible Controller Server's SSL certificate.||
24+
|`controller_username`|""|no|Admin User on the Ansible Controller Server. Either username / password or oauthtoken need to be specified.||
25+
|`controller_password`|""|no|Controller Admin User's password on the Ansible Controller Server. This should be stored in an Ansible Vault at vars/controller-secrets.yml or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.||
26+
|`controller_oauthtoken`|""|no|Controller Admin User's token on the Ansible Controller Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|||
27+
|`controller_instances`|`see below`|yes|Data structure describing your instances Described below.||
28+
29+
### Secure Logging Variables
30+
31+
The following Variables compliment each other.
32+
If Both variables are not set, secure logging defaults to false.
33+
The role defaults to False as normally the add instances task does not include sensitive information.
34+
controller_configuration_instances_secure_logging defaults to the value of controller_configuration_secure_logging if it is not explicitly called. This allows for secure logging to be toggled for the entire suite of controller configuration roles with a single variable, or for the user to selectively use it.
35+
36+
|Variable Name|Default Value|Required|Description|
37+
|:---:|:---:|:---:|:---:|
38+
|`controller_configuration_instances_secure_logging`|`False`|no|Whether or not to include the sensitive instance groups role tasks in the log. Set this value to `True` if you will be providing your sensitive values from elsewhere.|
39+
|`controller_configuration_secure_logging`|`False`|no|This variable enables secure logging as well, but is shared across multiple roles, see above.|
40+
41+
### Asynchronous Retry Variables
42+
43+
The following Variables set asynchronous retries for the role.
44+
If neither of the retries or delay or retries are set, they will default to their respective defaults.
45+
This allows for all items to be created, then checked that the task finishes successfully.
46+
This also speeds up the overall role.
47+
48+
|Variable Name|Default Value|Required|Description|
49+
|:---:|:---:|:---:|:---:|
50+
|`controller_configuration_async_retries`|30|no|This variable sets the number of retries to attempt for the role globally.|
51+
|`controller_configuration_instances_async_retries`|`{{ controller_configuration_async_retries }}`|no|This variable sets the number of retries to attempt for the role.|
52+
|`controller_configuration_async_delay`|1|no|This sets the delay between retries for the role globally.|
53+
|`controller_configuration_instances_async_delay`|`controller_configuration_async_delay`|no|This sets the delay between retries for the role.|
54+
55+
## Data Structure
56+
57+
### Instance Group Variables
58+
59+
|Variable Name|Default Value|Required|Type|Description|
60+
|:---:|:---:|:---:|:---:|:---:|
61+
|`hostname`|""|yes|str|Hostname of this instance.|
62+
|`capacity_adjustment`|""|float|no|Capacity adjustment between 0 and 1. |
63+
|`enabled`|False|no|bool|If true, the instance will be enabled and used.|
64+
|`managed_by_policy`|False|no|bool|If true, will be managed by instance group policy.|
65+
|`node_type`|""|no|str|Role that this node plays in the mesh. Most likely Execution. Current options are 'execution'.|
66+
|`node_state`|""|no|str|Indicates the current life cycle stage of this instance. Current options are 'installed' and 'deprovisioning'.|
67+
|`listener_port`|""|no|int|Port that Receptor will listen for incoming connections on.|
68+
69+
### Standard Project Data Structure
70+
71+
#### Yaml Example
72+
73+
```yaml
74+
---
75+
controller_instances:
76+
- hostname: my-instance.prod.example.com
77+
capacity_adjustment: 0.4
78+
listener_port: 31337
79+
```
80+
81+
## Playbook Examples
82+
83+
### Standard Role Usage
84+
85+
```yaml
86+
---
87+
- name: Playbook to configure ansible controller post installation
88+
hosts: localhost
89+
connection: local
90+
# Define following vars here, or in controller_configs/controller_auth.yml
91+
# controller_hostname: ansible-controller-web-svc-test-project.example.com
92+
# controller_username: admin
93+
# controller_password: changeme
94+
pre_tasks:
95+
- name: Include vars from controller_configs directory
96+
include_vars:
97+
dir: ./yaml
98+
ignore_files: [controller_config.yml.template]
99+
extensions: ["yml"]
100+
roles:
101+
- {role: redhat_cop.controller_configuration.instances, when: controller_instances is defined}
102+
```
103+
104+
## License
105+
106+
[MIT](LICENSE)
107+
108+
## Author
109+
110+
[Sean Sullivan](https://github.com/sean-m-sullivan)

roles/instances/defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
controller_instances: []
3+
controller_configuration_instances_secure_logging: "{{ controller_configuration_secure_logging | default('false') }}"
4+
controller_configuration_instances_async_retries: "{{ controller_configuration_async_retries | default(30) }}"
5+
controller_configuration_instances_async_delay: "{{ controller_configuration_async_delay | default(1) }}"
6+
...

0 commit comments

Comments
 (0)