代码拉取完成,页面将自动刷新
- hosts: kube-master
tasks:
- block:
- name: "Current user is '{{ ansible_env.USER }}'"
set_fact:
current_user: "{{ ansible_env.USER }}"
when: ansible_env.USER != 'root'
- name: "Current user is '{{ ansible_env.SUDO_USER }}'"
set_fact:
current_user: "{{ ansible_env.SUDO_USER }}"
when: ansible_env.SUDO_USER is defined
- name: "Create /home/{{ ansible_env.USER }}/.kube"
become_user: "{{ current_user }}"
file:
path: "/home/{{ current_user }}/.kube"
state: directory
mode: 0700
owner: "{{ current_user }}"
group: "{{ current_user }}"
- name: "Create /home/{{ current_user }}/.kube/config"
become: yes
copy:
remote_src: yes
src: /etc/kubernetes/admin.conf
dest: "/home/{{ current_user }}/.kube/config"
mode: 0600
owner: "{{ current_user }}"
group: "{{ current_user }}"
- name: "Initial helm for user '{{ current_user }}'"
become_user: "{{ current_user }}"
command: "{{ item }}"
changed_when: false
with_items:
- "{{ bin_dir }}/helm init --stable-repo-url={{ nexus_repo_charts }} --client-only"
- name: "Assign docker access to {{ current_user }}"
become: yes
user:
name: "{{ current_user }}"
groups: docker
append: yes
when:
- (ansible_env.USER != 'root') or (ansible_env.SUDO_USER is defined)
tags: user_init
- hosts: kube-master
become: yes
roles:
- name: k8s_patches
tags: patches
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。