aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/user_add/tasks/main.yaml
blob: 2672996202bc59e274da08544f4c60727031fc25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
# file: roles/user_add/tasks/main.yaml

- name: Add testuser account
  user:
    name: "testuser"
    state: present
    shell: "/bin/bash"
    password: "{{ user_pass }}"
  tags:
    - add-user

- name: Allow password login
  lineinfile:
    dest: "/etc/ssh/sshd_config"
    regexp: "^PasswordAuthentication no"
    line: "PasswordAuthentication yes"
  notify:
    - "Restart sshd"
  tags:
    - allow-password-login

- name: Add visudo entry
  lineinfile:
    dest: "/etc/sudoers"
    state: present
    line: "testuser ALL=(ALL) NOPASSWD: ALL"
    validate: "visudo -cf %s"
  tags:
    - allow-sudo