Created
April 22, 2013 09:43
-
-
Save DazWorrall/5433596 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: create logic volume | |
lvol: vg=$vol_group size=$vol_size lv={{ vol_name }} state=present | |
- name: check filesystem | |
command: tune2fs -l /dev/{{ vol_group }}/{{ vol_name }} | |
ignore_errors: True | |
register: result | |
- name: mkfs | |
command: mkfs.ext4 /dev/{{ vol_group }}/{{ vol_name }} | |
when_failed: $result | |
- name: setup mount point | |
file: path={{ container_mount_root }}/{{ vol_name }} state=directory | |
- name: mount | |
mount: name={{ container_mount_root }}/{{ vol_name }} src=/dev/{{ vol_group }}/{{ vol_name }} opts=rw state=mounted fstype=auto | |
- name: test container bootstrapped | |
shell: file {{ container_mount_root }}/{{ vol_name }}/sbin/init | |
register: result | |
ignore_errors: True | |
- name: debootstrap | |
command: /usr/sbin/debootstrap | |
--arch={{ arch }} | |
--variant=minbase | |
--include=ssh,sudo,python2.7,python-apt,ifupdown | |
{{ distro_release }} {{ container_mount_root }}/{{ vol_name }} | |
{{ deb_mirror }} | |
when_failed: $result | |
- name: define vm | |
iwebvirt: name={{ name }} command=define xml="{{item}}" uri=lxc:/// | |
with_template: ["roles/lxchost/templates/container-template.xml.j2"] | |
- name: start vm | |
iwebvirt: name={{ name }} state=running uri=lxc:/// | |
register: started |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment