2021-08-31 00:18:39 +00:00
|
|
|
---
|
|
|
|
- name: Install OpenQA packages
|
|
|
|
yum:
|
|
|
|
name: "{{ openqa_packages }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Copy httpd configuration files
|
|
|
|
copy:
|
|
|
|
remote_src: true
|
|
|
|
src: /etc/httpd/conf.d/{{ item }}.template
|
|
|
|
dest: /etc/httpd/conf.d/{{ item }}
|
2021-08-31 00:25:18 +00:00
|
|
|
mode: '0644'
|
|
|
|
owner: root
|
|
|
|
group: root
|
2021-08-31 00:18:39 +00:00
|
|
|
loop:
|
|
|
|
- openqa.conf
|
|
|
|
- openqa-ssl.conf
|
|
|
|
notify: restart_httpd
|
|
|
|
|
|
|
|
- name: Template OpenQA configuration files
|
|
|
|
template:
|
|
|
|
src: etc/openqa/{{ item }}.j2
|
|
|
|
dest: /etc/openqa/{{ item }}
|
|
|
|
owner: "{{ openqa_user }}"
|
|
|
|
group: "{{ openqa_group }}"
|
|
|
|
mode: "0444"
|
|
|
|
loop:
|
|
|
|
- openqa.ini
|
|
|
|
- client.conf
|
|
|
|
|
|
|
|
- name: Get service facts
|
|
|
|
service_facts:
|
|
|
|
|
|
|
|
- name: Check for non-empty postgres data directory
|
|
|
|
stat:
|
2021-09-02 13:45:26 +00:00
|
|
|
path: /var/lib/pgsql/data/base
|
2021-08-31 00:18:39 +00:00
|
|
|
register: postgres_data_dir
|
|
|
|
|
|
|
|
- name: If postgresql is not already running, initialize database
|
|
|
|
command: postgresql-setup --initdb
|
|
|
|
when: not ( ansible_facts.services["postgresql.service"]["state"] == "running" )
|
|
|
|
and not postgres_data_dir.stat.exists
|
|
|
|
|
|
|
|
- name: Enable and start postgresql service
|
|
|
|
systemd:
|
|
|
|
name: postgresql
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
when: not ( ansible_facts.services["postgresql.service"]["state"] == "running" )
|
|
|
|
and not postgres_data_dir.stat.exists
|
|
|
|
|
|
|
|
- name: Configure SELinux to allow httpd connection to network
|
|
|
|
seboolean:
|
|
|
|
name: httpd_can_network_connect
|
|
|
|
state: true
|
|
|
|
persistent: true
|
|
|
|
|
|
|
|
- name: Enable and start OpenQA services
|
|
|
|
systemd:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
loop: "{{ openqa_services }}"
|
|
|
|
|
|
|
|
- name: Permit traffic for {{ item }} service
|
|
|
|
ansible.posix.firewalld:
|
|
|
|
service: "{{ item }}"
|
|
|
|
permanent: true
|
|
|
|
state: enabled
|
|
|
|
loop:
|
2021-09-02 13:45:26 +00:00
|
|
|
- http
|
2021-08-31 00:18:39 +00:00
|
|
|
|
|
|
|
- name: Permit VNC traffic for local workers
|
|
|
|
ansible.posix.firewalld:
|
|
|
|
port: "{{ openqa_min_vnc_port }}-{{ openqa_max_vnc_port }}/tcp"
|
|
|
|
permanent: true
|
|
|
|
state: enabled
|
|
|
|
|
|
|
|
- name: Reload FirewallD
|
|
|
|
systemd:
|
|
|
|
name: firewalld
|
|
|
|
state: reloaded
|
|
|
|
|
|
|
|
- name: Check for existing repository
|
|
|
|
stat:
|
|
|
|
path: "{{ openqa_homedir }}/share/tests/rocky"
|
|
|
|
register: rocky_testing_repo
|
|
|
|
|
|
|
|
- name: Clone repository if it does not already exist
|
|
|
|
git:
|
|
|
|
accept_hostkey: true
|
|
|
|
dest: "{{ openqa_homedir }}/share/tests/rocky"
|
|
|
|
repo: "{{ openqa_rocky_testing_repo }}"
|
|
|
|
version: develop
|
|
|
|
when: not rocky_testing_repo.stat.exists
|
|
|
|
|
|
|
|
- name: Set permissions on repo dir
|
|
|
|
file:
|
|
|
|
path: "{{ openqa_homedir }}/share/tests/rocky"
|
|
|
|
recurse: true
|
|
|
|
owner: "{{ openqa_user }}"
|
|
|
|
group: "{{ openqa_group }}"
|
|
|
|
mode: "0775"
|
|
|
|
|
2021-09-02 13:45:26 +00:00
|
|
|
# fifloader.py will fail if the Demo user is not logged in
|
|
|
|
- name: Authenticate to web UI the first time
|
|
|
|
uri:
|
|
|
|
url: "http://{{ openqa_host }}/login"
|
|
|
|
|
2021-08-31 00:18:39 +00:00
|
|
|
- name: Run fifloader.py
|
|
|
|
command: ./fifloader.py -l -c templates.fif.json templates-updates.fif.json
|
2021-08-31 00:25:18 +00:00
|
|
|
changed_when: "1 != 1"
|
2021-08-31 00:18:39 +00:00
|
|
|
args:
|
|
|
|
chdir: "{{ openqa_homedir }}/share/tests/rocky"
|
|
|
|
|
|
|
|
- name: Create ISO directory
|
|
|
|
file:
|
|
|
|
path: "{{ openqa_homedir }}/share/factory/iso/fixed"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ openqa_user }}"
|
|
|
|
group: "{{ openqa_group }}"
|
|
|
|
mode: "0775"
|
|
|
|
|
|
|
|
- name: Download ISOs
|
|
|
|
get_url:
|
|
|
|
dest: "{{ openqa_homedir }}/share/factory/iso/fixed/"
|
|
|
|
url: "{{ rocky_iso_download_url }}/{{ item }}"
|
|
|
|
owner: "{{ openqa_user }}"
|
|
|
|
group: "{{ openqa_group }}"
|
|
|
|
mode: "0775"
|
|
|
|
loop:
|
|
|
|
- CHECKSUM
|
|
|
|
- Rocky-{{ rocky_version }}-{{ rocky_arch }}-boot.iso
|
|
|
|
- Rocky-{{ rocky_version }}-{{ rocky_arch }}-dvd1.iso
|
|
|
|
- Rocky-{{ rocky_version }}-{{ rocky_arch }}-minimal.iso
|
|
|
|
|
|
|
|
- name: Verify ISO checksums
|
|
|
|
command: shasum -a 256 --ignore-missing -c CHECKSUM
|
2021-08-31 00:25:18 +00:00
|
|
|
changed_when: "1 != 1"
|
2021-08-31 00:18:39 +00:00
|
|
|
args:
|
|
|
|
chdir: "{{ openqa_homedir }}/share/factory/iso/fixed"
|
|
|
|
|
2021-09-02 14:53:52 +00:00
|
|
|
- name: Start {{ openqa_worker_count }} OpenQA workers
|
2021-08-31 00:18:39 +00:00
|
|
|
ansible.builtin.systemd:
|
2021-09-02 14:53:52 +00:00
|
|
|
name: "openqa-worker@{{ item }}"
|
2021-08-31 00:18:39 +00:00
|
|
|
state: started
|
|
|
|
enabled: true
|
2021-09-02 14:53:52 +00:00
|
|
|
# range 'end' parameter is exclusive, so add 1
|
|
|
|
loop: "{{ range(1, (openqa_worker_count|int + 1)) | list }}"
|
|
|
|
tags: start_workers
|
2021-08-31 00:18:39 +00:00
|
|
|
|
|
|
|
- name: POST a job
|
|
|
|
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"
|
2021-08-31 00:25:18 +00:00
|
|
|
changed_when: "1 != 1"
|
|
|
|
...
|