Sunday, November 6, 2022

Ansible Modules

1)Ping

2)File

3)Copy

4)yum

5)setup 

6)user

7)lineinfile

8)template

9)service

10)debug

11)git

12)cli_config

13)archive

14)command


Playbook 1) Install httpd and start the service

---

- name: install httpd

  hosts: all

  become: true

  tasks:

    - name: Install httpd package

      yum:

        name: httpd

        state: installed

      notify: start httpd service


  handlers:

     - name: start httpd service

       service:

         name: httpd

         state: started

2)


How to connect from laptop to remote host via jump server:

Ansible Bastion - SSH to remote hosts using Bastion | Devops Junction (middlewareinventory.com)


Ansible Playbook Examples - Sample Ansible Playbooks | Devops Junction (middlewareinventory.com)

---
 - name: Ansible archive Examples
   user: vagrant
   hosts: testserver
   tasks:
    - name: Compress Directory contents
      become: yes
      archive:
        path: /apps/tomcat
        dest: /apps/tomcat.tar  
        format: tar
---
 - name: Ansible archive Examples
   user: vagrant
   hosts: testserver
   tasks:
    - name: Compress Directory contents
      become: yes
      archive:
        path: /apps/tomcat
        dest: /apps/tomcat.tar.gz
        format: gz
---
 - name: Ansible archive Examples
   user: vagrant
   hosts: testserver
   tasks:
    - name: Compress Directory contents
      become: yes
      archive:
        path: /apps/tomcat
        dest: /apps/tomcat.tar.gz
        format: gz
---
 - name: Ansible archive Examples
   user: vagrant
   hosts: testserver
   tasks:
    - name: Compress the file and remove
      become: yes
      archive:
        path: /apps/tomcat/logs/localhost-access.log
        dest: /apps/tomcat/localhost-access.log.gz
        remove: yes













1 comment:

Sample Game App Deployment on EKS cluster

 https://padmakshi.medium.com/setting-up-an-eks-cluster-and-deploying-a-game-application-a-step-by-step-guide-08790e0be117