update bootstrap.yaml to work with user supplied from cli

This commit is contained in:
2022-08-20 13:34:56 -04:00
parent bbc6b7818d
commit be6f184b81
2 changed files with 15 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
---
- name: bootstrap
hosts: cubox-m
remote_user: ansible
# remote_user: ansible
gather_facts: false
# become: true
@@ -14,17 +14,6 @@
- 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:
# removes: /home/ubuntu/.bashrc
- debug: var=ansible_os_family
run_once: true
@@ -43,7 +32,7 @@
shell: /bin/bash
create_home: yes
password: "$6$7z7PfYwduXom0o73$DEiy3K15URNNjmKkOQIwx8/mFKArUNYkFn8D/4q6t/eP9hf1X9jnG4YuSjI7q1Dnp1HwukZUxZY7cF2JK5DO/."
uid: "1001"
# uid: "1001"
groups:
- sudo
@@ -88,7 +77,7 @@
shell: /bin/bash
create_home: yes
password: "$6$yNKLUxX0$lxy/jaJI7cKCq5j.KondUalu9r96gUeRR//5qciZ/RX9z9PGSpbU9j7OsxaOzqV5uLeQ9ouIe8quo/2YqKE46/"
uid: "1000"
# uid: "1000"
groups:
- sudo
@@ -102,3 +91,13 @@
with_file:
- '/home/richard/.ssh/id_rsa.pub'
- name: remove {{item}} user if it exists
command: userdel -rf {{item}}
become: true
become_user: ansible
args:
removes: /home/{{item}}/.bashrc
loop:
- debian
- ubuntu