Implement VM configuration and deploy the images.
This commit is contained in:
parent
396a91fb40
commit
18928f2818
14 changed files with 315 additions and 9 deletions
|
@ -18,6 +18,19 @@
|
|||
autoremove: true
|
||||
when: ansible_distribution_release == 'bookworm'
|
||||
|
||||
- name: allow all users to use VMs
|
||||
lineinfile:
|
||||
dest: /etc/libvirt/libvirtd.conf
|
||||
line: 'auth_unix_rw = "none"'
|
||||
insertafter: '#auth_unix_rw = "polkit"'
|
||||
notify: reload libvirtd
|
||||
|
||||
- name: autostart default network for VMs
|
||||
file:
|
||||
src: /etc/libvirt/qemu/networks/default.xml
|
||||
dest: /etc/libvirt/qemu/networks/autostart/default.xml
|
||||
state: link
|
||||
|
||||
- name: install squid
|
||||
apt:
|
||||
name:
|
||||
|
@ -25,9 +38,78 @@
|
|||
state: latest
|
||||
autoremove: true
|
||||
|
||||
- name: allow all users to use VMs
|
||||
lineinfile:
|
||||
dest: /etc/libvirt/libvirtd.conf
|
||||
line: 'auth_unix_rw = "none"'
|
||||
insertafter: '#auth_unix_rw = "polkit"'
|
||||
notify: reload libvirtd
|
||||
- name: disable squid
|
||||
systemd:
|
||||
name: squid
|
||||
enabled: false
|
||||
state: stopped
|
||||
|
||||
- name: deploy squid user mode configuration
|
||||
template:
|
||||
src: squid-usermode.conf.j2
|
||||
dest: /etc/squid/squid-usermode.conf
|
||||
mode: '0644'
|
||||
|
||||
- name: deploy sudo configuration
|
||||
copy:
|
||||
src: lmn-mounthome-sudo
|
||||
dest: /etc/sudoers.d/90-lmn-mounthome
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0700'
|
||||
|
||||
- name: deploy sudo configuration
|
||||
copy:
|
||||
src: lmn-create-clone-sudo
|
||||
dest: /etc/sudoers.d/90-lmn-create-clone
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0700'
|
||||
|
||||
- name: deploy mount home script
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: /usr/local/bin/
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
loop:
|
||||
- mounthome.sh
|
||||
- create-vm.sh
|
||||
- rebase-vm.sh
|
||||
- create-clone.sh
|
||||
- run-vm.sh
|
||||
|
||||
- name: deploy http proxy config
|
||||
copy:
|
||||
src: lmn-proxy.sh
|
||||
dest: /etc/profile.d/
|
||||
mode: '0644'
|
||||
|
||||
- name: deploy pulseaudio fix
|
||||
file:
|
||||
path: /etc/systemd/user/pulseaudio.service.d/
|
||||
state: directory
|
||||
|
||||
- name: deploy pulseaudio fix
|
||||
copy:
|
||||
src: pulseaudio-override.conf
|
||||
dest: /etc/systemd/user/pulseaudio.service.d/override.conf
|
||||
|
||||
#### VMs
|
||||
- name: deploy initial image list
|
||||
copy:
|
||||
src: images.list
|
||||
dest: /var/lib/libvirt/images/images.list
|
||||
force: false
|
||||
|
||||
- name: rsync VM image definitions
|
||||
command: rsync -a --itemize-changes rsync://server:/vmimages-download/xml /var/lib/libvirt/images/
|
||||
register: result
|
||||
changed_when: result.stdout | length > 0
|
||||
|
||||
- name: rsync VM images
|
||||
command: rsync -a -i --files-from=/var/lib/libvirt/images/images.list rsync://server:/vmimages-download/ /var/lib/libvirt/images/
|
||||
register: result
|
||||
changed_when: result.stdout | length > 0
|
||||
when: (ansible_mounts | selectattr("mount", "equalto", "/") | list)[0].size_available > 80000000000
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue