initial commit of koji/make_builder playbook which replaces the new_builder builder script in a shockingly small amount of playbook code

This commit is contained in:
Seth Vidal 2013-05-01 22:28:12 +00:00
parent da150c374c
commit 6ba4db5267
2 changed files with 57 additions and 1 deletions

View file

@ -9,7 +9,7 @@ nm: 255.255.255.0
gw: 10.5.125.254
dns: 10.5.126.21
volgroup: /dev/vg_host01
install_command: /usr/bin/virt-install -n ${inventory_hostname} -r ${mem_size}
install_command: /usr/sbin/virt-install -n ${inventory_hostname} -r ${mem_size}
--disk ${volgroup}/${inventory_hostname_short}
--vcpus=${num_cpus} -l ${ks_repo} -x
"ksdevice=eth0 ks=${ks_url} ip=${eth0_ip} netmask=${nm}

View file

@ -0,0 +1,56 @@
# create a new koji builder
# NOTE: should be used with --limit most of the time
# NOTE: make sure there is room/space for this builder on the buildvmhost
# NOTE: most of these vars come from group_vars/buildvm or from hostvars
- name: make koji builder(s)
hosts: buildvm
user: root
gather_facts: False
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- ${private}/vars.yml
- ${vars}/${ansible_distribution}.yml
tasks:
- name: get vm list on the vmhost
delegate_to: $vmhost
virt: command=list_vms
register: result
- name: check if the host is already defined/existent
local_action: fail msg="host is up, need to kill it first"
when_string: ${inventory_hostname} in ${result.list_vms}
- name: echo well we got here
local_action: ping
delegate_to: $vmhost
- name: ensure the lv for the host is made
lvol: lv=$inventory_hostname_short vg=$volgroup size=$lvm_size state=present
delegate_to: $vmhost
- name: run the virt-install
shell: ${install_command}
delegate_to: $vmhost
- name: wait for the install to finish - by watching the vnc port
local_action: wait_for delay=180 host=${inventory_hostname} port=1 state=stopped timeout=900
- name: start the vm up
action: virt state=running name=${inventory_hostname}
delegate_to: $vmhost
- name: set the vm up to autostart
action: virt command=autostart name=${inventory_hostname}
delegate_to: $vmhost
- name: wait for ssh on the vm to start back
local_action: wait_for delay=10 host=${inventory_hostname} port=22 state=started timeout=300
# include postinstall playbook
# - include: $playbooks/koji/build_postinstall.yml