12 Commits

Author SHA1 Message Date
Major Hayden
6cd15acb26
Remove jinja2 delimiters from when
This patch removes Jinja2 delimiters from when clauses and fixes the
capitalization of task names to match the other tasks in the file.

Closes-Bug: 1735785
Change-Id: I16334a11c551026c593b1872a44ed68f786719a5
2017-12-01 10:24:05 -06:00
Andy McCrae
57de3c8817 Check if changes have made before attempting a rebalance
Utilize the "ringbuilder.devs_changed" option to ensure that the ring
needs a rebalance. This will prevent unnecessary rebalances that cause
failures due to "min_part_hours" not being passed even though no changes
were required.

Additionally, we can now return a correct Ansible repsonse when the ring
has changed/rebalanced - and return "OK" when it hasn't returned at all.

Change-Id: I1fb4b3544a50ab5f566b3846d616107a84ff29c9
2017-03-20 13:03:32 +00:00
Jean-Philippe Evrard
7e2db5362d Bring consistency to tags
Some tags were not applied on the highest level and forced duplication.
We apply here our practices to have role_name-(config|install) [1].

[1]: http://docs.openstack.org/developer/openstack-ansible/developer-docs/contribute.html#ansible-style-guide

Change-Id: I1cfb335307bc63e6c962c8bdbcb420b03c10f531
2017-01-13 13:44:06 +00:00
Logan V
7de60df8c3 Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: Ib78b5fd36dcd23d18fc13382359f5099405856d0
2016-11-02 13:03:19 +00:00
alextricity25
388a831d11 Cleanup/standardize usage of tags
The numerous tags within the role have been condensed
to two tags: swift-install and swift-config

These tags have been chosen as they are namespaced
and cover the two major functions of the role.

Change-Id: I96c04e5d2e43e68ad5af3cc5c6035130a5650af0
Signed-off-by: alextricity25 <miguel.cantu@rackspace.com>
2016-08-16 09:30:41 -05:00
Kevin Carter
99bfe27d7f
Fixed simple performance issue and deprecations
* Unquoted veriable deprecations have been resolved.
  [DEPRECATION WARNING]: Using bare variables is deprecated.
* Undefined variable references have been ressolved.
  [DEPRECATION WARNING]: Skipping task due to undefined Error,
* An Ansible performance issue has been discovered and fixed.
    When a task is "included", contains variables within the
    "include", and loads other tasks with conditionals that
    iterate  (using a lookup plugin) Ansible will spinlock for
    ~30 seconds per item per task. To resolve this the iteration
    using the lookup plugin was removed and the task broken out
    into individual tasks.

Change-Id: I1ca59bc71b93324900a2e68b9d83d075d8e8ce32
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-08-01 22:06:33 -05:00
Andy McCrae
cce0410334 Add pretend_min_part_hours_passed to ring build
Expose the "pretend_min_part_hours_passed" option when accessing
swift-ring-builder.

This PR adds a variable "swift_pretend_min_part_hours_passed" which
defaults to False.

Change-Id: Ief94f011049b57f1ab0c2c48dfa81659d7ba13f7
2016-07-13 09:27:54 +01:00
Andy McCrae
eb04bf154d Refactor Swift ring build & check tasks
We use duplicate tasks to handle a case where we specify
swift_managed_regions, we could handle this with an if statement
that will only add the '-r' flag when the variable is specified.

This PR removes the 2 duplicate tasks in both the build and
distribution_check tasks.

Change-Id: Icba70faf90c5e54499c67bac382a8bd507143ee8
2016-07-08 12:49:50 +01:00
Andy McCrae
0b834970a5 Merge os-swift-sync role into os-swift
The repo split out has meant that having multiple roles for swift has
become inconvenient. We can merge the os-swift-sync role back into
os-swift and utilise variables to ensure that the swift-install,
swift-setup and swift-sync playbooks work in the same way.

This will avoid code duplication and the requirement for duplicated
changes to happen to both repositories.

