Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Testing

When you want to make changes, make sure to commit them to staging or a new branch which you merge to staging.

Check that the staging branch deploys properly to staging automatically.

You cannot directly commit to master. Make a branch and merge it with staging, then commit staging to master.

If staging encounters no errors, merge staging with master. Do not delete the staging branch.

A box, manage_prod updates its copy of the repository every 2 minutes

...

Development Workflow

Take a look at

Variable Structure

Ansible looks at a number of different files when building or updating a box. When looking for a variable, use the following guide to decide where to check for a variable or where to place one. All variables are in the group_vars folder.

...

  1. Locate the file. Ansible files are pushed out from role/ROLENAME/templates or role/ROLENAME/file  files in templates have variables while files in the file directory are static.
    1. At the moment a role guide to help locate files isn't written, the usual name pattern for a template is file_name.extension.j2 where j2 is the jinja2 extension. Search for the file name to find it if you're not sure what role it might be in.
  2. Edit the file with the new value(s).
  3. Edit the group_var file(s) with the values you need.
  4. Commit your change
  5. Push your change to Bitbucket
  6. If you need to run the update sooner, manually run the update command in the main Ansible page.

...

  1. and push it to the repository.

Editing tasks

Ansible tasks are the default way to accomplish an action. We are using the role structure when designing new actions for Ansible, so when making a new set of tasks you will want to

...

See Editing Templates for the process to update and push out changes.

If you need to test in something in staging which absolutely cannot run in production, such as a potentially destructive password edit turn off the cronjob in manage_prod.

Editing handlers

Ansible handlers are tasks which only run when notified by another task that it has changed something. This is the preferred method to handle restarting or modifying services. This avoids potential downtimes or restarts when changes are not made to the machine's state.

...

Tasks which send an alert to the handler use notify: handler name

See Editing Templates for the process to update and push out changes.

If you need to test in something in staging which absolutely cannot run in production, such as a potentially destructive password edit turn off the cronjob in manage_prod.