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
6 changes: 6 additions & 0 deletions ch2-inventory/student-quanpt/01-ipOnly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
all:
hosts:
192.168.100.11:
192.168.100.12:
192.168.100.21:
192.168.100.22:
12 changes: 12 additions & 0 deletions ch2-inventory/student-quanpt/02-nonFQDN.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
all:
hosts:
ubuntu11:
ansible_host: 192.168.100.11
ubuntu12:
ansible_host: 192.168.100.12
centos21:
ansible_host: 192.168.100.21
centos22:
ansible_host: 192.168.100.22
ubuntu-2:
ansible_host: 192.168.94.242
18 changes: 18 additions & 0 deletions ch2-inventory/student-quanpt/03-hostgroups-children-copy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
all:
hosts:
fakehost.local:
children:
linux:
children:
ubuntu:
hosts:
ubuntu11:
ansible_host: 192.168.100.11
ubuntu12:
ansible_host: 192.168.100.12
centos:
hosts:
centos21:
ansible_host: 192.168.100.21
centos22:
ansible_host: 192.168.100.22
10 changes: 5 additions & 5 deletions ch3-playbook/07-install-apache-not-work.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

tasks:
- name: Install Apache package
yum:
name: httpd
apt:
name: apache2
state: latest

- name: Restart and enable the service
service:
name: httpd
systemd:
name: apache2
state: restarted
enabled: yes
enabled: yes
25 changes: 25 additions & 0 deletions ch3-playbook/08-quanpt-apache-helloworld.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Playbook for automated apache installation
---
- name: The demo playbook
hosts: all
gather_facts: yes
become: yes
vars:
my_name: 'QuanPT'

tasks:
- name: Install Apache package
apt:
name: apache2
state: latest

- name: template index.html
template:
src: ./files/index.html
dest: /var/www/html/
mode: 0755
- name: Restart and enable the service
systemd:
name: apache2
state: restarted
enabled: yes
1 change: 1 addition & 0 deletions ch3-playbook/files/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{my_name}}
16 changes: 8 additions & 8 deletions ch3-playbook/inventory/hosts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[ubuntu]
ubuntu11 ansible_host=192.168.100.11
ubuntu12 ansible_host=192.168.100.12
ubuntu-2 ansible_host=192.168.94.242
ubuntu-3 ansible_host=192.168.94.243

[centos]
centos21 ansible_host=192.168.100.21
centos22 ansible_host=192.168.100.22
#[centos]
#centos21 ansible_host=192.168.100.21
#centos22 ansible_host=192.168.100.22


[linux:children]
ubuntu
centos
#[linux:children]
#ubuntu
#centos