From 6bce843a115b822fce2fc66836b81c44fb7cff3d Mon Sep 17 00:00:00 2001 From: Tim Flink Date: Fri, 6 Nov 2015 23:11:50 +0000 Subject: [PATCH] initial ansible config for openqa, openqa-stg, openqa workers --- inventory/group_vars/openqa | 0 inventory/group_vars/openqa-stg | 0 .../openqa-stg01.qa.fedoraproject.org | 40 ++++++++++++++ .../host_vars/openqa01.qa.fedoraproject.org | 40 ++++++++++++++ inventory/host_vars/qa05.qa.fedoraproject.org | 2 +- inventory/host_vars/qa06.qa.fedoraproject.org | 2 +- inventory/inventory | 16 ++++-- master.yml | 2 + playbooks/groups/openqa-workers.yml | 52 +++++++++++++++++++ playbooks/groups/openqa.yml | 52 +++++++++++++++++++ 10 files changed, 201 insertions(+), 5 deletions(-) create mode 100644 inventory/group_vars/openqa create mode 100644 inventory/group_vars/openqa-stg create mode 100644 inventory/host_vars/openqa-stg01.qa.fedoraproject.org create mode 100644 inventory/host_vars/openqa01.qa.fedoraproject.org create mode 100644 playbooks/groups/openqa-workers.yml create mode 100644 playbooks/groups/openqa.yml diff --git a/inventory/group_vars/openqa b/inventory/group_vars/openqa new file mode 100644 index 0000000000..e69de29bb2 diff --git a/inventory/group_vars/openqa-stg b/inventory/group_vars/openqa-stg new file mode 100644 index 0000000000..e69de29bb2 diff --git a/inventory/host_vars/openqa-stg01.qa.fedoraproject.org b/inventory/host_vars/openqa-stg01.qa.fedoraproject.org new file mode 100644 index 0000000000..e34fb81a99 --- /dev/null +++ b/inventory/host_vars/openqa-stg01.qa.fedoraproject.org @@ -0,0 +1,40 @@ +--- +############################################################ +# networking +############################################################ + +nm: 255.255.255.0 +gw: 10.5.131.254 +dns: 10.5.126.21 +eth0_ip: 10.5.131.72 + +############################################################ +# install +############################################################ + +ks_url: http://10.5.126.23/repo/rhel/ks/kvm-fedora-23 +ks_repo: http://10.5.126.23/pub/fedora/linux/releases/23/Server/x86_64/os/ +volgroup: /dev/VirtGuests +vmhost: virthost-comm03.qa.fedoraproject.org +datacenter: phx2 + +############################################################ +# virtual machine +############################################################ + +fas_client_groups: sysadmin-qa,sysadmin-main,fi-apprentice + +lvm_size: 30720 +mem_size: 4096 +num_cpus: 4 + +nrpe_procs_warn: 250 +nrpe_procs_crit: 300 + +virt_install_command: /usr/bin/virt-install -n {{ inventory_hostname }} -r {{ mem_size }} + --disk bus=virtio,path={{ volgroup }}/{{ inventory_hostname }} + --vcpus={{ num_cpus }} -l {{ ks_repo }} -x + "ksdevice=eth0 ks={{ ks_url }} console=tty0 console=ttyS0 + hostname={{ inventory_hostname }} nameserver={{ dns }} + ip={{ eth0_ip }}::{{ gw }}:{{ nm }}:{{ inventory_hostname }}:eth0:none" + --network=bridge=br0,model=virtio --autostart --noautoconsole diff --git a/inventory/host_vars/openqa01.qa.fedoraproject.org b/inventory/host_vars/openqa01.qa.fedoraproject.org new file mode 100644 index 0000000000..37664a7eb5 --- /dev/null +++ b/inventory/host_vars/openqa01.qa.fedoraproject.org @@ -0,0 +1,40 @@ +--- +############################################################ +# networking +############################################################ + +nm: 255.255.255.0 +gw: 10.5.131.254 +dns: 10.5.126.21 +eth0_ip: 10.5.131.71 + +############################################################ +# install +############################################################ + +ks_url: http://10.5.126.23/repo/rhel/ks/kvm-fedora-23-openqa +ks_repo: http://10.5.126.23/pub/fedora/linux/releases/23/Server/x86_64/os/ +volgroup: /dev/VirtGuests +vmhost: virthost-comm03.qa.fedoraproject.org +datacenter: phx2 + +############################################################ +# virtual machine +############################################################ + +fas_client_groups: sysadmin-qa,sysadmin-main,fi-apprentice + +lvm_size: 768000 +mem_size: 4096 +num_cpus: 4 + +nrpe_procs_warn: 250 +nrpe_procs_crit: 300 + +virt_install_command: /usr/bin/virt-install -n {{ inventory_hostname }} -r {{ mem_size }} + --disk bus=virtio,path={{ volgroup }}/{{ inventory_hostname }} + --vcpus={{ num_cpus }} -l {{ ks_repo }} -x + "ksdevice=eth0 ks={{ ks_url }} console=tty0 console=ttyS0 + hostname={{ inventory_hostname }} nameserver={{ dns }} + ip={{ eth0_ip }}::{{ gw }}:{{ nm }}:{{ inventory_hostname }}:eth0:none" + --network=bridge=br0,model=virtio --autostart --noautoconsole diff --git a/inventory/host_vars/qa05.qa.fedoraproject.org b/inventory/host_vars/qa05.qa.fedoraproject.org index 2afe24a829..52d10a136b 100644 --- a/inventory/host_vars/qa05.qa.fedoraproject.org +++ b/inventory/host_vars/qa05.qa.fedoraproject.org @@ -1,4 +1,4 @@ --- -freezes: false +freezes: true fas_client_groups: sysadmin-qa,sysadmin-main sudoers: "{{ private }}/files/sudo/qavirt-sudoers" diff --git a/inventory/host_vars/qa06.qa.fedoraproject.org b/inventory/host_vars/qa06.qa.fedoraproject.org index 2afe24a829..52d10a136b 100644 --- a/inventory/host_vars/qa06.qa.fedoraproject.org +++ b/inventory/host_vars/qa06.qa.fedoraproject.org @@ -1,4 +1,4 @@ --- -freezes: false +freezes: true fas_client_groups: sysadmin-qa,sysadmin-main sudoers: "{{ private }}/files/sudo/qavirt-sudoers" diff --git a/inventory/inventory b/inventory/inventory index f3613d1a7d..8a119f59d1 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -475,6 +475,19 @@ ns03.phx2.fedoraproject.org ns04.phx2.fedoraproject.org ns05.fedoraproject.org +[openqa] +openqa01.qa.fedoraproject.org + +[openqa-workers] +qa05.qa.fedoraproject.org +qa06.qa.fedoraproject.org + +[openqa-stg] +openqa-stg01.qa.fedoraproject.org + +[openqa-stg-workers] +qa07.qa.fedoraproject.org + [packages] packages03.phx2.fedoraproject.org packages04.phx2.fedoraproject.org @@ -740,9 +753,6 @@ virthost21.phx2.fedoraproject.org virthost22.phx2.fedoraproject.org qa03.qa.fedoraproject.org qa04.qa.fedoraproject.org -qa05.qa.fedoraproject.org -qa06.qa.fedoraproject.org -qa07.qa.fedoraproject.org qa09.qa.fedoraproject.org qa10.qa.fedoraproject.org qa11.qa.fedoraproject.org diff --git a/master.yml b/master.yml index 207689fd83..27dcdd74be 100644 --- a/master.yml +++ b/master.yml @@ -74,6 +74,8 @@ - include: /srv/web/infra/ansible/playbooks/groups/notifs-web.yml - include: /srv/web/infra/ansible/playbooks/groups/nuancier.yml - include: /srv/web/infra/ansible/playbooks/groups/openstack-compute-nodes.yml +#- include: /srv/web/infra/ansible/playbooks/groups/openqa.yml +#- include: /srv/web/infra/ansible/playbooks/groups/openqa-workers.yml #- include: /srv/web/infra/ansible/playbooks/groups/osbs.yml - include: /srv/web/infra/ansible/playbooks/groups/packages.yml - include: /srv/web/infra/ansible/playbooks/groups/pagure.yml diff --git a/playbooks/groups/openqa-workers.yml b/playbooks/groups/openqa-workers.yml new file mode 100644 index 0000000000..afb7841785 --- /dev/null +++ b/playbooks/groups/openqa-workers.yml @@ -0,0 +1,52 @@ +# create a new openqa worker server system +# NOTE: should be used with --limit most of the time +# NOTE: most of these vars_path come from group_vars/backup_server or from hostvars +# This has an extra role that configures the virthost to be used with beaker for +# virtual machine clients + +- name: basic configuration + hosts: openqa-workers,openqa-stg-workers + user: root + gather_facts: True + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml + + roles: + - base + - rkhunter + - { role: denyhosts, when: ansible_distribution_major_version|int != 7 } + - nagios_client + - hosts + - fas_client + - collectd/base + - { role: iscsi_client, when: datacenter == "phx2" } + - sudo + - { role: openvpn/client, when: datacenter != "phx2" } + - { role: beaker/virthost, tags: ['beakervirthost'] } + + tasks: + - include: "{{ tasks }}/yumrepos.yml" + - include: "{{ tasks }}/2fa_client.yml" + - include: "{{ tasks }}/motd.yml" + + handlers: + - include: "{{ handlers }}/restart_services.yml" + +#- name: configure openqa workers +# hosts: openqa-workers, openqa-stg-workers +# user: root +# gather_facts: True +# +# vars_files: +# - /srv/web/infra/ansible/vars/global.yml +# - "/srv/private/ansible/vars.yml" +# - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml +# +# roles: +# - { role: openqa/something, tags: ['something'] } +# +# handlers: +# - include: "{{ handlers }}/restart_services.yml" diff --git a/playbooks/groups/openqa.yml b/playbooks/groups/openqa.yml new file mode 100644 index 0000000000..50eef514ad --- /dev/null +++ b/playbooks/groups/openqa.yml @@ -0,0 +1,52 @@ +--- +# create a new taskotron staging server +# NOTE: make sure there is room/space for this server on the vmhost +# NOTE: most of these vars_path come from group_vars/mirrorlist or from hostvars + +- include: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=openqa,openqa-stg" + +- name: make the box be real + hosts: openqa, openqa-stg + user: root + gather_facts: True + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml + + roles: + - { role: base, tags: ['base'] } + - { role: rkhunter, tags: ['rkhunter'] } + - { role: nagios_client, tags: ['nagios_client'] } + - { role: hosts, tags: ['hosts']} + - { role: fas_client, tags: ['fas_client'] } + - { role: collectd/base, tags: ['collectd_base'] } + - { role: yum-cron, tags: ['yumcron'] } + - { role: sudo, tags: ['sudo'] } + - apache + + tasks: + # this is how you include other task lists + - include: "{{ tasks }}/yumrepos.yml" + - include: "{{ tasks }}/2fa_client.yml" + - include: "{{ tasks }}/motd.yml" + + handlers: + - include: "{{ handlers }}/restart_services.yml" + +#- name: configure openqa +# hosts: openqa, openqa-stg +# user: root +# gather_facts: True +# +# vars_files: +# - /srv/web/infra/ansible/vars/global.yml +# - "/srv/private/ansible/vars.yml" +# - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml +# +# roles: +# - { role: openqa/something, tags: ['something'] } +# +# handlers: +# - include: "{{ handlers }}/restart_services.yml"