From ce3554b530065e713e7c66c096ecfdb2ce0eb85b Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 13 Apr 2021 11:30:42 -0400 Subject: [PATCH] Allow customization of deploy username --- roles/base/defaults/main.yml | 2 ++ roles/base/tasks/main.yml | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 roles/base/defaults/main.yml diff --git a/roles/base/defaults/main.yml b/roles/base/defaults/main.yml new file mode 100644 index 0000000..4111dcb --- /dev/null +++ b/roles/base/defaults/main.yml @@ -0,0 +1,2 @@ +--- +deploy_username: "deploy" diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index dcbf3ab..025c8b0 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -612,11 +612,11 @@ # deploy - name: ensure user deploy exists user: - name: deploy + name: "{{ deploy_username }}" uid: 200 group: operator shell: /bin/bash - home: /var/home/deploy + home: "/var/home/{{ deploy_username }}" createhome: yes move_home: yes state: present @@ -625,25 +625,25 @@ - name: ensure homedir has right permissions file: - dest: /var/home/deploy + dest: "/var/home/{{ deploy_username }}" state: directory - owner: deploy + owner: "{{ deploy_username }}" group: operator mode: 0700 tags: users - name: ensure .ssh directory exists file: - dest: /var/home/deploy/.ssh + dest: "/var/home/{{ deploy_username }}/.ssh" state: directory - owner: deploy + owner: "{{ deploy_username }}" group: operator mode: 0700 tags: users - name: add authorized keys authorized_key: - user: "deploy" + user: "{{ deploy_username }}" key: "{{ item.1 }}" with_subelements: - "{{ admin_users }}"