Use the singleplatform-eng.users role to create the kayobe ansible user
This commit is contained in:
parent
287acd1f92
commit
1216fec5e3
@ -3,28 +3,20 @@
|
||||
hosts: seed:overcloud
|
||||
vars:
|
||||
ansible_user: "{{ bootstrap_user }}"
|
||||
tasks:
|
||||
- block:
|
||||
- name: Ensure the Kayobe Ansible group exists
|
||||
group:
|
||||
name: "{{ kayobe_ansible_user }}"
|
||||
state: present
|
||||
|
||||
- name: Ensure the Kayobe Ansible user account exists
|
||||
user:
|
||||
name: "{{ kayobe_ansible_user }}"
|
||||
group: "{{ kayobe_ansible_user }}"
|
||||
comment: "Kayobe Ansible SSH access"
|
||||
state: present
|
||||
roles:
|
||||
- role: singleplatform-eng.users
|
||||
users:
|
||||
- username: "{{ kayobe_ansible_user }}"
|
||||
name: Kayobe deployment user
|
||||
append: True
|
||||
ssh_key:
|
||||
- "{{ lookup('file', ssh_public_key_path) }}"
|
||||
become: True
|
||||
|
||||
post_tasks:
|
||||
- name: Ensure the Kayobe Ansible user has passwordless sudo
|
||||
copy:
|
||||
content: "{{ kayobe_ansible_user }} ALL=(ALL) NOPASSWD: ALL"
|
||||
dest: "/etc/sudoers.d/kayobe-ansible-user"
|
||||
mode: 0440
|
||||
|
||||
- name: Ensure the Kayobe Ansible user has authorized our SSH key
|
||||
authorized_key:
|
||||
user: "{{ kayobe_ansible_user }}"
|
||||
key: "{{ lookup('file', ssh_public_key_path) }}"
|
||||
become: True
|
||||
|
Loading…
Reference in New Issue
Block a user