X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Ftestbed-setup%2Fansible%2Froles%2Fuser_add%2Ftasks%2Fmain.yaml;fp=resources%2Ftools%2Ftestbed-setup%2Fansible%2Froles%2Fuser_add%2Ftasks%2Fmain.yaml;h=2672996202bc59e274da08544f4c60727031fc25;hp=0000000000000000000000000000000000000000;hb=048a9ca3484a06e54f48dc80e7ab24dbfebe406f;hpb=d7aec8ee052468f55e2e9bd27de1dedd918c8a37 diff --git a/resources/tools/testbed-setup/ansible/roles/user_add/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/user_add/tasks/main.yaml new file mode 100644 index 0000000000..2672996202 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/user_add/tasks/main.yaml @@ -0,0 +1,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 +