質問編集履歴
1
expectの使い方で詰まってます。ansible-playbook実行時の具体的なエラーメッセージとansible-playbookの内容を追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,8 +7,7 @@
|
|
7
7
|
このキーボートでの応答を自動化する書き方をアドバイスいただけませんでしょうか。
|
8
8
|
|
9
9
|
具体的には以下の通りです。
|
10
|
-
|
11
|
-
1 パッケージファイルのアップロード
|
10
|
+
1 パッケージファイルのアップロード
|
12
11
|
rpm -ivh esets-4.0.8.x86_64.rpm
|
13
12
|
2 インストール実行
|
14
13
|
sh /tmp/esets-4.0.8.x84_64.rpm.bin
|
@@ -20,4 +19,87 @@
|
|
20
19
|
この手動で応答する必要のある画面操作部分も自動化するための ansible playbook の
|
21
20
|
書き方を教えていただけませんでしょうか。
|
22
21
|
|
22
|
+
---
|
23
|
+
(2016/08/27追記)
|
24
|
+
コメントありがとうございました。
|
25
|
+
expectの使い方を理解しきてなくて、現在の詰まっている状況を追加で質問させてもらいました。。
|
26
|
+
アドバイス、ヒントなどいただけるとありがたいです!
|
27
|
+
|
28
|
+
|
29
|
+
**ansible-playbook実行時のエラーメッセージです。**
|
30
|
+
|
31
|
+
|
32
|
+
---
|
33
|
+
fatal: [192.168.33.27]: FAILED! => {"changed": true, "cmd": ["sh", "/tmp/esets.x86_64.rpm.bin"], "delta": "0:00:00.009306", "end": "2016-08-27 10:56:13.881411", "failed": true, "rc": 1, "start": "2016-08-27 10:56:13.872105", "stderr": "", "stdout": "This is ESET Security distribution script. Press Enter to show the Licence...\n(press q after you have read the License to continue extraction)", "stdout_lines": ["This is ESET Security distribution script. Press Enter to show the Licence...", "(press q after you have read the License to continue extraction)"], "warnings": []}
|
34
|
+
```
|
35
|
+
コマンド実行時の状況
|
36
|
+
|
37
|
+
$ ansible-playbook -i hosts eset_install.yml
|
38
|
+
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure
|
39
|
+
become_method is 'sudo' (default).
|
40
|
+
This feature will be removed in a future release.
|
41
|
+
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
|
42
|
+
|
43
|
+
PLAY [test-svr] ****************************************************************
|
44
|
+
|
45
|
+
TASK [setup] *******************************************************************
|
46
|
+
ok: [192.168.33.27]
|
47
|
+
|
48
|
+
TASK [glibc.i686 install] ******************************************************
|
49
|
+
ok: [192.168.33.27]
|
50
|
+
|
51
|
+
TASK [Install libselinux-python] ***********************************************
|
52
|
+
ok: [192.168.33.27]
|
53
|
+
|
54
|
+
TASK [Check status of selinux] *************************************************
|
55
|
+
changed: [192.168.33.27]
|
56
|
+
|
57
|
+
TASK [ESET installser upload to server] ****************************************
|
58
|
+
ok: [192.168.33.27]
|
59
|
+
|
60
|
+
TASK [ESET nod32.inc LisenceFile upload to server] *****************************
|
61
|
+
ok: [192.168.33.27]
|
62
|
+
|
63
|
+
TASK [Run ESET install shell] **************************************************
|
64
|
+
fatal: [192.168.33.27]: FAILED! => {"changed": true, "cmd": ["sh", "/tmp/esets.x86_64.rpm.bin"], "delta": "0:00:00.009306", "end": "2016-08-27 10:56:13.881411", "failed": true, "rc": 1, "start": "2016-08-27 10:56:13.872105", "stderr": "", "stdout": "This is ESET Security distribution script. Press Enter to show the Licence...\n(press q after you have read the License to continue extraction)", "stdout_lines": ["This is ESET Security distribution script. Press Enter to show the Licence...", "(press q after you have read the License to continue extraction)"], "warnings": []}
|
65
|
+
|
66
|
+
NO MORE HOSTS LEFT *************************************************************
|
67
|
+
[WARNING]: Could not create retry file 'eset_install.retry'. [Errno 2] No such
|
68
|
+
file or directory: ''
|
69
|
+
|
70
|
+
|
71
|
+
PLAY RECAP *********************************************************************
|
72
|
+
192.168.33.27 : ok=6 changed=1 unreachable=0 failed=1
|
73
|
+
|
74
|
+
$
|
75
|
+
```
|
76
|
+
ansible-playbookの内容
|
77
|
+
|
78
|
+
---
|
79
|
+
```
|
80
|
+
---
|
81
|
+
- hosts: test-svr
|
82
|
+
sudo: yes
|
83
|
+
tasks:
|
84
|
+
- name: glibc.i686 install
|
85
|
+
yum: name=glibc.i686 state=latest
|
86
|
+
|
87
|
+
- name: Install libselinux-python
|
88
|
+
yum: name=libselinux-python state=present
|
89
|
+
|
90
|
+
- name: Check status of selinux
|
91
|
+
shell: getenforce
|
92
|
+
|
93
|
+
- name: ESET installser upload to server
|
94
|
+
copy: src=/home/ansible/files/installer/esets.x86_64.rpm.bin dest=/tmp/esets.x86_64.rpm.bin mode=755
|
95
|
+
|
96
|
+
- name: ESET nod32.inc LisenceFile upload to server
|
97
|
+
copy: src=/home/ansible/files/installer/nod32.lic dest=/tmp/nod32.lic
|
98
|
+
|
99
|
+
- name: Run ESET install shell
|
100
|
+
command: sh /tmp/esets.x86_64.rpm.bin
|
101
|
+
```
|
102
|
+
|
103
|
+
|
104
|
+
|
23
105
|
何卒宜しくお願い致します。
|