Move all shared into this new repo
This commit is contained in:
20
virt/opennebula-5.4-kvm-node/files/bin/cron-root-daily-12am.sh
Executable file
20
virt/opennebula-5.4-kvm-node/files/bin/cron-root-daily-12am.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
bin=/usr/local/bin
|
||||
|
||||
################################################################################
|
||||
# Touch for cron log
|
||||
touch /tmp/cron-root-daily-12am.begin.alive
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
# Restart libvirtd
|
||||
/etc/init.d/libvirtd restart
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
# Touch for cron log
|
||||
touch /tmp/cron-root-daily-12am.end.alive
|
||||
################################################################################
|
||||
28
virt/opennebula-5.4-kvm-node/files/libvirt.conf
Normal file
28
virt/opennebula-5.4-kvm-node/files/libvirt.conf
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# This can be used to setup URI aliases for frequently
|
||||
# used connection URIs. Aliases may contain only the
|
||||
# characters a-Z, 0-9, _, -.
|
||||
#
|
||||
# Following the '=' may be any valid libvirt connection
|
||||
# URI, including arbitrary parameters
|
||||
|
||||
#uri_aliases = [
|
||||
# "hail=qemu+ssh://root@hail.cloud.example.com/system",
|
||||
# "sleet=qemu+ssh://root@sleet.cloud.example.com/system",
|
||||
#]
|
||||
|
||||
#
|
||||
# These can be used in cases when no URI is supplied by the application
|
||||
# (@uri_default also prevents probing of the hypervisor driver).
|
||||
#
|
||||
#uri_default = "qemu:///system"
|
||||
|
||||
# Disable Policy Kit
|
||||
# See https://forum.opennebula.org/t/polkitd-traps-general-protection-ip-in-libmozjs-17-0-so/399/3
|
||||
# See https://docs.opennebula.org/5.4/intro_release_notes/release_notes/platform_notes.html#disable-policykit-for-libvirt
|
||||
# mReschke 2018-03-28
|
||||
auth_unix_ro = "none"
|
||||
auth_unix_rw = "none"
|
||||
unix_sock_group = "oneadmin"
|
||||
unix_sock_ro_perms = "0770"
|
||||
unix_sock_rw_perms = "0770"
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# This can be used to setup URI aliases for frequently
|
||||
# used connection URIs. Aliases may contain only the
|
||||
# characters a-Z, 0-9, _, -.
|
||||
#
|
||||
# Following the '=' may be any valid libvirt connection
|
||||
# URI, including arbitrary parameters
|
||||
|
||||
#uri_aliases = [
|
||||
# "hail=qemu+ssh://root@hail.cloud.example.com/system",
|
||||
# "sleet=qemu+ssh://root@sleet.cloud.example.com/system",
|
||||
#]
|
||||
|
||||
#
|
||||
# These can be used in cases when no URI is supplied by the application
|
||||
# (@uri_default also prevents probing of the hypervisor driver).
|
||||
#
|
||||
#uri_default = "qemu:///system"
|
||||
3
virt/opennebula-5.4-kvm-node/files/ssh.config
Normal file
3
virt/opennebula-5.4-kvm-node/files/ssh.config
Normal file
@@ -0,0 +1,3 @@
|
||||
# So ansible does not have to add each hypervisor node to known_hosts
|
||||
StrictHostKeyChecking=no
|
||||
UserKnownHostsFile=/dev/null
|
||||
3
virt/opennebula-5.4-kvm-node/handlers/main.yml
Normal file
3
virt/opennebula-5.4-kvm-node/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: restart libvirtd
|
||||
service: name=libvirtd state=restarted
|
||||
98
virt/opennebula-5.4-kvm-node/tasks/configure.yml
Normal file
98
virt/opennebula-5.4-kvm-node/tasks/configure.yml
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
# Create 256G datastore LVM for .img or .qcow2 filese. Other large VMs (databases) will use RAW LVM partitions!
|
||||
- name: LVM create 256G /dev/vg0/datastore
|
||||
lvol:
|
||||
vg: vg0
|
||||
lv: datastore
|
||||
#size: 256G
|
||||
size: 80G
|
||||
# Format /dev/vg0/datastore as ext4
|
||||
- name: Formatting /dev/vg0/datastore as ext4
|
||||
filesystem:
|
||||
fstype: ext4
|
||||
dev: /dev/vg0/datastore
|
||||
|
||||
# Mount datastore volume
|
||||
# Adds this to /etc/fstab and mounts: /dev/vg0/datastore /var/lib/one/datastores ext4 defaults 0 0
|
||||
# NO, too complex if we are doing per node RAW LVM volumes too, need to engineer manually per node
|
||||
- name: Mount large datastore volume
|
||||
mount:
|
||||
path: /var/lib/one/datastores
|
||||
src: /dev/vg0/datastore
|
||||
fstype: ext4
|
||||
state: mounted
|
||||
- file: {path: /var/lib/one/datastores, owner: oneadmin, group: oneadmin}
|
||||
|
||||
# Installing OpenNebula automatically creates user oneadmin ID 9869
|
||||
# We just need to set the [linux user] password here
|
||||
- name: Setting oneadmin password
|
||||
user:
|
||||
name: 'oneadmin'
|
||||
password: '{{ oneadmin_linux_password }}'
|
||||
update_password: always
|
||||
|
||||
# Copy ssh client config for oneadmin user
|
||||
- name: Copying oneadmin SSH client config
|
||||
copy:
|
||||
src: 'files/ssh.config'
|
||||
dest: '/var/lib/one/.ssh/config'
|
||||
owner: 'oneadmin'
|
||||
group: 'oneadmin'
|
||||
mode: 0644
|
||||
|
||||
# Authorize oneadmin user to SSH into itself
|
||||
- name: Authorizing SSH keys for oneadmin
|
||||
authorized_key:
|
||||
user: 'oneadmin'
|
||||
key: '{{ item }}'
|
||||
with_file:
|
||||
- '../../users/keys/oneadmin.key.pub'
|
||||
|
||||
# Create oneadmin public key
|
||||
- name: Copying oneadmin SSH public key
|
||||
copy:
|
||||
src: '../../users/keys/oneadmin.key.pub'
|
||||
dest: '/var/lib/one/.ssh/id_rsa.pub'
|
||||
owner: 'oneadmin'
|
||||
group: 'oneadmin'
|
||||
mode: 0644
|
||||
|
||||
# Create oneadmin private key
|
||||
- name: Copying oneadmin SSH private key
|
||||
copy:
|
||||
src: '../../../vault/oneadmin.key'
|
||||
dest: '/var/lib/one/.ssh/id_rsa'
|
||||
owner: 'oneadmin'
|
||||
group: 'oneadmin'
|
||||
mode: 0600
|
||||
|
||||
# Copy libvirt.conf
|
||||
- name: Copying /etc/libvirt/libvirt.conf
|
||||
copy:
|
||||
src: libvirt.conf
|
||||
dest: /etc/libvirt/libvirt.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart libvirtd # Only runs if file changed!
|
||||
|
||||
# Copy scripts to /usr/local/bin
|
||||
- name: Copying scripts to /usr/local/bin
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: /usr/local/bin/
|
||||
owner: toor
|
||||
group: staff
|
||||
mode: 0755
|
||||
with_fileglob:
|
||||
- files/bin/*
|
||||
|
||||
# Schedule cron
|
||||
- name: Scheduling cron cron-root-daily-12am
|
||||
cron:
|
||||
name: "cron-root-daily-12am"
|
||||
minute: "0"
|
||||
hour: "0"
|
||||
#job: "/usr/local/bin/cron-root-daily-12am.sh > /dev/null"
|
||||
job: "/usr/local/bin/cron-root-daily-12am.sh"
|
||||
user: root
|
||||
16
virt/opennebula-5.4-kvm-node/tasks/install.yml
Normal file
16
virt/opennebula-5.4-kvm-node/tasks/install.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: Adding Debian 9 OpenNebula GPG key
|
||||
apt_key: url='https://downloads.opennebula.org/repo/repo.key' state=present
|
||||
#when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
|
||||
|
||||
- name: Adding Debian 9 OpenNebula repository
|
||||
apt_repository: repo='deb https://downloads.opennebula.org/repo/5.4/Debian/9 stable opennebula' state=present
|
||||
#when: ansible_os_family == "Debian" and ansible_distribution_major_version == "9"
|
||||
|
||||
# Install OpenNebula
|
||||
- name: Installing OpenNebula controller applications
|
||||
apt:
|
||||
update_cache: yes
|
||||
state: present
|
||||
name: opennebula-node
|
||||
notify: restart libvirtd
|
||||
4
virt/opennebula-5.4-kvm-node/tasks/main.yml
Normal file
4
virt/opennebula-5.4-kvm-node/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
# Install and Configure OpenNebula Node
|
||||
- include_tasks: install.yml
|
||||
- include_tasks: configure.yml
|
||||
Reference in New Issue
Block a user