zengxyz / rpms / anaconda

Forked from rpms/anaconda 3 months ago
Clone
Blob Blame History Raw
---

- set_fact:
    kickstart: "{{ kickstart_template | basename }}"

- set_fact:
    test_name_with_ks: "{{ test_name }}.{{ kickstart }}"

- debug:
    msg: "Running '{{ test_name }}' with kickstart '{{ kickstart }}'"

- name: Copy installation kickstart
  template:
    src: "templates/kickstarts/{{ kickstart }}"
    dest: "{{ kickstart_dest }}"
    mode: 0755

- name: Clean target directory
  file:
    path: "{{ install_dir }}"
    state: "{{ item }}"
    mode: 0755
  with_items:
    - absent
    - directory

- name: Clean installation logs
  file:
    path: "/tmp/{{ item }}"
    state: absent
  with_items: "{{ installation_logs }}"

- name: Run dirinstall
  shell: timeout -k 10s 3600s anaconda --dirinstall {{ install_dir }} --kickstart {{ kickstart_dest }} {{ method }} --noninteractive 2>&1
  register: result
  ignore_errors: True

- debug:
    msg: "{{ result }}"

- set_fact:
    result_str: "PASS"

- set_fact:
    result_str: "FAIL"
    global_result: "FAIL"
  when: result.rc != 0

- name: Update global test.log
  lineinfile:
    path: "{{ local_artifacts }}/test.log"
    line: "{{ result_str }} {{ test_name_with_ks }}"
    create: yes
    insertafter: EOF

- name: Create this test log
  copy:
    content: "{{ result.stdout }}"
    dest: "{{ local_artifacts }}/{{ result_str }}_{{ test_name_with_ks }}.log"

- name: Create installation logs dir in artifacts
  file:
    path: "{{ local_artifacts }}/{{ test_name_with_ks }}"
    state: directory

- name: Copy input kickstart to artifacts
  copy:
    remote_src: True
    src: "{{ kickstart_dest }}"
    dest: "{{ local_artifacts }}/{{ test_name_with_ks }}/{{ kickstart_dest | basename }}"

- name: Copy installation logs to artifacts
  copy:
    remote_src: True
    src: "/tmp/{{ item }}"
    dest: "{{ local_artifacts }}/{{ test_name_with_ks }}/{{ item }}"
  with_items: "{{ installation_logs }}"
  ignore_errors: True