Add additional items to base role

Backups, GRUB configuration, and IPMI configuration.
This commit is contained in:
Joshua Boniface 2021-05-12 13:53:15 -04:00 committed by Joshua Boniface
parent da9eafcdfa
commit 45322e0f9e
4 changed files with 86 additions and 0 deletions

View File

@ -513,6 +513,62 @@
- ownership
tags: base-cmkagent
# backups
- name: create backup directory
file:
dest: /srv/backups
state: directory
tags: base-backups
- name: install daily backup script
template:
src: etc/cron.daily/pvc-backup.j2
dest: /etc/cron.daily/pvc-backup
mode: 0755
tags: base-backups
- name: install GRUB configuration
template:
src: etc/default/grub.j2
dest: /etc/default/grub
notify:
- update grub
tags: base-grub
- name: install IPMI network interfaces fragment
template:
src: etc/network/interfaces.d/ipmi.j2
dest: /etc/network/interfaces.d/ipmi
tags: base-ipmi
- name: configure IPMI username
command: "ipmitool user set name {{ ipmi_user_configuration[cluster_hardware][item]['id'] }} {{ ipmi_user_configuration[cluster_hardware][item]['username'] }}"
with_items:
- "admin"
- "pvc"
tags: base-ipmi
- name: configure IPMI password
command: "ipmitool user set password {{ ipmi_user_configuration[cluster_hardware][item]['id'] }} {{ ipmi_user_configuration[cluster_hardware][item]['password'] }}"
with_items:
- "admin"
- "pvc"
tags: base-ipmi
- name: configure IPMI role
command: "ipmitool user priv {{ ipmi_user_configuration[cluster_hardware][item]['id'] }} {{ ipmi_user_configuration[cluster_hardware][item]['role'] }} {{ ipmi_user_configuration[cluster_hardware]['channel'] }}"
with_items:
- "admin"
- "pvc"
tags: base-ipmi
- name: enable IPMI user
command: "ipmitool user enable {{ ipmi_user_configuration[cluster_hardware][item]['id'] }}"
with_items:
- "admin"
- "pvc"
tags: base-ipmi
#
# Configure users
#

View File

@ -0,0 +1,15 @@
#!/bin/bash
# Backup the PVC Zookeeper database
# {{ ansible_managed }}
set -o errexit
BACKUP_DIR="/srv/backups/"
BACKUP_FILENAME_BASE="pvc-zookeeper-backup"
DATE="$( date +%Y%m%d )"
BACKUP_FILENAME="${BACKUP_DIR}/${BACKUP_FILENAME_BASE}.${DATE}.json"
pvc -c local task backup > ${BACKUP_FILENAME}
xz ${BACKUP_FILENAME}
find ${BACKUP_DIR} -type f -name "${BACKUP_FILENAME_BASE}*" -mtime +7 -exec rm {} \;

View File

@ -0,0 +1,10 @@
# GRUB configuration
# {{ ansible_managed }}
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="{{ grub_cmdline_default }}"
GRUB_CMDLINE_LINUX=""
GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="gfxterm serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200"

View File

@ -0,0 +1,5 @@
iface ipmi inet manual
pre-up ipmitool lan set 1 ipsrc static
pre-up ipmitool lan set 1 ipaddr {{ ipmi['hosts'][ansible_hostname]['address'] }}
pre-up ipmitool lan set 1 netmask {{ ipmi['hosts'][ansible_hostname]['netmask'] }}
pre-up ipmitool lan set 1 defgw ipaddr {{ ipmi['hosts'][ansible_hostname]['gateway'] }}