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-07-20 09:35:06 +00:00
|
|
|
- include: set_facts.yml
|
|
|
|
|
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
|
2016-02-19 17:48:53 +00:00
|
|
|
skip: true
|
|
|
|
|
|
|
|
- name: Force binaries directory for CoreOS
|
|
|
|
set_fact:
|
|
|
|
bin_dir: "/opt/bin"
|
|
|
|
when: ansible_os_family == "CoreOS"
|
2016-01-09 09:45:50 +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
|
2016-02-13 10:17:20 +00:00
|
|
|
when: ansible_service_mgr in ["sysvinit","upstart"]
|
2016-01-30 15:04:47 +00:00
|
|
|
|
2016-03-23 16:27:06 +00:00
|
|
|
- name: check cloud_provider value
|
|
|
|
fail:
|
2016-04-13 01:43:31 +00:00
|
|
|
msg: "If set the 'cloud_provider' var must be set either to 'generic', 'gce', 'aws' or 'openstack'"
|
2016-04-11 21:34:46 +00:00
|
|
|
when: cloud_provider is defined and cloud_provider not in ['generic', 'gce', 'aws', 'openstack']
|
2016-03-29 12:50:22 +00:00
|
|
|
|
|
|
|
- include: openstack-credential-check.yml
|
|
|
|
when: cloud_provider is defined and cloud_provider == 'openstack'
|
2016-03-23 16:27:06 +00:00
|
|
|
|
2016-01-30 15:04:47 +00:00
|
|
|
- name: Create cni directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: kube
|
|
|
|
with_items:
|
|
|
|
- "/etc/cni/net.d"
|
|
|
|
- "/opt/cni/bin"
|
2016-04-20 15:09:09 +00:00
|
|
|
when: kube_network_plugin in ["calico", "weave"]
|
2016-01-30 15:04:47 +00:00
|
|
|
|
2016-01-25 17:16:56 +00:00
|
|
|
- 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-03-30 08:27:29 +00:00
|
|
|
- name: Install latest version of python-apt for Debian distribs
|
|
|
|
apt: name=python-apt state=latest update_cache=yes cache_valid_time=3600
|
2015-12-30 21:15:18 +00:00
|
|
|
when: ansible_os_family == "Debian"
|
2016-01-09 09:45:50 +00:00
|
|
|
|
|
|
|
- name: Install python-dnf for latest RedHat versions
|
2016-02-13 10:59:46 +00:00
|
|
|
command: dnf install -y python-dnf yum
|
2016-01-09 09:45:50 +00:00
|
|
|
when: ansible_distribution == "Fedora" and
|
|
|
|
ansible_distribution_major_version > 21
|
|
|
|
changed_when: False
|
2015-12-31 13:07:02 +00:00
|
|
|
|
2016-04-10 20:08:13 +00:00
|
|
|
- name: Install epel-release on RedHat/CentOS
|
2016-04-13 01:41:46 +00:00
|
|
|
shell: rpm -qa | grep epel-release || rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
2016-04-11 07:33:08 +00:00
|
|
|
when: ansible_distribution in ["CentOS","RedHat"] and
|
2016-04-13 01:41:46 +00:00
|
|
|
ansible_distribution_major_version >= 7
|
2016-04-11 07:33:08 +00:00
|
|
|
changed_when: False
|
2016-01-31 20:05:49 +00:00
|
|
|
|
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-02-19 17:48:53 +00:00
|
|
|
with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"
|
|
|
|
when: ansible_os_family != "CoreOS"
|
2016-01-09 09:45:50 +00:00
|
|
|
|
|
|
|
# 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-03-29 12:50:22 +00:00
|
|
|
- name: Write openstack cloud-config
|
|
|
|
template:
|
|
|
|
src: openstack-cloud-config.j2
|
|
|
|
dest: "{{ kube_config_dir }}/cloud_config"
|
|
|
|
group: "{{ kube_cert_group }}"
|
|
|
|
mode: 0640
|
|
|
|
when: cloud_provider is defined and cloud_provider == "openstack"
|
|
|
|
|
2016-01-20 16:37:23 +00:00
|
|
|
- include: etchosts.yml
|