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: dpkg --configure -a | |
shell: dpkg --configure -a | |
tags: | |
- packages | |
- common | |
- dpkg-reconf | |
- name: install system utils, packages and stuff... | |
package: |
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: install kvm packages on Debian | |
package: | |
name: | |
- bridge-utils | |
- genisoimage | |
- libguestfs-tools | |
- libnss-libvirt | |
- libosinfo-bin | |
- libvirt-clients |
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: install kvm packages on Debian | |
package: | |
name: | |
- bridge-utils | |
- genisoimage | |
- libguestfs-tools | |
- libnss-libvirt | |
- libosinfo-bin | |
- libvirt-clients | |
- libvirt-daemon-system |
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: Enable service libvirt, and start if not started | |
service: | |
name: libvirtd | |
enabled: yes | |
state: started |
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
# Facts will be available as 'ansible_libvirt_pools' | |
- name: gather facts on existing virsh pool | |
virt_pool: | |
command: facts | |
uri: "{{ libvirt_uri }}" |
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: add a storage pool for storing libvirt images if Pool doesn't already exists | |
virt_pool: | |
command: define | |
# looks like setting name here is a redundant, the name is anyways taken from the template xml file, but should set it to make virt_pool module happy. | |
name: "{{ image_pool_name }}" | |
xml: '{{ lookup("template", "pool/dir.xml.j2") }}' | |
uri: "{{ libvirt_uri }}" | |
when: image_pool_name not in ansible_libvirt_pools |
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 a image_pool_dir | |
file: | |
path: "{{ image_pool_dir }}" | |
owner: "{{ ansible_user }}" | |
group: libvirt | |
recurse: yes | |
mode: '0755' | |
become: true |
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
- block: | |
- name: build the storage pool. | |
virt_pool: | |
command: build | |
name: "{{ image_pool_name }}" | |
uri: "{{ libvirt_uri }}" | |
- name: start the storage pool. | |
virt_pool: | |
command: create |
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: autostart the storage pool | |
virt_pool: | |
autostart: yes | |
name: "{{ image_pool_name }}" | |
uri: "{{ libvirt_uri }}" | |
- name: ensure that the pool is active | |
virt_pool: | |
state: active | |
name: "{{ image_pool_name }}" |
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: adding existing user ansible to group libvirt/-qemu | |
user: | |
name: "{{ansible_user}}" | |
groups: libvirt,libvirt-qemu | |
# if append is not set to yes, the user is removed from all other groups and gets added only to this one! | |
append: yes |
OlderNewer