Compare commits
5 Commits
130fcb5069
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 54dfc77e78 | |||
| 6cdfa56880 | |||
| 45de5696f7 | |||
| 53da333970 | |||
| 8530b93fea |
@@ -23,9 +23,15 @@
|
|||||||
- name: Include input and validation for LXC privilege
|
- name: Include input and validation for LXC privilege
|
||||||
ansible.builtin.include_tasks: ../tasks/lxc_privileged_validation.yaml
|
ansible.builtin.include_tasks: ../tasks/lxc_privileged_validation.yaml
|
||||||
|
|
||||||
|
- name: Include input and validation for OS template
|
||||||
|
ansible.builtin.include_tasks: ../tasks/os_template_validation.yaml
|
||||||
|
|
||||||
- name: Include input and validation for human admin user creation
|
- name: Include input and validation for human admin user creation
|
||||||
ansible.builtin.include_tasks: ../tasks/human_admin_user_validation.yaml
|
ansible.builtin.include_tasks: ../tasks/human_admin_user_validation.yaml
|
||||||
|
|
||||||
|
- name: Include input and validation for storage selection
|
||||||
|
ansible.builtin.include_tasks: ../tasks/storage_validation.yaml
|
||||||
|
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ../roles/deploy_lxc_on_proxmox
|
- ../roles/deploy_lxc_on_proxmox
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
- name: Include input and validation for become method
|
- name: Include input and validation for become method
|
||||||
ansible.builtin.include_tasks: ../tasks/become_method_validation.yaml
|
ansible.builtin.include_tasks: ../tasks/become_method_validation.yaml
|
||||||
|
|
||||||
|
- name: Include input and validation for storage selection
|
||||||
|
ansible.builtin.include_tasks: ../tasks/storage_validation.yaml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ../roles/deploy_vm_on_proxmox
|
- ../roles/deploy_vm_on_proxmox
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
cmode: "shell"
|
cmode: "shell"
|
||||||
password: "{{ lxc_root_password }}"
|
password: "{{ lxc_root_password }}"
|
||||||
hostname: "{{ guest_hostname }}"
|
hostname: "{{ guest_hostname }}"
|
||||||
ostemplate: 'main:vztmpl/debian-13-golden-image.tar.gz'
|
ostemplate: "main:vztmpl/{{ guest_os_template }}-golden-image.tar.gz"
|
||||||
unprivileged: "{{ lxc_privileged }}"
|
unprivileged: "{{ not lxc_privileged | bool }}"
|
||||||
memory: 2048
|
memory: 2048
|
||||||
cores: 2
|
cores: 2
|
||||||
state: present
|
state: present
|
||||||
@@ -22,8 +22,10 @@
|
|||||||
# This is minimal requirement for rootfs
|
# This is minimal requirement for rootfs
|
||||||
# It might be resized later
|
# It might be resized later
|
||||||
size: 4 # 4GB rootfs
|
size: 4 # 4GB rootfs
|
||||||
# We put rootfs on fast local storage (NVMe SSD)
|
# We put rootfs on user-selected sotrage
|
||||||
storage: local
|
storage: "{{ guest_storage }}"
|
||||||
|
# We need timeout in case a slow storage is used, since it may cause a significant delay
|
||||||
|
timeout: 90
|
||||||
pubkey: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/ansible_key.pub') }}"
|
pubkey: "{{ lookup('file', lookup('env', 'HOME') + '/.ssh/ansible_key.pub') }}"
|
||||||
netif:
|
netif:
|
||||||
net0: "name=eth0,gw=192.168.0.1,ip={{ guest_ip_address }}/{{ guest_netmask }},bridge=vmbr0"
|
net0: "name=eth0,gw=192.168.0.1,ip={{ guest_ip_address }}/{{ guest_netmask }},bridge=vmbr0"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
clone: "{{ guest_os_template }}-cloud-init-template"
|
clone: "{{ guest_os_template }}-cloud-init-template"
|
||||||
name: "{{ guest_hostname }}"
|
name: "{{ guest_hostname }}"
|
||||||
storage: main
|
storage: "{{ guest_storage }}"
|
||||||
format: qcow2
|
format: qcow2
|
||||||
full: true
|
full: true
|
||||||
timeout: 500
|
timeout: 500
|
||||||
|
|||||||
@@ -25,5 +25,5 @@
|
|||||||
|
|
||||||
- name: Use user input only if provided, otherwise keep the default (netmask)
|
- name: Use user input only if provided, otherwise keep the default (netmask)
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
guest_netmask: "{{ ip_result.user_input.split('/') | second }}"
|
guest_netmask: "{{ ip_result.user_input.split('/')[1] }}"
|
||||||
when: ip_result.user_input | length > 0
|
when: ip_result.user_input | length > 0
|
||||||
|
|||||||
@@ -2,22 +2,20 @@
|
|||||||
|
|
||||||
- name: Set default password
|
- name: Set default password
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
lxc_root_password: "test-guest"
|
lxc_root_password: "test-guest"
|
||||||
|
|
||||||
- name: Prompt for password
|
- name: Prompt for password
|
||||||
ansible.builtin.pause:
|
ansible.builtin.pause:
|
||||||
prompt: "Enter your password [{{ lxc_root_password }}]"
|
prompt: "Enter your password [{{ lxc_root_password }}]"
|
||||||
echo: false
|
echo: false
|
||||||
register: password_result_1
|
register: password_result_1
|
||||||
until: password_result_1.user_input | length == 0
|
|
||||||
retries: 2
|
|
||||||
delay: 0
|
|
||||||
|
|
||||||
- name: Prompt for password (confirmation)
|
- name: Prompt for password confirmation (only if a password was entered)
|
||||||
ansible.builtin.pause:
|
ansible.builtin.pause:
|
||||||
prompt: "Confirm your new password"
|
prompt: "Confirm your new password"
|
||||||
echo: false
|
echo: false
|
||||||
register: password_result_2
|
register: password_result_2
|
||||||
|
when: password_result_1.user_input | length > 0
|
||||||
|
|
||||||
- name: Ensure passwords match
|
- name: Ensure passwords match
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
@@ -25,6 +23,7 @@
|
|||||||
- password_result_1.user_input == password_result_2.user_input
|
- password_result_1.user_input == password_result_2.user_input
|
||||||
fail_msg: "Passwords do not match!"
|
fail_msg: "Passwords do not match!"
|
||||||
success_msg: "Password confirmed."
|
success_msg: "Password confirmed."
|
||||||
|
when: password_result_1.user_input | length > 0
|
||||||
|
|
||||||
- name: Use user input only if provided, otherwise keep the default
|
- name: Use user input only if provided, otherwise keep the default
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Set default storage
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
guest_storage: "main"
|
||||||
|
|
||||||
|
- name: Prompt for guest storage with immediate validation
|
||||||
|
ansible.builtin.pause:
|
||||||
|
prompt: "Choose storage for root, available: main (HDD), local (PCIe NVMe SSD) [{{ guest_storage }}]"
|
||||||
|
register: storage_result
|
||||||
|
until: >
|
||||||
|
storage_result.user_input | length == 0 or
|
||||||
|
(
|
||||||
|
storage_result.user_input in ['main', 'local']
|
||||||
|
)
|
||||||
|
retries: 2
|
||||||
|
delay: 0
|
||||||
|
|
||||||
|
- name: Use user input only if provided, otherwise keep the default
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
guest_storage: "{{ storage_result.user_input }}"
|
||||||
|
when: storage_result.user_input | length > 0
|
||||||
Reference in New Issue
Block a user