From 4ac06057c9a77626bb181c22a5f1adc8014b13d2 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Tue, 17 Feb 2015 22:33:33 -0500 Subject: create openshift_common role - move common openshift logic into openshift_common - set openshift_common as a dependency for openshift_node and openshift_master - rename role variables to openshift_* to be more descriptive - start recording local_facts on the openshift hosts - clean up firewalld config to be a bit more dry - Update firewall ports for https, make sure http rules are removed - Replace references to ansible_eth0.ipv4.address with ansible_default_ipv4.address --- roles/openshift_node/defaults/main.yml | 3 +- roles/openshift_node/handlers/main.yml | 2 +- roles/openshift_node/meta/main.yml | 135 ++++----------------------------- roles/openshift_node/tasks/main.yml | 48 ++++++------ roles/openshift_node/vars/main.yml | 2 +- 5 files changed, 40 insertions(+), 150 deletions(-) (limited to 'roles/openshift_node') diff --git a/roles/openshift_node/defaults/main.yml b/roles/openshift_node/defaults/main.yml index af92e96d7..ae05a4479 100644 --- a/roles/openshift_node/defaults/main.yml +++ b/roles/openshift_node/defaults/main.yml @@ -1,2 +1,3 @@ --- -# defaults file for openshift_node +openshift_node_manage_service_externally: false +openshift_node_debug_level: "{{ openshift_debug_level | default(0) }}" diff --git a/roles/openshift_node/handlers/main.yml b/roles/openshift_node/handlers/main.yml index afbb5a53f..f7aa36d88 100644 --- a/roles/openshift_node/handlers/main.yml +++ b/roles/openshift_node/handlers/main.yml @@ -1,4 +1,4 @@ --- -# handlers file for openshift_node - name: restart openshift-node service: name=openshift-node state=restarted + when: not openshift_node_manage_service_externally diff --git a/roles/openshift_node/meta/main.yml b/roles/openshift_node/meta/main.yml index c5c362c60..674a320cb 100644 --- a/roles/openshift_node/meta/main.yml +++ b/roles/openshift_node/meta/main.yml @@ -1,124 +1,15 @@ --- 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: 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: Jhon Honce + description: OpenShift Node + company: Red Hat, Inc. + license: ASL 2.0 + min_ansible_version: 1.7 + platforms: + - name: EL + versions: + - 7 + categories: + - cloud +dependencies: +- { role: openshift_common } diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 8a0694905..e103daa83 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -1,45 +1,43 @@ --- - -# tasks file for openshift_node -- name: Install OpenShift +- name: Install OpenShift Node package yum: pkg=openshift-node state=installed - # fixme: Once openshift stops resolving hostnames for node queries remove this... -- name: Set hostname to IP Addr (WORKAROUND) - hostname: name={{ oo_bind_ip }} +- name: Set OpenShift node facts + include: "{{ role_path | dirname }}/openshift_common/tasks/set_facts.yml" + facts: + - { section: node, option: debug_level, value: "{{ openshift_node_debug_level }}" } - local_action: command /usr/bin/mktemp -d /tmp/openshift-ansible-XXXXXXX register: mktemp - name: Retrieve OpenShift Master credentials - local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' root@{{ oo_master_public_ips[0] }}:/var/lib/openshift/openshift.local.certificates/admin/ {{ mktemp.stdout }} + local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' root@{{ openshift_master_public_ips[0] }}:/var/lib/openshift/openshift.local.certificates/admin/ {{ mktemp.stdout }} ignore_errors: yes - file: path=/var/lib/openshift/openshift.local.certificates/admin state=directory - name: Store OpenShift Master credentials - local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' {{ mktemp.stdout }}/ root@{{ oo_public_ip }}:/var/lib/openshift/openshift.local.certificates/admin + local_action: command /usr/bin/rsync --compress --archive --rsh 'ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' {{ mktemp.stdout }}/ root@{{ openshift_public_ip }}:/var/lib/openshift/openshift.local.certificates/admin ignore_errors: yes + # fixme: Once the openshift_cluster playbook is published state should be started + # Always bounce service to pick up new credentials + notify: restart openshift-node + +- local_action: file name={{ mktemp.stdout }} state=absent + +- name: Configure firewall for OpenShift Node + include: "{{ role_path | dirname }}/openshift_common/tasks/firewall.yml" + allow: + - { service: OpenShift kubelet, port: 10250/tcp } - name: Configure OpenShift Node settings lineinfile: dest: /etc/sysconfig/openshift-node - regexp: "{{ item.regex }}" - line: "{{ item.line }}" - with_items: - - { regex: '^OPTIONS=', line: 'OPTIONS=\"--master=https://{{ oo_master_ips[0] }}:8443 --loglevel=5\"' } + regexp: '^OPTIONS=' + line: "OPTIONS=\"--master=http://{{ openshift_master_ips[0] }}:8080 --loglevel={{ openshift_node_debug_level }}\"" notify: - - restart openshift-node + - restart openshift-node -- name: Open firewalld port for OpenShift - firewalld: port=10250/tcp permanent=false state=enabled - -- name: Save firewalld port for OpenShift - firewalld: port=10250/tcp permanent=true state=enabled - - # fixme: Once the openshift_cluster playbook is published state should be started - # Always bounce service to pick up new credentials -- name: Enable OpenShift - service: name=openshift-node enabled=yes state=restarted - -- local_action: file name={{ mktemp.stdout }} state=absent +- name: Start and enable openshift-node + service: name=openshift-node enabled=yes state=started + when: not openshift_node_manage_service_externally diff --git a/roles/openshift_node/vars/main.yml b/roles/openshift_node/vars/main.yml index 3184e8ac7..9841d52f9 100644 --- a/roles/openshift_node/vars/main.yml +++ b/roles/openshift_node/vars/main.yml @@ -1,2 +1,2 @@ --- -# vars file for openshift_node +openshift_host_type: node -- cgit v1.2.3