[ansible] make a generic bootstrap playbook
change
commit 4fc1952874cab247e7483f46d8db9a4ba5f6fd9a
author Alpha Chen <alpha@kejadlen.dev>
date
parent 46007b6a
diff --git a/ansible/playbooks/bootstrap.yml b/ansible/playbooks/bootstrap.yml
new file mode 100644
index 00000000..86d529a1
--- /dev/null
+++ b/ansible/playbooks/bootstrap.yml
@@ -0,0 +1,22 @@
+- hosts: linux
+  become: yes
+  tasks:
+
+    - name: create user
+      user:
+        name: alpha
+        password: "{{ password | password_hash('sha512') }}"
+        shell: /bin/bash
+
+    - name: give user sudo access
+      lineinfile:
+        path: /etc/sudoers.d/alpha
+        line: "alpha ALL=(ALL) NOPASSWD: ALL"
+        create: yes
+        validate: visudo -cf %s
+
+    - name: add ssh keys
+      authorized_key:
+        user: alpha
+        key: https://github.com/kejadlen.keys
+