summaryrefslogtreecommitdiffstats
path: root/roles/openshift_common
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2015-02-27 09:23:43 -0500
committerThomas Wiest <twiest@users.noreply.github.com>2015-02-27 09:23:43 -0500
commit98d53c4119170bf87e635207152ac180a5420e21 (patch)
tree4c91c670d915a1f6e2ca933756a8b64b45dbb237 /roles/openshift_common
parent50f53296253953fb2d3fff6bd7d7d3e538b9430b (diff)
parent20b2f13b0a7b7aa87804a0d7d861dfe68f715928 (diff)
downloadopenshift-98d53c4119170bf87e635207152ac180a5420e21.tar.gz
openshift-98d53c4119170bf87e635207152ac180a5420e21.tar.bz2
openshift-98d53c4119170bf87e635207152ac180a5420e21.tar.xz
openshift-98d53c4119170bf87e635207152ac180a5420e21.zip
Merge pull request #82 from detiber/commonRole
create openshift-common role
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.yml22
-rw-r--r--roles/openshift_common/tasks/set_facts.yml9
-rw-r--r--roles/openshift_common/vars/main.yml2
7 files changed, 121 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..cfa0d8dfe
--- /dev/null
+++ b/roles/openshift_common/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+# 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 }}" }
+
+- name: Add KUBECONFIG to .bash_profile for user root
+ lineinfile:
+ dest: /root/.bash_profile
+ regexp: "KUBECONFIG="
+ line: "export KUBECONFIG=/var/lib/openshift/openshift.local.certificates/admin/.kubeconfig"
+ state: present
+ insertafter: EOF
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/