mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 13:54:37 +03:00
Merge pull request #12203 from VannTen/cleanup/rename_bootstrap_os
Rename bootstrap-os to bootstrap_os
This commit is contained in:
@@ -37,7 +37,7 @@ molecule:
|
||||
- container-engine/cri-o
|
||||
- adduser
|
||||
- bastion-ssh-config
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
molecule_full:
|
||||
allow_failure: true
|
||||
|
||||
@@ -62,7 +62,7 @@ The following tags are defined in playbooks:
|
||||
| aws-ebs-csi-driver | Configuring csi driver: aws-ebs |
|
||||
| azure-csi-driver | Configuring csi driver: azure |
|
||||
| bastion | Setup ssh config for bastion |
|
||||
| bootstrap-os | Anything related to host OS configuration |
|
||||
| bootstrap_os | Anything related to host OS configuration |
|
||||
| calico | Network plugin Calico |
|
||||
| calico_rr | Configuring Calico route reflector |
|
||||
| cert-manager | Configuring certificate manager for K8s |
|
||||
@@ -167,7 +167,7 @@ Example command to filter and apply only DNS configuration tasks and skip
|
||||
everything else related to host OS configuration and downloading images of containers:
|
||||
|
||||
```ShellSession
|
||||
ansible-playbook -i inventory/sample/hosts.ini cluster.yml --tags preinstall,facts --skip-tags=download,bootstrap-os
|
||||
ansible-playbook -i inventory/sample/hosts.ini cluster.yml --tags preinstall,facts --skip-tags=download,bootstrap_os
|
||||
```
|
||||
|
||||
And this play only removes the K8s cluster DNS resolver IP from hosts' /etc/resolv.conf files:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# bootstrap-os
|
||||
# bootstrap_os
|
||||
|
||||
Bootstrap an Ansible host to be able to run Ansible modules.
|
||||
|
||||
@@ -49,7 +49,7 @@ Remember to disable fact gathering since Python might not be present on hosts.
|
||||
gather_facts: false # not all hosts might be able to run modules yet
|
||||
roles:
|
||||
- kubespray_defaults
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
|
||||
gather_facts: false
|
||||
vars:
|
||||
# Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining
|
||||
# fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled.
|
||||
# Need to disable pipelining for bootstrap_os as some systems have requiretty in sudoers set, which makes pipelining
|
||||
# fail. bootstrap_os fixes this on these systems, so in later plays it can be enabled.
|
||||
ansible_ssh_pipelining: false
|
||||
roles:
|
||||
- { role: kubespray_defaults}
|
||||
- { role: bootstrap-os, tags: bootstrap-os}
|
||||
- { role: bootstrap_os, tags: bootstrap_os}
|
||||
|
||||
- name: Preinstall
|
||||
hosts: k8s_cluster:etcd:calico_rr
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
gather_facts: false
|
||||
environment: "{{ proxy_disable_env }}"
|
||||
roles:
|
||||
- { role: bootstrap-os, tags: bootstrap-os}
|
||||
- { role: bootstrap_os, tags: bootstrap_os}
|
||||
|
||||
- name: Gather facts
|
||||
hosts: k8s_cluster:etcd:calico_rr
|
||||
|
||||
@@ -1,62 +1,10 @@
|
||||
---
|
||||
- name: Fetch /etc/os-release
|
||||
raw: cat /etc/os-release
|
||||
register: os_release
|
||||
changed_when: false
|
||||
# This command should always run, even in check mode
|
||||
check_mode: false
|
||||
- name: Warn for usage of deprecated role
|
||||
fail:
|
||||
msg: bootstrap-os is deprecated, switch to bootstrap_os
|
||||
ignore_errors: true # noqa ignore-errors
|
||||
run_once: true
|
||||
|
||||
- name: Include distro specifics vars and tasks
|
||||
vars:
|
||||
os_release_dict: "{{ os_release.stdout_lines | select('regex', '^.+=.*$') | map('regex_replace', '\"', '') |
|
||||
map('split', '=') | community.general.dict }}"
|
||||
block:
|
||||
- name: Include vars
|
||||
include_vars: "{{ item }}"
|
||||
tags:
|
||||
- facts
|
||||
with_first_found:
|
||||
- &search
|
||||
files:
|
||||
- "{{ os_release_dict['ID'] }}-{{ os_release_dict['VARIANT_ID'] }}.yml"
|
||||
- "{{ os_release_dict['ID'] }}.yml"
|
||||
paths:
|
||||
- vars/
|
||||
skip: true
|
||||
- name: Include tasks
|
||||
include_tasks: "{{ included_tasks_file }}"
|
||||
with_first_found:
|
||||
- <<: *search
|
||||
paths: []
|
||||
loop_control:
|
||||
loop_var: included_tasks_file
|
||||
|
||||
- name: Install system packages
|
||||
- name: Compat for direct role import
|
||||
import_role:
|
||||
name: system_packages
|
||||
tags:
|
||||
- system-packages
|
||||
|
||||
- name: Create remote_tmp for it is used by another module
|
||||
file:
|
||||
path: "{{ ansible_remote_tmp | default('~/.ansible/tmp') }}"
|
||||
state: directory
|
||||
mode: "0700"
|
||||
|
||||
- name: Gather facts
|
||||
setup:
|
||||
gather_subset: '!all'
|
||||
filter: ansible_*
|
||||
|
||||
- name: Assign inventory name to unconfigured hostnames (non-CoreOS, non-Flatcar, Suse and ClearLinux, non-Fedora)
|
||||
hostname:
|
||||
name: "{{ inventory_hostname }}"
|
||||
when: override_system_hostname
|
||||
|
||||
- name: Ensure bash_completion.d folder exists
|
||||
file:
|
||||
name: /etc/bash_completion.d/
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
name: bootstrap_os
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
gather_facts: false
|
||||
become: true
|
||||
roles:
|
||||
- role: bootstrap-os
|
||||
- role: bootstrap_os
|
||||
62
roles/bootstrap_os/tasks/main.yml
Normal file
62
roles/bootstrap_os/tasks/main.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
- name: Fetch /etc/os-release
|
||||
raw: cat /etc/os-release
|
||||
register: os_release
|
||||
changed_when: false
|
||||
# This command should always run, even in check mode
|
||||
check_mode: false
|
||||
|
||||
- name: Include distro specifics vars and tasks
|
||||
vars:
|
||||
os_release_dict: "{{ os_release.stdout_lines | select('regex', '^.+=.*$') | map('regex_replace', '\"', '') |
|
||||
map('split', '=') | community.general.dict }}"
|
||||
block:
|
||||
- name: Include vars
|
||||
include_vars: "{{ item }}"
|
||||
tags:
|
||||
- facts
|
||||
with_first_found:
|
||||
- &search
|
||||
files:
|
||||
- "{{ os_release_dict['ID'] }}-{{ os_release_dict['VARIANT_ID'] }}.yml"
|
||||
- "{{ os_release_dict['ID'] }}.yml"
|
||||
paths:
|
||||
- vars/
|
||||
skip: true
|
||||
- name: Include tasks
|
||||
include_tasks: "{{ included_tasks_file }}"
|
||||
with_first_found:
|
||||
- <<: *search
|
||||
paths: []
|
||||
loop_control:
|
||||
loop_var: included_tasks_file
|
||||
|
||||
- name: Install system packages
|
||||
import_role:
|
||||
name: system_packages
|
||||
tags:
|
||||
- system-packages
|
||||
|
||||
- name: Create remote_tmp for it is used by another module
|
||||
file:
|
||||
path: "{{ ansible_remote_tmp | default('~/.ansible/tmp') }}"
|
||||
state: directory
|
||||
mode: "0700"
|
||||
|
||||
- name: Gather facts
|
||||
setup:
|
||||
gather_subset: '!all'
|
||||
filter: ansible_*
|
||||
|
||||
- name: Assign inventory name to unconfigured hostnames (non-CoreOS, non-Flatcar, Suse and ClearLinux, non-Fedora)
|
||||
hostname:
|
||||
name: "{{ inventory_hostname }}"
|
||||
when: override_system_hostname
|
||||
|
||||
- name: Ensure bash_completion.d folder exists
|
||||
file:
|
||||
name: /etc/bash_completion.d/
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
@@ -7,7 +7,7 @@
|
||||
ignore_assert_errors: true
|
||||
roles:
|
||||
- role: kubespray_defaults
|
||||
- role: bootstrap-os
|
||||
- role: bootstrap_os
|
||||
- role: network_facts
|
||||
- role: kubernetes/preinstall
|
||||
- role: adduser
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
become: true
|
||||
roles:
|
||||
- role: kubespray_defaults
|
||||
- role: bootstrap-os
|
||||
- role: bootstrap_os
|
||||
- role: adduser
|
||||
user: "{{ addusers.kube }}"
|
||||
tasks:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
ignore_assert_errors: true
|
||||
roles:
|
||||
- role: kubespray_defaults
|
||||
- role: bootstrap-os
|
||||
- role: bootstrap_os
|
||||
- role: network_facts
|
||||
- role: kubernetes/preinstall
|
||||
- role: adduser
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
become: true
|
||||
roles:
|
||||
- role: kubespray_defaults
|
||||
- role: bootstrap-os
|
||||
- role: bootstrap_os
|
||||
- role: adduser
|
||||
user: "{{ addusers.kube }}"
|
||||
tasks:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
become: true
|
||||
roles:
|
||||
- role: kubespray_defaults
|
||||
- role: bootstrap-os
|
||||
- role: bootstrap_os
|
||||
- role: adduser
|
||||
user: "{{ addusers.kube }}"
|
||||
tasks:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
become: true
|
||||
roles:
|
||||
- role: kubespray_defaults
|
||||
- role: bootstrap-os
|
||||
- role: bootstrap_os
|
||||
- role: adduser
|
||||
user: "{{ addusers.kube }}"
|
||||
tasks:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- kubelet
|
||||
- kube-controller-manager
|
||||
- kube-apiserver
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- apps
|
||||
- network
|
||||
- master # master tag is deprecated and replaced by control-plane
|
||||
@@ -35,7 +35,7 @@
|
||||
- kubelet
|
||||
- kube-controller-manager
|
||||
- kube-apiserver
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- apps
|
||||
- network
|
||||
- master # master tag is deprecated and replaced by control-plane
|
||||
@@ -86,7 +86,7 @@
|
||||
- weave
|
||||
- kube-ovn
|
||||
- kube-router
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Create calico cni directories
|
||||
file:
|
||||
@@ -102,7 +102,7 @@
|
||||
tags:
|
||||
- network
|
||||
- calico
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Create local volume provisioner directories
|
||||
file:
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
- "'Amazon' not in ansible_distribution"
|
||||
- slc.stat.exists
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Disable IPv6 DNS lookup
|
||||
lineinfile:
|
||||
@@ -34,7 +34,7 @@
|
||||
- disable_ipv6_dns
|
||||
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Clean previously used sysctl file locations
|
||||
file:
|
||||
@@ -52,7 +52,7 @@
|
||||
get_mime: false
|
||||
register: sysctl_file_stat
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Change sysctl file path to link source if linked
|
||||
set_fact:
|
||||
@@ -61,7 +61,7 @@
|
||||
- sysctl_file_stat.stat.islnk is defined
|
||||
- sysctl_file_stat.stat.islnk
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Make sure sysctl file path folder exists
|
||||
file:
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
- systemd_resolved_enabled.rc != 0
|
||||
- networkmanager_enabled.rc != 0
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- resolvconf
|
||||
|
||||
- name: Apply systemd-resolved settings
|
||||
@@ -42,7 +42,7 @@
|
||||
- resolvconf_mode == 'host_resolvconf'
|
||||
- systemd_resolved_enabled.rc == 0
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- resolvconf
|
||||
|
||||
- name: Apply networkmanager unmanaged devices settings
|
||||
@@ -50,7 +50,7 @@
|
||||
when:
|
||||
- networkmanager_enabled.rc == 0
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Apply networkmanager DNS settings
|
||||
import_tasks: 0063-networkmanager-dns.yml
|
||||
@@ -59,7 +59,7 @@
|
||||
- resolvconf_mode == 'host_resolvconf'
|
||||
- networkmanager_enabled.rc == 0
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- resolvconf
|
||||
|
||||
- name: Apply system configurations
|
||||
@@ -67,7 +67,7 @@
|
||||
when:
|
||||
- not dns_late
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Configure NTP
|
||||
import_tasks: 0081-ntp-configurations.yml
|
||||
@@ -75,12 +75,12 @@
|
||||
- not dns_late
|
||||
- ntp_enabled
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Configure /etc/hosts
|
||||
import_tasks: 0090-etchosts.yml
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- etchosts
|
||||
|
||||
- name: Configure dhclient
|
||||
@@ -91,7 +91,7 @@
|
||||
- dhclientconffile is defined
|
||||
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- resolvconf
|
||||
|
||||
- name: Configure dhclient dhclient hooks
|
||||
@@ -102,7 +102,7 @@
|
||||
- dhclientconffile is defined
|
||||
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
- resolvconf
|
||||
|
||||
# We need to make sure the network is restarted early enough so that docker can later pick up the correct system
|
||||
@@ -120,7 +120,7 @@
|
||||
when:
|
||||
- not dns_late
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Run calico checks
|
||||
include_role:
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
when:
|
||||
- ansible_pkg_mgr == 'zypper'
|
||||
tags: bootstrap-os
|
||||
tags: bootstrap_os
|
||||
|
||||
- name: Add debian 10 required repos
|
||||
when:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_version == "10"
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
block:
|
||||
- name: Add Debian Backports apt repo
|
||||
apt_repository:
|
||||
@@ -44,7 +44,7 @@
|
||||
cache_valid_time: 3600
|
||||
when: ansible_os_family == "Debian"
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Remove legacy docker repo file
|
||||
file:
|
||||
@@ -63,7 +63,7 @@
|
||||
- not is_fedora_coreos
|
||||
- epel_enabled | bool
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
- name: Install packages requirements
|
||||
package:
|
||||
@@ -75,4 +75,4 @@
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
when: not (ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] or is_fedora_coreos)
|
||||
tags:
|
||||
- bootstrap-os
|
||||
- bootstrap_os
|
||||
|
||||
Reference in New Issue
Block a user