From 1a8c2f66daf8ad9bd220d0cc8cfcc8cfac333a90 Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Thu, 16 Aug 2018 18:56:30 -0500
Subject: [PATCH] Move /opt/system-config/production to /opt/system-config

The production directory is a relic from the puppet environment concept,
which we do not use. Remove it.

The puppet apply tests run puppet locally, where the production
environment is still needed, so don't update the paths in the
tools/prep-apply.sh.

Depends-On: https://review.openstack.org/592946
Change-Id: I82572cc616e3c994eab38b0de8c3c72cb5ec5413
---
 doc/source/afs.rst                               |  2 +-
 doc/source/certificate_authority.rst             |  4 ++--
 doc/source/firehose_schema.rst                   |  2 +-
 doc/source/gerrit.rst                            |  2 +-
 doc/source/puppet.rst                            | 16 ++++++++--------
 launch/README                                    |  2 +-
 playbooks/group_vars/all.yaml                    |  5 +++--
 .../roles/install-ansible/files/ansible.cfg      |  2 +-
 playbooks/update-system-config.yaml              |  6 +++---
 playbooks/update_puppet_version.yaml             |  4 ++--
 run_all.sh                                       |  2 +-
 run_cloud_launcher.sh                            |  2 +-
 run_infracloud.sh                                |  2 +-
 tools/kick.sh                                    |  2 +-
 14 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/doc/source/afs.rst b/doc/source/afs.rst
index 2b4b1c0091..ede8587e0e 100644
--- a/doc/source/afs.rst
+++ b/doc/source/afs.rst
@@ -368,7 +368,7 @@ read-write volumes.
 
   .. code-block:: console
 
-    root@puppetmaster:~# /opt/system-config/production/tools/hieraedit.py \
+    root@puppetmaster:~# /opt/system-config/tools/hieraedit.py \
       --yaml /etc/puppet/hieradata/production/fqdn/mirror-update.openstack.org.yaml \
       -f /path/to/foo.keytab KEYNAME
 
diff --git a/doc/source/certificate_authority.rst b/doc/source/certificate_authority.rst
index e9b298d16d..654aa578ad 100644
--- a/doc/source/certificate_authority.rst
+++ b/doc/source/certificate_authority.rst
@@ -244,10 +244,10 @@ then deleted from disk.
 .. code-block:: bash
 
     root@puppetmaster:~# cd /etc/zuul-ca
-    root@puppetmaster:/etc/zuul-ca# /opt/system-config/production/tools/hieraedit.py \
+    root@puppetmaster:/etc/zuul-ca# /opt/system-config/tools/hieraedit.py \
     > --yaml /etc/puppet/hieradata/production/group/gearman.yaml \
     > -f newreq.pem gearman_ssl_key
-    root@puppetmaster:/etc/zuul-ca# /opt/system-config/production/tools/hieraedit.py \
+    root@puppetmaster:/etc/zuul-ca# /opt/system-config/tools/hieraedit.py \
     > --yaml /etc/puppet/hieradata/production/group/gearman.yaml \
     > -f newcert.pem gearman_ssl_cert
     root@puppetmaster:/etc/zuul-ca# shred newreq.pem
diff --git a/doc/source/firehose_schema.rst b/doc/source/firehose_schema.rst
index b1dbabfa26..5ef835504b 100644
--- a/doc/source/firehose_schema.rst
+++ b/doc/source/firehose_schema.rst
@@ -379,7 +379,7 @@ An example of a task event from the running system is::
                     "puppetmaster": null,
                     "show_diff": false,
                     "certname": null,
-                    "manifest": "/opt/system-config/production/manifests/site.pp",
+                    "manifest": "/opt/system-config/manifests/site.pp",
                     "environment": "production",
                     "debug": false,
                     "noop": false,
diff --git a/doc/source/gerrit.rst b/doc/source/gerrit.rst
index 0b2d047ee0..fc06fbae40 100644
--- a/doc/source/gerrit.rst
+++ b/doc/source/gerrit.rst
@@ -457,7 +457,7 @@ To rename a project:
 #. Run the ansible rename repos playbook, passing in the path to your yaml
    file::
 
-     sudo ansible-playbook -f 10 /opt/system-config/production/playbooks/rename_repos.yaml -e repolist=ABSOLUTE_PATH_TO_VARS_FILE
+     sudo ansible-playbook -f 10 /opt/system-config/playbooks/rename_repos.yaml -e repolist=ABSOLUTE_PATH_TO_VARS_FILE
 
 #. :ref:`Force-merge <force-merging-a-change>` the prepared Puppet
    configuration changes.
