Use kolla_user variable to setting kolla user name

Change-Id: I653e16270aab539edcec6d8622f0a1c06d04b492
This commit is contained in:
zhubingbing 2018-02-27 15:39:27 +08:00
parent 9a86713551
commit 83fe717837
3 changed files with 12 additions and 9 deletions

View File

@ -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

View File

@ -47,7 +47,7 @@
- name: Add kolla user to docker group
user:
name: kolla
name: "{{ kolla_user }}"
append: yes
groups: docker
become: True

View File

@ -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