diff --git a/inventory/host_vars/hulder.yaml b/inventory/host_vars/hulder.yaml index ead4b07..5c67bc7 100644 --- a/inventory/host_vars/hulder.yaml +++ b/inventory/host_vars/hulder.yaml @@ -1,6 +1,6 @@ --- ansible_user: root -ansible_host: 10.4.0.49 +#ansible_host: 10.4.0.49 base_root_swap_mib: "{{ 1024 * 16 }}" base_root_efi_mib: 512 diff --git a/inventory/hosts b/inventory/hosts index 2b73d7f..072ebf5 100644 --- a/inventory/hosts +++ b/inventory/hosts @@ -1,5 +1,2 @@ -[all] -localhost - [base] hulder diff --git a/local.yml b/local.yml index 7f73f39..2b060a4 100644 --- a/local.yml +++ b/local.yml @@ -1,7 +1,6 @@ --- - hosts: all - tasks: - - name: determine hostname if this is running from archiso - debug: msg=hello + roles: + - detect_archiso - import_playbook: playbooks/install.yaml diff --git a/playbooks/install.yaml b/playbooks/install.yaml index b03467e..fc1cc9b 100644 --- a/playbooks/install.yaml +++ b/playbooks/install.yaml @@ -1,6 +1,11 @@ --- -- name: Provision new Arch workstation from scratch +- name: Check if we appear to be inside an ArchLinux live install environment hosts: all + roles: + - detect_archiso + +- name: Provision new Arch workstation from scratch + hosts: base tags: base roles: - base diff --git a/roles/detect_archiso/tasks/main.yaml b/roles/detect_archiso/tasks/main.yaml new file mode 100644 index 0000000..8a043c1 --- /dev/null +++ b/roles/detect_archiso/tasks/main.yaml @@ -0,0 +1,13 @@ +- name: check for archinstall in path + command: which archinstall + ignore_errors: true + register: which_archinstall + +- name: inspect archinstall result + set_fact: + archiso_detected: "{{ which_archinstall.rc == 0 }}" + +- name: override the inventory_hostname + set_fact: + inventory_hostname: "{{ hostname }}" + when: archiso_detected