Change-Id: If01d8a3aa29fc7637aecb92e61929523af08103d
2016-03-17 09:10:52 +00:00
Andy McCrae
8fc0c9a8b4 Add swift-sync role and environment
Add the swift-remote host group and environment file.

Add an os_swift_sync role which will sync the swift ring and ssh keys
for swift hosts (remote and not-remote). Which has the following:
 * Moves the key and ring tasks out of os_swift role to os_swift_sync.
 * This adds the use of the "-r" flag that was added to the
   swift_rings.py and swift_rings_check.py.
 * Adds a ring.builder vs contents file consistency check.
 * Adjusts the rsync process to use the built-in synchronize module
 * Ensure services have started post ring/ssh key sync.

Adds environment file and sample configuration file for swift-remote
hosts (conf.d).

Move appropriate default vars to the os_swift_sync role, and remove them
from the os_swift role.

Rename the "os-swift-install.yml" playbook to "os-swift-setup.yml" as
this handles only the setup, and add a playbook to for both
os-swift-sync.yml and an overarching playbook (os-swift-install.yml)
that will call both the os-swift-sync.yml and os-swift-setup.yml
playbooks. This means the funcitonality of "os-swift-install.yml"
remains unchanged.

Adjust the run-playbooks.sh so that it calls the new overarching swift
playbook.

Change-Id: Ie2d8041b4bc46f092a96882fe3ca430be92195ed
Partially-Implements: blueprint multi-region-swift
2015-08-07 08:45:18 +00:00
Andy McCrae
59bff1bd3a Distribute rings to build dir on all swift_hosts
This prevents a situation where swift_hosts[0] changes as a host, or is
removed (meaning a new swift_hosts[0]) which would prevent the rings
from being built. Additionally it will act as a backup for the ring
build files.

To clarify the purpose of the rings directory, the directory was renamed
to "ring_build_files", clarifying that the active rings are in
/etc/swift/

Change-Id: Id878d219504db195353286b28d7c038e5e659263
Closes-Bug: #1444529
2015-04-15 16:30:58 +01:00
Kevin Carter
64b7659015 Convert existing roles into galaxy roles
This change implements the blueprint to convert all roles and plays into
a more generic setup, following upstream ansible best practices.

Items Changed:
* All tasks have tags.
* All roles use namespaced variables.
* All redundant tasks within a given play and role have been removed.
* All of the repetitive plays have been removed in-favor of a more
  simplistic approach. This change duplicates code within the roles but
  ensures that the roles only ever run within their own scope.
* All roles have been built using an ansible galaxy syntax.
* The `*requirement.txt` files have been reformatted follow upstream
  Openstack practices.
* Dynamically generated inventory is now more organized, this should assist
  anyone who may want or need to dive into the JSON blob that is created.
  In the inventory a properties field is used for items that customize containers
  within the inventory.
* The environment map has been modified to support additional host groups to
  enable the seperation of infrastructure pieces. While the old infra_hosts group
  will still work this change allows for groups to be divided up into seperate
  chunks; eg: deployment of a swift only stack.
* The LXC logic now exists within the plays.
* etc/openstack_deploy/user_variables.yml has all password/token
  variables extracted into the separate file
  etc/openstack_deploy/user_secrets.yml in order to allow seperate
  security settings on that file.

Items Excised:
* All of the roles have had the LXC logic removed from within them which
  should allow roles to be consumed outside of the `os-ansible-deployment`
  reference architecture.

Note:
* the directory rpc_deployment still exists and is presently pointed at plays
  containing a deprecation warning instructing the user to move to the standard
  playbooks directory.
* While all of the rackspace specific components and variables have been removed
  and or were refactored the repository still relies on an upstream mirror of
  Openstack built python files and container images. This upstream mirror is hosted
  at rackspace at "http://rpc-repo.rackspace.com" though this is
  not locked to and or tied to rackspace specific installations. This repository
  contains all of the needed code to create and/or clone your own mirror.

DocImpact
Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
Closes-Bug: #1403676
Implements: blueprint galaxy-roles
Change-Id: I03df3328b7655f0cc9e43ba83b02623d038d214e
2015-02-18 10:56:25 +00:00