Table of Contents

Ansible Best Playbooks with Roles



Ansible CLI Commands Cheet Sheat and Configuration Examples

How to execute

$ ansible-playbook webserver.yml -i hosts/local


directory structure

ansible/
    webserver.yml
    apserver.yml
    dbserver.yml

    hosts/
          local
          production
          staging
          test

    roles/
        common-centos6/
            files/
                xxxx.rpm
                xxxx.sh
                xxxx.conf
            tasks/
                main.yml

        nginx/
            files/
                xxxx.rpm
                xxxx.sh
                xxxx.conf
            tasks/
                main.yml

        mysql/
            files/
                xxxx.rpm
                xxxx.sh
                xxxx.conf
            tasks/
                main.yml

hosts/local


webserver.yml

-hosts: all
  become: yes
  roles:
    -common
    -nginx


Ansible CLI Commands Cheet Sheat and Configuration Examples





Ansible CLI Commands Cheet Sheat and Configuration Examples