Add nut SSH remote shutdown
This commit is contained in:
17
roles/ariane/files/lxc-betam.conf
Normal file
17
roles/ariane/files/lxc-betam.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.link = br0
|
||||
lxc.network.flags = up
|
||||
lxc.network.hwaddr = 2e:6d:b6:07:14:01
|
||||
|
||||
lxc.aa_profile = unconfined
|
||||
lxc.rootfs = /var/lib/lxc/lxc-betam-01/rootfs
|
||||
lxc.rootfs.backend = dir
|
||||
|
||||
lxc.include = /usr/share/lxc/config/debian.common.conf
|
||||
|
||||
lxc.utsname = lxc-betam-01
|
||||
lxc.arch = amd64
|
||||
|
||||
lxc.cgroup.devices.allow = c 188:0 rwm
|
||||
13
roles/ariane/tasks/lxc-betam.yml
Normal file
13
roles/ariane/tasks/lxc-betam.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
#- name: lxc - betam container
|
||||
# lxc_container:
|
||||
# name: betam
|
||||
# template: debian
|
||||
|
||||
- name: lxc - betam config
|
||||
copy:
|
||||
dest: /var/lib/lxc/lxc-betam-01/config
|
||||
src: lxc-betam.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
backup: yes
|
||||
@@ -22,3 +22,7 @@
|
||||
- include_tasks: lxc.yml
|
||||
when: ariane_lxc
|
||||
tags: ['ariane_lxc', 'lxc']
|
||||
|
||||
- include_tasks: lxc-betam.yml
|
||||
when: ariane_lxc
|
||||
tags: ['ariane_lxc', 'lxc']
|
||||
|
||||
17
roles/ariane/templates/lxc.j2
Normal file
17
roles/ariane/templates/lxc.j2
Normal file
@@ -0,0 +1,17 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
lxc.network.type = veth
|
||||
lxc.network.link = br0
|
||||
lxc.network.flags = up
|
||||
lxc.network.hwaddr = {{ lxc_hwaddr }}
|
||||
|
||||
lxc.aa_profile = unconfined
|
||||
lxc.rootfs = /var/lib/lxc/lxc-{{ lxc_host }}-{{ lxc_rev }}/rootfs
|
||||
lxc.rootfs.backend = dir
|
||||
|
||||
lxc.include = /usr/share/lxc/config/debian.common.conf
|
||||
|
||||
lxc.utsname = lxc-{{ lxc_host }}-{{ lxc-rev }}
|
||||
lxc.arch = amd64
|
||||
|
||||
{{ lxc_extra }}
|
||||
Submodule roles/common updated: 5d81b09172...c991c2adef
@@ -6,3 +6,6 @@ ups_port_dev: 188 0
|
||||
|
||||
ups_master_pw: Noongaig1quor9Waepe9
|
||||
ups_slave_pw:
|
||||
|
||||
ups_hosts:
|
||||
- ariane
|
||||
|
||||
@@ -53,3 +53,6 @@
|
||||
template: dest=/etc/nut/upssched.conf src=upssched.conf.j2 owner=root group=nut mode=0640
|
||||
notify:
|
||||
restart nut
|
||||
|
||||
- name: nut - generate SSH-key
|
||||
user: name=nut createhome=yes generate_ssh_key=yes ssh_key_bits=4096 ssh_key_comment="nut ups shutdown"
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
#! /bin/sh
|
||||
case $1 in
|
||||
onbatt)
|
||||
ssh
|
||||
{% for host in ups_hosts %}
|
||||
ssh root@{{ host }}
|
||||
{% endfor %}
|
||||
;;
|
||||
lowbatt)
|
||||
/sbin/upssched fsd;;
|
||||
|
||||
Reference in New Issue
Block a user