cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

middleware:iac:ansible:best-with-roles.html



Ansible Best Playbooks with Roles

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




middleware/iac/ansible/best-with-roles.html.txt ยท Last modified: 2020/04/12 by admin

Page Tools