BSA_AIS/AIS/lxc-create.yml

34 lines
707 B
YAML
Raw Normal View History

2023-09-26 10:17:33 +00:00
---
- hosts: lokal
become: yes
vars:
lxc_names:
- debian
- suse
- rocky
- ubuntu
tasks:
- name: Create a started container
community.general.lxc_container:
name: "{{ item }}"
container_log: true
template: ubuntu
state: started
template_options: --release focal
#container_command: |
# hostname -I
with_items: "{{ lxc_names }}"
register: lvm_container_info
- name: Variable ausgeben
debug:
msg: "Der Container {{ item.item }} hat {{ item.lxc_container.ips[0] }}"
with_items: "{{ lvm_container_info.results }}"
- name: Create inventory
template:
src: inventory.j2
dest: inventory