diff --git a/roles/ks-core/prepare/files/ks-init/admin-account.yaml b/roles/ks-core/prepare/files/ks-init/admin-account.yaml new file mode 100644 index 000000000..912d0ca40 --- /dev/null +++ b/roles/ks-core/prepare/files/ks-init/admin-account.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: iam.kubesphere.io/v1alpha2 +kind: User +metadata: + name: admin + annotations: + iam.kubesphere.io/uninitialized: "true" +spec: + email: admin@kubesphere.io + password: $2a$10$zcHepmzfKPoxCVCYZr5K7ORPZZ/ySe9p/7IUb/8u./xHrnSX2LOCO +status: + state: Active \ No newline at end of file diff --git a/roles/ks-core/prepare/files/ks-init/initial-account.yaml b/roles/ks-core/prepare/files/ks-init/initial-account.yaml index 8e750c74d..edfe10e3f 100644 --- a/roles/ks-core/prepare/files/ks-init/initial-account.yaml +++ b/roles/ks-core/prepare/files/ks-init/initial-account.yaml @@ -1,16 +1,3 @@ ---- -apiVersion: iam.kubesphere.io/v1alpha2 -kind: User -metadata: - name: admin - annotations: - iam.kubesphere.io/uninitialized: "true" -spec: - email: admin@kubesphere.io - password: $2a$10$zcHepmzfKPoxCVCYZr5K7ORPZZ/ySe9p/7IUb/8u./xHrnSX2LOCO -status: - state: Active - --- apiVersion: v1 kind: ServiceAccount diff --git a/roles/ks-core/prepare/tasks/ks-init.yaml b/roles/ks-core/prepare/tasks/ks-init.yaml index 400d988c4..09361f55d 100644 --- a/roles/ks-core/prepare/tasks/ks-init.yaml +++ b/roles/ks-core/prepare/tasks/ks-init.yaml @@ -5,10 +5,13 @@ register: kubesphere_user_check failed_when: "kubesphere_user_check.stderr and 'NotFound' not in kubesphere_user_check.stderr" -- name: KubeSphere | Initing account +- name: KubeSphere | Initing admin account shell: > - {{ bin_dir }}/kubectl apply -f {{ kubesphere_dir }}/ks-init/initial-account.yaml + {{ bin_dir }}/kubectl apply -f {{ kubesphere_dir }}/ks-init/admin-account.yaml when: - kubesphere_user_check.stderr is defined - kubesphere_user_check.stderr.find("NotFound") != -1 +- name: KubeSphere | Initing account + shell: > + {{ bin_dir }}/kubectl apply -f {{ kubesphere_dir }}/ks-init/initial-account.yaml \ No newline at end of file