bs_nix/ansible/add-user.yml

27 lines
621 B
YAML
Raw Permalink Normal View History

2021-03-12 23:55:03 +00:00
- hosts: '{{ target }}'
gather_facts: false
become: true
remote_user: root
any_errors_fatal: yes
tasks:
2021-06-12 04:30:45 +00:00
- name: add root ssh key
ansible.posix.authorized_key:
user: root
state: present
key: "{{ lookup('file', '../ssh_pub') }}"
2021-03-12 23:55:03 +00:00
- name: add user
user:
name: quackerd
2021-06-12 04:30:45 +00:00
password: "{{ user_password | password_hash('sha512', user_salt) }}"
shell: /bin/sh
2021-03-12 23:55:03 +00:00
groups: wheel
append: yes
state: present
- name: add user ssh key
ansible.posix.authorized_key:
user: quackerd
state: present
key: "{{ lookup('file', '../ssh_pub') }}"