From 548e2002eb8c5a9789cf836c9f7f056513110df2 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Tue, 26 Jan 2021 19:18:11 +0200
Subject: [PATCH] Don't ask password for localhost.

- Add localhost to the inventory, set become and connection options.
- Exclude localhost from playbooks that have all as the hosts list.
---
 hosts/all.yaml | 4 ++++
 update.yaml    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hosts/all.yaml b/hosts/all.yaml
index 1ed0550..220ebc4 100644
--- a/hosts/all.yaml
+++ b/hosts/all.yaml
@@ -14,6 +14,10 @@ all:
       ansible_host: ea6350.shore.co.il
     host01:
       ansible_host: host01.shore.co.il
+    localhost:
+      ansible_host: localhost
+      ansible_become: false
+      ansible_connection: local
   vars:
     # Force usage of Python3.
     ansible_become: true
diff --git a/update.yaml b/update.yaml
index 92078a3..ec8b786 100644
--- a/update.yaml
+++ b/update.yaml
@@ -1,7 +1,7 @@
 ---
 - name: Group hosts by package manager
   hosts:
-    - all
+    - all:!localhost
   tasks:
     - name: Group hosts by package manager
       group_by:
-- 
GitLab