From 83fe717837ebb04bf600a58cfa07f37dc5579f24 Mon Sep 17 00:00:00 2001 From: zhubingbing Date: Tue, 27 Feb 2018 15:39:27 +0800 Subject: [PATCH] Use kolla_user variable to setting kolla user name Change-Id: I653e16270aab539edcec6d8622f0a1c06d04b492 --- ansible/roles/baremetal/defaults/main.yml | 3 +++ ansible/roles/baremetal/tasks/post-install.yml | 2 +- ansible/roles/baremetal/tasks/pre-install.yml | 16 ++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ansible/roles/baremetal/defaults/main.yml b/ansible/roles/baremetal/defaults/main.yml index aff8ccfe5f..2645b8564d 100644 --- a/ansible/roles/baremetal/defaults/main.yml +++ b/ansible/roles/baremetal/defaults/main.yml @@ -10,6 +10,9 @@ customize_etc_hosts: True create_kolla_user: True +kolla_user: "kolla" +kolla_group: "kolla" + enable_host_ntp: True change_selinux: True diff --git a/ansible/roles/baremetal/tasks/post-install.yml b/ansible/roles/baremetal/tasks/post-install.yml index 2a19455d5a..a9f4c9ea1d 100644 --- a/ansible/roles/baremetal/tasks/post-install.yml +++ b/ansible/roles/baremetal/tasks/post-install.yml @@ -47,7 +47,7 @@ - name: Add kolla user to docker group user: - name: kolla + name: "{{ kolla_user }}" append: yes groups: docker become: True diff --git a/ansible/roles/baremetal/tasks/pre-install.yml b/ansible/roles/baremetal/tasks/pre-install.yml index a820a11f17..a471a7da57 100644 --- a/ansible/roles/baremetal/tasks/pre-install.yml +++ b/ansible/roles/baremetal/tasks/pre-install.yml @@ -42,16 +42,16 @@ - name: Ensure kolla group is present group: - name: kolla + name: "{{ kolla_group }}" state: present become: True when: create_kolla_user | bool - name: Create kolla user user: - name: kolla + name: "{{ kolla_user }}" state: present - group: kolla + group: "{{ kolla_group }}" groups: "sudo" become: True when: create_kolla_user | bool @@ -60,14 +60,14 @@ lineinfile: dest: /etc/sudoers state: present - regexp: '^kolla' - line: 'kolla ALL=(ALL) NOPASSWD: ALL' + regexp: '^{{ kolla_group }}' + line: '{{ kolla_group }} ALL=(ALL) NOPASSWD: ALL' become: True when: create_kolla_user | bool - name: Add public key to kolla user authorized keys authorized_key: - user: kolla + user: "{{ kolla_user }}" key: "{{ kolla_ssh_key.public_key }}" become: True when: create_kolla_user | bool @@ -139,8 +139,8 @@ path: "{{ node_config_directory }}" state: directory recurse: yes - owner: kolla - group: kolla + owner: "{{ kolla_user }}" + group: "{{ kolla_group }}" mode: 0755 become: True when: create_kolla_user | bool