feat(pb): makes human admin user optional #27

Merged
max merged 1 commits from issue-10-human-admin-optional into dev 2026-09-15 17:57:15 +04:00
2 changed files with 41 additions and 8 deletions
@@ -33,6 +33,11 @@
default: true
private: false
- name: lxc_create_human_admin_user
prompt: "Create human admin user? (true/false)?"
default: true
private: false
pre_tasks:
- name: Validate hostname
ansible.builtin.fail:
@@ -57,12 +62,15 @@
- name: Make the prompted hostname available to the whole playbook
ansible.builtin.set_fact:
fact_lxc_hostname: "{{ lxc_hostname }}"
- name: Make the prompted IP available to the whole playbook
ansible.builtin.set_fact:
#fact_lxc_ip_address: "{{ lxc_ip_address | ansible.utils.ipaddr('address') }}"
fact_lxc_ip_address: "{{ lxc_ip_address.split('/') | first }}"
- name: Make the "human admin user" selection available to the whole playbook
ansible.builtin.set_fact:
fact_lxc_create_human_admin_user: "{{ lxc_create_human_admin_user }}"
- name: Add the target host to the inventory
ansible.builtin.add_host:
name: "{{ fact_lxc_ip_address }}"
@@ -85,7 +93,15 @@
- ../roles/configure_ansible_user
- ../roles/harden_ssh
- ../roles/base_system
- ../roles/human_admin_user
# Update configs - omz, nvim, ranger and so on. Distribute the last version of those configs
- ../roles/update_configs
tasks:
- name: Include human admin user role
ansible.builtin.include_role:
name: ../roles/human_admin_user
when: "hostvars['localhost']['fact_lxc_create_human_admin_user'] | bool"
- name: Include update configs role
ansible.builtin.include_role:
name: ../roles/update_configs
when: "hostvars['localhost']['fact_lxc_create_human_admin_user'] | bool"
+20 -3
View File
@@ -26,6 +26,11 @@
default: "sudo"
private: false
- name: vm_create_human_admin_user
prompt: "Create human admin user? (true/false)?"
default: true
private: false
- name: vm_ip_address
prompt: "IP address for the VM (in x.x.x.x/x formant)"
default: "192.168.0.89/24"
@@ -80,6 +85,10 @@
ansible.builtin.set_fact:
fact_vm_ip_address: "{{ vm_ip_address.split('/') | first }}"
- name: Make the "human admin user" selection available to the whole playbook
ansible.builtin.set_fact:
fact_vm_create_human_admin_user: "{{ vm_create_human_admin_user }}"
- name: Add the target host to the inventory
ansible.builtin.add_host:
name: "{{ fact_vm_ip_address }}"
@@ -103,7 +112,15 @@
- ../roles/configure_ansible_user
- ../roles/harden_ssh
- ../roles/base_system
- ../roles/human_admin_user
# Update configs - omz, nvim, ranger and so on. Distribute the last version of those configs
- ../roles/update_configs
tasks:
- name: Include human admin user role
ansible.builtin.include_role:
name: ../roles/human_admin_user
when: "hostvars['localhost']['fact_vm_create_human_admin_user'] | bool"
- name: Include update configs role
ansible.builtin.include_role:
name: ../roles/update_configs
when: "hostvars['localhost']['fact_vm_create_human_admin_user'] | bool"