Initial commit

This commit is contained in:
Bradley Bickford 2024-09-21 12:26:45 -04:00
commit d6704cc251
2 changed files with 34 additions and 0 deletions

6
inventories/kubernetes Normal file
View File

@ -0,0 +1,6 @@
[masters]
KubeMaster ansible_host=192.168.100.2
[workers]
KubeWorker1 ansible_host=192.168.100.3
KubeWorker2 ansible_host=192.168.100.4

View File

@ -0,0 +1,28 @@
---
- hosts: all
become: true
tasks:
- name: Create the ansible user
ansible.builtin.user:
name: ansible
append: true
state: present
createhome: true
shell: /bin/bash
- name: Make sure the sudoers dropin directory exists
ansible.builtin.file:
path: "/etc/sudoers.d"
state: directory
- name: Create a sudoers file for the ansible user
ansible.builtin.lineinfile:
path: "/etc/sudoers.d/50-ansible"
line: "ansible ALL=(ALL) NOPASSWD: ALL"
validate: "visudo -cf"
- name: Add authorized key for ansible user
ansible.builtin.authorized_key:
user: ansible
key: "{{ lookup('ansible.builtin.file', '/home/ansible/.ssh/id_rsa.pub') }}"