- name: a play that runs entirely on the ansible host
  hosts: 127.0.0.1
  connection: local

  vars_prompt:
    - name: "slapos_master_url"
      prompt: "What is the url to the SlapOS Master API?  (ignore if you already have a configured re6st and slapos):"
      private: no
      default: "https://slap.vifib.com/"

    - name: "slapos_web_master_url"
      prompt: "What is the url to the SlapOS Master Website?  (ignore if you already have a configured re6st and slapos):"
      private: no
      default: "https://slapos.vifib.com/"

    - name: "computer_name"
      prompt: "Name your computer (ignore if you already have a configured re6st and slapos or if you don't want to register your computer to SlapOS Master):"
      private: no
      default: "noname"

  pre_tasks:
    - pause:
        prompt: "Input your slapos token (ignore if you already have a configured slapos) [notoken]"
      when: computer_name != "noname"
      register: prompt
    - set_fact:
        slapostoken: "{{ prompt.user_input | default('notoken', true) }}"

    - pause:
        prompt: "Which interface will provide IPv6? (ignore if you already have a configured re6st) [lo]"
      when: slapostoken != "notoken"
      register: prompt
    - set_fact:
        interface_name: "{{ prompt.user_input | default('lo', true) }}"

    - pause:
        prompt: "How many SlapOS computer partitions would you like? [10]"
      when: slapostoken != "notoken"
      register: prompt
    - set_fact:
        partition_number: "{{ prompt.user_input | default('10', true) }}"

  roles:
    - { role: slapos, package_state: present }