diff --git a/doc/source/puppet.rst b/doc/source/puppet.rst
index 50e05d2846..d891e246f5 100644
--- a/doc/source/puppet.rst
+++ b/doc/source/puppet.rst
@@ -46,12 +46,12 @@ Ansible and Puppet 3 is known to run on Precise, Trusty, Centos 6 and Centos 7.
 .. code-block:: bash
 
    sudo su -
-   git clone https://git.openstack.org/openstack-infra/system-config /opt/system-config/production
-   bash /opt/system-config/production/install_puppet.sh
-   bash /opt/system-config/production/install_modules.sh
+   git clone https://git.openstack.org/openstack-infra/system-config /opt/system-config
+   bash /opt/system-config/install_puppet.sh
+   bash /opt/system-config/install_modules.sh
    echo $REAL_HOSTNAME > /etc/hostname
    service hostname restart
-   puppet apply --modulepath='/opt/system-config/production/modules:/etc/puppet/modules' -e 'include openstack_project::puppetmaster'
+   puppet apply --modulepath='/opt/system-config/modules:/etc/puppet/modules' -e 'include openstack_project::puppetmaster'
 
 Hiera uses a systemwide configuration file in ``/etc/puppet/hiera.yaml``
 and this setup supports multiple configurations. The two sets of environments
@@ -82,7 +82,7 @@ Adding a node
 -------------
 
 For adding a new node to your puppet master, you can either use the
-``/opt/system-config/production/launch/launch-node.py`` script
+``/opt/system-config/launch/launch-node.py`` script
 (see :cgit_file:`launch/README` for full details) or bootstrap puppet manually.
 
 For manual bootstrap, you need to run on the new server connecting
@@ -101,7 +101,7 @@ In OpenStack's Infrastructure, puppet runs are triggered from a cronjob
 running on the puppetmaster which in turn runs a single run of puppet apply on
 each host we know about.
 
-The entry point for this process is ``/opt/system-config/production/run_all.sh``
+The entry point for this process is ``/opt/system-config/run_all.sh``
 
 There are a few sets of nodes which have their own playbooks so that they
 are run in sequence before the rest of the nodes are run in parallel.
@@ -110,12 +110,12 @@ creation of the master repos on the gerrit server.
 
 If an admin needs to run puppet by hand, it's a simple matter of either
 logging in to the server in question and running
-`puppet apply /opt/system-config/production/manifests/site.pp` or, on the
+`puppet apply /opt/system-config/manifests/site.pp` or, on the
 puppetmaster, running:
 
 .. code-block:: bash
 
-  ansible-playbook --limit="$HOST:localhost" /opt/system-config/production/playbooks/remote_puppet_adhoc.yaml
+  ansible-playbook --limit="$HOST:localhost" /opt/system-config/playbooks/remote_puppet_adhoc.yaml
 
 as root, where `$HOST` is the host you want to run puppet on.
 The `:localhost` is important as some of the plays depend on performing a task
diff --git a/launch/README b/launch/README
index fb346255d8..ce20e856bb 100644
--- a/launch/README
+++ b/launch/README
@@ -27,7 +27,7 @@ To launch a node in the OpenStack CI account (production servers)::
   export OS_REGION_NAME=DFW
   export FLAVOR="8 GB Performance"
   export FQDN=servername01.openstack.org
-  cd /opt/system-config/production/launch/
+  cd /opt/system-config/launch/
   ./launch-node.py $FQDN --flavor "$FLAVOR" \
     --cloud=$OS_CLOUD --region=$OS_REGION_NAME
 
diff --git a/playbooks/group_vars/all.yaml b/playbooks/group_vars/all.yaml
index 7edaf8d879..155221b1e1 100644
--- a/playbooks/group_vars/all.yaml
+++ b/playbooks/group_vars/all.yaml
@@ -1,7 +1,8 @@
 copy_hieradata: true
 copy_puppet: true
-manifest: /opt/system-config/production/manifests/site.pp
+manifest: /opt/system-config/manifests/site.pp
 manifest_base: /opt/system-config
+mgmt_manifestpath: /opt/system-config
 puppet_logdest: syslog
 distro_lookup_path:
   - "{{ ansible_facts.distribution }}.{{ ansible_facts.lsb.codename }}.{{ ansible_facts.architecture }}.yaml"
@@ -21,7 +22,7 @@ puppet:
   logdest: syslog
   copy_hieradata: true
   copy_puppet: true
-  manifest: /opt/system-config/production/manifests/site.pp
+  manifest: /opt/system-config/manifests/site.pp
   manifest_base: /opt/system-config
 
 # When adding new users, always pick a UID larger than the last UID, do not
