summaryrefslogtreecommitdiffstats
path: root/roles/openshift_register_nodes
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2015-03-23 23:53:17 -0400
committerJason DeTiberus <jdetiber@redhat.com>2015-04-03 14:51:26 -0400
commit4712e72c912a1102bff0508c98bd97da3f33ae95 (patch)
tree04a2bfebd3ac8b746150921bd134dbde70a9a56a /roles/openshift_register_nodes
parent59e69dd21c19bf745392b5e83bd652630ee870cc (diff)
downloadopenshift-4712e72c912a1102bff0508c98bd97da3f33ae95.tar.gz
openshift-4712e72c912a1102bff0508c98bd97da3f33ae95.tar.bz2
openshift-4712e72c912a1102bff0508c98bd97da3f33ae95.tar.xz
openshift-4712e72c912a1102bff0508c98bd97da3f33ae95.zip
openshift_facts role/module refactor default settings
- Add openshift_facts role and module - Created new role openshift_facts that contains an openshift_facts module - Refactor openshift_* roles to use openshift_facts instead of relying on defaults - Refactor playbooks to use openshift_facts - Cleanup inventory group_vars - Update defaults - update openshift_master role firewall defaults - remove etcd peer port, since we will not be supporting clustered embedded etcd - remove 8444 since console now runs on the api port by default - add 8444 and 7001 to disabled services to ensure removal if updating - Add new role os_env_extras_node that is a subset of the docker role - previously, we were starting/enabling docker which was causing issues with some installations - Does not install or start docker, since the openshift-node role will handle that for us - Only adds root to the dockerroot group - Update playbooks to use ops_env_extras_node role instead of docker role - os_firewall bug fixes - ignore ip6tables for now, since we are not configuring any ipv6 rules - if installing package do a daemon-reload before starting/enabling service - Add aws support to bin/cluster - Add list action to bin/cluster - Add update action to bin/cluster - cleanup some stray debug statements - some variable renaming for clarity
Diffstat (limited to 'roles/openshift_register_nodes')
-rw-r--r--roles/openshift_register_nodes/README.md22
-rwxr-xr-x[-rw-r--r--]roles/openshift_register_nodes/library/kubernetes_register_node.py3
-rw-r--r--roles/openshift_register_nodes/meta/main.yml141
-rw-r--r--roles/openshift_register_nodes/tasks/main.yml58
4 files changed, 53 insertions, 171 deletions
diff --git a/roles/openshift_register_nodes/README.md b/roles/openshift_register_nodes/README.md
index 225dd44b9..b96faa044 100644
--- a/roles/openshift_register_nodes/README.md
+++ b/roles/openshift_register_nodes/README.md
@@ -1,38 +1,34 @@
-Role Name
-=========
+OpenShift Register Nodes
+========================
-A brief description of the role goes here.
+TODO
Requirements
------------
-Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
+TODO
Role Variables
--------------
-A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
+TODO
Dependencies
------------
-A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
+TODO
Example Playbook
----------------
-Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
-
- - hosts: servers
- roles:
- - { role: username.rolename, x: 42 }
+TODO
License
-------
-BSD
+Apache License Version 2.0
Author Information
------------------
-An optional section for the role authors to include contact information, or a website (HTML is not allowed).
+Jason DeTiberus (jdetiber@redhat.com)
diff --git a/roles/openshift_register_nodes/library/kubernetes_register_node.py b/roles/openshift_register_nodes/library/kubernetes_register_node.py
index 409215616..8ebeb087a 100644..100755
--- a/roles/openshift_register_nodes/library/kubernetes_register_node.py
+++ b/roles/openshift_register_nodes/library/kubernetes_register_node.py
@@ -214,7 +214,8 @@ class Node:
resources = NodeResources(version, cpu, memory),
cidr = podCIDR,
labels = labels,
- annotations = annotations
+ annotations = annotations,
+ externalID = externalID
)
elif version == 'v1beta3':
metadata = dict(name = name,
diff --git a/roles/openshift_register_nodes/meta/main.yml b/roles/openshift_register_nodes/meta/main.yml
index 7b1f0ef0a..e40a152c1 100644
--- a/roles/openshift_register_nodes/meta/main.yml
+++ b/roles/openshift_register_nodes/meta/main.yml
@@ -1,128 +1,17 @@
---
galaxy_info:
- author: your name
- description:
- company: your company (optional)
- # Some suggested licenses:
- # - BSD (default)
- # - MIT
- # - GPLv2
- # - GPLv3
- # - Apache
- # - CC-BY
- license: license (GPLv2, CC-BY, etc)
- min_ansible_version: 1.2
- #
- # Below are all platforms currently available. Just uncomment
- # the ones that apply to your role. If you don't see your
- # platform on this list, let us know and we'll get it added!
- #
- #platforms:
- #- name: EL
- # versions:
- # - all
- # - 5
- # - 6
- # - 7
- #- name: GenericUNIX
- # versions:
- # - all
- # - any
- #- name: Fedora
- # versions:
- # - all
- # - 16
- # - 17
- # - 18
- # - 19
- # - 20
- #- name: SmartOS
- # versions:
- # - all
- # - any
- #- name: opensuse
- # versions:
- # - all
- # - 12.1
- # - 12.2
- # - 12.3
- # - 13.1
- # - 13.2
- #- name: Amazon
- # versions:
- # - all
- # - 2013.03
- # - 2013.09
- #- name: GenericBSD
- # versions:
- # - all
- # - any
- #- name: FreeBSD
- # versions:
- # - all
- # - 8.0
- # - 8.1
- # - 8.2
- # - 8.3
- # - 8.4
- # - 9.0
- # - 9.1
- # - 9.1
- # - 9.2
- #- name: Ubuntu
- # versions:
- # - all
- # - lucid
- # - maverick
- # - natty
- # - oneiric
- # - precise
- # - quantal
- # - raring
- # - saucy
- # - trusty
- #- name: SLES
- # versions:
- # - all
- # - 10SP3
- # - 10SP4
- # - 11
- # - 11SP1
- # - 11SP2
- # - 11SP3
- #- name: GenericLinux
- # versions:
- # - all
- # - any
- #- name: Debian
- # versions:
- # - all
- # - etch
- # - lenny
- # - squeeze
- # - wheezy
- #
- # Below are all categories currently available. Just as with
- # the platforms above, uncomment those that apply to your role.
- #
- #categories:
- #- cloud
- #- cloud:ec2
- #- cloud:gce
- #- cloud:rax
- #- clustering
- #- database
- #- database:nosql
- #- database:sql
- #- development
- #- monitoring
- #- networking
- #- packaging
- #- system
- #- web
-dependencies: []
- # List your role dependencies here, one per line. Only
- # dependencies available via galaxy should be listed here.
- # Be sure to remove the '[]' above if you add dependencies
- # to this list.
-
+ author: Jason DeTiberus
+ description:
+ company: Red Hat, Inc.
+ license: Apache License, Version 2.0
+ min_ansible_version: 1.8
+ platforms:
+ - name: EL
+ versions:
+ - 7
+ categories:
+ - cloud
+ - system
+dependencies:
+- { role: openshift_facts }
+
diff --git a/roles/openshift_register_nodes/tasks/main.yml b/roles/openshift_register_nodes/tasks/main.yml
index 59216fc87..7319b88b1 100644
--- a/roles/openshift_register_nodes/tasks/main.yml
+++ b/roles/openshift_register_nodes/tasks/main.yml
@@ -1,18 +1,20 @@
---
-# TODO: support configuration for multiple masters, currently hardcoding
-# the info from the first master
+# TODO: support new create-config command to generate node certs and config
+# TODO: recreate master/node configs if settings that affect the configs
+# change (hostname, public_hostname, ip, public_ip, etc)
# TODO: create a failed_when condition
- name: Create node server certificates
command: >
/usr/bin/openshift admin create-server-cert
--overwrite=false
- --cert={{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/server.crt
- --key={{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/server.key
- --hostnames={{ [openshift_hostname, openshift_public_hostname, openshift_ip, openshift_public_ip]|join(",") }}
+ --cert={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}/server.crt
+ --key={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}/server.key
+ --hostnames={{ [item.openshift.common.hostname,
+ item.openshift.common.public_hostname]|unique|join(",") }}
args:
chdir: "{{ openshift_cert_dir_parent }}"
- creates: "{{ openshift_cert_dir_abs }}/node-{{ item.openshift_node_hostname }}/server.crt"
+ creates: "{{ openshift_cert_dir_abs }}/node-{{ item.openshift.common.hostname }}/server.crt"
with_items: openshift_nodes
register: server_cert_result
@@ -21,48 +23,42 @@
command: >
/usr/bin/openshift admin create-node-cert
--overwrite=false
- --cert={{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/cert.crt
- --key={{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/key.key
- --node-name={{ item.openshift_node_hostname }}
+ --cert={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}/cert.crt
+ --key={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}/key.key
+ --node-name={{ item.openshift.common.hostname }}
args:
chdir: "{{ openshift_cert_dir_parent }}"
- creates: "{{ openshift_cert_dir_abs }}/node-{{ item.openshift_node_hostname }}/cert.crt"
+ creates: "{{ openshift_cert_dir_abs }}/node-{{ item.openshift.common.hostname }}/cert.crt"
with_items: openshift_nodes
register: node_cert_result
-# TODO: re-create kubeconfig if certs were regenerated, not just if
-# .kubeconfig doesn't exist
# TODO: create a failed_when condition
- name: Create kubeconfigs for nodes
command: >
/usr/bin/openshift admin create-kubeconfig
- --client-certificate={{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/cert.crt
- --client-key={{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/key.key
- --kubeconfig={{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/.kubeconfig
- --master={{ openshift_master_urls[0] }}
- --public-master={{ openshift_master_public_urls[0] }}
+ --client-certificate={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}/cert.crt
+ --client-key={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}/key.key
+ --kubeconfig={{ openshift_cert_dir }}/node-{{ item.openshift.common.hostname }}/.kubeconfig
+ --master={{ openshift.master.api_url }}
+ --public-master={{ openshift.master.public_api_url }}
args:
chdir: "{{ openshift_cert_dir_parent }}"
- creates: "{{ openshift_cert_dir_abs }}/node-{{ item.openshift_node_hostname }}/.kubeconfig"
+ creates: "{{ openshift_cert_dir_abs }}/node-{{ item.openshift.common.hostname }}/.kubeconfig"
with_items: openshift_nodes
register: kubeconfig_result
-# TODO: generate the node configs (openshift start node --write-config
-# --config='{{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/node.yaml'
-# --kubeconfig='{{ openshift_cert_dir }}/node-{{ item.openshift_node_hostname }}/.kubeconfig'
-# will need to modify the generated node config as needed
-# (servingInfo.{certFile,clientCA,keyFile})
-
- name: Register unregistered nodes
kubernetes_register_node:
- name: "{{ item.openshift_node_name }}"
+ client_user: openshift-client
+ name: "{{ item.openshift.common.hostname }}"
api_version: "{{ openshift_kube_api_version }}"
- cpu: "{{ item.openshift_node_cpu if item.openshift_node_cpu else None }}"
- memory: "{{ item.openshift_node_memory if item.openshift_node_memory else None }}"
- pod_cidr: "{{ item.openshift_node_pod_cidr if item.openshift_node_pod_cidr else None }}"
- host_ip: "{{ item.openshift_node_host_ip }}"
- labels: "{{ item.openshift_node_labels if item.openshift_node_labels else {} }}"
- annotations: "{{ item.openshift_node_annotations if item.openshift_node_annotations else {} }}"
+ cpu: "{{ item.openshift.node.resources_cpu | default(None) }}"
+ memory: "{{ item.openshift.node.resources_memory | default(None) }}"
+ pod_cidr: "{{ item.openshift.node.pod_cidr | default(None) }}"
+ host_ip: "{{ item.openshift.common.ip }}"
+ labels: "{{ item.openshift.node.labels | default({}) }}"
+ annotations: "{{ item.openshift.node.annotations | default({}) }}"
+ external_id: "{{ item.openshift.node.external_id }}"
# TODO: support customizing other attributes such as: client_config,
# client_cluster, client_context, client_user
# TODO: update for v1beta3 changes after rebase: hostnames, external_ips,