diff --git a/ansible-tower-setup-latest.tar.gz b/ansible-tower-setup-latest.tar.gz
new file mode 100644
index 0000000..cf5da0a
Binary files /dev/null and b/ansible-tower-setup-latest.tar.gz differ
diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
new file mode 100644
index 0000000..a9df18c
--- /dev/null
+++ b/ansible/ansible.cfg
@@ -0,0 +1,447 @@
+# config file for ansible -- https://ansible.com/
+# ===============================================
+
+# nearly all parameters can be overridden in ansible-playbook
+# or with command line flags. ansible will read ANSIBLE_CONFIG,
+# ansible.cfg in the current working directory, .ansible.cfg in
+# the home directory or /etc/ansible/ansible.cfg, whichever it
+# finds first
+
+[defaults]
+
+# some basic default values...
+
+#inventory = /etc/ansible/hosts
+inventory = /root/ansible/inventory
+#library = /usr/share/my_modules/
+#module_utils = /usr/share/my_module_utils/
+#remote_tmp = ~/.ansible/tmp
+#local_tmp = ~/.ansible/tmp
+#forks = 5
+#poll_interval = 15
+#sudo_user = root
+#ask_sudo_pass = True
+#ask_pass = True
+#transport = smart
+#remote_port = 22
+#module_lang = C
+#module_set_locale = False
+
+# plays will gather facts by default, which contain information about
+# the remote system.
+#
+# smart - gather by default, but don't regather if already gathered
+# implicit - gather by default, turn off with gather_facts: False
+# explicit - do not gather by default, must say gather_facts: True
+#gathering = implicit
+
+# This only affects the gathering done by a play's gather_facts directive,
+# by default gathering retrieves all facts subsets
+# all - gather all subsets
+# network - gather min and network facts
+# hardware - gather hardware facts (longest facts to retrieve)
+# virtual - gather min and virtual facts
+# facter - import facts from facter
+# ohai - import facts from ohai
+# You can combine them using comma (ex: network,virtual)
+# You can negate them using ! (ex: !hardware,!facter,!ohai)
+# A minimal set of facts is always gathered.
+#gather_subset = all
+
+# some hardware related facts are collected
+# with a maximum timeout of 10 seconds. This
+# option lets you increase or decrease that
+# timeout to something more suitable for the
+# environment.
+# gather_timeout = 10
+
+# additional paths to search for roles in, colon separated
+#roles_path = /etc/ansible/roles
+roles_path = /root/ansible/roles
+# uncomment this to disable SSH key host checking
+host_key_checking = False
+
+# change the default callback
+#stdout_callback = skippy
+# enable additional callbacks
+#callback_whitelist = timer, mail
+
+# Determine whether includes in tasks and handlers are "static" by
+# default. As of 2.0, includes are dynamic by default. Setting these
+# values to True will make includes behave more like they did in the
+# 1.x versions.
+#task_includes_static = True
+#handler_includes_static = True
+
+# Controls if a missing handler for a notification event is an error or a warning
+#error_on_missing_handler = True
+
+# change this for alternative sudo implementations
+#sudo_exe = sudo
+
+# What flags to pass to sudo
+# WARNING: leaving out the defaults might create unexpected behaviours
+#sudo_flags = -H -S -n
+
+# SSH timeout
+#timeout = 10
+
+# default user to use for playbooks if user is not specified
+# (/usr/bin/ansible will use current user as default)
+#remote_user = root
+remote_user = admin
+# logging is off by default unless this path is defined
+# if so defined, consider logrotate
+#log_path = /var/log/ansible.log
+
+# default module name for /usr/bin/ansible
+#module_name = command
+
+# use this shell for commands executed under sudo
+# you may need to change this to bin/bash in rare instances
+# if sudo is constrained
+#executable = /bin/sh
+
+# if inventory variables overlap, does the higher precedence one win
+# or are hash values merged together? The default is 'replace' but
+# this can also be set to 'merge'.
+#hash_behaviour = replace
+
+# by default, variables from roles will be visible in the global variable
+# scope. To prevent this, the following option can be enabled, and only
+# tasks and handlers within the role will see the variables there
+#private_role_vars = yes
+
+# list any Jinja2 extensions to enable here:
+#jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n
+
+# if set, always use this private key file for authentication, same as
+# if passing --private-key to ansible or ansible-playbook
+#private_key_file = /path/to/file
+private_key_file = /root/ansible/ansible.key
+
+# If set, configures the path to the Vault password file as an alternative to
+# specifying --vault-password-file on the command line.
+#vault_password_file = /path/to/vault_password_file
+
+# format of string {{ ansible_managed }} available within Jinja2
+# templates indicates to users editing templates files will be replaced.
+# replacing {file}, {host} and {uid} and strftime codes with proper values.
+#ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
+# {file}, {host}, {uid}, and the timestamp can all interfere with idempotence
+# in some situations so the default is a static string:
+#ansible_managed = Ansible managed
+
+# by default, ansible-playbook will display "Skipping [host]" if it determines a task
+# should not be run on a host. Set this to "False" if you don't want to see these "Skipping"
+# messages. NOTE: the task header will still be shown regardless of whether or not the
+# task is skipped.
+#display_skipped_hosts = True
+
+# by default, if a task in a playbook does not include a name: field then
+# ansible-playbook will construct a header that includes the task's action but
+# not the task's args. This is a security feature because ansible cannot know
+# if the *module* considers an argument to be no_log at the time that the
+# header is printed. If your environment doesn't have a problem securing
+# stdout from ansible-playbook (or you have manually specified no_log in your
+# playbook on all of the tasks where you have secret information) then you can
+# safely set this to True to get more informative messages.
+#display_args_to_stdout = False
+
+# by default (as of 1.3), Ansible will raise errors when attempting to dereference
+# Jinja2 variables that are not set in templates or action lines. Uncomment this line
+# to revert the behavior to pre-1.3.
+#error_on_undefined_vars = False
+
+# by default (as of 1.6), Ansible may display warnings based on the configuration of the
+# system running ansible itself. This may include warnings about 3rd party packages or
+# other conditions that should be resolved if possible.
+# to disable these warnings, set the following value to False:
+#system_warnings = True
+
+# by default (as of 1.4), Ansible may display deprecation warnings for language
+# features that should no longer be used and will be removed in future versions.
+# to disable these warnings, set the following value to False:
+#deprecation_warnings = True
+
+# (as of 1.8), Ansible can optionally warn when usage of the shell and
+# command module appear to be simplified by using a default Ansible module
+# instead. These warnings can be silenced by adjusting the following
+# setting or adding warn=yes or warn=no to the end of the command line
+# parameter string. This will for example suggest using the git module
+# instead of shelling out to the git command.
+# command_warnings = False
+
+
+# set plugin path directories here, separate with colons
+#action_plugins = /usr/share/ansible/plugins/action
+#cache_plugins = /usr/share/ansible/plugins/cache
+#callback_plugins = /usr/share/ansible/plugins/callback
+#connection_plugins = /usr/share/ansible/plugins/connection
+#lookup_plugins = /usr/share/ansible/plugins/lookup
+#inventory_plugins = /usr/share/ansible/plugins/inventory
+#vars_plugins = /usr/share/ansible/plugins/vars
+#filter_plugins = /usr/share/ansible/plugins/filter
+#test_plugins = /usr/share/ansible/plugins/test
+#terminal_plugins = /usr/share/ansible/plugins/terminal
+#strategy_plugins = /usr/share/ansible/plugins/strategy
+
+
+# by default, ansible will use the 'linear' strategy but you may want to try
+# another one
+#strategy = free
+
+# by default callbacks are not loaded for /bin/ansible, enable this if you
+# want, for example, a notification or logging callback to also apply to
+# /bin/ansible runs
+#bin_ansible_callbacks = False
+
+
+# don't like cows? that's unfortunate.
+# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1
+#nocows = 1
+
+# set which cowsay stencil you'd like to use by default. When set to 'random',
+# a random stencil will be selected for each task. The selection will be filtered
+# against the `cow_whitelist` option below.
+#cow_selection = default
+#cow_selection = random
+
+# when using the 'random' option for cowsay, stencils will be restricted to this list.
+# it should be formatted as a comma-separated list with no spaces between names.
+# NOTE: line continuations here are for formatting purposes only, as the INI parser
+# in python does not support them.
+#cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\
+# hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\
+# stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www
+
+# don't like colors either?
+# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
+#nocolor = 1
+
+# if set to a persistent type (not 'memory', for example 'redis') fact values
+# from previous runs in Ansible will be stored. This may be useful when
+# wanting to use, for example, IP information from one group of servers
+# without having to talk to them in the same playbook run to get their
+# current IP information.
+#fact_caching = memory
+
+
+# retry files
+# When a playbook fails by default a .retry file will be created in ~/
+# You can disable this feature by setting retry_files_enabled to False
+# and you can change the location of the files by setting retry_files_save_path
+
+retry_files_enabled = False
+#retry_files_save_path = ~/.ansible-retry
+
+# squash actions
+# Ansible can optimise actions that call modules with list parameters
+# when looping. Instead of calling the module once per with_ item, the
+# module is called once with all items at once. Currently this only works
+# under limited circumstances, and only with parameters named 'name'.
+#squash_actions = apk,apt,dnf,homebrew,pacman,pkgng,yum,zypper
+
+# prevents logging of task data, off by default
+#no_log = False
+
+# prevents logging of tasks, but only on the targets, data is still logged on the master/controller
+#no_target_syslog = False
+
+# controls whether Ansible will raise an error or warning if a task has no
+# choice but to create world readable temporary files to execute a module on
+# the remote machine. This option is False by default for security. Users may
+# turn this on to have behaviour more like Ansible prior to 2.1.x. See
+# https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user
+# for more secure ways to fix this than enabling this option.
+#allow_world_readable_tmpfiles = False
+
+# controls the compression level of variables sent to
+# worker processes. At the default of 0, no compression
+# is used. This value must be an integer from 0 to 9.
+#var_compression_level = 9
+
+# controls what compression method is used for new-style ansible modules when
+# they are sent to the remote system. The compression types depend on having
+# support compiled into both the controller's python and the client's python.
+# The names should match with the python Zipfile compression types:
+# * ZIP_STORED (no compression. available everywhere)
+# * ZIP_DEFLATED (uses zlib, the default)
+# These values may be set per host via the ansible_module_compression inventory
+# variable
+#module_compression = 'ZIP_DEFLATED'
+
+# This controls the cutoff point (in bytes) on --diff for files
+# set to 0 for unlimited (RAM may suffer!).
+#max_diff_size = 1048576
+
+# This controls how ansible handles multiple --tags and --skip-tags arguments
+# on the CLI. If this is True then multiple arguments are merged together. If
+# it is False, then the last specified argument is used and the others are ignored.
+#merge_multiple_cli_flags = False
+
+# Controls showing custom stats at the end, off by default
+#show_custom_stats = True
+
+# Controls which files to ignore when using a directory as inventory with
+# possibly multiple sources (both static and dynamic)
+#inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo
+
+# This family of modules use an alternative execution path optimized for network appliances
+# only update this setting if you know how this works, otherwise it can break module execution
+#network_group_modules=['eos', 'nxos', 'ios', 'iosxr', 'junos', 'vyos']
+
+# When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as
+# a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain
+# jinja2 templating language which will be run through the templating engine.
+# ENABLING THIS COULD BE A SECURITY RISK
+#allow_unsafe_lookups = False
+
+[privilege_escalation]
+#become=True
+#become_method=sudo
+#become_user=root
+#become_ask_pass=False
+
+[paramiko_connection]
+
+# uncomment this line to cause the paramiko connection plugin to not record new host
+# keys encountered. Increases performance on new host additions. Setting works independently of the
+# host key checking setting above.
+#record_host_keys=False
+
+# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
+# line to disable this behaviour.
+#pty=False
+
+# paramiko will default to looking for SSH keys initially when trying to
+# authenticate to remote devices. This is a problem for some network devices
+# that close the connection after a key failure. Uncomment this line to
+# disable the Paramiko look for keys function
+#look_for_keys = False
+
+# When using persistent connections with Paramiko, the connection runs in a
+# background process. If the host doesn't already have a valid SSH key, by
+# default Ansible will prompt to add the host key. This will cause connections
+# running in background processes to fail. Uncomment this line to have
+# Paramiko automatically add host keys.
+#host_key_auto_add = True
+
+[ssh_connection]
+
+# ssh arguments to use
+# Leaving off ControlPersist will result in poor performance, so use
+# paramiko on older platforms rather than removing it, -C controls compression use
+#ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s
+
+# The base directory for the ControlPath sockets.
+# This is the "%(directory)s" in the control_path option
+#
+# Example:
+# control_path_dir = /tmp/.ansible/cp
+#control_path_dir = ~/.ansible/cp
+
+# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname,
+# port and username (empty string in the config). The hash mitigates a common problem users
+# found with long hostames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format.
+# In those cases, a "too long for Unix domain socket" ssh error would occur.
+#
+# Example:
+# control_path = %(directory)s/%%h-%%r
+#control_path =
+
+# Enabling pipelining reduces the number of SSH operations required to
+# execute a module on the remote server. This can result in a significant
+# performance improvement when enabled, however when using "sudo:" you must
+# first disable 'requiretty' in /etc/sudoers
+#
+# By default, this option is disabled to preserve compatibility with
+# sudoers configurations that have requiretty (the default on many distros).
+#
+#pipelining = False
+
+# Control the mechanism for transferring files (old)
+# * smart = try sftp and then try scp [default]
+# * True = use scp only
+# * False = use sftp only
+#scp_if_ssh = smart
+
+# Control the mechanism for transferring files (new)
+# If set, this will override the scp_if_ssh option
+# * sftp = use sftp to transfer files
+# * scp = use scp to transfer files
+# * piped = use 'dd' over SSH to transfer files
+# * smart = try sftp, scp, and piped, in that order [default]
+#transfer_method = smart
+
+# if False, sftp will not use batch mode to transfer files. This may cause some
+# types of file transfer failures impossible to catch however, and should
+# only be disabled if your sftp version has problems with batch mode
+#sftp_batch_mode = False
+
+[persistent_connection]
+
+# Configures the persistent connection timeout value in seconds. This value is
+# how long the persistent connection will remain idle before it is destroyed.
+# If the connection doesn't receive a request before the timeout value
+# expires, the connection is shutdown. The default value is 30 seconds.
+connect_timeout = 30
+
+# Configures the persistent connection retries. This value configures the
+# number of attempts the ansible-connection will make when trying to connect
+# to the local domain socket. The default value is 30.
+connect_retries = 30
+
+# Configures the amount of time in seconds to wait between connection attempts
+# to the local unix domain socket. This value works in conjunction with the
+# connect_retries value to define how long to try to connect to the local
+# domain socket when setting up a persistent connection. The default value is
+# 1 second.
+connect_interval = 1
+
+[accelerate]
+#accelerate_port = 5099
+#accelerate_timeout = 30
+#accelerate_connect_timeout = 5.0
+
+# The daemon timeout is measured in minutes. This time is measured
+# from the last activity to the accelerate daemon.
+#accelerate_daemon_timeout = 30
+
+# If set to yes, accelerate_multi_key will allow multiple
+# private keys to be uploaded to it, though each user must
+# have access to the system via SSH to add a new key. The default
+# is "no".
+#accelerate_multi_key = yes
+
+[selinux]
+# file systems that require special treatment when dealing with security context
+# the default behaviour that copies the existing context or uses the user default
+# needs to be changed to use the file system dependent context.
+#special_context_filesystems=nfs,vboxsf,fuse,ramfs,9p
+
+# Set this to yes to allow libvirt_lxc connections to work without SELinux.
+#libvirt_lxc_noseclabel = yes
+
+[colors]
+#highlight = white
+#verbose = blue
+#warn = bright purple
+#error = red
+#debug = dark gray
+#deprecate = purple
+#skip = cyan
+#unreachable = red
+#ok = green
+#changed = yellow
+#diff_add = green
+#diff_remove = red
+#diff_lines = cyan
+
+
+[diff]
+# Always print diff when running ( same as always running with -D/--diff )
+# always = no
+
+# Set how many context lines to show in diff
+# context = 3
diff --git a/ansible/ansible.key b/ansible/ansible.key
new file mode 100644
index 0000000..0ed0588
--- /dev/null
+++ b/ansible/ansible.key
@@ -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-----
diff --git a/ansible/inventory b/ansible/inventory
new file mode 100644
index 0000000..cf8385a
--- /dev/null
+++ b/ansible/inventory
@@ -0,0 +1,2 @@
+10.128.0.15 HOSTNAME=NAGIOS
+10.128.0.5 HOSTNAME=APP01
diff --git a/ansible/playbooks/01-sample.yml b/ansible/playbooks/01-sample.yml
new file mode 100644
index 0000000..07e40a6
--- /dev/null
+++ b/ansible/playbooks/01-sample.yml
@@ -0,0 +1,3 @@
+- hosts: all
+ tasks:
+ - ping:
diff --git a/ansible/playbooks/02-debug.yaml b/ansible/playbooks/02-debug.yaml
new file mode 100644
index 0000000..5adee89
--- /dev/null
+++ b/ansible/playbooks/02-debug.yaml
@@ -0,0 +1,5 @@
+- hosts: all
+ tasks:
+ - name: Print a sample message
+ debug:
+ msg: "hello, how are you?"
diff --git a/ansible/playbooks/03-install-package.retry b/ansible/playbooks/03-install-package.retry
new file mode 100644
index 0000000..fa23f7d
--- /dev/null
+++ b/ansible/playbooks/03-install-package.retry
@@ -0,0 +1 @@
+app01
diff --git a/ansible/playbooks/03-install-package.yml b/ansible/playbooks/03-install-package.yml
new file mode 100644
index 0000000..e0efd2f
--- /dev/null
+++ b/ansible/playbooks/03-install-package.yml
@@ -0,0 +1,7 @@
+- hosts: all
+ become: yes
+ tasks:
+ - name: Install a Package
+ package:
+ name: wget
+ state: installed
diff --git a/ansible/playbooks/04-installweb.yml b/ansible/playbooks/04-installweb.yml
new file mode 100644
index 0000000..cec118b
--- /dev/null
+++ b/ansible/playbooks/04-installweb.yml
@@ -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
diff --git a/ansible/playbooks/05-print-fact.retry b/ansible/playbooks/05-print-fact.retry
new file mode 100644
index 0000000..fa23f7d
--- /dev/null
+++ b/ansible/playbooks/05-print-fact.retry
@@ -0,0 +1 @@
+app01
diff --git a/ansible/playbooks/05-print-fact.yml b/ansible/playbooks/05-print-fact.yml
new file mode 100644
index 0000000..e61d2e9
--- /dev/null
+++ b/ansible/playbooks/05-print-fact.yml
@@ -0,0 +1,6 @@
+- hosts: all
+ #gather_facts: no
+ tasks:
+ - name: print os arch
+ debug:
+ msg: "OS Arch = {{ansible_architecture}}"
diff --git a/ansible/playbooks/06-vars.yml b/ansible/playbooks/06-vars.yml
new file mode 100644
index 0000000..edf1fa4
--- /dev/null
+++ b/ansible/playbooks/06-vars.yml
@@ -0,0 +1,9 @@
+- hosts: all
+ become: yes
+ vars:
+ packname : gcc
+ tasks:
+ - name: Install package
+ package:
+ name: "{{ packname }}"
+ state: installed
diff --git a/ansible/playbooks/07-vars-files.yml b/ansible/playbooks/07-vars-files.yml
new file mode 100644
index 0000000..4af33a4
--- /dev/null
+++ b/ansible/playbooks/07-vars-files.yml
@@ -0,0 +1,9 @@
+- hosts: all
+ become: yes
+ vars_files:
+ - vars01.yml
+ tasks:
+ - name: install package
+ package:
+ name: "{{ packname }}"
+ state: installed
diff --git a/ansible/playbooks/08-vars-prompt.yml b/ansible/playbooks/08-vars-prompt.yml
new file mode 100644
index 0000000..5da0c6b
--- /dev/null
+++ b/ansible/playbooks/08-vars-prompt.yml
@@ -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
diff --git a/ansible/playbooks/09-register-var.yml b/ansible/playbooks/09-register-var.yml
new file mode 100644
index 0000000..d844b7c
--- /dev/null
+++ b/ansible/playbooks/09-register-var.yml
@@ -0,0 +1,10 @@
+- hosts: all
+ become: yes
+ tasks:
+ - name: Run some command
+ shell: ls
+ register: OUT
+
+ - name: Print OUT Variable
+ debug:
+ msg: "{{OUT}}"
diff --git a/ansible/playbooks/10-set-fact.yml b/ansible/playbooks/10-set-fact.yml
new file mode 100644
index 0000000..0b20874
--- /dev/null
+++ b/ansible/playbooks/10-set-fact.yml
@@ -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}}"
diff --git a/ansible/playbooks/11-cond01.yml b/ansible/playbooks/11-cond01.yml
new file mode 100644
index 0000000..0607afd
--- /dev/null
+++ b/ansible/playbooks/11-cond01.yml
@@ -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
diff --git a/ansible/playbooks/12-cond02.yml b/ansible/playbooks/12-cond02.yml
new file mode 100644
index 0000000..126ac93
--- /dev/null
+++ b/ansible/playbooks/12-cond02.yml
@@ -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
diff --git a/ansible/playbooks/13-loop1.yml b/ansible/playbooks/13-loop1.yml
new file mode 100644
index 0000000..0cdb549
--- /dev/null
+++ b/ansible/playbooks/13-loop1.yml
@@ -0,0 +1,12 @@
+- hosts: all
+ become: yes
+ tasks:
+ - name: Install Web packages
+ package:
+ name: "{{item}}"
+ state: installed
+ with_items:
+ - httpd
+ - httpd-devel
+ - gcc
+
diff --git a/ansible/playbooks/14-loop2.yml b/ansible/playbooks/14-loop2.yml
new file mode 100644
index 0000000..5aef573
--- /dev/null
+++ b/ansible/playbooks/14-loop2.yml
@@ -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}}"
diff --git a/ansible/playbooks/15-loop3.yml b/ansible/playbooks/15-loop3.yml
new file mode 100644
index 0000000..99751d1
--- /dev/null
+++ b/ansible/playbooks/15-loop3.yml
@@ -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' ]
diff --git a/ansible/playbooks/16-string-filter.yml b/ansible/playbooks/16-string-filter.yml
new file mode 100644
index 0000000..4e13501
--- /dev/null
+++ b/ansible/playbooks/16-string-filter.yml
@@ -0,0 +1,3 @@
+- hosts: localhost
+ vars:
+ URL : "http://redrockdigimark.com/apachemirror/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz"
diff --git a/ansible/playbooks/17-copy.yml b/ansible/playbooks/17-copy.yml
new file mode 100644
index 0000000..88dfb7d
--- /dev/null
+++ b/ansible/playbooks/17-copy.yml
@@ -0,0 +1,7 @@
+- hosts: all
+ become: yes
+ gather_facts: no
+ tasks:
+ - copy:
+ src: "/tmp/abc.txt"
+ dest: "/root/abc.txt"
diff --git a/ansible/playbooks/17-set-fact.yml b/ansible/playbooks/17-set-fact.yml
new file mode 100644
index 0000000..224bb8c
--- /dev/null
+++ b/ansible/playbooks/17-set-fact.yml
@@ -0,0 +1,10 @@
+- hosts: localhost
+ vars:
+ a: "10"
+ tasks:
+ - set_fact:
+ b: "10"
+ A: "{{a}} / {{b}}"
+
+ - debug:
+ msg: "{{A}}"
diff --git a/ansible/playbooks/18-template.yml b/ansible/playbooks/18-template.yml
new file mode 100644
index 0000000..55dacaa
--- /dev/null
+++ b/ansible/playbooks/18-template.yml
@@ -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
diff --git a/ansible/playbooks/19-tomcat-start.yml b/ansible/playbooks/19-tomcat-start.yml
new file mode 100644
index 0000000..e53d2b4
--- /dev/null
+++ b/ansible/playbooks/19-tomcat-start.yml
@@ -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'
diff --git a/ansible/playbooks/20-mysql.yml b/ansible/playbooks/20-mysql.yml
new file mode 100644
index 0000000..6c58d92
--- /dev/null
+++ b/ansible/playbooks/20-mysql.yml
@@ -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
diff --git a/ansible/playbooks/21-no-handler.yml b/ansible/playbooks/21-no-handler.yml
new file mode 100644
index 0000000..d31832c
--- /dev/null
+++ b/ansible/playbooks/21-no-handler.yml
@@ -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
diff --git a/ansible/playbooks/22-handlers.yml b/ansible/playbooks/22-handlers.yml
new file mode 100644
index 0000000..6335a77
--- /dev/null
+++ b/ansible/playbooks/22-handlers.yml
@@ -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
diff --git a/ansible/playbooks/23-role1.yml b/ansible/playbooks/23-role1.yml
new file mode 100644
index 0000000..b97c376
--- /dev/null
+++ b/ansible/playbooks/23-role1.yml
@@ -0,0 +1,4 @@
+- hosts: all
+ become: yes
+ roles:
+ - { role : roleA , TECH: CHEF }
diff --git a/ansible/playbooks/24-yumrepo.yml b/ansible/playbooks/24-yumrepo.yml
new file mode 100644
index 0000000..64c802e
--- /dev/null
+++ b/ansible/playbooks/24-yumrepo.yml
@@ -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/
+
diff --git a/ansible/playbooks/25-autghorized_key.yml b/ansible/playbooks/25-autghorized_key.yml
new file mode 100644
index 0000000..92d2392
--- /dev/null
+++ b/ansible/playbooks/25-autghorized_key.yml
@@ -0,0 +1,7 @@
+- hosts: all
+ tasks:
+ - name: Remove authorized key
+ authorized_key:
+ user: admin
+ state: absent
+ key: "{{ lookup('file', '/root/admin.pub') }}"
diff --git a/ansible/playbooks/26-user.yml b/ansible/playbooks/26-user.yml
new file mode 100644
index 0000000..c7344dd
--- /dev/null
+++ b/ansible/playbooks/26-user.yml
@@ -0,0 +1,6 @@
+- hosts: all
+ become: yes
+ tasks:
+ - name: Add user rama
+ user:
+ name: rama
diff --git a/ansible/playbooks/27-find.yml b/ansible/playbooks/27-find.yml
new file mode 100644
index 0000000..f530be8
--- /dev/null
+++ b/ansible/playbooks/27-find.yml
@@ -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}}"
diff --git a/ansible/playbooks/28-hostname.yml b/ansible/playbooks/28-hostname.yml
new file mode 100644
index 0000000..1fac677
--- /dev/null
+++ b/ansible/playbooks/28-hostname.yml
@@ -0,0 +1,6 @@
+- hosts: all
+ become: yes
+ tasks:
+ - name: Change hostname
+ hostname:
+ name: "{{HOSTNAME}}"
diff --git a/ansible/playbooks/29-print.yml b/ansible/playbooks/29-print.yml
new file mode 100644
index 0000000..0d04b32
--- /dev/null
+++ b/ansible/playbooks/29-print.yml
@@ -0,0 +1,9 @@
+$ANSIBLE_VAULT;1.1;AES256
+65366536333865376465323762326132393234656266663130313735656462656139393761353933
+6263323161663939636537626663323861636562393337340a303263643565333364336565323934
+65306532633031613432643138623337343336383431616561626331336132333234646631386139
+3065333466646562620a623533656533616361666137656532373266393839646635653632336662
+65613238366561623838346664653065396361393865353134616562646137373333383535623631
+63356263616363623638313562303531383062343434376638383431326133616535383039613032
+65633937333763306637633366633139386333343335666138643266323331393831376637643836
+39623836376230663764
diff --git a/ansible/playbooks/create-gce.yml b/ansible/playbooks/create-gce.yml
new file mode 100644
index 0000000..bd2d8d7
--- /dev/null
+++ b/ansible/playbooks/create-gce.yml
@@ -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
diff --git a/ansible/playbooks/files/context.xml.j2 b/ansible/playbooks/files/context.xml.j2
new file mode 100644
index 0000000..7ce960b
--- /dev/null
+++ b/ansible/playbooks/files/context.xml.j2
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ WEB-INF/web.xml
+ ${catalina.base}/conf/web.xml
+
+
+
+
+
diff --git a/ansible/playbooks/files/mod_jk.conf b/ansible/playbooks/files/mod_jk.conf
new file mode 100644
index 0000000..e04cf03
--- /dev/null
+++ b/ansible/playbooks/files/mod_jk.conf
@@ -0,0 +1,9 @@
+LoadModule jk_module modules/mod_jk.so
+JkWorkersFile conf.d/workers.properties
+JkLogFile logs/mod_jk.log
+JkLogLevel info
+JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
+JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
+JkRequestLogFormat "%w %V %T"
+JkMount /student tomcatA
+JkMount /student/* tomcatA
diff --git a/ansible/playbooks/files/sample.j2 b/ansible/playbooks/files/sample.j2
new file mode 100644
index 0000000..4a2266d
--- /dev/null
+++ b/ansible/playbooks/files/sample.j2
@@ -0,0 +1 @@
+Hello , Tomcat IP Address = {{ IPADDR }}
diff --git a/ansible/playbooks/files/student.sql b/ansible/playbooks/files/student.sql
new file mode 100644
index 0000000..9b0e016
--- /dev/null
+++ b/ansible/playbooks/files/student.sql
@@ -0,0 +1,12 @@
+use studentapp;
+CREATE TABLE IF NOT EXISTS Students(student_id INT NOT NULL AUTO_INCREMENT,
+ student_name VARCHAR(100) NOT NULL,
+ student_addr VARCHAR(100) NOT NULL,
+ student_age VARCHAR(3) NOT NULL,
+ student_qual VARCHAR(20) NOT NULL,
+ student_percent VARCHAR(10) NOT NULL,
+ student_year_passed VARCHAR(10) NOT NULL,
+ PRIMARY KEY (student_id)
+);
+grant all privileges on studentapp.* to 'student'@'localhost' identified by 'student@1';
+
diff --git a/ansible/playbooks/files/workers.properties b/ansible/playbooks/files/workers.properties
new file mode 100644
index 0000000..d751e87
--- /dev/null
+++ b/ansible/playbooks/files/workers.properties
@@ -0,0 +1,6 @@
+### Define workers
+worker.list=tomcatA
+### Set properties
+worker.tomcatA.type=ajp13
+worker.tomcatA.host=localhost
+worker.tomcatA.port=8009
diff --git a/ansible/playbooks/mystack.yml b/ansible/playbooks/mystack.yml
new file mode 100644
index 0000000..8bab7ca
--- /dev/null
+++ b/ansible/playbooks/mystack.yml
@@ -0,0 +1,152 @@
+- hosts: all
+ become: yes
+ vars:
+ HTTP_PACK_LIST: [ 'httpd', 'httpd-devel' , 'gcc' ]
+ HTTP_SERV_NAME: httpd
+ HTTP_CONF_FILES:
+ - mod_jk.conf
+ - workers.properties
+ CONN_URL: "http://redrockdigimark.com/apachemirror/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz"
+ CONN_BASE_DIR : '/opt'
+ TOMCAT_URL : "http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.0.M26/bin/apache-tomcat-9.0.0.M26.tar.gz"
+ TOMCAT_BASE_DIR: '/opt'
+ JDBC_URL : "https://github.com/carreerit/cogito/raw/master/appstack/mysql-connector-java-5.1.40.jar"
+ WAR_URL : "https://github.com/carreerit/cogito/raw/master/appstack/student.war"
+ DB_IPADDR : "localhost"
+
+ tasks:
+ - name: Install Web packages
+ package:
+ name: "{{item}}"
+ state: installed
+ with_items: "{{HTTP_PACK_LIST}}"
+
+ - name: Start Web Server
+ service:
+ name: "{{HTTP_SERV_NAME}}"
+ state: started
+ enabled: yes
+
+ - name: Download and extract APACHE-TOMCAT-Connector
+ unarchive:
+ src: "{{CONN_URL}}"
+ dest: "/opt"
+ remote_src: yes
+
+ - name: Collecting the location of extracted tar file
+ shell: "echo {{CONN_URL}}|awk -F / '{print $NF}'|sed -e 's/.tar.gz//g'"
+ register: out
+
+ - name: Creating facts for tomcat connector lcoation
+ set_fact:
+ CONN_EXTR_DIR: "{{out.stdout}}"
+
+ - name: Creating facts for tomcat connector location
+ set_fact:
+ CONN_SRC_LOC: "{{CONN_BASE_DIR}}/{{CONN_EXTR_DIR}}"
+
+ - name: Run ./configure and make and make install
+ shell: "./configure --with-apxs=/usr/bin/apxs && make && make install"
+ args:
+ chdir: "{{CONN_SRC_LOC}}/native"
+
+ - name: Copy httpd config files
+ copy:
+ src: "files/{{item}}"
+ dest: "/etc/httpd/conf.d/{{item}}"
+ with_items: "{{HTTP_CONF_FILES}}"
+
+ - name: restart httpd
+ service:
+ name: httpd
+ state: restarted
+
+
+ - name: Instll java
+ package:
+ name: java
+ state: installed
+
+ - name: Download and extract tomcat
+ unarchive:
+ src: "{{TOMCAT_URL}}"
+ dest: "/opt"
+ remote_src: yes
+
+ - name: Collecting the location of extracted tomcat tar file
+ shell: "echo {{TOMCAT_URL}}|awk -F / '{print $NF}'|sed -e 's/.tar.gz//g'"
+ register: out
+
+ - name: Creating facts for tomcat lcoation
+ set_fact:
+ TOMCAT_EXTR_DIR: "{{out.stdout}}"
+
+ - name: Creating facts for tomcat location
+ set_fact:
+ TOMCAT_LOC: "{{TOMCAT_BASE_DIR}}/{{TOMCAT_EXTR_DIR}}"
+
+ - name: Download jdbc jar file
+ get_url:
+ url: "{{JDBC_URL}}"
+ dest: "{{TOMCAT_LOC}}/lib"
+
+ - name: Download stundet application
+ get_url:
+ url: "{{WAR_URL}}"
+ dest: "{{TOMCAT_LOC}}/webapps"
+
+ - name: Setup DB Connection in context.xml
+ template:
+ src: files/context.xml.j2
+ dest: "{{TOMCAT_LOC}}/conf/context.xml"
+
+ - name: Start tomcat
+ command: "nohup {{TOMCAT_LOC}}/bin/startup.sh"
+
+ - name: Install mariadb
+ package:
+ name: "{{item}}"
+ state: installed
+ with_items:
+ - mariadb
+ - mariadb-server
+ - mariadb-devel
+ - python-devel
+ - python-pip
+
+ - name: Start marioadb
+ service:
+ name: mariadb
+ state: started
+ enabled: yes
+
+ - name: Copy student.sql file
+ copy:
+ src: files/student.sql
+ dest: /tmp/student.sql
+
+ - name: Install python mysql module
+ pip:
+ name: MySQL-python
+
+ - name: create database studnet
+ mysql_db:
+ name: studentapp
+ state: present
+
+ - name: Import DB
+ mysql_db:
+ state: import
+ name: all
+ target: /tmp/student.sql
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ansible/playbooks/vars01.yml b/ansible/playbooks/vars01.yml
new file mode 100644
index 0000000..2dc0076
--- /dev/null
+++ b/ansible/playbooks/vars01.yml
@@ -0,0 +1 @@
+packname : httpd
diff --git a/ansible/roles/roleA/tasks/main.yml b/ansible/roles/roleA/tasks/main.yml
new file mode 100644
index 0000000..018aee4
--- /dev/null
+++ b/ansible/roles/roleA/tasks/main.yml
@@ -0,0 +1,5 @@
+- debug:
+ msg: "This is message from ROLE-A"
+
+- debug:
+ msg: "Training Technology = {{TECH}}"
diff --git a/ansible/roles/roleA/vars/main.yml b/ansible/roles/roleA/vars/main.yml
new file mode 100644
index 0000000..547df22
--- /dev/null
+++ b/ansible/roles/roleA/vars/main.yml
@@ -0,0 +1 @@
+TECH: Ansible
diff --git a/ansible/roles/roleB/meta/main.yml b/ansible/roles/roleB/meta/main.yml
new file mode 100644
index 0000000..0822fe5
--- /dev/null
+++ b/ansible/roles/roleB/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - { role: roleA }
diff --git a/ansible/roles/roleB/tasks/main.yml b/ansible/roles/roleB/tasks/main.yml
new file mode 100644
index 0000000..0dfb12b
--- /dev/null
+++ b/ansible/roles/roleB/tasks/main.yml
@@ -0,0 +1,2 @@
+- debug:
+ msg: "This is a messaged from roleB"
diff --git a/ansible/roles/sample/handlers/main.yml b/ansible/roles/sample/handlers/main.yml
new file mode 100644
index 0000000..b275795
--- /dev/null
+++ b/ansible/roles/sample/handlers/main.yml
@@ -0,0 +1,2 @@
+- name: Sample handler
+ shell: uptime
diff --git a/ansible/roles/sample/tasks/main.yml b/ansible/roles/sample/tasks/main.yml
new file mode 100644
index 0000000..2f70b5a
--- /dev/null
+++ b/ansible/roles/sample/tasks/main.yml
@@ -0,0 +1,15 @@
+- name: Print OS Vendor
+ debug:
+ msg: "OS Vendor = {{ansible_system_vendor}}"
+
+- name: Some task1
+ shell: "true"
+ notify: Sample handler
+
+
+- name: Copy abc template
+ template:
+ src: abc.j2
+ dest: /tmp/abc
+
+- include: setup.yml
diff --git a/ansible/roles/sample/tasks/setup.yml b/ansible/roles/sample/tasks/setup.yml
new file mode 100644
index 0000000..8fab282
--- /dev/null
+++ b/ansible/roles/sample/tasks/setup.yml
@@ -0,0 +1,2 @@
+- debug:
+ msg: "Setting up Web Server"
diff --git a/ansible/roles/sample/templates/abc.j2 b/ansible/roles/sample/templates/abc.j2
new file mode 100644
index 0000000..5d65d80
--- /dev/null
+++ b/ansible/roles/sample/templates/abc.j2
@@ -0,0 +1,2 @@
+IP ADDRESS OF SERVER = {{ facter_ipaddress }}
+MY NAME = {{ myname }}
diff --git a/ansible/roles/sample/vars/main.yml b/ansible/roles/sample/vars/main.yml
new file mode 100644
index 0000000..2fb974b
--- /dev/null
+++ b/ansible/roles/sample/vars/main.yml
@@ -0,0 +1 @@
+myname: DevOps
diff --git a/ansible/roles/webstack/files/mod_jk.conf b/ansible/roles/webstack/files/mod_jk.conf
new file mode 100644
index 0000000..e04cf03
--- /dev/null
+++ b/ansible/roles/webstack/files/mod_jk.conf
@@ -0,0 +1,9 @@
+LoadModule jk_module modules/mod_jk.so
+JkWorkersFile conf.d/workers.properties
+JkLogFile logs/mod_jk.log
+JkLogLevel info
+JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
+JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
+JkRequestLogFormat "%w %V %T"
+JkMount /student tomcatA
+JkMount /student/* tomcatA
diff --git a/ansible/roles/webstack/tasks/main.yml b/ansible/roles/webstack/tasks/main.yml
new file mode 100644
index 0000000..e2d7ddc
--- /dev/null
+++ b/ansible/roles/webstack/tasks/main.yml
@@ -0,0 +1,16 @@
+- name: Install packages
+ package:
+ name: "{{item}}"
+ state: installed
+ with_items: "{{PACK_LIST}}"
+
+- name: Download and extract tomcat connector
+ unarchive:
+ src: "{{CONN_URL}}"
+ dest: /opt
+ remote_src: yes
+
+- name: Compile and Install tomcat connector
+ shell: "./configure --with-apxs=/bin/apxs && make && make install"
+ args:
+ chdir: "/opt/tomcat-connectors-1.2.42-src/native"
\ No newline at end of file
diff --git a/ansible/roles/webstack/templates/workers.properties b/ansible/roles/webstack/templates/workers.properties
new file mode 100644
index 0000000..209443d
--- /dev/null
+++ b/ansible/roles/webstack/templates/workers.properties
@@ -0,0 +1,6 @@
+### Define workers
+worker.list=tomcatA
+### Set properties
+worker.tomcatA.type=ajp13
+worker.tomcatA.host={{APP_IP_ADDRESS}}
+worker.tomcatA.port=8009
diff --git a/ansible/roles/webstack/vars/main.yml b/ansible/roles/webstack/vars/main.yml
new file mode 100644
index 0000000..1a33f32
--- /dev/null
+++ b/ansible/roles/webstack/vars/main.yml
@@ -0,0 +1,6 @@
+APP_IP_ADDRESS : localhost
+PACK_LIST:
+ - httpd
+ - httpd-devel
+ - gcc
+CONN_URL: "http://redrockdigimark.com/apachemirror/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz"
\ No newline at end of file
diff --git a/chef/ruby/01-sample.rb b/chef/ruby/01-sample.rb
new file mode 100644
index 0000000..2f33010
--- /dev/null
+++ b/chef/ruby/01-sample.rb
@@ -0,0 +1 @@
+puts 'Hello World'
diff --git a/chef/ruby/02-var.rb b/chef/ruby/02-var.rb
new file mode 100644
index 0000000..10be237
--- /dev/null
+++ b/chef/ruby/02-var.rb
@@ -0,0 +1,4 @@
+x = 1
+name = "Raghu"
+puts x
+puts name
diff --git a/chef/ruby/03-var.rb b/chef/ruby/03-var.rb
new file mode 100644
index 0000000..47279f9
--- /dev/null
+++ b/chef/ruby/03-var.rb
@@ -0,0 +1,2 @@
+name = 'Raghu'
+puts "Hello Welome, Mr. #{name}"
diff --git a/chef/ruby/04-list.rb b/chef/ruby/04-list.rb
new file mode 100644
index 0000000..1a823cb
--- /dev/null
+++ b/chef/ruby/04-list.rb
@@ -0,0 +1,3 @@
+x = ['a','b']
+
+puts "First Value = #{x[0]}"
diff --git a/chef/ruby/05-hash.rb b/chef/ruby/05-hash.rb
new file mode 100644
index 0000000..ff80173
--- /dev/null
+++ b/chef/ruby/05-hash.rb
@@ -0,0 +1,7 @@
+h = {
+ 'first_name' => 'Bob',
+ 'last_name' => 'Jones'
+}
+
+puts "First Name = #{h['first_name']}"
+puts 'First Name = #{h["first_name"]}'
diff --git a/chef/ruby/06-if.rb b/chef/ruby/06-if.rb
new file mode 100644
index 0000000..67be4c6
--- /dev/null
+++ b/chef/ruby/06-if.rb
@@ -0,0 +1,9 @@
+x = 0
+
+if x > 0
+ puts "X is GT 0 "
+elsif x < 0
+ puts "X is LT 0"
+else
+ puts "X is EQ 0"
+end
diff --git a/chef/ruby/07-loop.rb b/chef/ruby/07-loop.rb
new file mode 100644
index 0000000..307a3ac
--- /dev/null
+++ b/chef/ruby/07-loop.rb
@@ -0,0 +1,4 @@
+x=[1,2,3]
+x.each do |foo|
+puts foo
+end
diff --git a/chef/ruby/08-white-space.rb b/chef/ruby/08-white-space.rb
new file mode 100644
index 0000000..999964e
--- /dev/null
+++ b/chef/ruby/08-white-space.rb
@@ -0,0 +1,3 @@
+%w(Redhat Ubuntu SUSE).each do |os|
+ puts "OS Name = #{os}"
+end
diff --git a/chef/ruby/09-method.rb b/chef/ruby/09-method.rb
new file mode 100644
index 0000000..f6841fd
--- /dev/null
+++ b/chef/ruby/09-method.rb
@@ -0,0 +1,3 @@
+x= 'abc'
+
+puts x.upcase
diff --git a/chef/ruby/10-method.rb b/chef/ruby/10-method.rb
new file mode 100644
index 0000000..4ba1c52
--- /dev/null
+++ b/chef/ruby/10-method.rb
@@ -0,0 +1,6 @@
+def PRINT_NAME(fname,lname)
+ puts "First Name = #{fname}"
+ puts "Last Name = #{lname}"
+end
+
+PRINT_NAME('Rama', 'SK')
diff --git a/install-svn.sh b/install-svn.sh
new file mode 100644
index 0000000..1832d76
--- /dev/null
+++ b/install-svn.sh
@@ -0,0 +1,174 @@
+#!/bin/bash
+
+Print() {
+
+ case $3 in
+ B)
+ if [ "$1" = SL ]; then
+ echo -n -e "\e[34m$2\e[0m"
+ elif [ "$1" = NL ]; then
+ echo -e "\e[34m$2\e[0m"
+ else
+ echo -e "\e[34m$2\e[0m"
+ fi
+ ;;
+ G)
+ if [ "$1" = SL ]; then
+ echo -n -e "\e[32m$2\e[0m"
+ elif [ "$1" = NL ]; then
+ echo -e "\e[32m$2\e[0m"
+ else
+ echo -e "\e[32m$2\e[0m"
+ fi
+ ;;
+ Y)
+ if [ "$1" = SL ]; then
+ echo -n -e "\e[33m$2\e[0m"
+ elif [ "$1" = NL ]; then
+ echo -e "\e[33m$2\e[0m"
+ else
+ echo -e "\e[33m$2\e[0m"
+ fi
+ ;;
+ R)
+ if [ "$1" = SL ]; then
+ echo -n -e "\e[31m$2\e[0m"
+ elif [ "$1" = NL ]; then
+ echo -e "\e[31m$2\e[0m"
+ else
+ echo -e "\e[31m$2\e[0m"
+ fi
+ ;;
+
+ *)
+ if [ "$1" = SL ]; then
+ echo -n -e "$2\e[0m"
+ elif [ "$1" = NL ]; then
+ echo -e "$2\e[0m"
+ else
+ echo -e "$2\e[0m"
+ fi
+ ;;
+ esac
+
+}
+
+
+### Main Program
+if [ `sestatus |grep 'SELinux status' |awk '{print $NF}'` = enabled ]; then
+ echo -e "\n\e[31mSELINUX and IPTABLES are running in system. Disable them first and run this Install\e[0m"
+ echo
+ echo "Run the following command to disable SELINUX and IPTABLES"
+ echo -e "\t\e[35m# curl https://raw.githubusercontent.com/versionit/docs/master/vm-init.sh |bash\e[0m\n"
+ exit 5
+fi
+
+if [ `id -u` -ne 0 ]; then
+ echo -e "\e[You should run this script as root user\e[0m"
+ exit 4
+fi
+
+Print "SL" "=>> Checking existing configuration if any.. " "B"
+rpm -q httpd &>/dev/null
+pack_stat=$?
+[ -f /etc/httpd/conf.d/httpd.conf ]
+conf_stat=$?
+[ -d /etc/httpd ]
+dir_stat=$?
+
+if [ $pack_stat -eq 0 -o $conf_stat -eq 0 -o $dir_stat -eq 0 ]; then
+ rpm -e mod_dav_svn httpd &>/dev/null
+ rm -rf /etc/httpd /tmp/demo /tmp/template
+ [ -d /var/www/svn ] && rm -rf /var/www/svn
+ Print "SL" "Present.. " "R"
+ Print "NL" "Cleaned UP.. " "G"
+else
+ Print "SL" "No Present.. " "R"
+ Print "NL" "Skipping.. " "G"
+fi
+
+
+Print "SL" "=>> Installing Web Server.. " "B"
+yum install mod_dav_svn subversion -y &>/dev/null
+if [ $? -eq 0 ] ; then
+ Print "NL" "Completed.." "G"
+else
+ Print "NL" "Failed" "R"
+ exit 1
+fi
+
+Print "SL" "=>> Adding modules to apache configuration.. " B
+echo -e "LoadModule dav_svn_module modules/mod_dav_svn.so\nLoadModule authz_svn_module modules/mod_authz_svn.so\nLoadModule dontdothat_module modules/mod_dontdothat.so" >/etc/httpd/conf.modules.d/10-subversion.conf
+if [ `cat /etc/httpd/conf.modules.d/10-subversion.conf|wc -l` -eq 3 ]; then
+ Print "NL" "Completed.." "G"
+else
+ Print "NL" "Failed" "R" && exit 1
+fi
+
+
+Print "SL" "=>> Adding Subversion configuration to apache.." B
+echo "
+DAV svn
+SVNParentPath /var/www/svn
+AuthType Basic
+AuthName 'Authorization Realm'
+AuthUserFile /etc/svn-users
+Require valid-user
+" > /etc/httpd/conf.d/subversion.conf
+if [ -f /etc/httpd/conf.d/subversion.conf ]; then
+ Print "NL" "Completed.." "G"
+else
+ Print "NL" "Failed" "R" && exit 1
+fi
+
+Print "NL" "=>> Creating http users for SVN.." B
+Print "SL" "\t=>> Adding user - Username : tom -- Password : tom"
+htpasswd -b -cm /etc/svn-users tom tom &>/dev/null
+if [ $? -eq 0 ]; then
+ Print "NL" ".. Completed.." "G"
+else
+ Print "NL" ".. Failed" "R" && exit 1
+fi
+
+Print "SL" "\t=>> Adding user - Username : jerry -- Password : jerry"
+htpasswd -b -m /etc/svn-users jerry jerry &>/dev/null
+if [ $? -eq 0 ]; then
+ Print "NL" ".. Completed.." "G"
+else
+ Print "NL" ".. Failed" "R" && exit 1
+fi
+
+mkdir /var/www/svn
+Print NL "=>> Creating SVN repositories" B
+Print NL "\t=>> Repo Name : demo ; Repo URL : http:///svn/demo" Y
+cd /var/www/svn
+svnadmin create demo
+mkdir -p /tmp/template/{trunk,branches,tags}
+svn import /tmp/template file:///var/www/svn/demo -m "Creating repository" &>/dev/null
+chown -R apache:apache -R *
+
+Print NL "\t=>> Repo Name : samnple ; Repo URL : http:///svn/sample" Y
+cd /var/www/svn
+svnadmin create sample
+mkdir -p /tmp/template/{trunk,branches,tags}
+svn import /tmp/template file:///var/www/svn/sample -m "Creating repository" &>/dev/null
+chown -R apache:apache -R *
+
+Print "SL" "=>> Starting required services" B
+systemctl enable httpd &>/dev/null
+systemctl start httpd &>/dev/null
+if [ $? -eq 0 ]; then
+ Print "NL" ".. Completed.." "G"
+else
+ Print "NL" ".. Failed" "R" && exit 1
+fi
+
+cd /tmp
+ip=$(ip a |grep eth0 -A 3 |grep inet |awk '{print $2}' |awk -F / '{print $1}')
+Print "SL" "=>> Checking Installation.. " B
+svn co http://$ip/svn/demo --username tom --password tom --non-interactive &>/dev/null
+if [ $? -eq 0 ]; then
+ Print "NL" ".. Completed.." "G"
+else
+ Print "NL" ".. Failed" "R" && exit 1
+fi
diff --git a/script/examples/case1.sh b/script/examples/case1.sh
new file mode 100644
index 0000000..b51e15d
--- /dev/null
+++ b/script/examples/case1.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+USER=$1
+
+id $USER &>/dev/null
+case $? in
+ 0) echo User Exists ;;
+ *) echo User not Exists ;;
+esac
diff --git a/script/examples/if1.sh b/script/examples/if1.sh
new file mode 100644
index 0000000..a4fe2e2
--- /dev/null
+++ b/script/examples/if1.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+USER=$1
+id $USER &>/dev/null
+if [ $? -eq 0 ]; then
+ echo User exists
+else
+ echo User does not exists
+ exit 1
+fi
diff --git a/script/examples/input1.sh b/script/examples/input1.sh
new file mode 100755
index 0000000..195db3d
--- /dev/null
+++ b/script/examples/input1.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+read -p 'Enter your name: ' name
+
+echo "Your Name = $name"
diff --git a/script/examples/input2.sh b/script/examples/input2.sh
new file mode 100755
index 0000000..e41202c
--- /dev/null
+++ b/script/examples/input2.sh
@@ -0,0 +1,8 @@
+echo $0
+echo $1
+echo $2
+echo
+echo $*
+echo $@
+echo
+echo $#
diff --git a/script/examples/print.sh b/script/examples/print.sh
new file mode 100755
index 0000000..ff0e12e
--- /dev/null
+++ b/script/examples/print.sh
@@ -0,0 +1 @@
+echo Hello World
diff --git a/script/examples/print1.sh b/script/examples/print1.sh
new file mode 100755
index 0000000..d2fac59
--- /dev/null
+++ b/script/examples/print1.sh
@@ -0,0 +1 @@
+echo -e "Hello World\nWelcome to DevOps"
diff --git a/script/examples/print2.sh b/script/examples/print2.sh
new file mode 100755
index 0000000..e25f9cf
--- /dev/null
+++ b/script/examples/print2.sh
@@ -0,0 +1,3 @@
+echo -e "\e[34mHeloo World\e[0m"
+
+echo "Welcome to Devops"
diff --git a/script/examples/var01.sh b/script/examples/var01.sh
new file mode 100755
index 0000000..60fd173
--- /dev/null
+++ b/script/examples/var01.sh
@@ -0,0 +1,5 @@
+
+DATE=`date +%F`
+echo "Today date is $DATE"
+echo "$DATE 10:00 AM :: Meeting with manager"
+echo "$DATE 01:00 PM :: Lunch with client"
diff --git a/script/examples/var02.sh b/script/examples/var02.sh
new file mode 100755
index 0000000..60fd173
--- /dev/null
+++ b/script/examples/var02.sh
@@ -0,0 +1,5 @@
+
+DATE=`date +%F`
+echo "Today date is $DATE"
+echo "$DATE 10:00 AM :: Meeting with manager"
+echo "$DATE 01:00 PM :: Lunch with client"
diff --git a/script/stack_create.sh b/script/stack_create.sh
new file mode 100755
index 0000000..a73890b
--- /dev/null
+++ b/script/stack_create.sh
@@ -0,0 +1,188 @@
+#!/bin/bash
+
+### Color Variables
+Y="\e[33m"
+R="\e[31m"
+G="\e[32m"
+B="\e[34m"
+C="\e[36m"
+N="\e[0m"
+
+### Variables
+URL="http://redrockdigimark.com/apachemirror/tomcat/tomcat-9/v9.0.0.M22/bin/apache-tomcat-9.0.0.M22.tar.gz"
+TAR_FILE_NAME=$(echo $URL |awk -F / '{print $NF}')
+TAR_DIR=$(echo $TAR_FILE_NAME|sed -e 's/.tar.gz//')
+
+MODJK_URL="http://redrockdigimark.com/apachemirror/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz"
+MODJK_TAR_FILE_NAME=$(echo $MODJK_URL |awk -F / '{print $NF}')
+MODJK_TAR_DIR=$(echo $MODJK_TAR_FILE_NAME | sed -e 's/.tar.gz//')
+
+
+### Root user check
+ID=`id -u`
+if [ $ID -ne 0 ]; then
+ echo -e "$R You should be root user to perform this command $N"
+ echo -e "$Y If you have sudo access then run the script with sudo command $N"
+ exit 1
+fi
+#### Installation of WEb Server
+echo -n -e "$Y Installing Web Server..$N"
+yum install httpd httpd-devel -y &>/dev/null
+if [ $? -eq 0 ]; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+
+### Tomcat Instaallation
+echo -n -e "$Y Downloading Tomcat .. $N"
+yum install java -y &>/dev/null
+wget $URL -O /tmp/$TAR_FILE_NAME &>/dev/null
+tar tf /tmp/$TAR_FILE_NAME &>/dev/null
+if [ $? -eq 0 ]; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+if [ -d /opt/tomcat ]; then
+ rm -rf /opt/tomcat
+fi
+
+echo -n -e "$Y Extracting Tomcat .. $N"
+cd /opt
+tar xf /tmp/$TAR_FILE_NAME
+mv $TAR_DIR tomcat
+if [ -d /opt/tomcat ]; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+### DB Installation
+echo -n -e "$Y Installing Database .. $N"
+yum install mariadb mariadb-server -y &>/dev/null
+if [ $? -eq 0 ]; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+systemctl start mariadb
+systemctl enable mariadb &>/dev/null
+
+#### Setting up DB
+echo -n -e "$B Configuring DB .. $N"
+mysql -e 'use studentapp' &>/dev/null
+if [ $? -eq 0 ]; then
+ echo -e "$C Skipping $N"
+else
+
+mysql </dev/null
+rm -rf /opt/tomcat/webapps/*
+wget -O /opt/tomcat/webapps/student.war https://github.com/carreerit/cogito/raw/master/appstack/student.war &>/dev/null
+sed -i -e '$ i ' /opt/tomcat/conf/context.xml
+grep TestDB /opt/tomcat/conf/context.xml &>/dev/null
+STAT=$?
+if [ -f /opt/tomcat/lib/mysql-connector-java-5.1.40.jar -a -f /opt/tomcat/webapps/student.war -a $STAT -eq 0 ];then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+### Configuring Web Server
+echo -n -e "$B Configuring Mod_JK .. $N"
+yum install httpd-devel gcc -y &>/dev//null
+wget $MODJK_URL -O /opt/$MODJK_TAR_FILE_NAME &>/dev/null
+cd /opt
+tar xf $MODJK_TAR_FILE_NAME
+cd $MODJK_TAR_DIR/native
+./configure --with-apxs=/bin/apxs &>/dev/null
+make &>/dev/null
+make install &>/dev/null
+echo 'LoadModule jk_module modules/mod_jk.so
+JkWorkersFile conf.d/workers.properties
+JkLogFile logs/mod_jk.log
+JkLogLevel info
+JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
+JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
+JkRequestLogFormat "%w %V %T"
+JkMount /student tomcatA
+JkMount /student/* tomcatA' >/etc/httpd/conf.d/mod_jk.conf
+
+echo '### Define workers
+worker.list=tomcatA
+### Set properties
+worker.tomcatA.type=ajp13
+worker.tomcatA.host=localhost
+worker.tomcatA.port=8009' >/etc/httpd/conf.d/workers.properties
+
+systemctl restart httpd
+if [ $? -eq 0 ] ; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+
+### Restart Services
+echo -n -e "$C Restarting Mariadb .. "
+systemctl restart mariadb &>/dev/null
+if [ $? -eq 0 ]; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+echo -n -e "$C Restarting TOmcat .. "
+pkill -9 java &>/dev/null
+/opt/tomcat/bin/startup.sh &>/dev/null
+if [ $? -eq 0 ]; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+echo -n -e "$C Restarting Web Server .. "
+systemctl restart httpd &>/dev/null
+if [ $? -eq 0 ]; then
+ echo -e "$G SUCCESS $N"
+else
+ echo -e "$R FAILURE $N"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+