質問編集履歴

2

調査経過を追記

2020/06/26 06:54

投稿

papachiropa
papachiropa

スコア14

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,71 @@
67
67
  ↑を見ると{{ansible_eth0.ipv4.address}} {{inventory_hostname}}辺りを使うのかなと思いますが
68
68
 
69
69
  どのように組み込むのか分からないです。他にも方法が無いか現在調査中です。
70
+
71
+
72
+
73
+ ~追記~
74
+
75
+ インベントリファイルにホスト名の記載が出来ていなかった為、
76
+
77
+ {{inventory_hostname}}で指定してもホスト名が表示されずIPが追記されてしまったことが分かりました。
78
+
79
+ すみませんでした。インベントリファイルにホスト名を追記するとhttpd.confの編集は成功しました。
80
+
81
+ しかし、最後の起動で失敗してしまいます。エラーメッセージは以下です。
82
+
83
+
84
+
85
+ ```ERROR
86
+
87
+ [root@hoge tmp]# ansible-playbook Apache.yml -i hosts
88
+
89
+ SSH password:
90
+
91
+
92
+
93
+ PLAY [tomcat] *************************************************************************************************************************************
94
+
95
+
96
+
97
+ TASK [Gathering Facts] ****************************************************************************************************************************
98
+
99
+ ok: [host1]
100
+
101
+ ok: [host3]
102
+
103
+
104
+
105
+ TASK [apache : install Apache] ********************************************************************************************************************
106
+
107
+ ok: [host3]
108
+
109
+ ok: [host1]
110
+
111
+
112
+
113
+ TASK [apache : set httpd.conf] ********************************************************************************************************************
114
+
115
+ changed: [host1]
116
+
117
+ changed: [host3]
118
+
119
+
120
+
121
+ TASK [apache : run httpd] *************************************************************************************************************************
122
+
123
+ fatal: [host1]: FAILED! => {"changed": false, "msg": "Unable to start service httpd: Job for httpd.service failed because the control process exited with error code. See \"systemctl status httpd.service\" and \"journalctl -xe\" for details.\n"}
124
+
125
+ fatal: [host3]: FAILED! => {"changed": false, "msg": "Unable to start service httpd: Job for httpd.service failed because the control process exited with error code. See \"systemctl status httpd.service\" and \"journalctl -xe\" for details.\n"}
126
+
127
+ to retry, use: --limit @/tmp/Apache.retry
128
+
129
+
130
+
131
+ PLAY RECAP ****************************************************************************************************************************************
132
+
133
+ host1 : ok=3 changed=1 unreachable=0 failed=1
134
+
135
+ host3 : ok=3 changed=1 unreachable=0 failed=1
136
+
137
+ ```

1

誤記修正

2020/06/26 06:54

投稿

papachiropa
papachiropa

スコア14

test CHANGED
File without changes
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  - hosts: tomcat
12
12
 
13
- gather_facts: no
13
+ gather_facts: yes
14
14
 
15
15
  remote_user: root
16
16
 
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- - name: set tomcat-users.xml
29
+ - name: set httpd.conf
30
30
 
31
31
  template:
32
32