summaryrefslogtreecommitdiffstats
path: root/roles/openshift_common
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2015-02-17 22:33:33 -0500
committerJason DeTiberus <jdetiber@redhat.com>2015-02-24 23:10:37 -0500
commit4ac06057c9a77626bb181c22a5f1adc8014b13d2 (patch)
treec8ab69e2e65de32d2f29771fb47fcce78fe5dd04 /roles/openshift_common
parent114fcaac2a8f8e3d68baf8945f8991b1da9763ee (diff)
downloadopenshift-4ac06057c9a77626bb181c22a5f1adc8014b13d2.tar.gz
openshift-4ac06057c9a77626bb181c22a5f1adc8014b13d2.tar.bz2
openshift-4ac06057c9a77626bb181c22a5f1adc8014b13d2.tar.xz
openshift-4ac06057c9a77626bb181c22a5f1adc8014b13d2.zip
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
Diffstat (limited to 'roles/openshift_common')
-rw-r--r--roles/openshift_common/README.md38
-rw-r--r--roles/openshift_common/defaults/main.yml3
-rw-r--r--roles/openshift_common/meta/main.yml13
-rw-r--r--roles/openshift_common/tasks/firewall.yml34
-rw-r--r--roles/openshift_common/tasks/main.yml14
-rw-r--r--roles/openshift_common/tasks/set_facts.yml9
-rw-r--r--roles/openshift_common/vars/main.yml2
7 files changed, 113 insertions, 0 deletions
diff --git a/roles/openshift_common/README.md b/roles/openshift_common/README.md
new file mode 100644
index 000000000..225dd44b9
--- /dev/null
+++ b/roles/openshift_common/README.md
@@ -0,0 +1,38 @@
+Role Name
+=========
+
+A brief description of the role goes here.
+
+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.
+
+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.
+
+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.
+
+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 }
+
+License
+-------
+
+BSD
+
+Author Information
+------------------
+
+An optional section for the role authors to include contact information, or a website (HTML is not allowed).
diff --git a/roles/openshift_common/defaults/main.yml b/roles/openshift_common/defaults/main.yml
new file mode 100644
index 000000000..20b6f082c
--- /dev/null
+++ b/roles/openshift_common/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+openshift_bind_ip: "{{ ansible_default_ipv4.address }}"
+openshift_debug_level: 0
diff --git a/roles/openshift_common/meta/main.yml b/roles/openshift_common/meta/main.yml
new file mode 100644
index 000000000..128da25b4
--- /dev/null
+++ b/roles/openshift_common/meta/main.yml
@@ -0,0 +1,13 @@
+galaxy_info:
+ author: Jason DeTiberus
+ description: OpenShift Common
+ company: Red Hat, Inc.
+ license: ASL 2.0
+ min_ansible_version: 1.7
+ platforms:
+ - name: EL
+ versions:
+ - 7
+ categories:
+ - cloud
+dependencies: []
diff --git a/roles/openshift_common/tasks/firewall.yml b/roles/openshift_common/tasks/firewall.yml
new file mode 100644
index 000000000..514466769
--- /dev/null
+++ b/roles/openshift_common/tasks/firewall.yml
@@ -0,0 +1,34 @@
+---
+# TODO: Ansible 1.9 will eliminate the need for separate firewalld tasks for
+# enabling rules and making them permanent with the immediate flag
+- name: "Add firewalld allow rules"
+ firewalld:
+ port: "{{ item.port }}"
+ permanent: false
+ state: enabled
+ with_items: allow
+ when: allow is defined
+
+- name: "Persist firewalld allow rules"
+ firewalld:
+ port: "{{ item.port }}"
+ permanent: true
+ state: enabled
+ with_items: allow
+ when: allow is defined
+
+- name: "Remove firewalld allow rules"
+ firewalld:
+ port: "{{ item.port }}"
+ permanent: false
+ state: disabled
+ with_items: deny
+ when: deny is defined
+
+- name: "Persist removal of firewalld allow rules"
+ firewalld:
+ port: "{{ item.port }}"
+ permanent: true
+ state: disabled
+ with_items: deny
+ when: deny is defined
diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml
new file mode 100644
index 000000000..9043c3d8e
--- /dev/null
+++ b/roles/openshift_common/tasks/main.yml
@@ -0,0 +1,14 @@
+---
+# fixme: Once openshift stops resolving hostnames for node queries remove this...
+- name: Set hostname to IP Addr (WORKAROUND)
+ hostname: name={{ openshift_bind_ip }}
+
+- name: Configure local facts file
+ file: path=/etc/ansible/facts.d/ state=directory mode=0750
+
+- name: Set common OpenShift facts
+ include: set_facts.yml
+ facts:
+ - { section: common, option: env, value: "{{ openshift_env | default('default') }}" }
+ - { section: common, option: host_type, value: "{{ openshift_host_type }}" }
+ - { section: common, option: debug_level, value: "{{ openshift_debug_level }}" }
diff --git a/roles/openshift_common/tasks/set_facts.yml b/roles/openshift_common/tasks/set_facts.yml
new file mode 100644
index 000000000..349eecd1d
--- /dev/null
+++ b/roles/openshift_common/tasks/set_facts.yml
@@ -0,0 +1,9 @@
+---
+- name: "Setting local_facts"
+ ini_file:
+ dest: /etc/ansible/facts.d/openshift.fact
+ mode: 0640
+ section: "{{ item.section }}"
+ option: "{{ item.option }}"
+ value: "{{ item.value }}"
+ with_items: facts
diff --git a/roles/openshift_common/vars/main.yml b/roles/openshift_common/vars/main.yml
new file mode 100644
index 000000000..c93898665
--- /dev/null
+++ b/roles/openshift_common/vars/main.yml
@@ -0,0 +1,2 @@
+---
+openshift_master_credentials_dir: /var/lib/openshift/openshift.local.certificates/admin/