Skip to content

Commit d4cbac4

Browse files
new repo
1 parent b86f8bf commit d4cbac4

31 files changed

+1170
-1
lines changed

Ansible/Ansible_install

Whitespace-only changes.

Ansible/Ansible_install_on_RHEL.MD

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#### On RHEL 8.x server
2+
3+
1. Install Python latest version (on Control node and Managed host)
4+
```sh
5+
yum install python3 -y
6+
```
7+
8+
1. By default, python3 is the command to run python commands. to use just python, use "alternatives" command. (on Control node and Managed host)
9+
```sh
10+
alternatives --set python /usr/bin/python3
11+
```
12+
13+
1. Check for Python version
14+
```sh
15+
python --version
16+
```
17+
1. Install python-pip package manager (on Control node)
18+
```sh
19+
yum -y install python3-pip
20+
```
21+
22+
1. Create a new user for ansible administration & grant admin access to the user (on Control node and Managed host)
23+
```sh
24+
useradd ansadmin
25+
passwd ansadmin
26+
```
27+
1. Below command adds ansadmin to sudoers file. But we strongly recommended using "visudo" command if you are aware vi or nano editor. (on Control node and Managed host)
28+
```sh
29+
echo "ansadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
30+
```
31+
1. Using key-based authentication is advised. If you are still at the learning stage use password-based authentication (on Control node and Managed host)
32+
```sh
33+
# sed command replaces "PasswordAuthentication no to yes" without editing file
34+
sed -ie 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
35+
sudo service sshd reload
36+
```
37+
38+
#### Install Ansible as a ansadmin user (on Control node)
39+
```sh
40+
su - ansadmin
41+
pip3 install ansible --user
42+
```
43+
Note: Ansible must be installed as a user (here ansadmin)
44+
1. check for ansible version
45+
```sh
46+
ansible --version
47+
```
48+
49+
1. Log in as a ansadmin user on master and generate ssh key (on Control node)
50+
```sh
51+
ssh-keygen
52+
```
53+
1. Copy keys onto all ansible managed hosts (on Control node)
54+
```sh
55+
ssh-copy-id ansadmin@<target-server>
56+
```
57+
### Validation test
58+
59+
1. Create a directory /etc/ansible and create an inventory file called "hosts" add control node IP address in it.
60+
61+
1. Run ansible command as ansadmin user it should be successful (Master)
62+
```sh
63+
ansible all -m ping
64+
```

Ansible/Ansible_installation.MD

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Ansible Installation
2+
3+
Ansible is an open-source automation platform. It is very, very simple to set up and yet powerful. Ansible can help you with configuration management, application deployment, task automation.
4+
5+
### Pre-requisites
6+
7+
1. An AWS EC2 instance (on Control node)
8+
9+
### Installation steps:
10+
#### on Amazon EC2 instance
11+
12+
1. Install python and python-pip
13+
```sh
14+
yum install python
15+
yum install python-pip
16+
```
17+
1. Install ansible using pip check for version
18+
```sh
19+
pip install ansible
20+
ansible --version
21+
```
22+
23+
1. Create a user called ansadmin (on Control node and Managed host)
24+
```sh
25+
useradd ansadmin
26+
passwd ansadmin
27+
```
28+
1. Below command grant sudo access to ansadmin user. But we strongly recommended using "visudo" command if you are aware vi or nano editor. (on Control node and Managed host)
29+
```sh
30+
echo "ansadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
31+
```
32+
33+
1. Log in as a ansadmin user on master and generate ssh key (on Control node)
34+
```sh
35+
ssh-keygen
36+
```
37+
1. Copy keys onto all ansible managed hosts (on Control node)
38+
```sh
39+
ssh-copy-id ansadmin@<target-server>
40+
```
41+
42+
1. Ansible server used to create images and store on docker registry. Hence install docker, start docker services and add ansadmin to the docker group.
43+
```sh
44+
yum install docker
45+
46+
# start docker services
47+
service docker start
48+
service docker start
49+
50+
# add user to docker group
51+
usermod -aG docker ansadmin
52+
53+
```
54+
1. Create a directory /etc/ansible and create an inventory file called "hosts" add control node and managed hosts IP addresses to it.
55+
56+
### Validation test
57+
58+
59+
1. Run ansible command as ansadmin user it should be successful (Master)
60+
```sh
61+
ansible all -m ping
62+
```

