質問編集履歴
1
質問内容をより現実に近い形に改定
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
【試してみた内容】
|
23
|
+
【試してみた内容】(廃止)
|
24
24
|
|
25
25
|
```lang-yml
|
26
26
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
|
53
53
|
```
|
54
54
|
|
55
|
-
【実行結果】
|
55
|
+
【実行結果】(廃止)
|
56
56
|
|
57
57
|
```lang-bash
|
58
58
|
|
@@ -87,3 +87,55 @@
|
|
87
87
|
changed: [www.example.com]
|
88
88
|
|
89
89
|
```
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
【試してみた内容】(改訂版)
|
94
|
+
|
95
|
+
```lang-bash
|
96
|
+
|
97
|
+
$ cat /etc/ansible/hosts
|
98
|
+
|
99
|
+
www.example.com vhost=wp1
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
$ cat test.yml
|
104
|
+
|
105
|
+
---
|
106
|
+
|
107
|
+
- hosts: www.example.com
|
108
|
+
|
109
|
+
gather_facts: no
|
110
|
+
|
111
|
+
roles:
|
112
|
+
|
113
|
+
- test
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
$ cat /etc/ansible/roles/test/tasks/main.yml
|
118
|
+
|
119
|
+
---
|
120
|
+
|
121
|
+
- name: "{{vhost}} at roles/test/tasks/main.yml"
|
122
|
+
|
123
|
+
debug: msg={{vhost}}
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
【実行結果】(改訂版)
|
128
|
+
|
129
|
+
```lang-bash
|
130
|
+
|
131
|
+
$ ansible-playbook test.yml
|
132
|
+
|
133
|
+
TASK: [test | {{vhost}} at roles/test/tasks/main.yml] *************************
|
134
|
+
|
135
|
+
ok: [www.example.com] => {
|
136
|
+
|
137
|
+
"msg": "wp1"
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
```
|