Skip to content

Commit

Permalink
Retry ISO generaton
Browse files Browse the repository at this point in the history
  • Loading branch information
betoredhat committed Dec 12, 2024
1 parent 0feea55 commit 87589aa
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions roles/generate_agent_iso/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ansible.builtin.file:
path: "{{ generated_dir }}/containers/"
state: directory
mode: 0755
mode: '0755'
recurse: true

- name: Copy pull_secrets file.
Expand All @@ -12,22 +12,24 @@
mode: "0644"
remote_src: true

- name: Generate an ISO and print message if there is a failure
block:
- name: Generate ISO
ansible.builtin.shell:
cmd: "{{ agent_based_installer_path }} --log-level=debug agent create image"
chdir: "{{ manifests_dir }}"
environment:
XDG_RUNTIME_DIR: "{{ generated_dir }}"
register: gen_iso
rescue:
- name: Print message about nmstate package missing
fail:
msg: "nmstate package missing in the bastion. See Dependencies section in README.md for more details."
when:
- gen_iso.stderr is defined
- gen_iso.stderr | regex_search("nmstatectl(.*) executable file not found")
- name: Fail if required nmstatectl is not installed
ansible.builtin.command: type nmstatectl
register: _gai_nmstatectl_check
failed_when: _gai_nmstatectl_check.rc != 0
changed_when: _gai_nmstatectl_check.rc != 0

- name: Generate agent ISO
ansible.builtin.command:
cmd: "{{ agent_based_installer_path }} --log-level=debug agent create image"
chdir: "{{ manifests_dir }}"
environment:
XDG_RUNTIME_DIR: "{{ generated_dir }}"
changed_when: _gai_gen_iso.rc != 0
register: _gai_gen_iso
retries: 3
delay: 15
until:
- _gai_gen_iso.rc == 0

- name: Put discovery iso in http store
delegate_to: http_store
Expand All @@ -43,4 +45,4 @@
ansible.builtin.copy:
src: "{{ manifests_dir }}/agent.{{ arch }}.iso"
dest: "{{ download_dest_path }}/{{ download_agent_dest_file }}"
mode: 0644
mode: '0644'

0 comments on commit 87589aa

Please sign in to comment.