]> git.immae.eu Git - perso/Immae/Config/Ansible.git/commitdiff
Add a tag to prevent gpg-related actions during the home bootstrap
authorIsmaël Bouya <ismael.bouya@fretlink.com>
Wed, 21 Nov 2018 00:54:14 +0000 (01:54 +0100)
committerIsmaël Bouya <ismael.bouya@fretlink.com>
Wed, 21 Nov 2018 01:17:57 +0000 (02:17 +0100)
post_init.yml [new file with mode: 0644]
roles/gnupg/tasks/main.yml
roles/init/tasks/main.yml
roles/tools/tasks/main.yml
site.yml

diff --git a/post_init.yml b/post_init.yml
new file mode 100644 (file)
index 0000000..8a5c408
--- /dev/null
@@ -0,0 +1,17 @@
+---
+- hosts: home
+  tasks:
+    - file:
+        path: "$HOME/{{ item }}"
+        state: absent
+      loop:
+        - .bash_profile
+        - .bash_history
+        - Bureau
+        - Documents
+        - Images
+        - Modèles
+        - Musique
+        - Public
+        - Téléchargements
+        - Vidéos
index 954c02921381fccf28e9b28e8ca0173308d00890..84957cf549ff6c1ec593548b2333481bfcd838f9 100644 (file)
   changed_when: false
   check_mode: no
 - name: check existing secret key
+  tags: ["no_bootstrap"]
   shell: "gpg --list-secret-keys | grep '{{ gpg_useremail }}'"
   changed_when: false
   ignore_errors: true
   register: gpgkeys
   check_mode: no
 - name: Ask for gpg password
-  when: gpgkeys.stdout == ""
+  when: gpgkeys is defined and gpgkeys.stdout == ""
   block:
     - name: Ask for gpg password
       pause:
@@ -44,7 +45,7 @@
       assert:
         that: gpg_password_confirm.user_input == gpg_password.user_input
 - name: Generate gpg key
-  when: gpgkeys.stdout == ""
+  when: gpgkeys is defined and gpgkeys.stdout == ""
   block:
     - name: Copy default template for gpg key generation
       template:
@@ -63,7 +64,7 @@
 - name: get keygrip
   shell: "gpg -K --with-colons {{ gpg_useremail }} | grep '^grp' | cut -d':' -f10"
   register: keygrip
-  when: gpgkeys.stdout == ""
+  when: gpgkeys is defined and gpgkeys.stdout == ""
   notify:
     - notify add key to immae@immae.eu
     - send key to immae@immae.eu
index e60bb2a843f8520e1b56705c879828c95edbfb52..c06a07885bcff79770123092d83c232d30075dc7 100644 (file)
@@ -31,7 +31,7 @@
   when: pam_environment.changed
 - name: Add new lines in bashrc_temp
   lineinfile:
-    line: "{{ ('export ' ~ item) if item != '' and item.0 != '#' else '' }}"
+    line: "{{ ('export ' ~ item) | regex_replace('@{HOME}', '${HOME}') if item != '' and item.0 != '#' else '' }}"
     dest: $XDG_STATE_HOME/bash/bashrc_temp
     insertafter: EOF
     create: true
index d8ce64fdd2aaf594d4f9b0b619da1b856e379304..82b575baf5adcc1463bc0b63f966eae25436fe64 100644 (file)
@@ -84,6 +84,7 @@
     name: monitor_home.service
     enabled: true
 - name: Clone password store
+  tags: ["no_bootstrap"]
   git:
     dest: "$XDG_DATA_HOME/pass"
     repo: gitolite@git.immae.eu:perso/Immae/Prive/Password_store
index 90107377b8253e927ca8957c0e81d917910e60ff..8683b1d7772b3575835b48f62d838b4897622d69 100644 (file)
--- a/site.yml
+++ b/site.yml
@@ -23,4 +23,4 @@
     - tools
     - cron
     - role: contexts/fretlink
-      tags: ["fretlink"]
+      tags: ["no_bootstrap", "fretlink"]