ansible-roles/lxc/tasks/main.yml

34 lines
743 B
YAML
Raw Normal View History

2017-08-22 17:32:32 +02:00
---
- name: Install lxc tools
apt:
name: '{{ item }}'
with_items:
2019-06-21 10:36:32 +02:00
- lxc
- debootstrap
- xz-utils
2017-08-22 17:32:32 +02:00
- name: Copy LXC default containers configuration
template:
src: default.conf
dest: /etc/lxc/
- name: Check if root has subuids
command: grep '^root:100000:10000$' /etc/subuid
failed_when: false
changed_when: false
2017-08-22 17:32:32 +02:00
register: root_subuids
when: lxc_unprivilegied_containers
2017-08-22 17:32:32 +02:00
- name: Add subuid and subgid ranges to root
command: usermod -v 100000-199999 -w 100000-109999 root
2019-06-21 10:36:32 +02:00
when:
- lxc_unprivilegied_containers
- root_subuids.rc
2017-08-22 17:32:32 +02:00
- name: Create containers
2019-06-21 10:36:32 +02:00
include: create-container.yml
vars:
name: "{{ item.name }}"
release: "{{item.release}}"
with_items: "{{lxc_containers}}"