Docker/DockerHub.MD

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## What is Docker Hub Registry
2+
3+
Docker Hub is a cloud-based registry service which allows you to link to code repositories, build your images and test them, stores manually pushed images, and links to Docker Cloud so you can deploy images to your hosts. It provides a centralized resource for container image discovery, distribution and change management, user and team collaboration, and workflow automation throughout the development pipeline.
4+
5+
##### Ref URL : https://docs.docker.com/docker-hub/
6+
7+
1. Create a docker hub account in https://hub.docker.com/
8+
9+
1. Pull a docker image
10+
11+
```sh
12+
docker pull ubuntu
13+
```
14+
15+
1. pull a docker image with the old version
16+
17+
```sh
18+
docker pull ubuntu:16.04
19+
```
20+
21+
1. create a custom tag to the docker image
22+
```sh
23+
docker tag ubuntu:latest valaxy/ubuntu:demo
24+
```
25+
26+
1. login to your docker hub registry
27+
```sh
28+
docker login
29+
docker push valaxy/ubuntu:demo
30+
```
31+
32+
### testing
33+
34+
1. Remove all images in docker server
35+
```sh
36+
docker image rm -f <Image_id>
37+
```
38+
39+
1. Pull your custom image from your docker account
40+
```sh
41+
docker pull valaxy/ubuntu:demo
42+
```
43+

Docker/Docker_Commands.MD

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
1. how to search a docker image in hub.docker.com
3+
```sh
4+
docker search httpd
5+
```
6+
2. Download a docker image from hub.docker.com
7+
```sh
8+
docker image pull <image_name>:<image_version/tag>
9+
```
10+
11+
3. List out docker images from your local system
12+
```sh
13+
docker image ls
14+
```
15+
16+
4. Create/run/start a docker container from image
17+
```sh
18+
docker run -d --name <container_Name> <image_name>:<image_version/tag>
19+
20+
d - run your container in back ground (detached)
21+
```
22+
23+
5. Expose your application to host server
24+
```sh
25+
docker run -d -p <host_port>:<container_port> --name <container_Name> <image_name>:<Image_version/tag>
26+
27+
docker run -d --name httpd_server -p 8080:80 httpd:2.2
28+
```
29+
30+
6. List out running containers
31+
```sh
32+
docker ps
33+
```
34+
35+
7. List out all docker container (running, stpooed, terminated, etc...)
36+
```sh
37+
docker ps -a
38+
```
39+
40+
8. run a OS based container which interactive mode (nothing but login to container after it is up and running)
41+
42+
```sh
43+
docker run -i -t --name centos_server centos:latest
44+
i - interactive
45+
t - Terminal
46+
```
47+
48+
9. Stop a container
49+
```sh
50+
docker stop <container_id>
51+
```
52+
53+
10. Start a container which is in stopped or exit state
54+
55+
```sh
56+
docker start <container_id>
57+
```
58+
11. Remove a container
59+
60+
```sh
61+
docker rm <container_id>
62+
```
63+
64+
12. login to a docker container
65+
```sh
66+
docker exec -it <container_Name> /bin/bash
67+
```

