From 4e0cf80a0abcfb2f2156a16ddf89dbca6aea17c8 Mon Sep 17 00:00:00 2001 From: Valentin Gologuzov Date: Mon, 20 Jul 2015 16:36:48 +0200 Subject: [PATCH] [copr][dist-git] adding to ansible dist-git instance for copr service --- inventory/group_vars/copr-dist-git | 5 +++ inventory/group_vars/copr-dist-git-stg | 4 ++ inventory/host_vars/209.132.184.162 | 3 ++ inventory/inventory | 3 ++ playbooks/groups/copr-dist-git.yml | 51 ++++++++++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 inventory/group_vars/copr-dist-git create mode 100644 inventory/group_vars/copr-dist-git-stg create mode 100644 inventory/host_vars/209.132.184.162 create mode 100644 playbooks/groups/copr-dist-git.yml diff --git a/inventory/group_vars/copr-dist-git b/inventory/group_vars/copr-dist-git new file mode 100644 index 0000000000..4df7e39a11 --- /dev/null +++ b/inventory/group_vars/copr-dist-git @@ -0,0 +1,5 @@ +--- +tcp_ports: [22, 80] +datacenter: cloud +freezes: false +# volumes: [] diff --git a/inventory/group_vars/copr-dist-git-stg b/inventory/group_vars/copr-dist-git-stg new file mode 100644 index 0000000000..90a2dc104b --- /dev/null +++ b/inventory/group_vars/copr-dist-git-stg @@ -0,0 +1,4 @@ +--- +tcp_ports: [22, 80] +datacenter: cloud +freezes: false diff --git a/inventory/host_vars/209.132.184.162 b/inventory/host_vars/209.132.184.162 new file mode 100644 index 0000000000..f9af6ee4c5 --- /dev/null +++ b/inventory/host_vars/209.132.184.162 @@ -0,0 +1,3 @@ +# TODO: remove this config after copr-dist-git is moved to persistent tenant +name: copr-dist-git-dev +volumes: [ {volume_id: '21988d9d-f41e-46c4-b063-1c95df2f9205', device: '/dev/vdc'} ] diff --git a/inventory/inventory b/inventory/inventory index cbd2eeeb8f..3aa0fecdd1 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -929,6 +929,9 @@ copr-fe.cloud.fedoraproject.org [copr-back] copr-be.cloud.fedoraproject.org +[copr-dist-git-stg] +209.132.184.162 + [copr:children] copr-front copr-back diff --git a/playbooks/groups/copr-dist-git.yml b/playbooks/groups/copr-dist-git.yml new file mode 100644 index 0000000000..10911094c0 --- /dev/null +++ b/playbooks/groups/copr-dist-git.yml @@ -0,0 +1,51 @@ +- name: check/create instance + hosts: copr-dist-git-stg:copr-dist-git + + user: centos + sudo: True + gather_facts: False + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + - /srv/web/infra/ansible/vars/fedora-cloud.yml + - /srv/private/ansible/files/openstack/passwords.yml + + tasks: + # - include: "{{ tasks }}/persistend_cloud_new.yml" + - include: "{{ tasks }}/growroot_cloud.yml" + # TODO: remove when copr-dist-git will be deployed to the persistent tenant + - local_action: shell nova --os-auth-url="{{os_auth_url}}" --os-username="admin" --os-password="{{ADMIN_PASS}}" --os-tenant-name={{inventory_tenant}} volume-list | grep ' {{item.volume_id}} ' | grep 'available' && nova --os-auth-url="{{os_auth_url}}" --os-username="admin" --os-password="{{ADMIN_PASS}}" --os-tenant-name={{inventory_tenant}} volume-attach "{{inventory_instance_name}}" "{{item.volume_id}}" "{{item.device}}" + with_items: volumes + ignore_errors: yes + when: volumes is defined + +- name: cloud basic setup + hosts: copr-dist-git-stg:copr-dist-git + # hosts: copr-keygen + user: centos + sudo: True + gather_facts: True + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + + tasks: + - include: "{{ tasks }}/cloud_setup_basic.yml" + - name: set hostname (required by some services, at least postfix need it) + shell: "hostname {{copr_hostbase}}.cloud.fedoraproject.org" + +- name: provision instance + hosts: copr-dist-git-stg:copr-dist-git + user: centos + sudo: True + 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 + - copr/dist-git