2015-12-30 16:11:33 +00:00
|
|
|
---
|
2016-01-21 09:51:13 +00:00
|
|
|
- include: gitinfos.yml
|
2016-01-21 12:19:02 +00:00
|
|
|
when: run_gitinfos
|
2016-01-21 09:51:13 +00:00
|
|
|
|
2016-01-09 09:45:50 +00:00
|
|
|
- name: gather os specific variables
|
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- files:
|
|
|
|
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
|
|
|
|
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml"
|
|
|
|
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
|
|
|
|
- "{{ ansible_distribution|lower }}.yml"
|
|
|
|
- "{{ ansible_os_family|lower }}.yml"
|
|
|
|
- defaults.yml
|
|
|
|
paths:
|
|
|
|
- ../vars
|
|
|
|
|
2015-12-30 21:15:18 +00:00
|
|
|
- name: "Identify init system"
|
|
|
|
shell: >
|
2016-01-22 15:37:07 +00:00
|
|
|
$(pgrep systemd > /dev/null && systemctl status network.target > /dev/null);
|
2015-12-22 10:50:55 +00:00
|
|
|
if [ $? -eq 0 ] ; then
|
2015-12-30 21:15:18 +00:00
|
|
|
echo systemd;
|
2015-12-31 13:07:02 +00:00
|
|
|
else
|
|
|
|
echo sysvinit;
|
2015-12-30 21:15:18 +00:00
|
|
|
fi
|
|
|
|
always_run: True
|
|
|
|
register: init_system_output
|
2015-12-31 13:54:15 +00:00
|
|
|
changed_when: False
|
2016-01-23 17:26:07 +00:00
|
|
|
tags: always
|
2015-12-30 16:11:33 +00:00
|
|
|
|
2015-12-30 21:15:18 +00:00
|
|
|
- set_fact:
|
|
|
|
init_system: "{{ init_system_output.stdout }}"
|
2016-01-23 17:26:07 +00:00
|
|
|
always_run: True
|
|
|
|
tags: always
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-01-30 15:04:47 +00:00
|
|
|
- name: Create kubernetes config directory
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}"
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
|
|
|
|
- name: Create kubernetes script directory
|
|
|
|
file:
|
|
|
|
path: "{{ kube_script_dir }}"
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
|
|
|
|
- name: Create kubernetes manifests directory
|
|
|
|
file:
|
|
|
|
path: "{{ kube_manifest_dir }}"
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
|
|
|
|
- name: Create kubernetes logs directory
|
|
|
|
file:
|
|
|
|
path: "{{ kube_log_dir }}"
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
when: init_system == "sysvinit"
|
|
|
|
|
|
|
|
- name: Create cni directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
with_items:
|
|
|
|
- "/etc/cni/net.d"
|
|
|
|
- "/opt/cni/bin"
|
|
|
|
when: kube_network_plugin == "calico"
|
|
|
|
|
2016-01-25 17:16:56 +00:00
|
|
|
- name: Update package management cache (APT)
|
|
|
|
apt: update_cache=yes
|
|
|
|
when: ansible_pkg_mgr == 'apt'
|
|
|
|
|
|
|
|
- name: Update package management cache (YUM)
|
|
|
|
yum: update_cache=yes name='*'
|
|
|
|
when: ansible_pkg_mgr == 'yum'
|
2016-01-25 01:06:34 +00:00
|
|
|
|
2016-01-09 09:45:50 +00:00
|
|
|
- name: Install python-apt for Debian distribs
|
|
|
|
shell: apt-get install -y python-apt
|
2015-12-30 21:15:18 +00:00
|
|
|
when: ansible_os_family == "Debian"
|
2016-01-09 09:45:50 +00:00
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Install python-dnf for latest RedHat versions
|
|
|
|
shell: dnf install -y python-dnf yum
|
|
|
|
when: ansible_distribution == "Fedora" and
|
|
|
|
ansible_distribution_major_version > 21
|
|
|
|
changed_when: False
|
2015-12-31 13:07:02 +00:00
|
|
|
|
2016-01-31 20:05:49 +00:00
|
|
|
- name: Install epel-release for RedHat and CentOS distribs
|
|
|
|
action:
|
|
|
|
module: "{{ ansible_pkg_mgr }}"
|
|
|
|
name: "epel-release"
|
|
|
|
state: latest
|
|
|
|
when: ansible_distribution == "RedHat" or
|
|
|
|
ansible_distribution == "CentOS"
|
|
|
|
|
2016-01-09 09:45:50 +00:00
|
|
|
- name: Install packages requirements
|
2015-12-31 13:07:02 +00:00
|
|
|
action:
|
|
|
|
module: "{{ ansible_pkg_mgr }}"
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: latest
|
2016-01-09 09:45:50 +00:00
|
|
|
with_items: "{{required_pkgs | union(common_required_pkgs)}}"
|
|
|
|
|
|
|
|
# Todo : selinux configuration
|
|
|
|
- name: Set selinux policy to permissive
|
|
|
|
selinux: policy=targeted state=permissive
|
2015-12-31 13:07:02 +00:00
|
|
|
when: ansible_os_family == "RedHat"
|
2016-01-09 09:45:50 +00:00
|
|
|
changed_when: False
|
2015-12-30 21:15:18 +00:00
|
|
|
|
2016-01-20 16:37:23 +00:00
|
|
|
- include: etchosts.yml
|
|
|
|
|
2015-12-30 21:15:18 +00:00
|
|
|
- include: python-bootstrap.yml
|
|
|
|
when: ansible_os_family not in [ "Debian", "RedHat" ]
|