diff --git a/ansible-playbook.yml b/ansible-playbook.yml new file mode 100644 index 0000000..6db9bde --- /dev/null +++ b/ansible-playbook.yml @@ -0,0 +1,97 @@ +--- +- name: Play 1 - Run Roles for misl softwares,Apache & Tomcat + hosts: webservers + become: yes + vars: + v_role_path: "{{ WORKSPACE }}/roles" + roles: + - "{{ v_role_path }}/misl" + - "{{ v_role_path }}/apache" + - "{{ v_role_path }}/tomcat" + +- name: Play 2 - Custom configuration of Apache + hosts: webservers + become: yes + tasks: + - name: delete the doc root dir + file: + path: /var/www/html + state: absent + + - name: "code copy" + git: + repo: 'https://github.com/mailrahulsre/learnwithprojects.com.git' + dest: /var/www/html + version: master + force: yes + + - name: copy the proxypass file + copy: + src: "{{ WORKSPACE }}/proxypass.conf" + dest: /etc/httpd/conf.d/proxypass.conf + owner: root + group: root + notify: + - reload apache + + - name: Set httpd_can_network_connect flag on and keep it persistent across reboots + seboolean: + name: httpd_can_network_connect + state: yes + persistent: yes + tags: selinux + + handlers: + - name: reload apache + service: name=httpd state=reloaded + +- name: Play 3 - Python Install + hosts: webservers + become: yes + tasks: + - name: Install Python 3.6 + yum: + name: python36 + state: present + tags: python-install + + - name: alternatives + alternatives: + name: python + link: /usr/bin/python3.6 + path: /usr/bin/python3 + tags: python-alternatives + +- name: Play 4 - Python library install and copying of War file + hosts: webservers + become: yes + vars: + ansible_python_interpreter: /usr/bin/python + tasks: + - name: Install boto3 and botocore with pip3 module + pip: + name: + - boto + - boto3 + - botocore + executable: pip3.6 + tags: boto-lib-install + + - name: copy the war file + aws_s3: + bucket: lwplabs + object: login##1.0.war + dest: /etc/tomcat/webapps/login##1.0.war + mode: get + tags: copy-war + +- name: Play 5 - Start Tomcat Servers + hosts: webservers + become: yes + become_user: root + tasks: + #- name: shut tomcat + #command: nohup sh /etc/tomcat/bin/shutdown.sh + - name: start tomcat + command: nohup sh /etc/tomcat/bin/startup.sh + tags: start-tomcat diff --git a/bootstrapping.sh b/bootstrapping.sh new file mode 100644 index 0000000..bdfa1a6 --- /dev/null +++ b/bootstrapping.sh @@ -0,0 +1,17 @@ +#!/bin/bash +############################################################# +## This script is used for bootstrapping servers for ansible +############################################################# + +LOGFILE=/tmp/bootstrap.log +sudo -i <> $LOGFILE 2>$LOGFILE +useradd ansadmin +cp /etc/sudoers /etc/sudoers-bkp-$date +echo "ansadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +su - ansadmin <> $LOGFILE 2>$LOGFILE +mkdir .ssh +chmod 700 .ssh +echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCcSB+8KnuOZCcmil1t99xkWDTPrM0OyhcqfqO0ZykRrkOspmadIAf2/PJTGiyEBIplasvJrRzWLQrqhGZGXK8AF9fpPeQH7Mp2tMzFpnPv971/UNIYV9b88mK3ciuDa9hn4yX9x0iwz+q5AJOimFW1xtg5PUR09f3jwsk7leF5z3KNzFwtqzaF01mwpnP8hI7JwrT6OMZXuaIbhoGIhSQvA8Flhw4WGbLanqUYqJ6ZGlRum++FXKw11L8Cqq0t72i4ByajK/4ZZdLxcmt8kRePfJuLiixvAfRB4fh2J6e10P3tPHWj4EU/f6IV8KQN3o0J8z5Bbhb7GcQyvDDPznvBegWTX0vsV57OxC7WIVSl6P9GoTx3mlZw/qmrwaw9eyc/cvyt5tliMl6/IvMsUIEZKQB1+KUtLg7Y1POuhopZliBRBwP+f2d/pEJh3UWAtW/dlvP30tbZhDQUIN3jZI06I6vbgJFKiKOcqv/Go/zysQE2cXD6Ury+FnOqx2AzHxE= ansadmin@ip-172-31-91-71.ec2.internal" >> .ssh/authorized_keys +chmod 600 .ssh/authorized_keys +EOF1 +EOF diff --git a/host.ini b/host.ini new file mode 100644 index 0000000..7d447af --- /dev/null +++ b/host.ini @@ -0,0 +1,3 @@ +[webservers] +172.31.83.173 +172.31.86.28 diff --git a/proxypass.conf b/proxypass.conf new file mode 100644 index 0000000..1d35a54 --- /dev/null +++ b/proxypass.conf @@ -0,0 +1,2 @@ +ProxyPass /login http://localhost:8080/login/ +ProxyPassReverse /login http://localhost:8080/login/ diff --git a/roles/apache/.travis.yml b/roles/apache/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/roles/apache/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/roles/apache/README.md b/roles/apache/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/apache/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/apache/defaults/main.yml b/roles/apache/defaults/main.yml new file mode 100644 index 0000000..27c13ca --- /dev/null +++ b/roles/apache/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for /etc/ansible/roles/apache \ No newline at end of file diff --git a/roles/apache/files/httpd.original b/roles/apache/files/httpd.original new file mode 100644 index 0000000..38a4c5e --- /dev/null +++ b/roles/apache/files/httpd.original @@ -0,0 +1,361 @@ +#This is Ansible genereated file +#v1.1 +#update by rahul on date - 30-Nov-2020 +#Change log - +# 1. Timeout change +# This is the main Apache HTTP server configuration file. It contains the +# configuration directives that give the server its instructions. +# See for detailed information. +# In particular, see +# +# for a discussion of each configuration directive. +# +# See the httpd.conf(5) man page for more information on this configuration, +# and httpd.service(8) on using and configuring the httpd service. +# +# Do NOT simply read the instructions in here without understanding +# what they do. They're here only as hints or reminders. If you are unsure +# consult the online docs. You have been warned. +# +# Configuration and logfile names: If the filenames you specify for many +# of the server's control files begin with "/" (or "drive:/" for Win32), the +# server will use that explicit path. If the filenames do *not* begin +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' +# with ServerRoot set to '/www' will be interpreted by the +# server as '/www/log/access_log', where as '/log/access_log' will be +# interpreted as '/log/access_log'. + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# Do not add a slash at the end of the directory path. If you point +# ServerRoot at a non-local disk, be sure to specify a local disk on the +# Mutex directive, if file-based mutexes are used. If you wish to share the +# same ServerRoot for multiple httpd daemons, you will need to change at +# least PidFile. +# +ServerRoot "/etc/httpd" + +# +# Listen: Allows you to bind Apache to specific IP addresses and/or +# ports, instead of the default. See also the +# directive. +# +# Change this to Listen on specific IP addresses as shown below to +# prevent Apache from glomming onto all bound IP addresses. +# +#Listen 12.34.56.78:80 +Listen 80 +Timeout 600 +# +# Dynamic Shared Object (DSO) Support +# +# To be able to use the functionality of a module which was built as a DSO you +# have to place corresponding `LoadModule' lines at this location so the +# directives contained in it are actually available _before_ they are used. +# Statically compiled modules (those listed by `httpd -l') do not need +# to be loaded here. +# +# Example: +# LoadModule foo_module modules/mod_foo.so +# +Include conf.modules.d/*.conf + +# +# If you wish httpd to run as a different user or group, you must run +# httpd as root initially and it will switch. +# +# User/Group: The name (or #number) of the user/group to run httpd as. +# It is usually good practice to create a dedicated user and group for +# running httpd, as with most system services. +# +User apache +Group apache + +# 'Main' server configuration +# +# The directives in this section set up the values used by the 'main' +# server, which responds to any requests that aren't handled by a +# definition. These values also provide defaults for +# any containers you may define later in the file. +# +# All of these directives may appear inside containers, +# in which case these default settings will be overridden for the +# virtual host being defined. +# + +# +# ServerAdmin: Your address, where problems with the server should be +# e-mailed. This address appears on some server-generated pages, such +# as error documents. e.g. admin@your-domain.com +# +ServerAdmin root@localhost + +# +# ServerName gives the name and port that the server uses to identify itself. +# This can often be determined automatically, but we recommend you specify +# it explicitly to prevent problems during startup. +# +# If your host doesn't have a registered DNS name, enter its IP address here. +# +#ServerName www.example.com:80 + +# +# Deny access to the entirety of your server's filesystem. You must +# explicitly permit access to web content directories in other +# blocks below. +# + + AllowOverride none + Require all denied + + +# +# Note that from this point forward you must specifically allow +# particular features to be enabled - so if something's not working as +# you might expect, make sure that you have specifically enabled it +# below. +# + +# +# DocumentRoot: The directory out of which you will serve your +# documents. By default, all requests are taken from this directory, but +# symbolic links and aliases may be used to point to other locations. +# +DocumentRoot "/var/www/html" + +# +# Relax access to content within /var/www. +# + + AllowOverride None + # Allow open access: + Require all granted + + +# Further relax access to the default document root: + + # + # Possible values for the Options directive are "None", "All", + # or any combination of: + # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews + # + # Note that "MultiViews" must be named *explicitly* --- "Options All" + # doesn't give it to you. + # + # The Options directive is both complicated and important. Please see + # http://httpd.apache.org/docs/2.4/mod/core.html#options + # for more information. + # + Options Indexes FollowSymLinks + + # + # AllowOverride controls what directives may be placed in .htaccess files. + # It can be "All", "None", or any combination of the keywords: + # Options FileInfo AuthConfig Limit + # + AllowOverride None + + # + # Controls who can get stuff from this server. + # + Require all granted + + +# +# DirectoryIndex: sets the file that Apache will serve if a directory +# is requested. +# + + DirectoryIndex index.html + + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + +# +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog "logs/error_log" + +# +# LogLevel: Control the number of messages logged to the error_log. +# Possible values include: debug, info, notice, warn, error, crit, +# alert, emerg. +# +LogLevel warn + + + # + # The following directives define some format nicknames for use with + # a CustomLog directive (see below). + # + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + # You need to enable mod_logio.c to use %I and %O + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + + + # + # The location and format of the access logfile (Common Logfile Format). + # If you do not define any access logfiles within a + # container, they will be logged here. Contrariwise, if you *do* + # define per- access logfiles, transactions will be + # logged therein and *not* in this file. + # + #CustomLog "logs/access_log" common + + # + # If you prefer a logfile with access, agent, and referer information + # (Combined Logfile Format) you can use the following directive. + # + CustomLog "logs/access_log" combined + + + + # + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. + # Example: + # Redirect permanent /foo http://www.example.com/bar + + # + # Alias: Maps web paths into filesystem paths and is used to + # access content that does not live under the DocumentRoot. + # Example: + # Alias /webpath /full/filesystem/path + # + # If you include a trailing / on /webpath then the server will + # require it to be present in the URL. You will also likely + # need to provide a section to allow access to + # the filesystem path. + + # + # ScriptAlias: This controls which directories contain server scripts. + # ScriptAliases are essentially the same as Aliases, except that + # documents in the target directory are treated as applications and + # run by the server when requested rather than as documents sent to the + # client. The same rules about trailing "/" apply to ScriptAlias + # directives as to Alias. + # + ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" + + + +# +# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased +# CGI directory exists, if you have that configured. +# + + AllowOverride None + Options None + Require all granted + + + + # + # TypesConfig points to the file containing the list of mappings from + # filename extension to MIME-type. + # + TypesConfig /etc/mime.types + + # + # AddType allows you to add to or override the MIME configuration + # file specified in TypesConfig for specific file types. + # + #AddType application/x-gzip .tgz + # + # AddEncoding allows you to have certain browsers uncompress + # information on the fly. Note: Not all browsers support this. + # + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + # + # If the AddEncoding directives above are commented-out, then you + # probably should define those extensions to indicate media types: + # + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + + # + # AddHandler allows you to map certain file extensions to "handlers": + # actions unrelated to filetype. These can be either built into the server + # or added with the Action directive (see below) + # + # To use CGI scripts outside of ScriptAliased directories: + # (You will also need to add "ExecCGI" to the "Options" directive.) + # + #AddHandler cgi-script .cgi + + # For type maps (negotiated resources): + #AddHandler type-map var + + # + # Filters allow you to process content before it is sent to the client. + # + # To parse .shtml files for server-side includes (SSI): + # (You will also need to add "Includes" to the "Options" directive.) + # + AddType text/html .shtml + AddOutputFilter INCLUDES .shtml + + +# +# Specify a default charset for all content served; this enables +# interpretation of all content as UTF-8 by default. To use the +# default browser choice (ISO-8859-1), or to allow the META tags +# in HTML content to override this choice, comment out this +# directive: +# +AddDefaultCharset UTF-8 + + + # + # The mod_mime_magic module allows the server to use various hints from the + # contents of the file itself to determine its type. The MIMEMagicFile + # directive tells the module where the hint definitions are located. + # + MIMEMagicFile conf/magic + + +# +# Customizable error responses come in three flavors: +# 1) plain text 2) local redirects 3) external redirects +# +# Some examples: +#ErrorDocument 500 "The server made a boo boo." +#ErrorDocument 404 /missing.html +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" +#ErrorDocument 402 http://www.example.com/subscription_info.html +# + +# +# EnableMMAP and EnableSendfile: On systems that support it, +# memory-mapping or the sendfile syscall may be used to deliver +# files. This usually improves server performance, but must +# be turned off when serving from networked-mounted +# filesystems or if support for these functions is otherwise +# broken on your system. +# Defaults if commented: EnableMMAP On, EnableSendfile Off +# +#EnableMMAP off +EnableSendfile on + +# Supplemental configuration +# +# Load config files in the "/etc/httpd/conf.d" directory, if any. +IncludeOptional conf.d/*.conf + diff --git a/roles/apache/handlers/main.yml b/roles/apache/handlers/main.yml new file mode 100644 index 0000000..05c210b --- /dev/null +++ b/roles/apache/handlers/main.yml @@ -0,0 +1,7 @@ +--- +# handlers file for /etc/ansible/roles/apache +- name: reload apache + service: + name: httpd + state: reloaded + diff --git a/roles/apache/meta/main.yml b/roles/apache/meta/main.yml new file mode 100644 index 0000000..227ad9c --- /dev/null +++ b/roles/apache/meta/main.yml @@ -0,0 +1,53 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.9 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. + \ No newline at end of file diff --git a/roles/apache/tasks/configure.yml b/roles/apache/tasks/configure.yml new file mode 100644 index 0000000..9d8afde --- /dev/null +++ b/roles/apache/tasks/configure.yml @@ -0,0 +1,10 @@ +- name: "Copy httpd Configuration file" + copy: + src: files/httpd.original + dest: /etc/httpd/conf/httpd.conf + owner: root + group: root + mode: '0644' + notify: + - reload apache + diff --git a/roles/apache/tasks/install.yml b/roles/apache/tasks/install.yml new file mode 100644 index 0000000..5be5a5e --- /dev/null +++ b/roles/apache/tasks/install.yml @@ -0,0 +1,4 @@ +- name: "Install Apache" + yum: + name: "{{ packages }}" + state: present diff --git a/roles/apache/tasks/main.yml b/roles/apache/tasks/main.yml new file mode 100644 index 0000000..f9be035 --- /dev/null +++ b/roles/apache/tasks/main.yml @@ -0,0 +1,6 @@ +--- +# tasks file for /etc/ansible/roles/apache +- import_tasks: install.yml +- import_tasks: service.yml +- import_tasks: configure.yml + diff --git a/roles/apache/tasks/service.yml b/roles/apache/tasks/service.yml new file mode 100644 index 0000000..89001b4 --- /dev/null +++ b/roles/apache/tasks/service.yml @@ -0,0 +1,5 @@ +- name: Start service httpd, if not started + service: + name: httpd + state: started + enabled: yes \ No newline at end of file diff --git a/roles/apache/tests/inventory b/roles/apache/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/apache/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/apache/tests/test.yml b/roles/apache/tests/test.yml new file mode 100644 index 0000000..be2f7a5 --- /dev/null +++ b/roles/apache/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - /etc/ansible/roles/apache \ No newline at end of file diff --git a/roles/apache/vars/main.yml b/roles/apache/vars/main.yml new file mode 100644 index 0000000..ef0016a --- /dev/null +++ b/roles/apache/vars/main.yml @@ -0,0 +1,7 @@ +--- +# vars file for /etc/ansible/roles/apache +packages: + - httpd + - httpd-tools + + diff --git a/roles/misl/.travis.yml b/roles/misl/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/roles/misl/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/roles/misl/README.md b/roles/misl/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/misl/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/misl/defaults/main.yml b/roles/misl/defaults/main.yml new file mode 100644 index 0000000..269754b --- /dev/null +++ b/roles/misl/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for /etc/ansible/roles/misl \ No newline at end of file diff --git a/roles/misl/handlers/main.yml b/roles/misl/handlers/main.yml new file mode 100644 index 0000000..3707d21 --- /dev/null +++ b/roles/misl/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for /etc/ansible/roles/misl \ No newline at end of file diff --git a/roles/misl/meta/main.yml b/roles/misl/meta/main.yml new file mode 100644 index 0000000..227ad9c --- /dev/null +++ b/roles/misl/meta/main.yml @@ -0,0 +1,53 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.9 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. + \ No newline at end of file diff --git a/roles/misl/tasks/main.yml b/roles/misl/tasks/main.yml new file mode 100644 index 0000000..bdc8177 --- /dev/null +++ b/roles/misl/tasks/main.yml @@ -0,0 +1,14 @@ +--- +# tasks file for /etc/ansible/roles/misl + +# Task 1 - installing vim, wget and nslookup + +- name: install the latest version of misl softwares + package: + name: + - vim + - wget + - bind-utils #nslookup + - tree + - git + state: latest diff --git a/roles/misl/tests/inventory b/roles/misl/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/misl/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/misl/tests/test.yml b/roles/misl/tests/test.yml new file mode 100644 index 0000000..a01556a --- /dev/null +++ b/roles/misl/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - /etc/ansible/roles/misl \ No newline at end of file diff --git a/roles/misl/vars/main.yml b/roles/misl/vars/main.yml new file mode 100644 index 0000000..cc9ede5 --- /dev/null +++ b/roles/misl/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for /etc/ansible/roles/misl \ No newline at end of file diff --git a/roles/tomcat/.travis.yml b/roles/tomcat/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/roles/tomcat/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/roles/tomcat/README.md b/roles/tomcat/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/tomcat/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/tomcat/defaults/main.yml b/roles/tomcat/defaults/main.yml new file mode 100644 index 0000000..7399109 --- /dev/null +++ b/roles/tomcat/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for /etc/ansible/roles/tomcat \ No newline at end of file diff --git a/roles/tomcat/files/apache-tomcat-8.5.60.tar.gz b/roles/tomcat/files/apache-tomcat-8.5.60.tar.gz new file mode 100644 index 0000000..95fe87d Binary files /dev/null and b/roles/tomcat/files/apache-tomcat-8.5.60.tar.gz differ diff --git a/roles/tomcat/handlers/main.yml b/roles/tomcat/handlers/main.yml new file mode 100644 index 0000000..390860e --- /dev/null +++ b/roles/tomcat/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for /etc/ansible/roles/tomcat \ No newline at end of file diff --git a/roles/tomcat/meta/main.yml b/roles/tomcat/meta/main.yml new file mode 100644 index 0000000..227ad9c --- /dev/null +++ b/roles/tomcat/meta/main.yml @@ -0,0 +1,53 @@ +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.9 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. + \ No newline at end of file diff --git a/roles/tomcat/tasks/java.yml b/roles/tomcat/tasks/java.yml new file mode 100644 index 0000000..3fa10cb --- /dev/null +++ b/roles/tomcat/tasks/java.yml @@ -0,0 +1,5 @@ +- name: "Install Java" + yum: + name: 'java-1.8*' + state: present + diff --git a/roles/tomcat/tasks/main.yml b/roles/tomcat/tasks/main.yml new file mode 100644 index 0000000..a693d30 --- /dev/null +++ b/roles/tomcat/tasks/main.yml @@ -0,0 +1,5 @@ +--- +# tasks file for /etc/ansible/roles/tomcat +- import_tasks: java.yml +- import_tasks: tomcat8.yml + #- import_tasks: service.yml diff --git a/roles/tomcat/tasks/tomcat8.yml b/roles/tomcat/tasks/tomcat8.yml new file mode 100644 index 0000000..b9ef755 --- /dev/null +++ b/roles/tomcat/tasks/tomcat8.yml @@ -0,0 +1,21 @@ + +- name: Unarchive a tomcat tar from tomcat website + unarchive: + src: https://dlcdn.apache.org/tomcat/tomcat-8/v{{ tomcatVersion }}/bin/apache-tomcat-{{ tomcatVersion }}.tar.gz + dest: /etc/ + remote_src: yes + owner: root + group: root + mode: 0755 + tags: + - tar-copy + +- name: create a soft link to th tomcat folder + file: + src: /etc/apache-tomcat-{{ tomcatVersion }} + dest: /etc/tomcat + owner: root + group: root + state: link + tags: + - softlink diff --git a/roles/tomcat/tests/inventory b/roles/tomcat/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/tomcat/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/tomcat/tests/test.yml b/roles/tomcat/tests/test.yml new file mode 100644 index 0000000..a4fe957 --- /dev/null +++ b/roles/tomcat/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - /etc/ansible/roles/tomcat \ No newline at end of file diff --git a/roles/tomcat/vars/main.yml b/roles/tomcat/vars/main.yml new file mode 100644 index 0000000..c2f5b86 --- /dev/null +++ b/roles/tomcat/vars/main.yml @@ -0,0 +1,3 @@ +--- +# vars file for /etc/ansible/roles/tomcat +tomcatVersion: 8.5.82 diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 9295819..c9afc4b 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -1,6 +1,6 @@ -

Welcome to maven Class


+

Welcome to Ansible class. Project is completed........................


Login
Register