From 8b2a51f95ceaf2d28c47db15901dfd77e24ab038 Mon Sep 17 00:00:00 2001
From: Freezed <2160318-free_zed@users.noreply.gitlab.com>
Date: Tue, 11 Jan 2022 00:15:41 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Move=20tasks=20in=20dedicated=20?=
 =?UTF-8?q?directory?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Makefile                                         | 12 +++++++++++-
 README.md                                        | 12 ++++++------
 become_user_cfg.yml => tasks/become_user_cfg.yml | 13 ++++++++++---
 sshd_config => tasks/files/sshd_config           |  0
 host_info.yml => tasks/host_info.yml             |  0
 shutdown.yml => tasks/shutdown.yml               |  0
 whoami.yml => tasks/whoami.yml                   |  0
 7 files changed, 27 insertions(+), 10 deletions(-)
 rename become_user_cfg.yml => tasks/become_user_cfg.yml (88%)
 rename sshd_config => tasks/files/sshd_config (100%)
 rename host_info.yml => tasks/host_info.yml (100%)
 rename shutdown.yml => tasks/shutdown.yml (100%)
 rename whoami.yml => tasks/whoami.yml (100%)

diff --git a/Makefile b/Makefile
index bc41cf0..3f694da 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,17 @@ clean:
 	find . -type f -name "*.orig" -delete
 
 open_all:
-	${EDITOR} .gitignore become_user_cfg.yml host_info.yml inventory Makefile README.md shutdown.yml whoami.yml
+	${EDITOR} .gitignore inventory Makefile README.md
+	${EDITOR} tasks/*.yml
+<<<<<<< HEAD
+=======
+	${EDITOR} tasks/files/sshd_config
+	${EDITOR} tasks/user_cfg/*.yml
+	${EDITOR} tasks/user_cfg/files/dotfiles/*
+	${EDITOR} tasks/user_cfg/templates/*.j2
+	${EDITOR} tasks/user_cfg/vars/*.yml
+	${EDITOR} tasks/vars/*.yml
+>>>>>>> eab54ad (fixup! 🚚 Move tasks in dedicated directory)
 
 inventory_generation:
 	cp inventory.sample inventory && ${EDITOR} inventory
diff --git a/README.md b/README.md
index 10e040a..60c11bc 100644
--- a/README.md
+++ b/README.md
@@ -13,12 +13,12 @@ Suitable for server and workstation.
 ✨ Features
 -----------
 
-|   playbook                                    |   purpose                                                             |
-|   :--------------------------------------:    |   :--------------------------------------------------------------:    |
-| [`become_user_cfg.yml`](become_user_cfg.yml)  |   Set `sudo` without password for `become_user` access                |
-| [`host_info.yml`](host_info.yml)              |   Return message with distribution full name & version                |
-| [`shutdown.yml`](shutdown.yml)                |   Shutdown target in 10 min                                           |
-| [`whoami.yml`](whoami.yml)                    |   Return message with `ansible_user` & `become_user` (`sudo` method)  |
+|   playbook                                            |   purpose                                                             |
+|   :--------------------------------------:            |   :--------------------------------------------------------------:    |
+| [`become_user_cfg.yml`](tasks/become_user_cfg.yml)    |   Set `sudo` without password for `become_user` access                |
+| [`host_info.yml`](tasks/host_info.yml)                |   Return message with distribution full name & version                |
+| [`shutdown.yml`](tasks/shutdown.yml)                  |   Shutdown target in 10 min                                           |
+| [`whoami.yml`](tasks/whoami.yml)                      |   Return message with `ansible_user` & `become_user` (`sudo` method)  |
 
 
 🚀 Quickstart
diff --git a/become_user_cfg.yml b/tasks/become_user_cfg.yml
similarity index 88%
rename from become_user_cfg.yml
rename to tasks/become_user_cfg.yml
index 943e482..8fff609 100644
--- a/become_user_cfg.yml
+++ b/tasks/become_user_cfg.yml
@@ -1,21 +1,23 @@
 ---
 - hosts: "{{ host_list }}"
-  become: yes
   become_method: sudo
   remote_user: "{{ my_user }}"
 
   tasks:
     - name: SUDO | Group sudo presence
+      become: yes
       ansible.builtin.group:
         name: sudo
         state: present
 
     - name: SUDO | Group wheel absence
+      become: yes
       ansible.builtin.group:
         name: wheel
         state: absent
 
     - name: SUDO | User presence (with groups)
+      become: yes
       ansible.builtin.user:
         name: "{{ my_user }}"
         state: present
@@ -23,21 +25,25 @@
         append: true
 
     - name: SUDO | Reset ansible connection to apply group update
+      become: yes
       meta: reset_connection
 
     - name: "SSH | Local public key is present for {{ my_user }}"
+      become: yes
       ansible.builtin.authorized_key:
-        comment: "Managed by Ansible from GitLab @free_zed"
         key: https://gitlab.com/free_zed.keys
         state: present
         user: "{{ my_user }}"
 
+
     - name: SSH | Disallow SSH password authentication for root
+      become: yes
       copy:
-        src: sshd_config
+        src: files/sshd_config
         dest: /etc/ssh/sshd_config
 
     - name: "SSH | Local public key is present for root"
+      become: yes
       ansible.builtin.authorized_key:
         comment: "Managed by Ansible from GitLab @free_zed"
         key: https://gitlab.com/free_zed.keys
@@ -45,6 +51,7 @@
         user: root
 
     - name: SSH | Remove no password directive
+      become: yes
       ansible.builtin.lineinfile:
         path: /etc/sudoers
         state: absent
diff --git a/sshd_config b/tasks/files/sshd_config
similarity index 100%
rename from sshd_config
rename to tasks/files/sshd_config
diff --git a/host_info.yml b/tasks/host_info.yml
similarity index 100%
rename from host_info.yml
rename to tasks/host_info.yml
diff --git a/shutdown.yml b/tasks/shutdown.yml
similarity index 100%
rename from shutdown.yml
rename to tasks/shutdown.yml
diff --git a/whoami.yml b/tasks/whoami.yml
similarity index 100%
rename from whoami.yml
rename to tasks/whoami.yml
-- 
GitLab