Skip to content

Commit 839b53f

Browse files
authored
Create variables
1 parent e426dff commit 839b53f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

variables

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Create a VARS section inside the playbook to define VARIABLES
2+
# THE PALYBOOK IS RUN FROM TOP TO BOTTOM
3+
-> So then the VARS section should be next to the top
4+
-> KEY:VALUE
5+
6+
- hosts: appserver
7+
vars:
8+
control_server: localhost
9+
web_root: /var/www/html/
10+
tasks:
11+
- name: Install Lynx on APP Servers
12+
yum: pkg=lynx state=installed update_cache=true
13+
14+
# RATHER than describing variables inside the main YAML file,
15+
# reference a VAR file where to check for VARIABLES
16+
17+
- hosts: appserver
18+
vars_files:
19+
- vars.yml
20+
tasks:
21+
- name: Install Lynx on APP Servers
22+
yum: pkg=lynx state=installed update_cache=true
23+
24+
#CREATE the VAR File
25+
26+
$vi vars.yml
27+
28+
control_server: localhost
29+
web_root: /var/www/html/
30+
31+
# We can STILL HAVE a VARS section inside the main YAML fie

0 commit comments

Comments
 (0)