From 2e5395d76170fed3360d48bc4d642698f0a9bbc1 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Mon, 14 Dec 2015 18:29:45 +0200
Subject: [PATCH] Assume that gather_facts is set to False, run the setup
 module when it's safe.

---
 README.rst     | 7 +++++--
 tasks/main.yml | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/README.rst b/README.rst
index 240eb6b..835bda2 100644
--- a/README.rst
+++ b/README.rst
@@ -2,8 +2,10 @@ Ansible-common
 ##############
 
 An Ansible role with common tasks that ran on all (or most) hosts.
-The tls_key_path, tls_cert_path and tls_ca_cert_path facts are added to point to
-the path of the host's key and cert.
+The tls_key_path, tls_cert_path and tls_ca_cert_path facts are added to point
+to the path of the host's key and cert. Gathering facts on the first run on an
+OpenBSD system fails, so the role runs the setup module in case gather_facts
+was set to False.
 
 Requirements
 ------------
@@ -50,6 +52,7 @@ Example Playbook
 
     - hosts:
       - all
+      gather_facts: False
       roles:
       - role: common
         extra_tls_certs: ['vagrant.crt', 'example.com.crt']
diff --git a/tasks/main.yml b/tasks/main.yml
index 78242c4..b849f6e 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -4,6 +4,9 @@
 - include: openbsd_bootstrap.yml
   when: openbsd_bootstrap is defined
 
+- setup:
+  when: openbsd_bootstrap is undefined
+
 - name: Assert
   assert:
     that: ansible_os_family in [ 'Debian', 'OpenBSD' ]
-- 
GitLab