Skip to content

Crossover assignment answers

herve meftah edited this page Feb 5, 2018 · 2 revisions

Answers to CROSSOVER assignment

Create a Centos 7 VM on a cheap provider such as lunanode https://www.lunanode.com/

No 1

  • Install Icinga 2 and Icinga Web 2 on CentOS 7

No 2

see https://www.vultr.com/docs/how-to-install-icinga-2-and-icinga-web-2-on-centos-7

No 3 and 4

install docker on the VM see https://docs.docker.com/engine/installation/linux/docker-ce/centos/ sudo yum epel-release

sudo yum install python-pip

sudo pip install docker-compose

see docker-compose.yml

Now icinga web is on the port 80 and it is able to monitor all docker containers . Container Web_application is connected to the port 8080 et phpmyadmin to port 8181. Logs files are copied respectively to /var/log/centos-web and /var/log/mysql-db.

CROSSOVER might want a batch script for doing a sort of logrotate, I guess. You have to think of it or leave it as it is.

No 5 -

type as root

pip install boto3

pip install awscli

yum -y install git

as a user

type

aws configure

set access ID and access secret key

as user type

git clone https://github.com/promogekko/python2-aws.git

and

cd python2-aws

and

type ./example-boto3.py see Python source code

check in the Aws console S3 if you get the S3 bucket you need to prefix your bucket with an IP address to get a unique bucket name. log2S3 is the Python script to copy all logs files to Amazon S3 In the directory python2-aws.git see the file cronfile change the path to the script log2S3 accordingly to your directory.

type crontab cronfile

check with crontab -l

change the time and check on AWS S3 if all files are there

No 6

create a .netrc file in your home directory

insert this line it’s the database user/password

machine db login root password password

do a git pull if you have already cloned the git repo

https://github.com/promogekko/python2-aws.git or do a git clone

backup script is mysql-backup.py

I used a docker exec command directly to the container for doing a backup of test database previously created using phpmyadmin see :8181 root/password I added another line in cronfile file so now I can do all database backup

No 7

Find an Ansible playbook.yml file for starting a fresh install of your VM (without Icinga install)

Change the inventory file accordingly to your Centos VM

Modified the /vars/main.yml file with your AWS credentials

and here the command to run the ansible script against a new Centos VM

ansible-playbook playbook.yml -i inventory


https://app.crossover.com/x/marketplace/available-jobs?label=12

test

Clone this wiki locally