質問編集履歴

12

説明文の修正

2023/04/25 11:34

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -105,7 +105,7 @@
105
105
  fatal: [dev01]: FAILED! => {"msg": "The task includes an option with an undefined variable.
106
106
  ```
107
107
  そこでhostsを以下のように修正して実行しました。
108
- ```hosts
108
+ ```hosts
109
109
  [1st]
110
110
  www.tokyo.co.jp
111
111
 

11

説明文の修正

2023/04/25 11:26

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -39,7 +39,7 @@
39
39
  gourp_vars配下の変数用のファイルが反映されていない様子です。
40
40
 
41
41
  ```
42
- fatal: [dev01]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'vip_ipaddress' is undefined. 'vip_ipaddress' is undefined\n\nThe error appears to be in '/vip_set.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: make /hoge/vip.conf\n ^ here\n"}
42
+ fatal: [dev01]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'vip_ipaddress' is undefined. 'vip_ipaddress' is undefined\n\nThe error appears to be in '/home/user/playbook/roles/hoge/tasks/vip_set.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: make /hoge/vip.conf\n ^ here\n"}
43
43
  ```
44
44
 
45
45
  ### 該当のソースコード
@@ -104,3 +104,18 @@
104
104
  ```
105
105
  fatal: [dev01]: FAILED! => {"msg": "The task includes an option with an undefined variable.
106
106
  ```
107
+ そこでhostsを以下のように修正して実行しました。
108
+ ```hosts
109
+ [1st]
110
+ www.tokyo.co.jp
111
+
112
+ [2nd]
113
+ www.osaka.co.jp
114
+
115
+ [3rd]
116
+ www.kobe.co.jp
117
+ ```
118
+ しかし、同エラーとなりました。
119
+ ```
120
+ fatal: [www.tokyo.co.jp]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'vip_ipaddress' is undefined. 'vip_ipaddress' is undefined\n\nThe error appears to be in ‘/home/user/playbook/roles/hoge/tasks/vip_set.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: make /etc/vip.conf\n ^ here\n"}
121
+ ```

10

説明文の修正

2023/04/25 11:04

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -39,7 +39,7 @@
39
39
  gourp_vars配下の変数用のファイルが反映されていない様子です。
40
40
 
41
41
  ```
42
- fatal: [1st]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'vip_ipaddress' is undefined. 'vip_ipaddress' is undefined\n\nThe error appears to be in '/vip_set.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: make /hoge/vip.conf\n ^ here\n"}
42
+ fatal: [dev01]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'vip_ipaddress' is undefined. 'vip_ipaddress' is undefined\n\nThe error appears to be in '/vip_set.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: make /hoge/vip.conf\n ^ here\n"}
43
43
  ```
44
44
 
45
45
  ### 該当のソースコード
@@ -47,13 +47,13 @@
47
47
  hostsは下記のような3種類のグループに分けています。
48
48
  ```hosts
49
49
  [1st]
50
- tokyo01 ansible_ssh_host=www.tokyo.co.jp
50
+ dev01 ansible_ssh_host=www.tokyo.co.jp
51
51
 
52
52
  [2nd]
53
- osaka02 ansible_ssh_host=www.osaka.co.jp
53
+ dev02 ansible_ssh_host=www.osaka.co.jp
54
54
 
55
55
  [3rd]
56
- kobe03 ansible_ssh_host=www.kobe.co.jp
56
+ dev03 ansible_ssh_host=www.kobe.co.jp
57
57
  ```
58
58
 
59
59
  ```playbook.yml
@@ -97,3 +97,10 @@
97
97
  gourp_vars配下のファイルから .yml を取り、1st、2nd、3rdにしましたが
98
98
  同エラーは解消しませんでした。
99
99
 
100
+ ### 気づいたこと
101
+ playbook.ymlにはhostsとして1stを設定していますが、エラー内容を見ますとdev01になっていました。
102
+
103
+ エラーメッセージの抜萃
104
+ ```
105
+ fatal: [dev01]: FAILED! => {"msg": "The task includes an option with an undefined variable.
106
+ ```

9

エラー内容を修正

2023/04/25 11:01

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -39,7 +39,7 @@
39
39
  gourp_vars配下の変数用のファイルが反映されていない様子です。
40
40
 
41
41
  ```
42
- fatal: [dev01]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'vip_ipaddress' is undefined. 'vip_ipaddress' is undefined\n\nThe error appears to be in '/vip_set.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: make /hoge/vip.conf\n ^ here\n"}
42
+ fatal: [1st]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'vip_ipaddress' is undefined. 'vip_ipaddress' is undefined\n\nThe error appears to be in '/vip_set.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: make /hoge/vip.conf\n ^ here\n"}
43
43
  ```
44
44
 
45
45
  ### 該当のソースコード

8

説明文の修正

2023/04/25 10:56

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -94,5 +94,6 @@
94
94
 
95
95
  ### 試したこと
96
96
 
97
- gourp_vars配下のファイルから .yml を取り、1st、2nd、3rdにしましたが同エラーは解消しませんでした。
97
+ gourp_vars配下のファイルから .yml を取り、1st、2nd、3rdにしましたが
98
+ 同エラーは解消しませんでした。
98
99
 

7

説明文の修正

2023/04/25 10:54

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -65,7 +65,7 @@
65
65
  ```
66
66
  ```main.yml
67
67
  ---
68
- - include_tasks: vip_setyml
68
+ - include_tasks: vip_set.yml
69
69
  ```
70
70
 
71
71
  ```vip_set.yml

6

タイトル文の修正

2023/04/25 10:52

投稿

khaii21
khaii21

スコア66

test CHANGED
@@ -1 +1 @@
1
- Ansible ロールによる変数の設定 / gourp_vars配下にサーバグループ毎の変数用のファイルを置いているが変数が反映されない
1
+ Ansible ロールによる変数の設定 / gourp_vars配下にサーバグループ毎の変数用のファイルを置いて変数が反映されない
test CHANGED
File without changes

5

タイトルの修正

2023/04/25 10:51

投稿

khaii21
khaii21

スコア66

test CHANGED
@@ -1 +1 @@
1
- Ansible ロールによるgourp_vars配下にサーバグループ毎の変数用のファイルを置いているが変数が反映されない
1
+ Ansible ロールによる変数の設定 / gourp_vars配下にサーバグループ毎の変数用のファイルを置いているが変数が反映されない
test CHANGED
File without changes

4

説明文の修正

2023/04/25 10:49

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -94,5 +94,5 @@
94
94
 
95
95
  ### 試したこと
96
96
 
97
- gourp_vars配下のファイルから .yml を取り、1st、2nd、3rdにしましたがどうエラー解消しませんでした。
97
+ gourp_vars配下のファイルから .yml を取り、1st、2nd、3rdにしましたがエラー解消しませんでした。
98
98
 

3

タイトルの修正

2023/04/25 10:45

投稿

khaii21
khaii21

スコア66

test CHANGED
@@ -1 +1 @@
1
- Ansible gourp_vars配下にサーバグループ毎の変数用のファイルを置いているが変数が反映されない
1
+ Ansible ロールによるgourp_vars配下にサーバグループ毎の変数用のファイルを置いているが変数が反映されない
test CHANGED
File without changes

2

説明文の修正

2023/04/25 10:30

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
  3rdグループのサーバに対しては333.333.333.333のアドレスを設定したいです。
7
7
 
8
8
  gourp_vars 配下にサーバグループ名と同じ名前のファイルを置けば
9
- 自動的に変数が反映される認識です。
9
+ 自動的に変数がサーバグループに紐付けされる認識です。
10
10
 
11
11
  何かお気づきの方がいらっしゃいましたらご教授頂けないでしょうか。
12
12
  宜しくお願い致します。

1

説明文の修正

2023/04/25 10:07

投稿

khaii21
khaii21

スコア66

test CHANGED
File without changes
test CHANGED
@@ -4,6 +4,9 @@
4
4
  1stグループのサーバに対しては111.111.111.111、
5
5
  2ndグループのサーバに対しては222.222.222.222、
6
6
  3rdグループのサーバに対しては333.333.333.333のアドレスを設定したいです。
7
+
8
+ gourp_vars 配下にサーバグループ名と同じ名前のファイルを置けば
9
+ 自動的に変数が反映される認識です。
7
10
 
8
11
  何かお気づきの方がいらっしゃいましたらご教授頂けないでしょうか。
9
12
  宜しくお願い致します。