summaryrefslogtreecommitdiffstats
path: root/roles/openshift_common/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_common/tasks')
-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
3 files changed, 65 insertions, 0 deletions
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