kubespray/roles/bootstrap-os/tasks/bootstrap-coreos.yml

60 lines
1.4 KiB
YAML

---
- name: Bootstrap | Check if bootstrap is needed
raw: stat /opt/bin/.bootstrapped
register: need_bootstrap
environment: {}
failed_when: false
changed_when: false
tags:
- facts
- name: Force binaries directory for Container Linux by CoreOS
set_fact:
bin_dir: "/opt/bin"
tags:
- facts
- name: Bootstrap | Run bootstrap.sh
script: bootstrap.sh
when: need_bootstrap.rc != 0
- set_fact:
ansible_python_interpreter: "{{ bin_dir }}/python"
tags:
- facts
- name: Bootstrap | Check if we need to install pip
shell: "pip3 --version"
register: need_pip
failed_when: false
changed_when: false
check_mode: no
tags:
- facts
environment:
PATH: "{{ ansible_env.PATH }}:{{ bin_dir }}"
- name: Bootstrap | Install pip
shell: "{{ ansible_python_interpreter }} -m ensurepip"
when: need_pip.rc != 0
- name: Bootstrap | Install pip launcher
copy:
src: runner
dest: "{{ bin_dir }}/pip3"
mode: 0755
when: need_pip.rc != 0
- name: Install required python modules
pip:
name: "{{ item }}"
extra_args: "{{ pip_extra_args | default(omit) }}"
with_items: "{{ pip_python_coreos_modules }}"
environment:
PATH: "{{ ansible_env.PATH }}:{{ bin_dir }}"
- name: Bootstrap | Disable auto-upgrade
shell: "systemctl stop locksmithd.service && systemctl mask --now locksmithd.service"
when:
- not coreos_auto_upgrade