Kill off the old temp cloud instance stuff and make the new one default.

This commit is contained in:
Kevin Fenzi 2015-05-13 23:12:42 +00:00
parent 7e1f931765
commit 7bc4f4523e
9 changed files with 30 additions and 311 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -35,7 +35,7 @@
fail: msg="Please specify the name of the instance" fail: msg="Please specify the name of the instance"
when: name is not defined when: name is not defined
- include: "{{ tasks }}/transient_cloud_new.yml" - include: "{{ tasks }}/transient_cloud.yml"
- name: provision instance - name: provision instance
hosts: tmp_just_created hosts: tmp_just_created

View file

@ -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"

View file

@ -1,16 +1,35 @@
--- # New tasks to spin up instance in https://fed-cloud09.cloud.fedoraproject.org
- 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 }} - name: spin UP VM using nova_compute
register: inst_res 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 - 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 - 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 }} " 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 the host to be hot
local_action: wait_for host={{ inst_res.instances[0].public_ip }} port=22 delay=2 timeout=300
- 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

View file

@ -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