---
- hosts: localhost
  name: bootstrap Arch Linux system
  connection: local

  vars_prompt:
    - name: luks_passphrase
      prompt: "encryption passphrase:"
      private: yes
      confirm: yes

    - name: user_password
      prompt: "user password:"
      encrypt: "sha512_crypt"
      private: yes
      confirm: yes

  pre_tasks:
    - include_vars: "host_vars/{{ machine_aliases[ansible_product_name] }}"

    # Make prompted vars available for all plays.
    - set_fact:
        luks_passphrase: "{{ luks_passphrase }}"

    - set_fact:
        user_password: "{{ user_password }}"

  tasks:
    - import_role:
        name: arch-bootstrap


- hosts: chroot
  name: install minimal Arch Linux system
  connection: chroot

  pre_tasks:
    - include_vars: "host_vars/{{ machine_aliases[ansible_product_name] }}"

  roles:
    - arch-chroot


- hosts: localhost
  connection: local
  name: finish up installation
  tasks:
    - name: copy playbook to newly installed system
      command: "cp -ar {{ playbook_dir }} {{ arch_root }}/home/{{ user.name }}"

    - name: unmount partitions with the new system
      command: umount -Rf {{ arch_root }}

    - name: close LUKS encrypted devices
      command: "cryptsetup luksClose /dev/mapper/arch-{{ item.name }}"
      with_items: "{{ drive.partitions }}"
      when: item.encrypt

    - name: reboot
      command: reboot

---
- hosts: localhost
  name: bootstrap Arch Linux system
  connection: local

  vars_prompt:
    - name: luks_passphrase
      prompt: "encryption passphrase:"
      private: yes
      confirm: yes

    - name: user_password
      prompt: "user password:"
      encrypt: "sha512_crypt"
      private: yes
      confirm: yes

  pre_tasks:
    - include_vars: "host_vars/{{ machine_aliases[ansible_product_name] }}"

    # Make prompted vars available for all plays.
    - set_fact:
        luks_passphrase: "{{ luks_passphrase }}"

    - set_fact:
        user_password: "{{ user_password }}"

  tasks:
    - import_role:
        name: arch-bootstrap


- hosts: chroot
  name: install minimal Arch Linux system
  connection: chroot

  pre_tasks:
    - include_vars: "host_vars/{{ machine_aliases[ansible_product_name] }}"

  roles:
    - arch-chroot


- hosts: localhost
  connection: local
  name: finish up installation
  tasks:
    - name: copy playbook to newly installed system
      copy:
        src: "{{ playbook_dir }}"
        dest: "{{ arch_root }}/home/{{ user.name }}/"
        owner: "{{ user.name }}"
        group: "{{ user.group }}"

    - name: unmount partitions with the new system
      command: umount -Rf {{ arch_root }}

    - name: close LUKS encrypted devices
      command: "cryptsetup luksClose /dev/mapper/arch-{{ item.name }}"
      with_items: "{{ drive.partitions }}"
      when: item.encrypt

    - name: reboot
      command: reboot

Use ansible copy module to copy playbook
Use ansible copy module to copy playbook
