Skip to content

Commit

Permalink
Dont do tasks with worker_ip_addresses when its undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Mar 21, 2024
1 parent 151297c commit 5381683
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions research-cloud-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@
name: jumphost
hostname: localhost

- name: Create group workers with workers' IPs
add_host:
name: "{{ item }}"
groups: workers
ansible_user: ubuntu
ansible_connection: ssh
ansible_ssh_private_key_file: ~/.ssh/id_rsa
ansible_become: yes
loop: '{{ worker_ip_addresses }}'

- name: Scan for worker keys.
shell:
cmd: ssh-keyscan {{ item }}
register: ssh_scan
loop: '{{ worker_ip_addresses }}'
- name: SSH to workers configuration
when: worker_ip_addresses
block:
- name: Create group workers with workers' IPs

Check failure on line 29 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (add_host).

Check failure on line 29 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (add_host).
add_host:
name: "{{ item }}"
groups: workers
ansible_user: ubuntu
ansible_connection: ssh
ansible_ssh_private_key_file: ~/.ssh/id_rsa
ansible_become: yes

Check failure on line 36 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

yaml[truthy]

Truthy value should be one of \[false, true]

Check failure on line 36 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

yaml[truthy]

Truthy value should be one of \[false, true]
loop: '{{ worker_ip_addresses }}'
- name: Scan for worker keys.

Check failure on line 38 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

command-instead-of-shell

Use shell only when shell functionality is required.

Check failure on line 38 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (shell).

Check failure on line 38 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

no-changed-when

Commands should not change things if nothing needs doing.

Check failure on line 38 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

command-instead-of-shell

Use shell only when shell functionality is required.

Check failure on line 38 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (shell).

Check failure on line 38 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

no-changed-when

Commands should not change things if nothing needs doing.
shell:
cmd: ssh-keyscan {{ item }}
register: ssh_scan
loop: '{{ worker_ip_addresses }}'

- name: Write the worker keys to known hosts

Check failure on line 44 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (known_hosts).

Check warning on line 44 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

jinja[spacing]

Jinja2 spacing could be improved: {{ ssh_scan.results | subelements('stdout_lines') | default([])}} -> {{ ssh_scan.results | subelements('stdout_lines') | default([]) }}

Check failure on line 44 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (known_hosts).

Check warning on line 44 in research-cloud-plugin.yml

View workflow job for this annotation

GitHub Actions / build

jinja[spacing]

Jinja2 spacing could be improved: {{ ssh_scan.results | subelements('stdout_lines') | default([])}} -> {{ ssh_scan.results | subelements('stdout_lines') | default([]) }}
known_hosts:
Expand Down

0 comments on commit 5381683

Please sign in to comment.