Commit 48570668 authored by Lu Xu's avatar Lu Xu 👀

Fix warning and conditionalize questions when install SlapOS node

See merge request nexedi/slapos.package!136
parents 7d818359 e00c818f
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
- name: Configure SlapOS with slapos node register - name: Configure SlapOS with slapos node register
shell: "slapos node register --token {{ slapostoken }} --master-url {{ slapos_master_url }} --master-url-web {{ slapos_web_master_url }} --interface-name {{ interface_name }} {{ computer_name }}" shell: "slapos node register --token {{ slapostoken }} --master-url {{ slapos_master_url }} --master-url-web {{ slapos_web_master_url }} --interface-name {{ interface_name }} {{ computer_name }}"
when: slapos_cfg.stat.exists == False and "{{ slapostoken }}" != "notoken" and "{{ computer_name }}" != "noname" when: slapos_cfg.stat.exists == False and slapostoken != "notoken" and computer_name != "noname"
- name: Check if configuration exists already - name: Check if configuration exists already
stat: path=/etc/opt/slapos/slapos.cfg stat: path=/etc/opt/slapos/slapos.cfg
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
hosts: 127.0.0.1 hosts: 127.0.0.1
connection: local connection: local
vars:
- interface_name: lo
vars_prompt: vars_prompt:
- name: "slapos_master_url" - name: "slapos_master_url"
prompt: "What is the url to the SlapOS Master API? (ignore if you already have a configured re6st and slapos):" prompt: "What is the url to the SlapOS Master API? (ignore if you already have a configured re6st and slapos):"
...@@ -17,14 +14,24 @@ ...@@ -17,14 +14,24 @@
default: "https://slapos.vifib.com/" default: "https://slapos.vifib.com/"
- name: "computer_name" - name: "computer_name"
prompt: "What is this computer name? (ignore if you already have a configured re6st and slapos):" 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 private: no
default: "noname" default: "noname"
- name: "slapostoken" pre_tasks:
prompt: "If you have slapos token if you have (ignore if you already have a configured slapos):" - pause:
private: no prompt: "Input your slapos token (ignore if you already have a configured slapos) [notoken]"
default: "notoken" when: computer_name != "noname"
register: prompt
- set_fact:
slapostoken: "{{ prompt.user_input | default('notoken', true) }}"
- pause:
prompt: "Which network interface are you using? (ignore if you already have a configured re6st) [lo]"
when: slapostoken != "notoken"
register: prompt
- set_fact:
interface_name: "{{ prompt.user_input | default('lo', true) }}"
roles: roles:
- { role: slapos, package_state: present } - { role: slapos, package_state: present }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment