Difference between revisions of "Ansible Roles"

From rbachwiki
Jump to navigation Jump to search
(Created page with "= Create Roles to organize playbooks= <code> --- - name: Install httpd package yum: name: httpd state: present - name: Start httpd service: name: httpd state: started - name: Open port for http firewalld: service: http permanent: true state: enabled - name: Restart firewalld service: name: firewalld state: reloaded </code>")
 
Line 1: Line 1:
= Create Roles to organize playbooks=
= Create Roles to organize playbooks=


<code>
 
---
---
- name: Install httpd package
- name: Install httpd package
   yum:
   yum:
   name: httpd
   name: httpd
   state: present
   state: present
 
- name: Start httpd
- name: Start httpd
   service:
   service:
   name: httpd
   name: httpd
   state: started
   state: started
 
- name: Open port for http
- name: Open port for http
   firewalld:
   firewalld:
   service: http
   service: http
   permanent: true
   permanent: true
   state: enabled
   state: enabled
 
- name: Restart firewalld  
- name: Restart firewalld  
   service:
   service:
   name: firewalld
   name: firewalld
   state: reloaded
   state: reloaded
</code>

Revision as of 15:58, 30 June 2022

Create Roles to organize playbooks

---
- name: Install httpd package
 yum:
  name: httpd
  state: present

- name: Start httpd
 service:
  name: httpd
  state: started

- name: Open port for http
 firewalld:
  service: http
  permanent: true
  state: enabled

- name: Restart firewalld 
 service:
  name: firewalld
  state: reloaded