update bootstrap.yaml to work with user supplied from cli
This commit is contained in:
@@ -3,10 +3,12 @@ localhost ansible_connection=local
|
|||||||
[managed]
|
[managed]
|
||||||
home ansible_ssh_host=192.168.4.11
|
home ansible_ssh_host=192.168.4.11
|
||||||
cubox-i ansible_ssh_host=192.168.4.12
|
cubox-i ansible_ssh_host=192.168.4.12
|
||||||
|
cubox-m ansible_ssh_host=192.168.4.15
|
||||||
|
|
||||||
[ns]
|
[ns]
|
||||||
home ansible_ssh_host=192.168.4.11
|
home ansible_ssh_host=192.168.4.11
|
||||||
cubox-i ansible_ssh_host=192.168.4.12
|
cubox-i ansible_ssh_host=192.168.4.12
|
||||||
|
cubox-m ansible_ssh_host=192.168.4.15
|
||||||
|
|
||||||
[gfs]
|
[gfs]
|
||||||
;home ansible_ssh_host=192.168.4.11
|
;home ansible_ssh_host=192.168.4.11
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: bootstrap
|
- name: bootstrap
|
||||||
hosts: cubox-m
|
hosts: cubox-m
|
||||||
remote_user: ansible
|
# remote_user: ansible
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
# become: true
|
# become: true
|
||||||
|
|
||||||
@@ -14,17 +14,6 @@
|
|||||||
- name: Creates .ssh directory
|
- name: Creates .ssh directory
|
||||||
file: path=~/.ssh state=directory mode=700
|
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
|
- debug: var=ansible_os_family
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
@@ -43,7 +32,7 @@
|
|||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
create_home: yes
|
create_home: yes
|
||||||
password: "$6$7z7PfYwduXom0o73$DEiy3K15URNNjmKkOQIwx8/mFKArUNYkFn8D/4q6t/eP9hf1X9jnG4YuSjI7q1Dnp1HwukZUxZY7cF2JK5DO/."
|
password: "$6$7z7PfYwduXom0o73$DEiy3K15URNNjmKkOQIwx8/mFKArUNYkFn8D/4q6t/eP9hf1X9jnG4YuSjI7q1Dnp1HwukZUxZY7cF2JK5DO/."
|
||||||
uid: "1001"
|
# uid: "1001"
|
||||||
groups:
|
groups:
|
||||||
- sudo
|
- sudo
|
||||||
|
|
||||||
@@ -88,7 +77,7 @@
|
|||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
create_home: yes
|
create_home: yes
|
||||||
password: "$6$yNKLUxX0$lxy/jaJI7cKCq5j.KondUalu9r96gUeRR//5qciZ/RX9z9PGSpbU9j7OsxaOzqV5uLeQ9ouIe8quo/2YqKE46/"
|
password: "$6$yNKLUxX0$lxy/jaJI7cKCq5j.KondUalu9r96gUeRR//5qciZ/RX9z9PGSpbU9j7OsxaOzqV5uLeQ9ouIe8quo/2YqKE46/"
|
||||||
uid: "1000"
|
# uid: "1000"
|
||||||
groups:
|
groups:
|
||||||
- sudo
|
- sudo
|
||||||
|
|
||||||
@@ -102,3 +91,13 @@
|
|||||||
with_file:
|
with_file:
|
||||||
- '/home/richard/.ssh/id_rsa.pub'
|
- '/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