Debug School

Diktesh
Diktesh

Posted on

Day2

ansible-playbook SQL1.yaml

  • name: Create a new group hosts: localhost # Change this to the appropriate host(s) where you want to create the group become: yes # Enable privilege escalation to execute commands with root/administrator permissions

tasks:
- name: Create the group
group:
name: deploy

#####################################33

ansible-playbook SQL2.yaml


  • name: Create index.html file with dummy HTML contents hosts: target_host # Replace 'target_host' with the name of the host where you want to create the file become: yes # Enable privilege escalation to execute commands with root/administrator permissions

tasks:
- name: Create the directory if it doesn't exist
file:
path: /var/www/html
state: directory

- name: Create index.html file with dummy contents
  copy:
    content: |
      <!DOCTYPE html>
      <html>
      <head>
          <title>Welcome to my website</title>
      </head>
      <body>
          <h1>Hello, this is a dummy index page!</h1>
          <p>This is just a placeholder for your real content.</p>
      </body>
      </html>
    dest: /var/www/html/index.html
Enter fullscreen mode Exit fullscreen mode

ansible-playbook -i inventory SQL7.yaml


  • name: Create index.html file with dummy HTML contents hosts: target_host # Replace 'target_host' with the name of the host where you want to create the file become: yes # Enable privilege escalation to execute commands with root/administrator permissions

tasks:
- name: Create the directory if it doesn't exist
file:
path: /var/www/html
state: directory

- name: Create index.html file with dummy contents
  template:
    src: index.html.j2
    dest: /var/www/html/index.html
Enter fullscreen mode Exit fullscreen mode

Top comments (0)