From 03d09b777e6b25b2d230de28ad1f6fab2494b74c Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Thu, 16 Aug 2018 18:51:55 -0500
Subject: [PATCH] Use openstack and groups inventory from system-config

Rather than copying these out of system-config inside of
install-ansible, just point the ansible.cfg to them in the system-config
location. This way as changes come in that have group updates we don't
have to first apply them to the system.

Change-Id: I1cefd7848b7f3f1adc8fbfa080eb9831124a297b
---
 .../roles/install-ansible/files => inventory}/groups.yaml | 0
 .../install-ansible/files => inventory}/openstack.yaml    | 0
 playbooks/roles/install-ansible/files/ansible.cfg         | 2 +-
 playbooks/roles/install-ansible/tasks/main.yaml           | 8 --------
 4 files changed, 1 insertion(+), 9 deletions(-)
 rename {playbooks/roles/install-ansible/files => inventory}/groups.yaml (100%)
 rename {playbooks/roles/install-ansible/files => inventory}/openstack.yaml (100%)

diff --git a/playbooks/roles/install-ansible/files/groups.yaml b/inventory/groups.yaml
similarity index 100%
rename from playbooks/roles/install-ansible/files/groups.yaml
rename to inventory/groups.yaml
diff --git a/playbooks/roles/install-ansible/files/openstack.yaml b/inventory/openstack.yaml
similarity index 100%
rename from playbooks/roles/install-ansible/files/openstack.yaml
rename to inventory/openstack.yaml
diff --git a/playbooks/roles/install-ansible/files/ansible.cfg b/playbooks/roles/install-ansible/files/ansible.cfg
index 906452b1b0..96db79224d 100644
--- a/playbooks/roles/install-ansible/files/ansible.cfg
+++ b/playbooks/roles/install-ansible/files/ansible.cfg
@@ -1,5 +1,5 @@
 [defaults]
-inventory=/etc/ansible/hosts/openstack.yaml,/etc/ansible/hosts/groups.yaml,/etc/ansible/hosts/emergency
+inventory=/opt/system-config/inventory/openstack.yaml,/opt/system-config/inventory/groups.yaml,/etc/ansible/hosts/emergency
 library=/usr/share/ansible
 log_path=/var/log/ansible.log
 callback_plugins=/etc/ansible/callback_plugins
diff --git a/playbooks/roles/install-ansible/tasks/main.yaml b/playbooks/roles/install-ansible/tasks/main.yaml
index 5a9653381d..f4e58c0847 100644
--- a/playbooks/roles/install-ansible/tasks/main.yaml
+++ b/playbooks/roles/install-ansible/tasks/main.yaml
@@ -37,14 +37,6 @@
     src: ansible.cfg
     dest: /etc/ansible/ansible.cfg
 
-- name: Copy inventory config into place
-  loop:
-    - openstack.yaml
-    - groups.yaml
-  copy:
-    src: "{{ item }}"
-    dest: "/etc/ansible/hosts/{{ item }}"
-
 # NOTE(mordred) The copy of the openstack inventory plugin from 2.6 is busted.
 # It doesn't proerly deal with caching. A fix has been submitted upstream, but
 # for now this is a fixed copy.