51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
---
|
|
|
|
- name: Create a new container with minimal options defining network interface with static ip
|
|
become: false
|
|
community.proxmox.proxmox:
|
|
validate_certs: false
|
|
node: proxmox-server
|
|
api_user: root@pam
|
|
api_host: 192.168.0.2
|
|
api_token_id: ansible
|
|
api_token_secret: "{{ proxmox_token_secret }}"
|
|
|
|
cmode: "shell"
|
|
password: "{{ lxc_root_password }}"
|
|
hostname: "{{ lxc_hostname }}"
|
|
ostemplate: 'main:vztmpl/debian-13-golden-image.tar.gz'
|
|
unprivileged: "{{ lxc_is_privileged }}"
|
|
memory: 2048
|
|
cores: 2
|
|
state: present
|
|
disk_volume:
|
|
# This is minimal requirement for rootfs
|
|
# It might be resized later
|
|
size: 4 # 4GB rootfs
|
|
# We put rootfs on fast local storage (NVMe SSD)
|
|
storage: local
|
|
pubkey: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/ansible_key.pub') }}"
|
|
netif:
|
|
net0: "name=eth0,gw=192.168.0.1,ip={{ lxc_ip_address }},bridge=vmbr0"
|
|
|
|
- name: Make sure the container has started
|
|
become: false
|
|
community.proxmox.proxmox:
|
|
validate_certs: false
|
|
node: proxmox-server
|
|
api_user: root@pam
|
|
api_host: 192.168.0.2
|
|
api_token_id: ansible
|
|
api_token_secret: "{{ proxmox_token_secret }}"
|
|
|
|
hostname: "{{ lxc_hostname }}"
|
|
state: started
|
|
retries: 3
|
|
delay: 15
|
|
|
|
- name: Sleep for a minute to ensure that ssh is ready
|
|
become: false
|
|
ansible.builtin.wait_for:
|
|
timeout: 60
|
|
changed_when: false
|