[PATCH v3 30/36] terraform: Squelch Ansible complaints about missing inventory file

Chuck Lever <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Chuck Lever <[email protected]>

During "make", I see this warning twice when preparing a terraform-
based kdevops run:

[WARNING]: provided hosts list is empty, only localhost is available.
   Note that the implicit localhost does not match 'all'

The install_terraform and gen_tfvars playbooks both run before the
inventory file is created. AIUI they have to be invoked with an
explicit inventory on the command line.

Fixes: 0987c30034c9 ("Makefile: use inventory from ansible.cfg")
Reviewed-by: Luis Chamberlain <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
---
 Makefile.kdevops                | 1 +
 playbooks/gen_tfvars.yml        | 1 +
 playbooks/install_terraform.yml | 1 +
 scripts/terraform.Makefile      | 1 +
 4 files changed, 4 insertions(+)

diff --git a/Makefile.kdevops b/Makefile.kdevops
index 9c6109f3a114..fd03b392f1d9 100644
--- a/Makefile.kdevops
+++ b/Makefile.kdevops
@@ -9,6 +9,7 @@ PHONY := kdevops_all
 
 kdevops_terraform_deps:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--inventory localhost, \
 		$(KDEVOPS_PLAYBOOKS_DIR)/install_terraform.yml
 PHONY += kdevops_terraform_deps
 
diff --git a/playbooks/gen_tfvars.yml b/playbooks/gen_tfvars.yml
index 9d75c86810b0..11437fa252d8 100644
--- a/playbooks/gen_tfvars.yml
+++ b/playbooks/gen_tfvars.yml
@@ -1,5 +1,6 @@
 ---
 - name: Generate Terraform variables file (terraform/terraform.tfvars)
+  connection: local
   hosts: localhost
   roles:
     - role: gen_tfvars
diff --git a/playbooks/install_terraform.yml b/playbooks/install_terraform.yml
index 5a5fa724a212..3342d32a6269 100644
--- a/playbooks/install_terraform.yml
+++ b/playbooks/install_terraform.yml
@@ -1,5 +1,6 @@
 ---
 - name: Install Terraform
+  connection: local
   hosts: localhost
   roles:
     - role: install_terraform
diff --git a/scripts/terraform.Makefile b/scripts/terraform.Makefile
index d1411a1868f1..305b287a5e6c 100644
--- a/scripts/terraform.Makefile
+++ b/scripts/terraform.Makefile
@@ -232,5 +232,6 @@ destroy_terraform_base:
 
 $(KDEVOPS_TFVARS): $(KDEVOPS_TFVARS_TEMPLATE) .config
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--inventory localhost, \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_tfvars.yml \
 		--extra-vars=@./extra_vars.yaml
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.