Role repo_server for OpenStack-Ansible
Go to file
Hugh Saunders b457f3bda6 Disable slave repo servers while syncing
Currently there is a race between the repo servers syncing and the first
role that attempts to install a pip package. This change ensures that
only the primary repo server is accessible until the slaves are synced.

This is achieved by adding a hook into lsyncd that allows a command to
be run before and after each sync. This command is an ssh command to
connect to the relevant secondary container and stop/start nginx. As the
nginx user is unprivileged, a sudoers file is added to allow nginx to be
stopped and started.

Notes on adding the hook into lsyncd:
 * There is an existing script in lsyncd/examples for postcmd. This
   works at a higher level by adding an event onto the stack for executing a
   command once the sync has finished. I experimented with that but
   events dont get fired for the initial recursive sync, only on
   subsequent changes. As it is the initial sync that causes the problem
   that this patch is addressing, I had to look at a lower level.

 * The lsync lua C lib has an exec function, but it is hidden from
   config scripts except through the spawn(...) function. However spawn
   requires an event so can't be used for the initial sync.

 * I ended up going outside the lsync framework and using lua's own
   os.execute() function for pre/post cmds.

While this looks like a big patch, its actually a relatively small
change to the default rsync script. See
https://github.com/hughsaunders/lsyncd/compare/master...hughsaunders:rsync_prepost
for a comparison.

Bug: #1543146
Change-Id: I045a4a6bf722d6f1e01d21fbbec733872acb87a5
2016-03-16 07:19:20 +00:00
defaults Remove memcached_server dependency 2016-03-07 08:24:36 -08:00
doc first commit 2015-12-09 09:25:37 -06:00
files Removed sshd_config file 2016-03-02 04:20:17 +00:00
handlers first commit 2015-12-09 09:25:37 -06:00
meta Remove memcached_server dependency 2016-03-07 08:24:36 -08:00
releasenotes/notes Disable slave repo servers while syncing 2016-03-16 07:19:20 +00:00
tasks Disable slave repo servers while syncing 2016-03-16 07:19:20 +00:00
templates Disable slave repo servers while syncing 2016-03-16 07:19:20 +00:00
tests Remove memcached_server dependency 2016-03-07 08:24:36 -08:00
.gitreview updated repo pathing for new org 2015-12-10 20:47:45 -06:00
CONTRIBUTING.rst first commit 2015-12-09 09:25:37 -06:00
LICENSE first commit 2015-12-09 09:25:37 -06:00
README.rst Remove memcached_server dependency 2016-03-07 08:24:36 -08:00
other-requirements.txt Add curl to bindep requirements 2016-03-04 19:25:30 +00:00
run_tests.sh first commit 2015-12-09 09:25:37 -06:00
setup.cfg first commit 2015-12-09 09:25:37 -06:00
setup.py first commit 2015-12-09 09:25:37 -06:00
test-requirements.txt Update tox config and add bashate E006, E040 exceptions 2016-02-12 11:59:02 +00:00
tox.ini Implement human readable logging for functional tests 2016-03-01 16:04:36 +00:00

README.rst

OpenStack repo server

tags

openstack, repo, server, cloud, ansible

category

*nix

Role to deploy a repository server for both python packages and git sources.

- name: Setup repo servers
  hosts: repo_all
  user: root
  roles:
    - { role: "repo_server", tags: [ "repo-server" ] }