From 7bc4f4523e9b2118c403c5d395d0ce3c0fe3edc3 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Wed, 13 May 2015 23:12:42 +0000 Subject: [PATCH] Kill off the old temp cloud instance stuff and make the new one default. --- playbooks/el6_temp_instance.yml | 41 -------------- playbooks/el7_temp_instance.yml | 56 ------------------- playbooks/f19_temp_instance.yml | 53 ------------------ playbooks/f20_temp_instance.yml | 53 ------------------ playbooks/fedora_temp_instance.yml | 37 ------------ ...tance.yml => transient_cloud_instance.yml} | 2 +- playbooks/transient_post_provision.yml | 25 --------- tasks/transient_cloud.yml | 39 +++++++++---- tasks/transient_cloud_new.yml | 35 ------------ 9 files changed, 30 insertions(+), 311 deletions(-) delete mode 100644 playbooks/el6_temp_instance.yml delete mode 100644 playbooks/el7_temp_instance.yml delete mode 100644 playbooks/f19_temp_instance.yml delete mode 100644 playbooks/f20_temp_instance.yml delete mode 100644 playbooks/fedora_temp_instance.yml rename playbooks/{temp_cloud_instance.yml => transient_cloud_instance.yml} (97%) delete mode 100644 playbooks/transient_post_provision.yml delete mode 100644 tasks/transient_cloud_new.yml diff --git a/playbooks/el6_temp_instance.yml b/playbooks/el6_temp_instance.yml deleted file mode 100644 index 36a29d9cc3..0000000000 --- a/playbooks/el6_temp_instance.yml +++ /dev/null @@ -1,41 +0,0 @@ -# setup a transient el6 instance -# optionally can take --extra-vars="hostbase=hostnamebase root_auth_users='user1 user2 user3'" -# -# You might need to run it with `-c paramiko` for it to finish cleanly - -- name: check/create instance - hosts: lockbox01.phx2.fedoraproject.org - user: root - gather_facts: False - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - - vars: - - keypair: fedora-admin-20130801 - - image: "{{ el6_qcow_id }}" - - instance_type: m1.small - - security_group: default - - region: nova - - tasks: - - include: "{{ tasks }}/transient_cloud.yml" - -- name: provision instance - hosts: tmp_just_created - 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 - - tasks: - - include: "{{ tasks }}/growroot_cloud.yml" - - include: "{{ tasks }}/cloud_setup_basic.yml" - - - handlers: - - include: "{{ handlers }}/restart_services.yml" diff --git a/playbooks/el7_temp_instance.yml b/playbooks/el7_temp_instance.yml deleted file mode 100644 index 2b8076e014..0000000000 --- a/playbooks/el7_temp_instance.yml +++ /dev/null @@ -1,56 +0,0 @@ -# setup a transient fedora instance -# optionally can take --extra-vars="hostbase=hostnamebase root_auth_users='user1 user2 user3'" - -- name: check/create instance - hosts: lockbox01.phx2.fedoraproject.org - user: root - gather_facts: False - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - vars: - - keypair: fedora-admin-20130801 - - image: "{{ el7_qcow_id }}" - - instance_type: m1.small - - security_group: default - - region: nova - - tasks: - - include: "{{ tasks }}/transient_cloud.yml" - -- name: provision instance - hosts: tmp_just_created - gather_facts: True - user: fedora - sudo: True - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml - - tasks: - - name: install cloud-utils - yum: pkg=cloud-utils state=present - - - name: growpart /dev/vda1 partition (/) to full size - action: command growpart /dev/vda 1 - register: growpart - always_run: true - changed_when: "growpart.rc != 1" - failed_when: growpart.rc == 2 - - - name: resize the /dev/vda 1 fs - action: command xfs_growfs /dev/vda1 - when: growpart.rc == 0 - -# - name: put the mbr back - b/c the resize breaks booting otherwise -# action: shell cat /usr/share/syslinux/mbr.bin > /dev/vda -# when: growpart.rc == 0 - - - - include: "{{ tasks }}/cloud_setup_basic.yml" - - handlers: - - include: "{{ handlers }}/restart_services.yml" diff --git a/playbooks/f19_temp_instance.yml b/playbooks/f19_temp_instance.yml deleted file mode 100644 index d696172387..0000000000 --- a/playbooks/f19_temp_instance.yml +++ /dev/null @@ -1,53 +0,0 @@ -# setup a transient fedora instance -# optionally can take --extra-vars="hostbase=hostnamebase root_auth_users='user1 user2 user3'" - -- name: check/create instance - hosts: lockbox01.phx2.fedoraproject.org - user: root - gather_facts: False - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - vars: - - keypair: fedora-admin-20130801 - - image: "{{ f19_qcow_id }}" - - instance_type: m1.small - - security_group: default - - region: nova - - tasks: - - include: "{{ tasks }}/transient_cloud.yml" - -- name: provision instance - hosts: tmp_just_created - user: fedora - gather_facts: True - sudo: yes - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml - - tasks: - - name: growpart /dev/vda1 partition (/) to full size - action: command growpart /dev/vda 1 - register: growpart - always_run: true - changed_when: "growpart.rc != 1" - failed_when: growpart.rc == 2 - - - name: resize the /dev/vda 1 fs - action: command resize2fs /dev/vda1 - when: growpart.rc == 0 - - - name: put the mbr back - b/c the resize breaks booting otherwise - action: shell cat /usr/share/syslinux/mbr.bin > /dev/vda - when: growpart.rc == 0 - - - - include: "{{ tasks }}/cloud_setup_basic.yml" - - handlers: - - include: "{{ handlers }}/restart_services.yml" diff --git a/playbooks/f20_temp_instance.yml b/playbooks/f20_temp_instance.yml deleted file mode 100644 index 582d7f0b40..0000000000 --- a/playbooks/f20_temp_instance.yml +++ /dev/null @@ -1,53 +0,0 @@ -# setup a transient fedora instance -# optionally can take --extra-vars="hostbase=hostnamebase root_auth_users='user1 user2 user3'" - -- name: check/create instance - hosts: lockbox01.phx2.fedoraproject.org - user: root - gather_facts: False - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - vars: - - keypair: fedora-admin-20130801 - - image: "{{ f20_qcow_id }}" - - instance_type: m1.small - - security_group: default - - region: nova - - tasks: - - include: "{{ tasks }}/transient_cloud.yml" - -- name: provision instance - hosts: tmp_just_created - user: fedora - gather_facts: True - sudo: yes - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml - - tasks: - - name: growpart /dev/vda1 partition (/) to full size - action: command growpart /dev/vda 1 - register: growpart - always_run: true - changed_when: "growpart.rc != 1" - failed_when: growpart.rc == 2 - - - name: resize the /dev/vda 1 fs - action: command resize2fs /dev/vda1 - when: growpart.rc == 0 - - - name: put the mbr back - b/c the resize breaks booting otherwise - action: shell cat /usr/share/syslinux/mbr.bin > /dev/vda - when: growpart.rc == 0 - - - - include: "{{ tasks }}/cloud_setup_basic.yml" - - handlers: - - include: "{{ handlers }}/restart_services.yml" diff --git a/playbooks/fedora_temp_instance.yml b/playbooks/fedora_temp_instance.yml deleted file mode 100644 index d4d927c6e6..0000000000 --- a/playbooks/fedora_temp_instance.yml +++ /dev/null @@ -1,37 +0,0 @@ -# setup a transient fedora instance -# optionally can take --extra-vars="hostbase=hostnamebase root_auth_users='user1 user2 user3'" - -- name: check/create instance - hosts: lockbox01.phx2.fedoraproject.org - user: root - gather_facts: False - - vars_files: - - /srv/web/infra/ansible/vars/global.yml - - "/srv/private/ansible/vars.yml" - vars: - - keypair: fedora-admin-20130801 - - image: "{{ f18_qcow_id }}" - - instance_type: m1.small - - security_group: default - - region: nova - - tasks: - - include: "{{ tasks }}/transient_cloud.yml" - -- name: provision instance - hosts: tmp_just_created - 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 - - tasks: - - include: "{{ tasks }}/growroot_cloud.yml" - - include: "{{ tasks }}/cloud_setup_basic.yml" - - handlers: - - include: "{{ handlers }}/restart_services.yml" diff --git a/playbooks/temp_cloud_instance.yml b/playbooks/transient_cloud_instance.yml similarity index 97% rename from playbooks/temp_cloud_instance.yml rename to playbooks/transient_cloud_instance.yml index 6c19660ebc..57956be93b 100644 --- a/playbooks/temp_cloud_instance.yml +++ b/playbooks/transient_cloud_instance.yml @@ -35,7 +35,7 @@ fail: msg="Please specify the name of the instance" when: name is not defined - - include: "{{ tasks }}/transient_cloud_new.yml" + - include: "{{ tasks }}/transient_cloud.yml" - name: provision instance hosts: tmp_just_created diff --git a/playbooks/transient_post_provision.yml b/playbooks/transient_post_provision.yml deleted file mode 100644 index 0543525f86..0000000000 --- a/playbooks/transient_post_provision.yml +++ /dev/null @@ -1,25 +0,0 @@ -- name: add to group - hosts: lockbox01.phx2.fedoraproject.org - user: root - gather_facts: False - - tasks: - - name: add it to the special group - local_action: add_host hostname={{ target }} groupname=tmp_just_created - -- name: provision instance - hosts: tmp_just_created - 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 - - tasks: - - include: "{{ tasks }}/growroot_cloud.yml" - - include: "{{ tasks }}/cloud_setup_basic.yml" - - handlers: - - include: "{{ handlers }}/restart_services.yml" diff --git a/tasks/transient_cloud.yml b/tasks/transient_cloud.yml index fbf47d93fb..07a459aa3f 100644 --- a/tasks/transient_cloud.yml +++ b/tasks/transient_cloud.yml @@ -1,16 +1,35 @@ ---- -- name: spin it up - local_action: ec2 keypair={{ keypair }} image={{ image }} type={{ instance_type }} wait=true group={{ security_group }} ec2_access_key={{ transient_access_key }} ec2_secret_key={{ transient_secret_key }} ec2_url={{ os_ec2_url }} region={{ region }} - register: inst_res +# New tasks to spin up instance in https://fed-cloud09.cloud.fedoraproject.org + +- name: spin UP VM using nova_compute + sudo: False + local_action: + security_groups: all-icmp-transient,web-80-anywhere-transient,web-443-anywhere-transient,ssh-anywhere-transient,default + nics: + - net-id: "28db7265-fb78-4937-bfe3-9c8a9b959c30" + name: "{{ name }}" + module: nova_compute + auth_url: "{{os_auth_url}}" + login_username: "admin" + login_password: "{{ADMIN_PASS}}" + login_tenant_name: transient + image_id: "{{ image|image_name_to_id('admin', ADMIN_PASS, 'transient', os_auth_url) }}" + wait_for: 300 + flavor_id: "{{ instance_type|flavor_name_to_id('admin', ADMIN_PASS, 'transient', os_auth_url) }}" + key_name: fedora-admin-20130801 + auto_floating_ip: true + user_data: "#cloud-config\ndisable_root: 0" + register: nova_result - name: add it to the special group - local_action: add_host hostname={{ inst_res.instances[0].public_ip }} groupname=tmp_just_created - + local_action: add_host hostname="{{ nova_result.public_ip }}" groupname=tmp_just_created - name: mail off about where it is - local_action: mail to=sysadmin-main-members@fedoraproject.org from=ansible-create@fedoraproject.org subject={{ inst_res.instances[0].public_ip }} msg="cloud instance created on {{ inst_res.instances[0].public_ip }}\n instance id - {{ inst_res.instances[0].id }} - {{ hostbase }} {{ root_auth_users }} " - -- name: wait for the host to be hot - local_action: wait_for host={{ inst_res.instances[0].public_ip }} port=22 delay=2 timeout=300 + local_action: mail to=sysadmin-main-members@fedoraproject.org from=ansible-create@fedoraproject.org subject="{{ nova_result.public_ip }}" msg="transient cloud instance created on {{ nova_result.public_ip }}\n name = {{ name }}\nroot_uath_users = {{ root_auth_users }}\nimage = {{ image }}" +- name: wait for he host to be hot + local_action: wait_for host={{ nova_result.public_ip }} port=22 delay=1 timeout=600 +# SSH is up and running, however cloud-init still did not deployed ssh keypair +# we have to wait some time. 10 sec is usually enough, but not always. +- name: waiting for cloud-init + pause: seconds=30 diff --git a/tasks/transient_cloud_new.yml b/tasks/transient_cloud_new.yml deleted file mode 100644 index 07a459aa3f..0000000000 --- a/tasks/transient_cloud_new.yml +++ /dev/null @@ -1,35 +0,0 @@ -# New tasks to spin up instance in https://fed-cloud09.cloud.fedoraproject.org - -- name: spin UP VM using nova_compute - sudo: False - local_action: - security_groups: all-icmp-transient,web-80-anywhere-transient,web-443-anywhere-transient,ssh-anywhere-transient,default - nics: - - net-id: "28db7265-fb78-4937-bfe3-9c8a9b959c30" - name: "{{ name }}" - module: nova_compute - auth_url: "{{os_auth_url}}" - login_username: "admin" - login_password: "{{ADMIN_PASS}}" - login_tenant_name: transient - image_id: "{{ image|image_name_to_id('admin', ADMIN_PASS, 'transient', os_auth_url) }}" - wait_for: 300 - flavor_id: "{{ instance_type|flavor_name_to_id('admin', ADMIN_PASS, 'transient', os_auth_url) }}" - key_name: fedora-admin-20130801 - auto_floating_ip: true - user_data: "#cloud-config\ndisable_root: 0" - register: nova_result - -- name: add it to the special group - local_action: add_host hostname="{{ nova_result.public_ip }}" groupname=tmp_just_created - -- name: mail off about where it is - local_action: mail to=sysadmin-main-members@fedoraproject.org from=ansible-create@fedoraproject.org subject="{{ nova_result.public_ip }}" msg="transient cloud instance created on {{ nova_result.public_ip }}\n name = {{ name }}\nroot_uath_users = {{ root_auth_users }}\nimage = {{ image }}" - -- name: wait for he host to be hot - local_action: wait_for host={{ nova_result.public_ip }} port=22 delay=1 timeout=600 - -# SSH is up and running, however cloud-init still did not deployed ssh keypair -# we have to wait some time. 10 sec is usually enough, but not always. -- name: waiting for cloud-init - pause: seconds=30