From 23901fb6a7fca75ad46c88282cf6b30f98e7b070 Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Wed, 10 May 2023 17:15:57 +0200 Subject: [PATCH] copy/paste cleanup --- defaults/main.yml | 8 ++++---- tasks/add_ssh_keys.yml | 12 ++++++------ tasks/create_user.yml | 28 ++++++++++++++-------------- tasks/main.yml | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8a217b7..c13fabc 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,10 +1,10 @@ --- # defaults file for provision_management_user -provision_management_user_name: ansible -provision_management_user_group: ansible +provision_management_user_name: ubuntu +provision_management_user_group: ubuntu provision_management_user_password: "*" -provision_management_user_is_system: true -provision_management_user_home: /opt/{{ provision_management_user_name }} +provision_management_user_is_system: false +provision_management_user_home: /home/{{ provision_management_user_name }} provision_management_user_shell: /bin/bash provision_management_user_sudoer: false provision_management_user_add_ssh_key: false diff --git a/tasks/add_ssh_keys.yml b/tasks/add_ssh_keys.yml index 165bf2e..d2688c0 100644 --- a/tasks/add_ssh_keys.yml +++ b/tasks/add_ssh_keys.yml @@ -1,9 +1,9 @@ --- -# task/add_ssh_keys file for provision_ansible_user +# task/add_ssh_keys file for provision_management_user - name: "Add key to authorized_keys" ansible.posix.authorized_key: - user: "{{ provision_ansible_user_name }}" - key: "{{ provision_ansible_user_ssh_key }}" - comment: "{{ provision_ansible_user_name }}@{{ ansible_hostname }}" - key_options: "{{ provision_ansible_user_ssh_key_options }}" - exclusive: "{{ provision_ansible_user_ssh_key_exclusive }}" + user: "{{ provision_management_user_name }}" + key: "{{ provision_management_user_ssh_key }}" + comment: "{{ provision_management_user_name }}@{{ ansible_hostname }}" + key_options: "{{ provision_management_user_ssh_key_options }}" + exclusive: "{{ provision_management_user_ssh_key_exclusive }}" diff --git a/tasks/create_user.yml b/tasks/create_user.yml index df6f61f..0e38793 100644 --- a/tasks/create_user.yml +++ b/tasks/create_user.yml @@ -1,27 +1,27 @@ --- -# task/create_user file for provision_ansible_user -- name: "Create group {{ provision_ansible_user_group }}" +# task/create_user file for provision_management_user +- name: "Create group {{ provision_management_user_group }}" ansible.builtin.group: - name: "{{ provision_ansible_user_group }}" + name: "{{ provision_management_user_group }}" state: present - system: "{{ provision_ansible_user_is_system }}" + system: "{{ provision_management_user_is_system }}" -- name: "Create user {{ provision_ansible_user_name }}" +- name: "Create user {{ provision_management_user_name }}" ansible.builtin.user: - name: "{{ provision_ansible_user_name }}" + name: "{{ provision_management_user_name }}" comment: "Ansible service user" - password: "{{ provision_ansible_user_password }}" - group: "{{ provision_ansible_user_group }}" - home: "{{ provision_ansible_user_home }}" - shell: "{{ provision_ansible_user_shell }}" - system: "{{ provision_ansible_user_is_system }}" + password: "{{ provision_management_user_password }}" + group: "{{ provision_management_user_group }}" + home: "{{ provision_management_user_home }}" + shell: "{{ provision_management_user_shell }}" + system: "{{ provision_management_user_is_system }}" create_home: true - name: "Add user to sudoers" ansible.builtin.copy: - dest: "/etc/sudoers.d/{{ provision_ansible_user_name }}" + dest: "/etc/sudoers.d/{{ provision_management_user_name }}" owner: root group: root mode: 0640 - content: "{{ provision_ansible_user_name }} ALL=(ALL) NOPASSWD: ALL" - when: provision_ansible_user_sudoer + content: "{{ provision_management_user_name }} ALL=(ALL) NOPASSWD: ALL" + when: provision_management_user_sudoer diff --git a/tasks/main.yml b/tasks/main.yml index 6d4d78f..52c85d4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,4 +5,4 @@ - name: "Import add_ssh_keys.yml" ansible.builtin.include_tasks: add_ssh_keys.yml - when: provision_ansible_user_add_ssh_key + when: provision_management_user_add_ssh_key