summaryrefslogtreecommitdiffstats
path: root/roles/pve-lxc/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/pve-lxc/tasks')
-rw-r--r--roles/pve-lxc/tasks/main.yml50
1 files changed, 50 insertions, 0 deletions
diff --git a/roles/pve-lxc/tasks/main.yml b/roles/pve-lxc/tasks/main.yml
new file mode 100644
index 00000000..5d035270
--- /dev/null
+++ b/roles/pve-lxc/tasks/main.yml
@@ -0,0 +1,50 @@
+---
+- name: "Download LXC template"
+ community.general.proxmox_template:
+ api_host: "{{ ansible_facts['hostname'] }}"
+ api_user: "{{ pve_admin_user }}@pve"
+ api_password: "{{ pve_admin_password }}"
+ node: "{{ ansible_facts['hostname'] }}"
+ storage: "local"
+ content_type: "vztmpl"
+ template: "{{ pve_lxc_template }}"
+ state: present
+ no_log: true
+ tags:
+ # PVE API not available in containers — requires proxmox-ve package
+ - "molecule-notest"
+
+- name: "Provision LXC container"
+ community.general.proxmox:
+ api_host: "{{ ansible_facts['hostname'] }}"
+ api_user: "{{ pve_admin_user }}@pve"
+ api_password: "{{ pve_admin_password }}"
+ node: "{{ ansible_facts['hostname'] }}"
+ vmid: "{{ pve_lxc_id }}"
+ hostname: "{{ pve_lxc_hostname }}"
+ ostemplate: "local:vztmpl/{{ pve_lxc_template }}"
+ disk: "{{ pve_lxc_disk }}"
+ cores: "{{ pve_lxc_cores }}"
+ memory: "{{ pve_lxc_memory }}"
+ pubkey: "{{ user_public_keys | join('\n') }}"
+ netif:
+ net0: "name=eth0,ip={{ pve_lxc_ip }},gw={{ pve_lxc_gateway }},bridge=vmbr0"
+ nameserver: "{{ pve_lxc_dns }}"
+ onboot: true
+ unprivileged: true
+ state: present
+ tags:
+ # PVE API not available in containers — requires proxmox-ve package
+ - "molecule-notest"
+
+- name: "Start LXC container"
+ community.general.proxmox:
+ api_host: "{{ ansible_facts['hostname'] }}"
+ api_user: "{{ pve_admin_user }}@pve"
+ api_password: "{{ pve_admin_password }}"
+ vmid: "{{ pve_lxc_id }}"
+ state: started
+ no_log: true
+ tags:
+ # PVE API not available in containers — requires proxmox-ve package
+ - "molecule-notest"