Add LXC initial SSH setup
This commit is contained in:
2
group_vars/fet_containers
Normal file
2
group_vars/fet_containers
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
common_apt: False
|
||||||
@@ -3,11 +3,10 @@ all:
|
|||||||
fet_hosts:
|
fet_hosts:
|
||||||
hosts:
|
hosts:
|
||||||
ariane:
|
ariane:
|
||||||
lxc-pet-01:
|
fet_containers:
|
||||||
betam:
|
|
||||||
fet_container:
|
|
||||||
hosts:
|
hosts:
|
||||||
lxc-pet-01:
|
lxc-pet-01:
|
||||||
betam:
|
betam:
|
||||||
|
zyklon:
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter=/usr/bin/python3
|
ansible_python_interpreter=/usr/bin/python3
|
||||||
|
|||||||
@@ -16,3 +16,8 @@
|
|||||||
|
|
||||||
- name: restart smartd
|
- name: restart smartd
|
||||||
service: name=smartd state=restarted
|
service: name=smartd state=restarted
|
||||||
|
|
||||||
|
- name: lxc - create authorized_keys file in VM for root
|
||||||
|
listen: lxc - inital ssh authorized_keys
|
||||||
|
copy: remote_src=yes src=/root/.ssh/authorized_keys dest="/var/lib/lxc/lxc-{{ item.name }}-{{ item.revision }}/rootfs/root/.ssh/authorized_keys" owner=root group=root mode=0600
|
||||||
|
with_items: "{{ lxc.containers }}"
|
||||||
|
|||||||
@@ -35,3 +35,17 @@
|
|||||||
template: "{{ item.template }}"
|
template: "{{ item.template }}"
|
||||||
container_config: "{{ item.config }}"
|
container_config: "{{ item.config }}"
|
||||||
with_items: "{{ lxc.containers }}"
|
with_items: "{{ lxc.containers }}"
|
||||||
|
notify: lxc - inital ssh setup
|
||||||
|
|
||||||
|
- name : lxc - enable ssh on voidlinux
|
||||||
|
lxc_container:
|
||||||
|
name: "lxc-{{ item.name }}-{{ item.revision }}"
|
||||||
|
container_command: "ln -s /etc/sv/{sshd,dhcpcd-eth0} /var/service/"
|
||||||
|
when: item.template == "voidlinux"
|
||||||
|
changed_when: False
|
||||||
|
with_items: "{{ lxc.containers }}"
|
||||||
|
|
||||||
|
- name: lxc - create .ssh directory for root in VM
|
||||||
|
file: path="/var/lib/lxc/lxc-{{ item.name }}-{{ item.revision }}/rootfs/root/.ssh" state=directory owner=root group=root mode=0700
|
||||||
|
with_items: "{{ lxc.containers }}"
|
||||||
|
notify: lxc - inital ssh authorized_keys
|
||||||
|
|||||||
Reference in New Issue
Block a user