Jérémy Lecour
2ed77c60f0
replace « x | changed » by « x is changed » add explicit « bool » filter use « length » filter instead of string comparison
41 lines
927 B
YAML
41 lines
927 B
YAML
---
|
|
- name: Install lxc tools
|
|
apt:
|
|
name:
|
|
- lxc
|
|
- debootstrap
|
|
- xz-utils
|
|
- python-lxc
|
|
|
|
- name: Install additional packages on Buster
|
|
apt:
|
|
name:
|
|
- apparmor
|
|
- lxc-templates
|
|
when: ansible_distribution_major_version is version('10', '>=')
|
|
|
|
- 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
|
|
register: root_subuids
|
|
when: lxc_unprivilegied_containers | bool
|
|
|
|
- name: Add subuid and subgid ranges to root
|
|
command: usermod -v 100000-199999 -w 100000-109999 root
|
|
when:
|
|
- lxc_unprivilegied_containers | bool
|
|
- root_subuids.rc != 0
|
|
|
|
- name: Create containers
|
|
include: create-container.yml
|
|
vars:
|
|
name: "{{ item.name }}"
|
|
release: "{{ item.release }}"
|
|
loop: "{{ lxc_containers }}"
|