Docker/Docker_Installation_Steps.MD

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Installing Docker on Amazon Linux server
2+
3+
### Pre-requisites
4+
1. Amazon Linux EC2 Instance
5+
6+
## Installation Steps
7+
8+
1. Install docker and start docker services
9+
```sh
10+
yum install docker -y
11+
docker --version
12+
13+
# start docker services
14+
service docker start
15+
service docker status
16+
```
17+
1. Create a user called dockeradmin
18+
```sh
19+
useradd dockeradmin
20+
passwd dockeradmin
21+
```
22+
1. add a user to docker group to manage docker
23+
```
24+
usermod -aG docker dockeradmin
25+
```
26+
### Validation test
27+
1. Create a tomcat docker container by pulling a docker image from the public docker registry
28+
```sh
29+
docker run -d --name test-tomcat-server -p 8090:8080 tomcat:latest
30+
```
31+
32+
## Docker Installation on CentOS server
33+
##### Referance URL : https://docs.docker.com/install/linux/docker-ce/centos/#install-using-the-repository
34+
### Pre-requisites
35+
36+
Please follow below steps to install docker CE on CentoOS server instance. For RedHat only Docker EE available
37+
38+
1. Install the required packages.
39+
40+
```sh
41+
sudo yum install -y yum-utils \
42+
device-mapper-persistent-data \
43+
lvm2
44+
```
45+
46+
1. Use the following command to set up the stable repository.
47+
48+
```sh
49+
sudo yum-config-manager \
50+
--add-repo \
51+
https://download.docker.com/linux/centos/docker-ce.repo
52+
```
53+
54+
### INSTALLING DOCKER CE
55+
56+
1. Install the latest version of Docker CE.
57+
```sh
58+
sudo yum install docker-ce
59+
```
60+
61+
Note: If prompted to accept the GPG key, verify that the fingerprint matches
62+
060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.
63+
64+
1. Start Docker.
65+
```sh
66+
sudo systemctl start docker
67+
```
68+
69+
1. Verify that docker is installed correctly by running the hello-world image.
70+
```sh
71+
sudo docker run hello-world
72+
```

Docker/install_apache_dockerfile.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM ubuntu:12.04
2+
3+
MAINTAINER Valaxy Technologies [email protected]
4+
5+
LABEL version="1.1.0" \
6+
app_name="Training registration application" \
7+
release_date="9-Sep-2018"
8+
RUN apt-get update && apt-get install -y apache2 && apt-get clean
9+
10+
ENV APACHE_RUN_USER www-data
11+
ENV APACHE_RUN_GROUP www-data
12+
ENV APACHE_LOG_DIR /var/log/apache2
13+
14+
EXPOSE 80
15+
16+
COPY index.html /var/www/html
17+
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
18+
19+
20+
21+
22+
23+

Jenkins/Ansible_integration.MD

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Ansible integration with Jenkins
2+
3+
Follow this on **[YouTube](https://www.youtube.com/watch?v=nE4b9mW2ym0)**
4+
5+
### Prerequisites:
6+
1. Ansible server **[Get Help Here](https://www.youtube.com/watch?v=79xFyOc_eEY)**
7+
2. Jenkins Server **[Get Help Here](https://www.youtube.com/watch?v=M32O4Yv0ANc)**
8+
9+
### Part-01 Integration Setps
10+
11+
Install "publish Over SSH"
12+
- `Manage Jenkins` > `Manage Plugins` > `Available` > `Publish over SSH`
13+
14+
Enable connection between Ansible and Jenkins
15+
- `Manage Jenkins` > `Configure System` > `Publish Over SSH` > `SSH Servers`
16+
17+
- SSH Servers:
18+
- Hostname:`<ServerIP>`
19+
- username: `ansadm`
20+
- password: `*******`
21+
22+
Test the connection "Test Connection"

Jenkins/Git_plugin_install.MD

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Configure Git pulgin on Jenkins
2+
Git is one of the most popular tools for version control system. you can pull code from git repositories using jenkins if you use github plugin.
3+
4+
5+
#### Prerequisites
6+
1. Jenkins server
7+
8+
#### Install Git on Jenkins server
9+
1. Install git packages on jenkins server
10+
```sh
11+
yum install git -y
12+
```
13+
14+
#### Setup Git on jenkins console
15+
- Install git plugin without restart
16+
- `Manage Jenkins` > `Jenkins Plugins` > `available` > `github`
17+
18+
- Configure git path
19+
- `Manage Jenkins` > `Global Tool Configuration` > `git`
20+

0 commit comments

Comments
 (0)