Browse Source

Initial user setup

Fred Damstra [io2] 4 years ago
parent
commit
78f39b1455
5 changed files with 37 additions and 1 deletions
  1. 1 1
      Ansible/inventory.ini
  2. 4 0
      Ansible/io.yml
  3. 5 0
      Ansible/k8s.yml
  4. 3 0
      Ansible/site.yml
  5. 24 0
      Ansible/tasks/initial_users.yml

+ 1 - 1
Ansible/inventory.ini

@@ -1,5 +1,5 @@
 [targets]
-io   ansible_host=io.monkeybox.org
+io   ansible_host=io.home.monkeybox.org
 k8s1 ansible_host=k8s1.home.monkeybox.org
 k8s2 ansible_host=k8s2.home.monkeybox.org
 k8s3 ansible_host=k8s3.home.monkeybox.org

+ 4 - 0
Ansible/io.yml

@@ -0,0 +1,4 @@
+- hosts: io
+  roles:
+    - common
+    - io

+ 5 - 0
Ansible/k8s.yml

@@ -0,0 +1,5 @@
+---
+- hosts: k8s
+  roles:
+    - common
+    - k8s

+ 3 - 0
Ansible/site.yml

@@ -0,0 +1,3 @@
+---
+- import_playbook: k8s.yml
+- import_playbook: io.yml

+ 24 - 0
Ansible/tasks/initial_users.yml

@@ -0,0 +1,24 @@
+---
+  # Intended to be called on a fresh box, just to set up my users
+  - name: Add the fdamstra account
+    hosts: all
+    become: yes
+    become_user: root
+    tasks:
+      - name: Create fdamstra user
+        ansible.builtin.user:
+          name: fdamstra
+          state: present
+          comment: Fred Damstra
+          shell: /bin/bash
+          append: yes # add groups, not replace
+          groups:
+            - sudo
+          home: /home/fdamstra
+          password: $6$hYFN1pnIw3Gi8Lca$HdoHUUVVPbBdp/HGeBdo2rpWjhvBYcpV2EbCkZqW0Sqp1nsxQmuAy6sy6wjLHv1EdODG8oNUBPys94bxOOwbp/
+          update_password: on_create
+      - name: Create authorized key
+        authorized_key:
+          user: fdamstra
+          state: present
+          key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDF3pGU9+HufgfEhPP7P0Lt7kqfGWLTGd6sfJgSypcSo3FP1XhwFOWkaNvZIpoIeQXhux5vTm+RoqYZ/3Gj7hcGMLdoHWArvLHD2AGjxbFnsmiCioQgsC/rYLBjiWNsDdVF5Arofby/RwzivMAi7yivhY4nGzXPsHZoucB0Wi34/9AmxbvXWv6ckuWkMjrXVe+uwFje3U7jQHRW9jQRpCRRfUjVA4FmH0PWqWFBlt/zqsDPOzbxNNhAvyrJho7jVBNjCLsq0++lT8BDKrYbaZiT0F2c9uIDRpHJSdjpqVCf9bghmeJWYMoNHAkGR7WCFjPCJ7QM57a2oRBtm1A/EWcr fdamstra@io"