From 1dbab50ff81cf657f99468faa6359364fe9ad7d8 Mon Sep 17 00:00:00 2001 From: ffdavis <33498961+ffdavis@users.noreply.github.com> Date: Sat, 8 Dec 2018 02:41:01 -0300 Subject: [PATCH 01/23] ansadmin corrected instead of dockeradmin ansadmin corrected instead of dockeradmin --- SimpeDevOpsProjects/Project-4.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimpeDevOpsProjects/Project-4.MD b/SimpeDevOpsProjects/Project-4.MD index ef91b2c..444b552 100644 --- a/SimpeDevOpsProjects/Project-4.MD +++ b/SimpeDevOpsProjects/Project-4.MD @@ -61,7 +61,7 @@ In *part-01* we create Docker image on ansible server through Jenkins job and pu #### Troubleshooting: 1. Docker should be installed on ansible server 1. Should login to "docker hub" on ansible server -1. Docker admin user should be part of `docker` group +1. ansadmin user should be part of `docker` group In *Part-02* we create *create_docker_container.yml* playbook. this get intiated by jenkins job, run by ansible and exected on dokcer_host From e24b33aa4396e31a4f9c7ab91966a26ee51fee7f Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Sat, 22 Dec 2018 08:28:22 +0530 Subject: [PATCH 02/23] updated git info --- Jenkins/Git_plugin_install.MD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkins/Git_plugin_install.MD b/Jenkins/Git_plugin_install.MD index 09c15b1..09cad2a 100644 --- a/Jenkins/Git_plugin_install.MD +++ b/Jenkins/Git_plugin_install.MD @@ -12,11 +12,11 @@ Install git packages on jenkins server yum install git -y ``` -#### Setup maven on jenkins console -- Install maven plugin without restart +#### Setup Git on jenkins console +- Install git plugin without restart - `Manage Jenkins` > `Jenkins Plugins` > `available` > `github` -- Configure java path +- Configure git path - `Manage Jenkins` > `Global Tool Configuration` > `git` #### Next Steps From c00ed2167084a5dad3cb85ff722d87b8e3b32c95 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 10:28:39 +0530 Subject: [PATCH 03/23] Delete testfile3 --- testfile3 | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 testfile3 diff --git a/testfile3 b/testfile3 deleted file mode 100644 index e11b757..0000000 --- a/testfile3 +++ /dev/null @@ -1,2 +0,0 @@ -djalfjadsd -dsjfadlj From 613e4187acd841f96eb3ba6f4ff6d4928d1abd56 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 10:28:47 +0530 Subject: [PATCH 04/23] Delete testfile2 --- testfile2 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 testfile2 diff --git a/testfile2 b/testfile2 deleted file mode 100644 index 8b13789..0000000 --- a/testfile2 +++ /dev/null @@ -1 +0,0 @@ - From 0a8b7d4c06f788c5924ef5242610a92e9abf9b8a Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 10:28:56 +0530 Subject: [PATCH 05/23] Delete testfile --- testfile | 1 - 1 file changed, 1 deletion(-) delete mode 100644 testfile diff --git a/testfile b/testfile deleted file mode 100644 index 4a576e5..0000000 --- a/testfile +++ /dev/null @@ -1 +0,0 @@ -this is a test file From 6f0305a196a5d913511ebc075397bcef1f895dc5 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 10:30:29 +0530 Subject: [PATCH 06/23] Create S3_Artifact_for_Jenkins --- Jenkins/S3_Artifact_for_Jenkins | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Jenkins/S3_Artifact_for_Jenkins diff --git a/Jenkins/S3_Artifact_for_Jenkins b/Jenkins/S3_Artifact_for_Jenkins new file mode 100644 index 0000000..e56ad68 --- /dev/null +++ b/Jenkins/S3_Artifact_for_Jenkins @@ -0,0 +1,31 @@ + +1. Create Jenkins Server + +2. Create a S3 bucket to store artifacts + ```sh + S3 --> Create bucket + ``` + Bucket name: valaxy-s3-artifact + Region: Singapore + + +3. Create new IAM role with "S3 full access" and assign it to jenkins server + IAM --> Create role --> EC2 + Permission: AmazonS3FullAccess + Tags: key - Name, Value - S3FullAccess + Role name: S3_Full_Access + +4. Install "S3 Publisher" plugin on Jenkins + + ` Manage Jenkins --> Manage Plugins --> availabe --> S3 publisher ` + +5. Create "Amazon S3 profiles" under Configure Systems + ` Manage Jenkins --> Configure Systems --> Amazon S3 profiles` + Profile name : s3-artifact-repository + Use IAM Role : chose + +6. Create a job to store artifacts under S3. + +Validations: + Go and check S3 bucket for artifact + From ad96402206a521864ca2b63c2faffe1014c3f743 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 19:09:41 +0530 Subject: [PATCH 07/23] Rename S3_Artifact_for_Jenkins to S3_Artifact_for_Jenkins.md --- Jenkins/{S3_Artifact_for_Jenkins => S3_Artifact_for_Jenkins.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Jenkins/{S3_Artifact_for_Jenkins => S3_Artifact_for_Jenkins.md} (100%) diff --git a/Jenkins/S3_Artifact_for_Jenkins b/Jenkins/S3_Artifact_for_Jenkins.md similarity index 100% rename from Jenkins/S3_Artifact_for_Jenkins rename to Jenkins/S3_Artifact_for_Jenkins.md From 646b9f92906ef4c8368f76899f91cf8f1d4e2caf Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 19:26:02 +0530 Subject: [PATCH 08/23] Update S3_Artifact_for_Jenkins.md --- Jenkins/S3_Artifact_for_Jenkins.md | 55 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/Jenkins/S3_Artifact_for_Jenkins.md b/Jenkins/S3_Artifact_for_Jenkins.md index e56ad68..3604cac 100644 --- a/Jenkins/S3_Artifact_for_Jenkins.md +++ b/Jenkins/S3_Artifact_for_Jenkins.md @@ -1,31 +1,34 @@ -1. Create Jenkins Server +# S3 as a artifact for Jenkins -2. Create a S3 bucket to store artifacts - ```sh - S3 --> Create bucket - ``` - Bucket name: valaxy-s3-artifact - Region: Singapore - - -3. Create new IAM role with "S3 full access" and assign it to jenkins server - IAM --> Create role --> EC2 - Permission: AmazonS3FullAccess - Tags: key - Name, Value - S3FullAccess - Role name: S3_Full_Access - -4. Install "S3 Publisher" plugin on Jenkins - ` Manage Jenkins --> Manage Plugins --> availabe --> S3 publisher ` +### Prerequisites +1. Create Jenkins Server + Jenkins server **[Get Help here](https://www.youtube.com/watch?v=M32O4Yv0ANc) + + ### Setup steps +1. Create a S3 bucket to store artifacts + `S3 --> Create bucket ` + ```sh + Bucket name: valaxy-s3-artifact + Region: Singapore + ``` +1. Create new IAM role with "S3 full access" and assign it to jenkins server + `IAM --> Create role --> EC2` + ```ssh + Permission: AmazonS3FullAccess + Tags: key - Name, Value - S3FullAccess Role + name: S3_Full_Access + ``` -5. Create "Amazon S3 profiles" under Configure Systems - ` Manage Jenkins --> Configure Systems --> Amazon S3 profiles` - Profile name : s3-artifact-repository - Use IAM Role : chose - -6. Create a job to store artifacts under S3. +1. Install "S3 Publisher" plugin on Jenkins + `Manage Jenkins --> Manage Plugins --> Availabe --> S3 publisher` + +1. Configure S3 profile on Jenkins + `Manage Jenkins --> Configure Systems --> Amazon S3 profiles` + ```sh + Profile name : s3-artifact-repository + Use IAM Role : chose + ``` -Validations: - Go and check S3 bucket for artifact - +1. Create a job to store artifacts under S3. From d3ae534e3052dd3f2f58de0d880e685afa03d5d7 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 19:26:47 +0530 Subject: [PATCH 09/23] Update S3_Artifact_for_Jenkins.md --- Jenkins/S3_Artifact_for_Jenkins.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkins/S3_Artifact_for_Jenkins.md b/Jenkins/S3_Artifact_for_Jenkins.md index 3604cac..7c21ab4 100644 --- a/Jenkins/S3_Artifact_for_Jenkins.md +++ b/Jenkins/S3_Artifact_for_Jenkins.md @@ -13,7 +13,7 @@ Bucket name: valaxy-s3-artifact Region: Singapore ``` -1. Create new IAM role with "S3 full access" and assign it to jenkins server +1. Create new IAM role with "S3 full access" and assign it to jenkins server `IAM --> Create role --> EC2` ```ssh Permission: AmazonS3FullAccess @@ -21,10 +21,10 @@ name: S3_Full_Access ``` -1. Install "S3 Publisher" plugin on Jenkins +1. Install "S3 Publisher" plugin on Jenkins `Manage Jenkins --> Manage Plugins --> Availabe --> S3 publisher` -1. Configure S3 profile on Jenkins +1. Configure S3 profile on Jenkins `Manage Jenkins --> Configure Systems --> Amazon S3 profiles` ```sh Profile name : s3-artifact-repository From 064273109fe8fb84a89a70039c08496143901155 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Feb 2019 19:27:07 +0530 Subject: [PATCH 10/23] Update S3_Artifact_for_Jenkins.md --- Jenkins/S3_Artifact_for_Jenkins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkins/S3_Artifact_for_Jenkins.md b/Jenkins/S3_Artifact_for_Jenkins.md index 7c21ab4..8f55386 100644 --- a/Jenkins/S3_Artifact_for_Jenkins.md +++ b/Jenkins/S3_Artifact_for_Jenkins.md @@ -7,7 +7,7 @@ Jenkins server **[Get Help here](https://www.youtube.com/watch?v=M32O4Yv0ANc) ### Setup steps -1. Create a S3 bucket to store artifacts +1. Create a S3 bucket to store artifacts `S3 --> Create bucket ` ```sh Bucket name: valaxy-s3-artifact From 182ba2d1adda6ff905d4a90e8a42ad6ae82efcc9 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Wed, 13 Feb 2019 06:36:05 +0530 Subject: [PATCH 11/23] Update S3_Artifact_for_Jenkins.md --- Jenkins/S3_Artifact_for_Jenkins.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkins/S3_Artifact_for_Jenkins.md b/Jenkins/S3_Artifact_for_Jenkins.md index 8f55386..70740d6 100644 --- a/Jenkins/S3_Artifact_for_Jenkins.md +++ b/Jenkins/S3_Artifact_for_Jenkins.md @@ -1,10 +1,11 @@ # S3 as a artifact for Jenkins +Follow this in YouTube **[Get Help here](https://youtu.be/GQZYpIRxi-g)** ### Prerequisites 1. Create Jenkins Server - Jenkins server **[Get Help here](https://www.youtube.com/watch?v=M32O4Yv0ANc) + Jenkins server **[Get Help here](https://www.youtube.com/watch?v=M32O4Yv0ANc)** ### Setup steps 1. Create a S3 bucket to store artifacts From 9dbb69bf06f8ec13c780ca96df29e97e905f6193 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Wed, 13 Feb 2019 06:36:34 +0530 Subject: [PATCH 12/23] Update S3_Artifact_for_Jenkins.md --- Jenkins/S3_Artifact_for_Jenkins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkins/S3_Artifact_for_Jenkins.md b/Jenkins/S3_Artifact_for_Jenkins.md index 70740d6..bf493a5 100644 --- a/Jenkins/S3_Artifact_for_Jenkins.md +++ b/Jenkins/S3_Artifact_for_Jenkins.md @@ -1,7 +1,7 @@ # S3 as a artifact for Jenkins -Follow this in YouTube **[Get Help here](https://youtu.be/GQZYpIRxi-g)** +Follow this in **[YouTube](https://youtu.be/GQZYpIRxi-g)** ### Prerequisites 1. Create Jenkins Server From 7ff2903f25b085191b0efa6dda5e72b21485a30c Mon Sep 17 00:00:00 2001 From: Miztiik Date: Mon, 4 Mar 2019 14:21:49 +0100 Subject: [PATCH 13/23] Highlighting commands Highlighting commands --- SimpeDevOpsProjects/Project-3.MD | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/SimpeDevOpsProjects/Project-3.MD b/SimpeDevOpsProjects/Project-3.MD index 8edc7d9..ba5c685 100644 --- a/SimpeDevOpsProjects/Project-3.MD +++ b/SimpeDevOpsProjects/Project-3.MD @@ -26,7 +26,7 @@ mkdir /opt/docker From tomcat:8-jre8 # Maintainer -MAINTAINER "valaxytech@gmail.com" +MAINTAINER "valaxytech" # copy war file on to container COPY ./webapp.war /usr/local/tomcat/webapps @@ -47,14 +47,14 @@ B) Build C) send files or execute commands over SSH Name: docker_host - Source files : webapp/target/*.war - Remove prefix : webapp/target - Remote directory : //opt//docker - Exec command : docker stop valaxy_demo; docker rm -f valaxy_demo; docker image rm -f valaxy_demo; cd /opt/docker; docker build -t valaxy_demo . + Source files : `webapp/target/*.war` + Remove prefix : `webapp/target` + Remote directory : `//opt//docker` + Exec command : `docker stop valaxy_demo; docker rm -f valaxy_demo; docker image rm -f valaxy_demo; cd /opt/docker; docker build -t valaxy_demo .` D) send files or execute commands over SSH - Name: docker_host - Exec command : docker run -d --name valaxy_demo -p 8090:8080 valaxy_demo + Name: `docker_host` + Exec command : `docker run -d --name valaxy_demo -p 8090:8080 valaxy_demo` 7. Login to Docker host and check images and containers. (no images and containers) @@ -63,4 +63,6 @@ D) send files or execute commands over SSH 9. check images and containers again on Docker host. This time an image and container get creates through Jenkins job 10. Access web application from browser which is running on container +``` :8090 +``` From 53577e66a79cd6f796bf41bb3d573a9317dc185d Mon Sep 17 00:00:00 2001 From: Miztiik Date: Mon, 4 Mar 2019 14:24:48 +0100 Subject: [PATCH 14/23] Highlighting Command Syntax Highlighting Command Syntax --- SimpeDevOpsProjects/Project-3.MD | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SimpeDevOpsProjects/Project-3.MD b/SimpeDevOpsProjects/Project-3.MD index ba5c685..9da214d 100644 --- a/SimpeDevOpsProjects/Project-3.MD +++ b/SimpeDevOpsProjects/Project-3.MD @@ -50,7 +50,14 @@ C) send files or execute commands over SSH Source files : `webapp/target/*.war` Remove prefix : `webapp/target` Remote directory : `//opt//docker` - Exec command : `docker stop valaxy_demo; docker rm -f valaxy_demo; docker image rm -f valaxy_demo; cd /opt/docker; docker build -t valaxy_demo .` + Exec command[s] : + ```sh + docker stop valaxy_demo; + docker rm -f valaxy_demo; + docker image rm -f valaxy_demo; + cd /opt/docker; + docker build -t valaxy_demo . + ``` D) send files or execute commands over SSH Name: `docker_host` From 08417769cd9af4ca9211cf02015a65913fc374b3 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Mar 2019 08:00:20 +0530 Subject: [PATCH 15/23] Create K8s-setup initial commit --- Kubernetes/k8s-setup | 81 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Kubernetes/k8s-setup diff --git a/Kubernetes/k8s-setup b/Kubernetes/k8s-setup new file mode 100644 index 0000000..b4bf14c --- /dev/null +++ b/Kubernetes/k8s-setup @@ -0,0 +1,81 @@ + +#### Setup Kubernetes (K8s) Cluster on AWS + + +1. Create Ubuntu EC2 instance +1. install AWSCLI + ```sh + curl https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundle.zip + apt install unzip python + unzip awscli-bundle.zip + #sudo apt-get install unzip - if you dont have unzip in your system + ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws + ``` + +1. Install kubectl + ```sh + curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl + chmod +x ./kubectl + sudo mv ./kubectl /usr/local/bin/kubectl + ``` +1. Create an IAM user/role with Route53, EC2, IAM and S3 full access +1. Attach IAM role to ubuntu server + + #### Note: If you create IAM user with programmatic access then provide Access keys. + ```sh + aws configure + ``` +1. Install kops on ubuntu instance: + ```sh + curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64 + chmod +x kops-linux-amd64 + sudo mv kops-linux-amd64 /usr/local/bin/kops + ``` +1. Create a Route53 private hosted zone (you can create Public hosted zone if you have a domain) +1. create an S3 bucket + ```sh + aws s3 mb s3://dev.k8s.valaxy.in + ``` +1. Expose environment variable: + ```sh + export KOPS_STATE_STORE=s3://dev.k8s.valaxy.in + ``` +1. Create sshkeys before creating cluster + ```sh + ssh-keygen + ``` +1. Create kubernetes cluster definitions on S3 bucket + ```sh + kops create cluster --cloud=aws --zones=ap-southeast-1b --name=dev.k8s.valaxy.in --dns-zone=valaxy.in --dns private + ``` +1. Create kubernetes cluser + ```sh + kops update cluster dev.k8s.valaxy.in --yes + ``` +1. Validate your cluster + ```sh + kops validate cluster + ``` + +1. To list nodes + ```sh + kubectl get nodes + ``` + +#### Deploying Nginx container on Kubernetes +1. Deploying Nginx Container + ```sh + kubectl run sample-nginx --image=nginx --replicas=2 --port=80 + kubectl get pods + kubectl get deployments + ``` + +1. Expose the deployment as service. This will create an ELB in front of those 2 containers and allow us to publicly access them: + ```sh + kubectl expose deployment sample-nginx --port=80 --type=LoadBalancer + kubectl get services -o wide + ``` + 1. To delete cluster + ```sh + kops update cluster dev.k8s.valaxy.in --yes + ``` From c16da671a32c11a833daa4fdb7d3e8b2698ca0e6 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Mar 2019 08:00:45 +0530 Subject: [PATCH 16/23] Rename k8s-setup to k8s-setup.md --- Kubernetes/{k8s-setup => k8s-setup.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Kubernetes/{k8s-setup => k8s-setup.md} (100%) diff --git a/Kubernetes/k8s-setup b/Kubernetes/k8s-setup.md similarity index 100% rename from Kubernetes/k8s-setup rename to Kubernetes/k8s-setup.md From 328647fba6a18d1f43422423095d6d3383639064 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Tue, 12 Mar 2019 09:18:21 +0530 Subject: [PATCH 17/23] Update k8s-setup.md --- Kubernetes/k8s-setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kubernetes/k8s-setup.md b/Kubernetes/k8s-setup.md index b4bf14c..31412b0 100644 --- a/Kubernetes/k8s-setup.md +++ b/Kubernetes/k8s-setup.md @@ -77,5 +77,5 @@ ``` 1. To delete cluster ```sh - kops update cluster dev.k8s.valaxy.in --yes + kops delete cluster dev.k8s.valaxy.in --yes ``` From 692bf65013173f7bc2fa23cfcad525b32ca74023 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Wed, 24 Jul 2019 05:28:40 +0530 Subject: [PATCH 18/23] initial commit Ansible installation on RHEL --- Ansible/Ansible_installation_on_RHEL8 | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Ansible/Ansible_installation_on_RHEL8 diff --git a/Ansible/Ansible_installation_on_RHEL8 b/Ansible/Ansible_installation_on_RHEL8 new file mode 100644 index 0000000..595b433 --- /dev/null +++ b/Ansible/Ansible_installation_on_RHEL8 @@ -0,0 +1,64 @@ +#### On RHEL 8.x server + +1. Install Python latest version (on Control node and Managed host) + ```sh + yum install python3 -y + ``` + +1. By default, python3 is the command to run python commands. to use just python, use "alternatives" command. (on Control node and Managed host) + ```sh + alternatives --set python /usr/bin/python3 + ``` + +1. Check for Python version + ```sh + python --version + ``` +1. Install python-pip package manager (on Control node) + ```sh + yum -y install python3-pip + ``` + +1. Create a new user for ansible administration & grant admin access to the user (on Control node and Managed host) + ```sh + useradd ansadmin + passwd ansadmin + ``` +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) + ```sh + echo "ansadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + ``` +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) + ```sh + # sed command replaces "PasswordAuthentication no to yes" without editing file + sed -ie 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config + sudo service sshd reload + ``` + + #### Install Ansible as a ansadmin user (on Control node) + ```sh + su - ansadmin + pip3 install ansible --user + ``` + Note: Ansible must be installed as a user (here ansadmin) +1. check for ansible version + ```sh + ansible --version + ``` + +1. Log in as a ansadmin user on master and generate ssh key (on Control node) + ```sh + ssh-keygen + ``` +1. Copy keys onto all ansible managed hosts (on Control node) + ```sh + ssh-copy-id ansadmin@ + ``` +### Validation test + +1. Create a directory /etc/ansible and create an inventory file called "hosts" add control node IP address in it. + +1. Run ansible command as ansadmin user it should be successful (Master) + ```sh + ansible all -m ping + ``` From 1dc59cd269576540bc163a4bd319df1e2f775186 Mon Sep 17 00:00:00 2001 From: AR Shankar Date: Wed, 24 Jul 2019 00:02:51 +0000 Subject: [PATCH 19/23] Modified ansible file --- ...ble_installation_on_RHEL8 => Ansible_installation_on_RHEL8.MD} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Ansible/{Ansible_installation_on_RHEL8 => Ansible_installation_on_RHEL8.MD} (100%) diff --git a/Ansible/Ansible_installation_on_RHEL8 b/Ansible/Ansible_installation_on_RHEL8.MD similarity index 100% rename from Ansible/Ansible_installation_on_RHEL8 rename to Ansible/Ansible_installation_on_RHEL8.MD From 87bed86590b112c61095b9c3e13db24f5a749508 Mon Sep 17 00:00:00 2001 From: AR Shankar Date: Wed, 24 Jul 2019 00:04:06 +0000 Subject: [PATCH 20/23] title updated --- Ansible/Ansible_installation_on_RHEL8.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ansible/Ansible_installation_on_RHEL8.MD b/Ansible/Ansible_installation_on_RHEL8.MD index 595b433..7a01a87 100644 --- a/Ansible/Ansible_installation_on_RHEL8.MD +++ b/Ansible/Ansible_installation_on_RHEL8.MD @@ -1,4 +1,4 @@ -#### On RHEL 8.x server +# Ansible Installation on RHEL 8.x server 1. Install Python latest version (on Control node and Managed host) ```sh From 55a0e0c475ac07103882e01821f980eb95976df9 Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Sat, 10 Aug 2019 23:02:28 +0530 Subject: [PATCH 21/23] Ansible Dynamic Inventory Ansible Dynamic Inventory --- Ansible/Dynamic_Inventory.MD | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Ansible/Dynamic_Inventory.MD diff --git a/Ansible/Dynamic_Inventory.MD b/Ansible/Dynamic_Inventory.MD new file mode 100644 index 0000000..d6004b6 --- /dev/null +++ b/Ansible/Dynamic_Inventory.MD @@ -0,0 +1,34 @@ +# Ansible Dynamic Inventory + +### Pre-requisites: + 1. Ansible Server - Get [Click here](https://www.youtube.com/watch?v=-Y8Oatd49qA) to install on RHEL 8 and [click here](https://www.youtube.com/watch?v=79xFyOc_eEY) to install on Amazon Linux + + +### Setup + +To get dynamic inventory details please follow this [Ansible Document](https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html#inventory-script-example-aws-ec2) + +1. Download [ec2.py](https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py) and [ec2.ini](https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini) files + +1. Create IAM Programmatic access user with EC2 full access on AWS console + + `IAM` --> `users` --> `Add user` + +1. Export IAM user credentials on Ansible server. + + ```bash + export AWS_ACCESS_KEY_ID='1bc123' + export AWS_SECRET_ACCESS_KEY='abc123' + ``` +1. add executing permissions to ec2.py script + ```sh + chmod 755 ec2.py + ``` +1. test the script + ``` + ./ec2.py --list + ``` +1. List out servers which are running on ap-south-1a AZ + ``` + ansible -i ec2.py ap-south-1a --list-hosts + ``` From 3352f1b86f4a79aebc345a3c6b5b516ad6afe74b Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Mon, 19 Aug 2019 07:03:27 +0530 Subject: [PATCH 22/23] Update Dynamic_Inventory.MD --- Ansible/Dynamic_Inventory.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ansible/Dynamic_Inventory.MD b/Ansible/Dynamic_Inventory.MD index d6004b6..1d48b92 100644 --- a/Ansible/Dynamic_Inventory.MD +++ b/Ansible/Dynamic_Inventory.MD @@ -6,7 +6,7 @@ ### Setup -To get dynamic inventory details please follow this [Ansible Document](https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html#inventory-script-example-aws-ec2) +To get help on dynamic inventory please follow [Ansible Official Document](https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html#inventory-script-example-aws-ec2) 1. Download [ec2.py](https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py) and [ec2.ini](https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini) files From c7f8bf16683d6395ff5dbe48535a8a4ecb2996db Mon Sep 17 00:00:00 2001 From: ValaxyTech <40397252+ValaxyTech@users.noreply.github.com> Date: Mon, 19 Aug 2019 07:06:47 +0530 Subject: [PATCH 23/23] Update Dynamic_Inventory.MD --- Ansible/Dynamic_Inventory.MD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Ansible/Dynamic_Inventory.MD b/Ansible/Dynamic_Inventory.MD index 1d48b92..70ffb70 100644 --- a/Ansible/Dynamic_Inventory.MD +++ b/Ansible/Dynamic_Inventory.MD @@ -20,6 +20,8 @@ To get help on dynamic inventory please follow [Ansible Official Document](http export AWS_ACCESS_KEY_ID='1bc123' export AWS_SECRET_ACCESS_KEY='abc123' ``` +1. To export keys permanently make sure that you have installed pip and boto and add credentials ~/.boto file + 1. add executing permissions to ec2.py script ```sh chmod 755 ec2.py