Skip to content

Commit a8b3b97

Browse files
committed
Minor-commit
1 parent 05c53bf commit a8b3b97

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

demo-scripts/demo1/sample.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
- hosts: demo_hosts
3+
vars:
4+
package1 : "nginx"
5+
package2 : "wget"
6+
tasks:
7+
- name: Installing package nginx
8+
apt: pkg=nginx state=installed update_cache=true
9+
become: true
10+
- name: Installing wget
11+
apt: name={{ package2 }} state=installed update_cache=true
12+
become: true
13+
- name: Copying test1 file
14+
copy: src=/tmp/test11 dest=/tmp/test11
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
- hosts: web_portal
3+
tasks:
4+
- name: Apt get update
5+
apt: update_cache=yes
6+
7+
- name: Install Apache2, nginx, nmap
8+
apt: name={{ item }} update_cache=no
9+
with_items:
10+
- apache2
11+
- nginx
12+
- nmap
13+
14+
- name: Copy data files
15+
copy: src=index.html dest=/var/www/html/
16+
17+
- name: Stop the service
18+
service: name=apache2 state=stopped
19+
20+
- name: Copy template file
21+
template: src=current.html.j2 dest=/var/www/html/current.html
22+
notify:
23+
- Start apache
24+
25+
- name: Testing conditional
26+
shell: uptime
27+
when: ansible_hostname == "node01"
28+
29+
- name : Testing untill
30+
shell: service apache2 status
31+
register: result
32+
until: result.stdout.find("active (running)") != -1
33+
retries: 5
34+
delay: 5
35+
36+
37+
38+
handlers:
39+
- name: Start apache
40+
service: name=apache2 state=restarted

demo-scripts/demo2/current.html.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This is my current file -
2+
My hostname is - {{ ansible_hostname }}

demo-scripts/demo2/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is my test web page

0 commit comments

Comments
 (0)