working on configuring a k3s cluster
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: bootstrap
|
||||
hosts: all
|
||||
remote_user: richard
|
||||
hosts: cubox-m
|
||||
remote_user: ansible
|
||||
gather_facts: false
|
||||
# become: true
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
- name: Creates .ssh directory
|
||||
file: path=~/.ssh state=directory mode=700
|
||||
|
||||
- name: remove debian user if it exists
|
||||
command: userdel -rf debian
|
||||
become: true
|
||||
args:
|
||||
removes: /home/debian/.bashrc
|
||||
|
||||
# - name: remove ubuntu user if it exists
|
||||
# command: userdel -rf ubuntu
|
||||
# args:
|
||||
@@ -41,18 +47,6 @@
|
||||
groups:
|
||||
- sudo
|
||||
|
||||
- name: Add the user 'richard'
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: richard
|
||||
state: present
|
||||
shell: /bin/bash
|
||||
create_home: yes
|
||||
password: "$6$yNKLUxX0$lxy/jaJI7cKCq5j.KondUalu9r96gUeRR//5qciZ/RX9z9PGSpbU9j7OsxaOzqV5uLeQ9ouIe8quo/2YqKE46/"
|
||||
uid: "1000"
|
||||
groups:
|
||||
- sudo
|
||||
|
||||
- name: Add the authorized key for 'ansible'
|
||||
become: true
|
||||
ansible.posix.authorized_key:
|
||||
@@ -77,6 +71,27 @@
|
||||
62666132613033633733336434373161316664626531336363306664373131303937383066363066
|
||||
636534343631376365633666316534663932
|
||||
|
||||
- name: add ansible to sudoers
|
||||
become: true
|
||||
lineinfile:
|
||||
dest: /etc/sudoers
|
||||
state: present
|
||||
regexp: '^ansible ALL='
|
||||
line: 'ansible ALL=(ALL) NOPASSWD: ALL'
|
||||
validate: 'visudo -cf %s'
|
||||
|
||||
- name: Add the user 'richard'
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: richard
|
||||
state: present
|
||||
shell: /bin/bash
|
||||
create_home: yes
|
||||
password: "$6$yNKLUxX0$lxy/jaJI7cKCq5j.KondUalu9r96gUeRR//5qciZ/RX9z9PGSpbU9j7OsxaOzqV5uLeQ9ouIe8quo/2YqKE46/"
|
||||
uid: "1000"
|
||||
groups:
|
||||
- sudo
|
||||
|
||||
- name: Add the authorized key for 'richard'
|
||||
become: true
|
||||
ansible.posix.authorized_key:
|
||||
@@ -87,11 +102,3 @@
|
||||
with_file:
|
||||
- '/home/richard/.ssh/id_rsa.pub'
|
||||
|
||||
- name: add ansible to sudoers
|
||||
become: true
|
||||
lineinfile:
|
||||
dest: /etc/sudoers
|
||||
state: present
|
||||
regexp: '^ansible ALL='
|
||||
line: 'ansible ALL=(ALL) NOPASSWD: ALL'
|
||||
validate: 'visudo -cf %s'
|
||||
|
||||
Reference in New Issue
Block a user