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 create_kolla_user: True
kolla_user: "kolla"
kolla_group: "kolla"
enable_host_ntp: True enable_host_ntp: True
change_selinux: True change_selinux: True

View File

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

View File

@ -42,16 +42,16 @@
- name: Ensure kolla group is present - name: Ensure kolla group is present
group: group:
name: kolla name: "{{ kolla_group }}"
state: present state: present
become: True become: True
when: create_kolla_user | bool when: create_kolla_user | bool
- name: Create kolla user - name: Create kolla user
user: user:
name: kolla name: "{{ kolla_user }}"
state: present state: present
group: kolla group: "{{ kolla_group }}"
groups: "sudo" groups: "sudo"
become: True become: True
when: create_kolla_user | bool when: create_kolla_user | bool
@ -60,14 +60,14 @@
lineinfile: lineinfile:
dest: /etc/sudoers dest: /etc/sudoers
state: present state: present
regexp: '^kolla' regexp: '^{{ kolla_group }}'
line: 'kolla ALL=(ALL) NOPASSWD: ALL' line: '{{ kolla_group }} ALL=(ALL) NOPASSWD: ALL'
become: True become: True
when: create_kolla_user | bool when: create_kolla_user | bool
- name: Add public key to kolla user authorized keys - name: Add public key to kolla user authorized keys
authorized_key: authorized_key:
user: kolla user: "{{ kolla_user }}"
key: "{{ kolla_ssh_key.public_key }}" key: "{{ kolla_ssh_key.public_key }}"
become: True become: True
when: create_kolla_user | bool when: create_kolla_user | bool
@ -139,8 +139,8 @@
path: "{{ node_config_directory }}" path: "{{ node_config_directory }}"
state: directory state: directory
recurse: yes recurse: yes
owner: kolla owner: "{{ kolla_user }}"
group: kolla group: "{{ kolla_group }}"
mode: 0755 mode: 0755
become: True become: True
when: create_kolla_user | bool when: create_kolla_user | bool