++
+ %= include_branding 'docbox'
+
+-
++
+ %= include_branding 'sponsorbox'
+
+
diff --git a/handlers/main.yml b/handlers/main.yml
index 253a14f..8aa6b51 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -14,6 +14,13 @@
loop: "{{ range(1, (openqa_worker_count | int + 1)) | list }}"
ignore_errors: "{{ ansible_check_mode }}"
+- name: Restart httpd
+ ansible.builtin.service:
+ name: httpd
+ state: restarted
+ enabled: true
+ ignore_errors: "{{ ansible_check_mode }}"
+
- name: Restart openqa services
ansible.builtin.systemd:
name: "{{ item }}"
@@ -27,3 +34,4 @@
state: restarted
enabled: true
ignore_errors: "{{ ansible_check_mode }}"
+...
diff --git a/init-rocky-openqa-developer-host.yml b/init-rocky-openqa-developer-host.yml
index 811a5b9..d113ea4 100644
--- a/init-rocky-openqa-developer-host.yml
+++ b/init-rocky-openqa-developer-host.yml
@@ -20,6 +20,7 @@
become: true
vars_files:
- vars/openqa.yml
+ - vars/openqa_branding.yml
# This is to try to avoid the handler issue in pre/post tasks
handlers:
@@ -43,6 +44,9 @@
- name: Install and configure OpenQA
ansible.builtin.import_tasks: tasks/openqa.yml
+ - name: Apply Rocky Linux OpenQA Branding
+ ansible.builtin.import_tasks: tasks/openqa_branding.yml
+
post_tasks:
- name: Touching run file that ansible has ran here
ansible.builtin.file:
diff --git a/remove-rocky-openqa-developer-host.yml b/remove-rocky-openqa-developer-host.yml
new file mode 100644
index 0000000..18c1aad
--- /dev/null
+++ b/remove-rocky-openqa-developer-host.yml
@@ -0,0 +1,41 @@
+# Delete local OpenQA testing environment
+# This playbook is *NOT* intended for WAN-facing systems!
+# Created: @akatch
+---
+- name: Rocky OpenQA Runbook
+ hosts: localhost
+ connection: local
+ become: true
+ vars_files:
+ - vars/openqa.yml
+
+ # This is to try to avoid the handler issue in pre/post tasks
+ handlers:
+ - name: Import handlers
+ ansible.builtin.import_tasks: handlers/main.yml
+
+ pre_tasks:
+ - name: Check if ansible cannot be run here
+ ansible.builtin.stat:
+ path: /etc/no-ansible
+ register: no_ansible
+
+ - name: Verify if we can run ansible
+ ansible.builtin.assert:
+ that:
+ - "not no_ansible.stat.exists"
+ success_msg: "We are able to run on this node"
+ fail_msg: "/etc/no-ansible exists - skipping run on this node"
+
+ tasks:
+ - name: Remove OpenQA installation from this system
+ ansible.builtin.import_tasks: tasks/remove_openqa.yml
+
+ post_tasks:
+ - name: Touching run file that ansible has ran here
+ ansible.builtin.file:
+ path: /var/log/ansible.run
+ state: touch
+ mode: '0644'
+ owner: root
+ group: root
diff --git a/tasks/openqa.yml b/tasks/openqa.yml
index f449fc1..c3cbf72 100644
--- a/tasks/openqa.yml
+++ b/tasks/openqa.yml
@@ -11,15 +11,16 @@
remote_src: true
src: /etc/httpd/conf.d/{{ item }}.template
dest: /etc/httpd/conf.d/{{ item }}
- mode: '0644'
+ mode: "0644"
owner: root
group: root
loop:
- openqa.conf
- openqa-ssl.conf
- notify: restart_httpd
+ notify: Restart httpd
tags:
- configure
+ ignore_errors: "{{ ansible_check_mode }}"
- name: Template OpenQA configuration files
ansible.builtin.template:
@@ -33,9 +34,11 @@
- client.conf
tags:
- configure
+ notify: Restart openQA workers
- name: Get service facts
ansible.builtin.service_facts:
+ check_mode: false
- name: Check for non-empty postgres data directory
ansible.builtin.stat:
@@ -47,6 +50,7 @@
when: not ( ansible_facts.services["postgresql.service"]["state"] == "running" )
and not postgres_data_dir.stat.exists
changed_when: true
+ ignore_errors: "{{ ansible_check_mode }}"
- name: Enable and start postgresql service
ansible.builtin.systemd:
@@ -55,6 +59,7 @@
enabled: true
when: not ( ansible_facts.services["postgresql.service"]["state"] == "running" )
and not postgres_data_dir.stat.exists
+ ignore_errors: "{{ ansible_check_mode }}"
- name: Configure SELinux to allow httpd connection to network
ansible.posix.seboolean:
@@ -72,6 +77,7 @@
loop: "{{ openqa_services }}"
tags:
- configure
+ ignore_errors: "{{ ansible_check_mode }}"
- name: Create openqa-vnc firewalld service
ansible.builtin.template:
@@ -82,13 +88,11 @@
mode: "0644"
tags:
- configure
+ notify: Reload firewalld
-- name: Load openqa-vnc firewalld service
+- name: Systemctl daemon-reload
ansible.builtin.systemd:
- name: firewalld
- state: reloaded
- tags:
- - configure
+ daemon_reload: true
- name: Permit traffic for http and openqa-vnc services
ansible.posix.firewalld:
@@ -100,13 +104,7 @@
- openqa-vnc
tags:
- configure
-
-- name: Reload FirewallD
- ansible.builtin.systemd:
- name: firewalld
- state: reloaded
- tags:
- - configure
+ notify: Reload firewalld
- name: Check for existing repository
ansible.builtin.stat:
@@ -131,63 +129,18 @@
recurse: true
owner: "{{ openqa_user }}"
group: "{{ openqa_group }}"
- mode: "u+rwX,g+rwX,o+rX,o-w"
+ mode: "0775"
tags:
- configure
-# fifloader.py will fail if the Demo user is not logged in
-- name: Authenticate to web UI the first time
- ansible.builtin.uri:
- url: "http://{{ openqa_host }}/login"
-
-- name: Run fifloader.py
- ansible.builtin.command: ./fifloader.py -l -c templates.fif.json templates-updates.fif.json
- changed_when: "1 != 1"
- args:
- chdir: "{{ openqa_homedir }}/share/tests/rocky"
-
-- name: Create ISO directory
+- name: Create asset directories
ansible.builtin.file:
- path: "{{ openqa_homedir }}/share/factory/iso/fixed"
+ path: "{{ openqa_homedir }}/share/factory/{{ item }}/fixed"
state: directory
owner: "{{ openqa_user }}"
group: "{{ openqa_group }}"
mode: "0775"
- tags:
- - download_isos
-
-- name: Download ISOs
- ansible.builtin.get_url:
- dest: "{{ openqa_homedir }}/share/factory/iso/fixed/{{ item.name }}"
- url: "{{ rocky_iso_download_url }}/{{ item.name }}"
- checksum: "{{ item.checksum }}"
- owner: "{{ openqa_user }}"
- group: "{{ openqa_group }}"
- tmp_dest: "/var/tmp"
- mode: "0644"
- loop: "{{ openqa_isos }}"
- tags:
- - download_isos
-
-- name: Start OpenQA workers
- ansible.builtin.systemd:
- name: "openqa-worker@{{ item }}"
- state: started
- enabled: true
- # range 'end' parameter is exclusive, so add 1
- loop: "{{ range(1, (openqa_worker_count | int + 1)) | list }}"
- tags:
- - start_workers
- - configure
-
-- name: POST a job
- ansible.builtin.command: |
- openqa-cli api -X POST isos \
- ISO=Rocky-{{ rocky_version }}-{{ rocky_arch }}-minimal.iso \
- ARCH={{ rocky_arch }} \
- DISTRI=rocky \
- FLAVOR=minimal-iso \
- VERSION={{ rocky_version }} \
- BUILD="{{ '%Y%m%d.%H%M%S' | strftime }}.0"
- changed_when: "1 != 1"
+ loop:
+ - iso
+ - hdd
...
diff --git a/tasks/openqa_branding.yml b/tasks/openqa_branding.yml
new file mode 100644
index 0000000..29f6e6e
--- /dev/null
+++ b/tasks/openqa_branding.yml
@@ -0,0 +1,35 @@
+---
+- name: Copy assets hierarchy
+ ansible.posix.synchronize:
+ src: "{{ assets_src_dir }}/"
+ dest: "{{ assets_dest_dir }}"
+ recursive: true
+ tags:
+ - branding
+
+- name: Copy templates hierarchy
+ ansible.posix.synchronize:
+ src: "{{ templates_src_dir }}/"
+ dest: "{{ templates_dest_dir }}"
+ recursive: true
+ tags:
+ - branding
+
+- name: Apply patches to specific assets, template and config files
+ ansible.posix.patch:
+ src: "{{ item.patch }}"
+ dest: "{{ item.path }}"
+ # optional parameters, see documentation for details
+ # strip: 1
+ backup: true
+ with_items: "{{ branding_patches }}"
+ tags:
+ - branding
+
+- name: Restart openqa-webui service
+ ansible.builtin.systemd:
+ name: openqa-webui
+ state: restarted
+ tags:
+ - branding
+...
diff --git a/templates/etc/openqa/openqa.ini.j2 b/templates/etc/openqa/openqa.ini.j2
index 932c182..7cadafc 100644
--- a/templates/etc/openqa/openqa.ini.j2
+++ b/templates/etc/openqa/openqa.ini.j2
@@ -1,5 +1,5 @@
[global]
-branding=plain
+branding = {{ openqa_branding }}
download_domains = rockylinux.org fedoraproject.org opensuse.org
[auth]
diff --git a/vars/openqa_branding.yml b/vars/openqa_branding.yml
new file mode 100644
index 0000000..ad577d8
--- /dev/null
+++ b/vars/openqa_branding.yml
@@ -0,0 +1,14 @@
+---
+# Branding type used, default is plain but we are rocky
+openqa_branding: "rocky"
+
+assets_src_dir: "{{ playbook_dir }}/files/usr/share/openqa/assets"
+assets_dest_dir: "/usr/share/openqa/assets"
+
+templates_src_dir: "{{ playbook_dir }}/files/usr/share/openqa/templates"
+templates_dest_dir: "/usr/share/openqa/templates"
+
+branding_patches:
+ - {path: /usr/share/openqa/assets/assetpack.def, patch: /usr/share/openqa/assets/assetpack.def.patch}
+ - {path: /usr/share/openqa/templates/webapi/main/index.html.ep, patch: /usr/share/openqa/templates/webapi/main/index.html.ep.patch}
+...