This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Ansible: Repository Hierarchy (config,yml, global.yml)

Tip

Setup instructions can be found in Setup Ansible.

Repository

The Ansible configuration is stored in a Git repository in the /wordpress directory.

Overview of the repository structure:

tocco
    │
    ├── config.yml                                # Definition of existing WordPress instances
    │
    ├── global.yml                                # Global variables
    │
    ├── inventory.py                              # Script used to parse config.yml/global.yml and
    │                                             # convert it to a proper Ansible Inventory
    │
    ├── playbook.yml                              # Starting point for executing playbook.
    │
    ├── roles
    │   ├── wordpress                             # Server-wide configuration related to WordPress
    │   │
    │   └── wordpress-sites                       # Per instance configuration
    │
    ├── secrets2.yml                              # Ansible Vault containing passwords
    │
    │
    └── wordpress/                                # Root folder for WordPress-related playbooks

Configuration (config.yml/global.yml)

This is identical to Configuration (config.yml/global.yml) except that another level is added for WordPress (wordpress):

Structure

Hint

All variables pertaining to WordPress have a leading wordpress_ prefix. Variables that apply to both Nice and WordPress, for example, enable_monitoring, will not have such a prefix but can still be set per WordPress instance.

global.yml:

# Global variables

wordpress_memory_limit: 2G
wordpress_post_max_size: 5M

config.yml:

abc:                                        # Customer "abc"

  wordpress_memory_limit: 1G                # Customer variables for "abc"

  installations:
    abc:                                    # Installation "abc"

      wordpress_memory_limit: 3G            # Installation variables for "abc"

      wordpress:
        routes:
          example.net:

    abctest:                                # Installation "abctest"

      wordpress_post_max_size: 5M           # Installation variables for "abctest"

      wordpress:
        abctest:                            # WordPress instance "abctest"
          routes:
            web.abctest.tocco.ch:           # WordPress routes
          wordpress_post_max_size: 8M       # WordPress instance variable

        abctest-tmp:
          routes:
            temp.example.net:

Variable Precedence

Variables from highest to lowest priority. Higher priority precedes lower priority:

  • WordPress instance variables (added for WordPress, identical to Nice variables otherwise)

  • Nice Installation variables

  • Customer variables

  • Global variables

Example:

global.yml:

wordpress_xyz: 1

config.yml:

abc:
  wordpress_xyz: 2              # overrides '1'
  abc:
    wordpress_xyz: 3            # overrides '2'
  abctest:
xyz:
  xyz:
  xyztest:
    wordpress_xyz: 4            # overrides '1'
    wordpress:
      xyztest:
        wordpress_xyz: 5        # overrides '4'

More Information

Most of the documentation in Ansible: Repository Hierarchy (ansible.yml, global.yml) applies for WordPress too.