You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

GOAL

To organize our Ansible Repository, to easily merge all in one.

Ansible Command

For staging environment:

    ansible-playbook -i inventory/staging playbook/site.yml

For production environment:

    ansible-playbook -i inventory/production playbook/site.yml

repository organization

Inventory/                # here we store our inventory file

   production             # inventory file for production servers

   staging                # inventory file for staging environment

 

group_vars/

   generic                # here we assign variables to generic groups

   comanage               # here we assign variables to comanage groups

   teip                   # here we assign variables to TEIP groups

   loadbalancer           # here we assign variables to loadbalance groups

   vault                  # Vault file, to store password and secret informations   

 

host_vars/

   hostname1              # if systems need specific variables, put them here

   hostname2              # ""

  

playbook/

   site.yml                  # master playbook

   webservers.yml            # playbook for webserver tier

   dbservers.yml             # playbook for dbserver tier

 

roles/

    generic/               # this hierarchy represents a "role"

        tasks/            #

            main.yml      #  <-- tasks file can include smaller files if warranted

        handlers/         #

            main.yml      #  <-- handlers file

        templates/        #  <-- files for use with the template resource

            ntp.conf.j2   #  <------- templates end in .j2

        files/            #

            bar.txt       #  <-- files for use with the copy resource

            foo.sh        #  <-- script files for use with the script resource

        vars/             #

            main.yml      #  <-- variables associated with this role

        defaults/         #

            main.yml      #  <-- default lower priority variables for this role

        meta/             #

            main.yml      #  <-- role dependencies

 

work in progress..

 

  • No labels