diff --git a/playbooks/roles/install-ansible/files/ansible.cfg b/playbooks/roles/install-ansible/files/ansible.cfg
index 467c2e37eb..906452b1b0 100644
--- a/playbooks/roles/install-ansible/files/ansible.cfg
+++ b/playbooks/roles/install-ansible/files/ansible.cfg
@@ -4,7 +4,7 @@ library=/usr/share/ansible
 log_path=/var/log/ansible.log
 callback_plugins=/etc/ansible/callback_plugins
 inventory_plugins=/etc/ansible/inventory_plugins
-roles_path=/opt/system-config/production/roles:/etc/ansible/roles
+roles_path=/opt/system-config/roles:/etc/ansible/roles
 retry_files_enabled=False
 retry_files_save_path=
 gathering=smart
diff --git a/playbooks/update-system-config.yaml b/playbooks/update-system-config.yaml
index a0729b36be..004c7702c8 100644
--- a/playbooks/update-system-config.yaml
+++ b/playbooks/update-system-config.yaml
@@ -7,15 +7,15 @@
     - name: Make sure system-config repo is up to date
       git:
         repo: https://git.openstack.org/openstack-infra/system-config
-        dest: /opt/system-config/production
+        dest: /opt/system-config
         force: yes
 
     - name: Clone puppet modules to /etc/puppet/modules
       command: ./install_modules.sh
       args:
-        chdir: /opt/system-config/production
+        chdir: /opt/system-config
 
     - name: Install ansible roles to /etc/ansible/roles
       command: ansible-galaxy install --force -r roles.yaml
       args:
-        chdir: /opt/system-config/production
+        chdir: /opt/system-config
diff --git a/playbooks/update_puppet_version.yaml b/playbooks/update_puppet_version.yaml
index c8d3f1bf4d..c80cfff524 100644
--- a/playbooks/update_puppet_version.yaml
+++ b/playbooks/update_puppet_version.yaml
@@ -3,10 +3,10 @@
   tasks:
   - git:
       repo: https://git.openstack.org/openstack-infra/system-config
-      dest: /opt/system-config/production
+      dest: /opt/system-config
       force: yes
   - shell: ./install_puppet.sh
     args:
-      chdir: /opt/system-config/production
+      chdir: /opt/system-config
     environment:
       PUPPET_VERSION: 4
diff --git a/run_all.sh b/run_all.sh
index 4a514fc0f5..6f634809ec 100755
--- a/run_all.sh
+++ b/run_all.sh
@@ -19,7 +19,7 @@
 # expect.
 set -e
 export ANSIBLE_LOG_PATH=/var/log/puppet_run_all.log
-SYSTEM_CONFIG=/opt/system-config/production
+SYSTEM_CONFIG=/opt/system-config
 ANSIBLE_PLAYBOOKS=$SYSTEM_CONFIG/playbooks
 
 # It's possible for connectivity to a server or manifest application to break
diff --git a/run_cloud_launcher.sh b/run_cloud_launcher.sh
index a89823c794..538dcd392d 100755
--- a/run_cloud_launcher.sh
+++ b/run_cloud_launcher.sh
@@ -19,7 +19,7 @@
 # expect.
 set -e
 export ANSIBLE_LOG_PATH=/var/log/puppet_run_cloud_launcher.log
-SYSTEM_CONFIG=/opt/system-config/production
+SYSTEM_CONFIG=/opt/system-config
 ANSIBLE_PLAYBOOKS=$SYSTEM_CONFIG/playbooks
 
 # It's possible for connectivity to a server or manifest application to break
diff --git a/run_infracloud.sh b/run_infracloud.sh
index 8f9cec91dd..88ec2ca789 100755
--- a/run_infracloud.sh
+++ b/run_infracloud.sh
@@ -19,7 +19,7 @@
 # expect.
 set -e
 export ANSIBLE_LOG_PATH=/var/log/puppet_run_all_infracloud.log
-SYSTEM_CONFIG=/opt/system-config/production
+SYSTEM_CONFIG=/opt/system-config
 ANSIBLE_PLAYBOOKS=$SYSTEM_CONFIG/playbooks
 
 # It's possible for connectivity to a server or manifest application to break
diff --git a/tools/kick.sh b/tools/kick.sh
index f3dcb73423..ffad0581ae 100755
--- a/tools/kick.sh
+++ b/tools/kick.sh
@@ -16,5 +16,5 @@
 
 for playbook in base.yaml remote_puppet_adhoc.yaml ; do
     ansible-playbook -f1 --limit $1 \
-        /opt/system-config/production/playbooks/$playbook
+        /opt/system-config/playbooks/$playbook
 done