Move all shared into this new repo
This commit is contained in:
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