Ansible Roles by Application

From rbachwiki
Jump to navigation Jump to search

Create Roles based on Applications

To Create Role

cd /etc/ansible/roles
  • Make a Directory for each role
Mkdir apache
mkdir phpmyadmin
mkdir tmux
  • Create sub-directory tasks' within each directory
Mkdir apache/tasks
mkdir phpmyadmin/tasks
mkdir tmux/tasks
  • Create yml file within these sub-directories
touch apache/tasks/main.yml
touch phpmyadmin/tasks/main.yml
touch tmux/tasks/main.yml

Write your yml file and install those apps

---
- name: install packages
  hosts: all
  roles:
  - apache
  - phpmyadmin
  - tmux


Ansible Menu