Ansible Notes – Aug Batch Online – Notes – Day -3

DevOps

MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

ansible web -i inventory -m apt -a"name=apache2 state=present" -u ubuntu -k -b
ansible web -i inventory -m copy -a"src=index.html dest=/var/www/html/index.html" -u ubuntu -k -b
ansible web -i inventory -m service -a"name=apache2 state=started"  -u ubuntu -k -b

ansible web -i inventory -m apt -a"name=apache2 state=present" -u ubuntu -k -b
ansible web -i inventory -m copy -a"src=index.html dest=/var/www/html/index.html" -u ubuntu -k -b
ansible web -i inventory -m service -a"name=apache2 state=started"  -u ubuntu -k -b


ansible web -i inventory -m apt -a"name=apache2 state=present" -u ubuntu -k -b
ansible web -i inventory -m copy -a"src=index.html dest=/var/www/html/index.html" -u ubuntu -k -b
ansible web -i inventory -m service -a"name=apache2 state=started"  -u ubuntu -k -b

Ansible Playbook
================================
YAML
Contains PLAY

PLAY
---------------------------
Hosts:	localhost OR Groupname from inventory
TAsKS:
	Task1 == Mode1 n Its Param
	Task2 == Mode1 n Its Param
	Task3 == Mode1 n Its Param
	Task4 == Mode1 n Its Param
==========================================


---
- name: Update web servers
  hosts: localhost

  tasks:
  - name: Install apache httpd  (state=present is optional)
    ansible.builtin.apt:
      name: apache2
      state: present
  - name: Copy file with owner and permissions
    ansible.builtin.copy:
      src: index.html
      dest: /var/www/html/index.html
  - name: Start service httpd, if not started
    ansible.builtin.service:
      name: apache2
      state: started




===============================
ansible-playbook web.yaml

ansible-playbook -C web.yaml

ansible-playbook -C web.yaml -vvvvvvv

ansible-playbook -i inventory web.yaml -u ubuntu -k -b

==================================================
How to add Vars | Template | Handlers | Cond | Loop


Code language: JavaScript (javascript)
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x