diff --git a/roles/init-server/tasks/contingent/pkg/surge.yml b/roles/init-server/tasks/contingent/pkg/surge.yml index dcd2441..ca211d8 100644 --- a/roles/init-server/tasks/contingent/pkg/surge.yml +++ b/roles/init-server/tasks/contingent/pkg/surge.yml @@ -19,8 +19,40 @@ ansible.builtin.command: cmd: surge token register: surge_token -- name: Presenting Surge API token to Control Node - ansible.builtin.debug: - msg: "Make sure to store the following API token for Surge:\n {{ surge_token.stdout }}" -- name: Pausing to ensure completion of manual act +- name: Pausing to inquire about how to proceed ansible.builtin.pause: + prompt: "Type \"fetch\" to get the Surge API token, or \"show\" to see it for manual copying instead" + echo: true + register: data_method +- name: Choosing to present Surge API token to Control Node + when: data_method.user_input == "show" + block: + - name: Presenting Surge API token to Control Node + ansible.builtin.debug: + msg: "Make sure to store the following API token for Surge:\n {{ surge_token.stdout }}" + - name: Giving opportunity to manually copy Surge API token + ansible.builtin.pause: +- name: Choosing to provide file on control node containing Surge's API token + when: data_method.user_input == "fetch" + block: + - name: Creating temporary file on managed node that stores Surge API token + become: true + ansible.builtin.copy: + content: "{{ surge_token.stdout }}" + dest: /tmp/surge.token + owner: "{{ ansible_user }}" + group: "{{ ansible_user }}" + mode: "644" + state: touch + register: surge_token + - name: Placing Surge API token into file on control node + ansible.builtin.fetch: + src: "{{ surge_token.dest }}" + dest: "/var/tmp/{{ inventory_hostname }}/surge.token" + flat: true + - name: Informing control node of acquired files + ansible.builtin.debug: + msg: "The Surge API token file have been duplicated to '/var/tmp/{{ inventory_hostname }}/surge.token' at the control node." + - name: Giving control node user time to read the aforementiioned message + ansible.builtin.pause: + seconds: 30 \ No newline at end of file