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
Binary file added ansible-tower-setup-latest.tar.gz
Binary file not shown.
447 changes: 447 additions & 0 deletions ansible/ansible.cfg

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions ansible/ansible.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA6tLknR2Nx53NjZh8PVrux0EsMmelKPariW4lbqgfvxwe9i30
YPHVeqngh++pwhqb55tHUPFGitUHkU3jDfim4sSFzB21O1Hz5AltaaXacR7qLSSL
aeK7EVHSeho22LT5zzIltWvWRoDaJlVvJiFusc2wjndn99KPhO0X/+YHhLhNSl0H
MShYgSyqB7tnggRvlYDPcpCibs8yQ1/fSfJLoazJILyBAcwukJVRNgam15VmtsTI
JGUFk8bq/TjkkeVV7qTN18tgQi58OuOCC/ChrxI8ZkYPRFEIiiJzSHl1OO0H7NeE
/AUmR4BS+Rq4n9+RtgskGvQTH7IkugqYNppr5QIDAQABAoIBAHulCBNimGDfSnig
LerwkoIAYxE3WdOz7qayhKs7g1vRpsvhbqgNLmckQ8HQBAbck/Lj5C1OneJEQXPV
GxUkNFt7Nyg/DEpr4IvWGvJiDh86M/wJHg9m/zEjcDwyyWZaBJ+AvDJG0dDV0AgX
PCtLt0mQEMMzRF9NU5yeauCncpYCou4ahoQOWt5BmRj9g8YhADPNmXT0gjYpiBRN
uYVip6qWQub7SL1fgJgAhpN0biFrPrH1OXb8t4xY3B9p5k14MzBXmQhdbR4nUan+
DOuO2mm4/qYRsx+lhU6vUdi906TiiSDxpbQ9H+m561xXE/KfaM4iN+k3sUkhsuq9
tsnq/RECgYEA/n0tNGYTvzWc+WwJ8MbY8QG7R238qc4i8qy/CzuteoCN8X1LbkQh
FYgvbjpyxjCx47aXESs3+lkrCWNJOYkjE6lT97eTBa1XCh40APrVY/dyt4RroRvH
p2tl0K5tY6keoA6l/GlEf920HSpxAQmaKoXC5vql40p3aAv9O1i86GcCgYEA7DfT
S17SfhRN6COkMZe7qhp6vieMpdij8+AtaVqHyLFSu0pQSQKhLAcsTKcpZPxH9VOn
JWtgRcS1wPUj0p/XeJmwUWw6NlosG5oPvvSXUwTmOulE7CU1VbGmSVdP5rEk3JSr
cglW8vs/Vpw6b7uiwzoNYSeq5oBtif4yn09iydMCgYEA/m5D7alIgNinMi8z2QfV
CU+D36w0+cff5OOUtTRbAqjYQOHVsk5nDVH0qa3B5if1EgcRDdc5xg+0GVSsdtuG
uDeIfZeJZBmjdbgwofIluiZBCP1ZZd+SQu37AyIAt6zzs24xwSO1mmkblDVEeZcS
DQVikO9zPsTKkLm72cOkSm0CgYEAtYS8mKl4BSyjJWTmErnvmuqYMbGAkh0k+A3n
t5K6zwz8bzHO+hvMMGIet5So6ZI31Zx/z/BwXYyowmteKMdts54ecKNDJGssg9Vi
jjG0azZTmSeSMAjzsDNAfhFbNAIiOmMAUDQ/HZ7WcD7DZQMCMxVUHLl3yYMdKbIt
wmAloMMCgYBH/UYvwhoLnjRmd8ERA0ShbbbIAilOiZlnCGu/ky/emx8232AT5Ej0
GYlSWPE/MkamNmRHoxe7Oqd5MMHvcICwxS6zkzAt6qZiSTw7d9jd4dr5WpJLuqBr
Mc1nKoQ70QN1gL4wpisTvaoKx4VR1ZWiP+j+Bxa+8xTc8snx+LZ6fQ==
-----END RSA PRIVATE KEY-----
2 changes: 2 additions & 0 deletions ansible/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
10.128.0.15 HOSTNAME=NAGIOS
10.128.0.5 HOSTNAME=APP01
3 changes: 3 additions & 0 deletions ansible/playbooks/01-sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- hosts: all
tasks:
- ping:
5 changes: 5 additions & 0 deletions ansible/playbooks/02-debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: all
tasks:
- name: Print a sample message
debug:
msg: "hello, how are you?"
1 change: 1 addition & 0 deletions ansible/playbooks/03-install-package.retry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app01
7 changes: 7 additions & 0 deletions ansible/playbooks/03-install-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- hosts: all
become: yes
tasks:
- name: Install a Package
package:
name: wget
state: installed
13 changes: 13 additions & 0 deletions ansible/playbooks/04-installweb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- hosts: all
become: yes
tasks:
- name: Install Web Server
package:
name: httpd
state: installed

