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

fixing sorting logic for populating automation controller #2071

Merged
merged 10 commits into from
Jan 12, 2024

Conversation

IPvSean
Copy link
Contributor

@IPvSean IPvSean commented Jan 12, 2024

i know what the problem is! in my code
if i got a bunch of workbenches

student_hosts:
  - "dec18-workshop-provision-satellite-student1-node1"
  - "dec18-workshop-provision-satellite-student1-node2"
  - "dec18-workshop-provision-satellite-student1-node3"
  - "dec18-workshop-provision-satellite-student2-node1"
  - "dec18-workshop-provision-satellite-student2-node2"
  - "dec18-workshop-provision-satellite-student2-node3"
  - "dec18-workshop-provision-satellite-student11-node3"
  - "dec18-workshop-provision-satellite-student11-node3"
  - "dec18-workshop-provision-satellite-student11-node3"

student_number: 1

i would filter through the giant list of inventory
to sort them “per workbench”

- name: Filter hosts containing student number
  ansible.builtin.set_fact:
    student_hosts: "{{ groups['rhel'] | select('search', student_number ~ '-') | list }}"
    control_nodes: "{{ groups['control_nodes'] | select('search', student_number ~ '-') | list }}"
    satellite_nodes: "{{ groups['satellite'] | select('search', student_number ~ '-') | list }}"

but this will return student1 AND student11 AND student21 and so on and so forth

if i was just looking for student1
the fix should be

new_hosts: "{{ student_hosts | select('search', 'student' ~ student_number ~ '-') | list }}"

this fixes this error

```
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: nginx.service: Succeeded.
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: Stopped The nginx HTTP and reverse proxy server.
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal nginx[22236]: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal nginx[22236]: nginx: configuration file /etc/nginx/nginx.conf test failed
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: nginx.service: Control process exited, code=exited status=1
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: nginx.service: Failed with result 'exit-code'.
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
```
making it so SSL can fail and it will continue on
this fixes this error

```
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: nginx.service: Succeeded.
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: Stopped The nginx HTTP and reverse proxy server.
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server...
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal nginx[22236]: nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal nginx[22236]: nginx: configuration file /etc/nginx/nginx.conf test failed
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: nginx.service: Control process exited, code=exited status=1
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: nginx.service: Failed with result 'exit-code'.
Dec 13 20:47:38 ip-172-16-157-92.us-east-2.compute.internal systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
```
making it so SSL can fail and it will continue on
fixing logic for sorting
@IPvSean IPvSean merged commit 1a5c10f into ansible:devel Jan 12, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant