Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/.vagrant/
**/*.retry
*-console.log
**/all.yaml
12 changes: 12 additions & 0 deletions ch2-inventory/student-trungdc/02-nonFQDN.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
all:
children:
ungrouped:
hosts:
centos21:
ansible_host: 192.168.100.21
centos22:
ansible_host: 192.168.100.22
ubuntu11:
ansible_host: 192.168.100.11
ubuntu12:
ansible_host: 192.168.100.12
19 changes: 19 additions & 0 deletions ch2-inventory/student-trungdc/03-hostgroups-children.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
all:
children:
linux:
children:
centos:
hosts:
centos21:
ansible_host: 192.168.100.21
centos22:
ansible_host: 192.168.100.22
ubuntu:
hosts:
ubuntu11:
ansible_host: 192.168.100.11
ubuntu12:
ansible_host: 192.168.100.12
ungrouped:
hosts:
fakehost.local: {}
24 changes: 24 additions & 0 deletions ch2-inventory/student-trungdc/04-hostvars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
all:
children:
linux:
children:
centos:
hosts:
centos21:
ansible_host: 192.168.100.21
foo: bar1
centos22:
ansible_host: 192.168.100.22
foo: bar1
ubuntu:
hosts:
ubuntu11:
ansible_host: 192.168.100.11
foo: bar
ubuntu12:
ansible_host: 192.168.100.12
foo: bar2
ungrouped:
hosts:
fakehost.local:
foo: bar3
33 changes: 33 additions & 0 deletions ch3-playbook/student-trungdc/07-install-apache-not-work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Playbook for automated apache installation
---
- name: The demo playbook
hosts: all
gather_facts: yes
become: yes

tasks:
- name: Install Apache package Centos
yum:
name: httpd
state: latest
when: ansible_os_family == 'RedHat'

- name: Install Apache package Ubuntu
apt:
name: apache2
state: latest
when: ansible_os_family == 'Debian'

- name: Restart and enable on Centos
service:
name: httpd
state: restarted
enabled: yes
when: ansible_os_family == 'RedHat'

- name: Restart and enable on Ubuntu
service:
name: apache2
state: restarted
enabled: yes
when: ansible_os_family == 'Debian'