- name: Start Web Server
service:
name: httpd
state: started
enabled: yes
1 change: 1 addition & 0 deletions ansible/playbooks/05-print-fact.retry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app01
6 changes: 6 additions & 0 deletions ansible/playbooks/05-print-fact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: all
#gather_facts: no
tasks:
- name: print os arch
debug:
msg: "OS Arch = {{ansible_architecture}}"
9 changes: 9 additions & 0 deletions ansible/playbooks/06-vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- hosts: all
become: yes
vars:
packname : gcc
tasks:
- name: Install package
package:
name: "{{ packname }}"
state: installed
9 changes: 9 additions & 0 deletions ansible/playbooks/07-vars-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- hosts: all
become: yes
vars_files:
- vars01.yml
tasks:
- name: install package
package:
name: "{{ packname }}"
state: installed
11 changes: 11 additions & 0 deletions ansible/playbooks/08-vars-prompt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- hosts: all
become: yes
vars_prompt:
- name: packname
prompt: "Enter the package name "
private: no
tasks:
- name : "Install {{ packname }} package"
package:
name: "{{packname}}"
state: installed
10 changes: 10 additions & 0 deletions ansible/playbooks/09-register-var.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- hosts: all
become: yes
tasks:
- name: Run some command
shell: ls
register: OUT

- name: Print OUT Variable
debug:
msg: "{{OUT}}"
10 changes: 10 additions & 0 deletions ansible/playbooks/10-set-fact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- hosts: all
become: yes
tasks:
- name: Define a fact
set_fact:
PACK_NAME: httpd

- name: Print PACK_NAME fact
debug:
msg: "{{PACK_NAME}}"
9 changes: 9 additions & 0 deletions ansible/playbooks/11-cond01.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- hosts: all
tasks:
- name: Running false command
shell: "true"
register: OUT
ignore_errors: yes

- shell: echo Hello Failed
when: OUT|failed
15 changes: 15 additions & 0 deletions ansible/playbooks/12-cond02.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- hosts: all
tasks:
- name: Running false command
shell: "false"
register: OUT
ignore_errors: yes


- name: Rpint OUT
debug:
msg: "{{OUT.rc}}"

- name: Run some command
command: "true"
when: OUT.rc == 1
12 changes: 12 additions & 0 deletions ansible/playbooks/13-loop1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- hosts: all
become: yes
tasks:
- name: Install Web packages
package:
name: "{{item}}"
state: installed
with_items:
- httpd
- httpd-devel
- gcc

13 changes: 13 additions & 0 deletions ansible/playbooks/14-loop2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- hosts: all
become: yes
vars:
pack:
- httpd
- httpd-devel
- gcc
tasks:
- name: Install Web packages
package:
name: "{{item}}"
state: installed
with_items: "{{pack}}"
9 changes: 9 additions & 0 deletions ansible/playbooks/15-loop3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- hosts: all
gather_facts: no
tasks:
- name: print some valiues
debug:
msg: "Pack BName = {{item[0]}} , Action Name = {{item[1]}}"
with_nested:
- [ 'httpd' , 'httpd-devel' ]
- [ 'install' , 'update', 'remove' ]
3 changes: 3 additions & 0 deletions ansible/playbooks/16-string-filter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- hosts: localhost
vars:
URL : "http://redrockdigimark.com/apachemirror/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz"
7 changes: 7 additions & 0 deletions ansible/playbooks/17-copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- hosts: all
become: yes
gather_facts: no
tasks:
- copy:
src: "/tmp/abc.txt"
dest: "/root/abc.txt"
10 changes: 10 additions & 0 deletions ansible/playbooks/17-set-fact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- hosts: localhost
vars:
a: "10"
tasks:
- set_fact:
b: "10"
A: "{{a}} / {{b}}"

