update bootstrap.yaml to work with user supplied from cli
This commit is contained in:
@@ -3,10 +3,12 @@ localhost ansible_connection=local
|
||||
[managed]
|
||||
home ansible_ssh_host=192.168.4.11
|
||||
cubox-i ansible_ssh_host=192.168.4.12
|
||||
cubox-m ansible_ssh_host=192.168.4.15
|
||||
|
||||
[ns]
|
||||
home ansible_ssh_host=192.168.4.11
|
||||
cubox-i ansible_ssh_host=192.168.4.12
|
||||
cubox-m ansible_ssh_host=192.168.4.15
|
||||
|
||||
[gfs]
|
||||
;home ansible_ssh_host=192.168.4.11
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user