tp ssh : initial commit

This commit is contained in:
2020-09-28 11:17:58 +02:00
commit a4c81a00c9
5 changed files with 253 additions and 0 deletions

39
0eval.yml Normal file
View File

@@ -0,0 +1,39 @@
---
- hosts: b1
user: root
gather_facts: false
vars_prompt:
- name: script
prompt: "script? "
private: false
- name: result_file
prompt: "result file ? "
private: false
pre_tasks:
- name: insert header
lineinfile:
path: "{{ result_file }}"
line: "machine\tuser\tquestions.."
state: present
create: true
delegate_to: localhost
tasks:
- name: copy script
copy:
src: "{{ script }}"
dest: /root
mode: 0700
- name: exec script
command: "/root/{{ script }}"
register: result
post_tasks:
- name: get result
lineinfile:
path: "{{ result_file }}"
line: "{{ result.stdout }}"
create: true
delegate_to: localhost