- debug:
msg: "{{A}}"
9 changes: 9 additions & 0 deletions ansible/playbooks/18-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- hosts: all
become: yes
vars:
IPADDR : 192.168.20.3
tasks:
- name: Copy sample tempalte
template:
src: files/sample.j2
dest: /tmp/sample
6 changes: 6 additions & 0 deletions ansible/playbooks/19-tomcat-start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: all
gather_facts: no
become: yes
tasks:
- name: Start Tomcat
command: nohup '/opt/apache-tomcat-9.0.0.M26/bin/startup.sh'
13 changes: 13 additions & 0 deletions ansible/playbooks/20-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- hosts: all
gather_facts: no
become: yes
tasks:
- name: create database studnet
mysql_db:
name: studentapp
state: present
- name: Import DB
mysql_db:
state: import
name: all
target : /tmp/student.sql
12 changes: 12 additions & 0 deletions ansible/playbooks/21-no-handler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- hosts: all
become: yes
tasks:
- name: Copy mod_jk configuration
copy:
src: files/mod_jk.conf
dest: /etc/httpd/conf.d/mod_jk.conf

- name: Restart Web Service
service:
name: httpd
state: restarted
15 changes: 15 additions & 0 deletions ansible/playbooks/22-handlers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- hosts: all
become: yes
gather_facts: no
tasks:
- name: Copy mod_jk configuration
copy:
src: files/mod_jk.conf
dest: /etc/httpd/conf.d/mod_jk.conf
notify: Restart Web Service

handlers:
- name: Restart Web Service
service:
name: httpd
state: restarted
4 changes: 4 additions & 0 deletions ansible/playbooks/23-role1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- hosts: all
become: yes
roles:
- { role : roleA , TECH: CHEF }
9 changes: 9 additions & 0 deletions ansible/playbooks/24-yumrepo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- hosts: all
become: yes
tasks:
- name: Add repository
yum_repository:
name: epel-new
description: EPEL YUM repo
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/

7 changes: 7 additions & 0 deletions ansible/playbooks/25-autghorized_key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- hosts: all
tasks:
- name: Remove authorized key
authorized_key:
user: admin
state: absent
key: "{{ lookup('file', '/root/admin.pub') }}"
6 changes: 6 additions & 0 deletions ansible/playbooks/26-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: all
become: yes
tasks:
- name: Add user rama
user:
name: rama
15 changes: 15 additions & 0 deletions ansible/playbooks/27-find.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- hosts: all
become: yes
tasks:
- name: Fidn files
find:
paths: "/opt/demo"
patterns: "*.txt"
register: out


- name: Remove files
file:
name: "{{item.path}}"
state: absent
with_items: "{{out.files}}"
6 changes: 6 additions & 0 deletions ansible/playbooks/28-hostname.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: all
become: yes
tasks:
- name: Change hostname
hostname:
name: "{{HOSTNAME}}"
9 changes: 9 additions & 0 deletions ansible/playbooks/29-print.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$ANSIBLE_VAULT;1.1;AES256
65366536333865376465323762326132393234656266663130313735656462656139393761353933
6263323161663939636537626663323861636562393337340a303263643565333364336565323934
65306532633031613432643138623337343336383431616561626331336132333234646631386139
3065333466646562620a623533656533616361666137656532373266393839646635653632336662
65613238366561623838346664653065396361393865353134616562646137373333383535623631
63356263616363623638313562303531383062343434376638383431326133616535383039613032
65633937333763306637633366633139386333343335666138643266323331393831376637643836
39623836376230663764
33 changes: 33 additions & 0 deletions ansible/playbooks/create-gce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- name: Create google instance
hosts: localhost
tasks:
- gce:
instance_names: my-test-instance1
zone: us-central1-a
machine_type: n1-standard-1
image: centos-7-v20170816
state: present
service_account_email: "ansible@junebatch-170007.iam.gserviceaccount.com"
credentials_file: "/root/ansible.json"
project_id: "junebatch-170007"
disk_size: 10
register: out

- add_host:
hostname: "{{item.private_ip}}"
groupname: new
with_items: "{{out.instance_data}}"

- name: Wait for SSH for instances
wait_for:
delay: 1
host: "{{ item.private_ip }}"
port: 22
state: started
timeout: 300
with_items: "{{ out.instance_data }}"

- name: Run uptime commannd
hosts: new
tasks:
- shell : uptime
Loading