From d039a62045a3a9a91e47fa3fdace23a79299c964 Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Wed, 11 Mar 2015 11:29:33 -0400
Subject: [PATCH] Move playbooks out of the puppet module

/etc/ansible/playbooks isn't actually a thing, it was just a convenient
place to put things. However, to enable puppet apply, we're going to
want a group_vars directory adjacent to the playbooks, so having them be
a subdirectory of the puppet module and installed by it is just extra
complexity. Also, if we run out of system-config, then it'll be easier
to work with things like what we do with puppet environments for testing
things.

Change-Id: I947521a73051a44036e7f4c45ce74a79637f5a8b
---
 doc/source/gerrit.rst                                        | 2 +-
 modules/openstack_project/manifests/puppetmaster.pp          | 5 +----
 .../ansible/playbooks => playbooks}/clean_workspaces.yaml    | 0
 .../ansible/playbooks => playbooks}/remote_puppet_afs.yaml   | 0
 .../ansible/playbooks => playbooks}/remote_puppet_else.yaml  | 0
 .../ansible/playbooks => playbooks}/remote_puppet_git.yaml   | 0
 run_all.sh                                                   | 5 +++--
 7 files changed, 5 insertions(+), 7 deletions(-)
 rename {modules/openstack_project/files/ansible/playbooks => playbooks}/clean_workspaces.yaml (100%)
 rename {modules/openstack_project/files/ansible/playbooks => playbooks}/remote_puppet_afs.yaml (100%)
 rename {modules/openstack_project/files/ansible/playbooks => playbooks}/remote_puppet_else.yaml (100%)
 rename {modules/openstack_project/files/ansible/playbooks => playbooks}/remote_puppet_git.yaml (100%)

diff --git a/doc/source/gerrit.rst b/doc/source/gerrit.rst
index a5f18d539e..68df56f329 100644
--- a/doc/source/gerrit.rst
+++ b/doc/source/gerrit.rst
@@ -524,7 +524,7 @@ To rename a project:
    changing, gate jobs may fail due to outdated remote URLs. Clear
    the workspaces on persistent Jenkins slaves to mitigate this::
 
-     sudo ansible-playbook -f 10 /etc/ansible/playbooks/clean_workspaces.yaml --extra-vars "project=PROJECTNAME"
+     sudo ansible-playbook -f 10 /opt/system-config/production/playbooks/clean_workspaces.yaml --extra-vars "project=PROJECTNAME"
 
 #. Submit a change that updates .gitreview with the new location of the
    project.
diff --git a/modules/openstack_project/manifests/puppetmaster.pp b/modules/openstack_project/manifests/puppetmaster.pp
index 38307905c3..c6c7735ad1 100644
--- a/modules/openstack_project/manifests/puppetmaster.pp
+++ b/modules/openstack_project/manifests/puppetmaster.pp
@@ -176,10 +176,7 @@ class openstack_project::puppetmaster (
 # Playbooks
 #
   file { '/etc/ansible/playbooks':
-    ensure  => directory,
-    recurse => true,
-    source  => 'puppet:///modules/openstack_project/ansible/playbooks',
-    require => Class[ansible],
+    ensure  => absent,
   }
 
   file { '/etc/ansible/remote_puppet.yaml':
diff --git a/modules/openstack_project/files/ansible/playbooks/clean_workspaces.yaml b/playbooks/clean_workspaces.yaml
similarity index 100%
rename from modules/openstack_project/files/ansible/playbooks/clean_workspaces.yaml
rename to playbooks/clean_workspaces.yaml
diff --git a/modules/openstack_project/files/ansible/playbooks/remote_puppet_afs.yaml b/playbooks/remote_puppet_afs.yaml
similarity index 100%
rename from modules/openstack_project/files/ansible/playbooks/remote_puppet_afs.yaml
rename to playbooks/remote_puppet_afs.yaml
diff --git a/modules/openstack_project/files/ansible/playbooks/remote_puppet_else.yaml b/playbooks/remote_puppet_else.yaml
similarity index 100%
rename from modules/openstack_project/files/ansible/playbooks/remote_puppet_else.yaml
rename to playbooks/remote_puppet_else.yaml
diff --git a/modules/openstack_project/files/ansible/playbooks/remote_puppet_git.yaml b/playbooks/remote_puppet_git.yaml
similarity index 100%
rename from modules/openstack_project/files/ansible/playbooks/remote_puppet_git.yaml
rename to playbooks/remote_puppet_git.yaml
diff --git a/run_all.sh b/run_all.sh
index d559a2324e..e3b8a99e59 100755
--- a/run_all.sh
+++ b/run_all.sh
@@ -19,9 +19,10 @@
 # expect.
 set -e
 export ANSIBLE_LOG_PATH=/var/log/puppet_run_all.log
-ANSIBLE_PLAYBOOKS=/etc/ansible/playbooks
+SYSTEM_CONFIG=/opt/system-config/production
+ANSIBLE_PLAYBOOKS=$SYSTEM_CONFIG/playbooks
 
-cd /opt/system-config/production
+cd $SYSTEM_CONFIG
 git fetch -a && git reset -q --hard @{u}
 ./install_modules.sh
 ansible-galaxy install --force -r roles.yaml