From a9ec2fa35b325f534ad4f08d6801549f9ff773fd Mon Sep 17 00:00:00 2001
From: foobar <git@foo.bar>
Date: Sun, 18 Sep 2022 16:46:02 +0200
Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Add=20a=20subgroup=20for=20cloning?=
 =?UTF-8?q?=20git=20repo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 inventory.sample            | 16 +++++++++++++++-
 tasks/become_user_cfg.yml   |  2 ++
 tasks/user_cfg/my_user.yml  |  4 ++--
 tasks/user_cfg/vars/git.yml |  6 ++----
 4 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/inventory.sample b/inventory.sample
index 1190cb6..90d3de6 100644
--- a/inventory.sample
+++ b/inventory.sample
@@ -2,6 +2,12 @@
 192.168.1.1
 192.168.1.11
 
+[gnome]
+192.168.1.11
+
+[mate]
+192.168.1.2
+
 [virtual]
 192.168.1.2
 192.168.1.22
@@ -10,11 +16,19 @@
 192.168.1.1
 192.168.1.2
 
-[workstation]
+[localdev]
+192.168.1.11
+
+[station]
 localhost
 192.168.1.11
 192.168.1.22
 
+[workstation:children]
+gnome
+mate
+localdev
+
 [server:vars]
 timezone="UTC"
 
diff --git a/tasks/become_user_cfg.yml b/tasks/become_user_cfg.yml
index aee552e..960cfce 100644
--- a/tasks/become_user_cfg.yml
+++ b/tasks/become_user_cfg.yml
@@ -1,7 +1,9 @@
 ---
+# When 1st user is root, set it as "remote_user"  and remove all "become: yes"
 - hosts: "{{ host_list }}"
   become_method: sudo
   remote_user: "{{ my_user }}"
+  #remote_user: root
 
   tasks:
     - name: SUDO | Group sudo presence
diff --git a/tasks/user_cfg/my_user.yml b/tasks/user_cfg/my_user.yml
index 3e0354b..5868568 100644
--- a/tasks/user_cfg/my_user.yml
+++ b/tasks/user_cfg/my_user.yml
@@ -31,12 +31,12 @@
     state: directory
 
 - name: INCLUDE_VARS | git
-  when: inventory_hostname in groups.station
+  when: inventory_hostname in groups.localdev
   ansible.builtin.include_vars: "vars/git.yml"
 
 - name: MY USER | clone git repos
   become: yes
-  when: inventory_hostname in groups.station
+  when: inventory_hostname in groups.localdev
   ansible.builtin.git:
     dest: "/home/{{ my_user }}/git/{{ item.local_name }}"
     repo:  "{{ item.url_https }}"
diff --git a/tasks/user_cfg/vars/git.yml b/tasks/user_cfg/vars/git.yml
index b877338..1a744a9 100644
--- a/tasks/user_cfg/vars/git.yml
+++ b/tasks/user_cfg/vars/git.yml
@@ -1,13 +1,11 @@
 ---
 git_repositories:
-  - {local_name: "afpy19",              url_https: "https://gitlab.com/free_zed/afpy19.git"}
   - {local_name: "askthom",             url_https: "https://lab.frogg.it/fcode/askthom.git"}
   - {local_name: "djlease",             url_https: "https://gitlab.com/free_zed/djlease.git"}
   - {local_name: "eb-car",              url_https: "https://gitlab.com/combien-de-temps-pour-faire-sonner-la-cloche-a-aiguebelle/combien-de-temps-pour-faire-sonner-la-cloche-a-aiguebelle.gitlab.io.git"}
-  - {local_name: "exchange",            url_https: "https://gitlab.com/free_zed/mymsesb.git"}
   - {local_name: "forga-a14n",          url_https: "https://gitlab.com/free_zed/djbp.git"}
   - {local_name: "forga-core",          url_https: "https://gitlab.com/forga/tool/django/core.git"}
-  - {local_name: "forga-dev-bpy",       url_https: "https://gitlab.com/forga/devel/boilerplate/python.git"}
+  - {local_name: "forga-dev-bpy",       url_https: "https://git.afpy.org/fcode/boilerplate-python.git"}
   - {local_name: "forga-emb",           url_https: "https://gitlab.com/forga/process/fr/embarquement.git"}
   - {local_name: "forga-glio",          url_https: "https://gitlab.com/forga/forga.gitlab.io.git"}
   - {local_name: "forga-man",           url_https: "https://gitlab.com/forga/process/fr/manuel.git"}
@@ -18,7 +16,7 @@ git_repositories:
   - {local_name: "gpxpy",               url_https: "https://github.com/freezed/gpxpy.git"}
   - {local_name: "grandpy",             url_https: "https://github.com/freezed/ocp7.git"}
   - {local_name: "hellozappa",          url_https: "https://gitlab.com/free_zed/hellozappa.git"}
-  - {local_name: "men-rt-ocp08",        url_https: "https://github.com/remace/OC-P8-Purbeurre.git"}
+  - {local_name: "ldpy",                url_https: "https://git.afpy.org/fcode/ldpy.git.git"}
   - {local_name: "mountaingpx",         url_https: "https://github.com/krisanselmo/mountaingpx.git"}
   - {local_name: "myasb",               url_https: "https://gitlab.com/forga/tool/ansible/debian.git"}
   - {local_name: "mypsb",               url_https: "https://gitlab.com/free_zed/mypsb.git"}
-- 
GitLab