summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/dns/README.md43
-rw-r--r--roles/dns/handlers/main.yml4
-rw-r--r--roles/dns/meta/main.yml7
-rw-r--r--roles/dns/tasks/main.yml22
-rw-r--r--roles/dns/templates/named.conf23
-rw-r--r--roles/dns/templates/openshift-cluster.zone14
-rw-r--r--roles/openshift_cluster_metrics/tasks/main.yml10
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py24
-rw-r--r--roles/openshift_master/tasks/main.yml4
-rw-r--r--roles/os_firewall/tasks/firewall/iptables.yml32
-rw-r--r--roles/os_zabbix/vars/template_openshift_master.yml25
-rw-r--r--roles/oso_host_monitoring/templates/oso-rhel7-host-monitoring.service.j28
12 files changed, 182 insertions, 34 deletions
diff --git a/roles/dns/README.md b/roles/dns/README.md
new file mode 100644
index 000000000..e238fb92e
--- /dev/null
+++ b/roles/dns/README.md
@@ -0,0 +1,43 @@
+dns
+===
+
+Configure a DNS server serving IPs of all the nodes of the cluster
+
+Requirements
+------------
+
+None
+
+Role Variables
+--------------
+
+| Name | Mandatory / Optional | Description |
+|------|----------------------|-------------|
+| `dns_zones` | Mandatory | DNS zones in which we must find the hosts |
+| `dns_forwarders` | If not set, the DNS will be a recursive non-forwarding DNS server | DNS forwarders to delegate the requests for hosts outside of `dns_zones` |
+| `dns_all_hosts` | Mandatory | Exhaustive list of hosts |
+
+Dependencies
+------------
+
+None
+
+Example Playbook
+----------------
+
+ - hosts: dns_hosts
+ roles:
+ - role: dns
+ dns_forwarders: [ '8.8.8.8', '8.8.4.4' ]
+ dns_zones: [ novalocal, openstacklocal ]
+ dns_all_hosts: "{{ g_all_hosts }}"
+
+License
+-------
+
+ASL 2.0
+
+Author Information
+------------------
+
+OpenShift operations, Red Hat, Inc
diff --git a/roles/dns/handlers/main.yml b/roles/dns/handlers/main.yml
new file mode 100644
index 000000000..ef101785e
--- /dev/null
+++ b/roles/dns/handlers/main.yml
@@ -0,0 +1,4 @@
+- name: restart bind
+ service:
+ name: named
+ state: restarted
diff --git a/roles/dns/meta/main.yml b/roles/dns/meta/main.yml
new file mode 100644
index 000000000..b6e9d9ad0
--- /dev/null
+++ b/roles/dns/meta/main.yml
@@ -0,0 +1,7 @@
+---
+galaxy_info:
+ author: Lénaïc Huard
+ description: Deploy and configure a DNS server
+ company: Amadeus SAS
+ license: ASL 2.0
+dependencies: []
diff --git a/roles/dns/tasks/main.yml b/roles/dns/tasks/main.yml
new file mode 100644
index 000000000..af728585d
--- /dev/null
+++ b/roles/dns/tasks/main.yml
@@ -0,0 +1,22 @@
+- name: Install Bind
+ action: "{{ ansible_pkg_mgr }} name=bind"
+
+- name: Configure Bind
+ template:
+ src: "{{ item.src }}"
+ dest: "{{ item.dest }}"
+ validate: "{{ item.validate }}"
+ with_items:
+ - src: openshift-cluster.zone
+ dest: /var/named/openshift-cluster.zone
+ validate: "named-checkzone {{ dns_zones[0] }} %s"
+ - src: named.conf
+ dest: /etc/named.conf
+ validate: "named-checkconf %s"
+ notify: restart bind
+
+- name: Enable Bind
+ service:
+ name: named
+ state: started
+ enabled: yes
diff --git a/roles/dns/templates/named.conf b/roles/dns/templates/named.conf
new file mode 100644
index 000000000..22c1ff935
--- /dev/null
+++ b/roles/dns/templates/named.conf
@@ -0,0 +1,23 @@
+options
+{
+ directory "/var/named";
+
+ allow-query { {{ ansible_default_ipv4.network }}/24; };
+
+ recursion yes;
+
+{% if dns_forwarders is defined %}
+ forwarders {
+ {% for dns in dns_forwarders %}
+ {{ dns }};
+ {% endfor %}
+ };
+{% endif %}
+};
+{% for zone in dns_zones %}
+
+zone "{{ zone }}" IN {
+ type master;
+ file "openshift-cluster.zone";
+};
+{% endfor %}
diff --git a/roles/dns/templates/openshift-cluster.zone b/roles/dns/templates/openshift-cluster.zone
new file mode 100644
index 000000000..03f5dc089
--- /dev/null
+++ b/roles/dns/templates/openshift-cluster.zone
@@ -0,0 +1,14 @@
+$TTL 1d
+@ IN SOA {{ ansible_hostname }} openshift (
+ {{ ansible_date_time.epoch }} ; Serial (To be fixed before 2039)
+ 12h ; Refresh
+ 3m ; Retry
+ 4w ; Expire
+ 3h ; TTL for negative replies
+ )
+
+ IN NS {{ ansible_hostname }}
+{{ ansible_hostname }} IN A {{ ansible_default_ipv4.address }}
+{% for host in dns_all_hosts %}
+{{ hostvars[host].ansible_hostname }} IN A {{ hostvars[host]['ansible_default_ipv4'].address }}
+{% endfor %}
diff --git a/roles/openshift_cluster_metrics/tasks/main.yml b/roles/openshift_cluster_metrics/tasks/main.yml
index 9b7735e54..d45f62eca 100644
--- a/roles/openshift_cluster_metrics/tasks/main.yml
+++ b/roles/openshift_cluster_metrics/tasks/main.yml
@@ -3,12 +3,12 @@
- name: Install cluster metrics templates
copy:
src: cluster-metrics
- dest: /etc/openshift/
+ dest: /etc/origin/
- name: Create InfluxDB Services
command: >
{{ openshift.common.client_binary }} create -f
- /etc/openshift/cluster-metrics/influxdb.yaml
+ /etc/origin/cluster-metrics/influxdb.yaml
register: oex_influxdb_services
failed_when: "'already exists' not in oex_influxdb_services.stderr and oex_influxdb_services.rc != 0"
changed_when: false
@@ -16,7 +16,7 @@
- name: Create Heapster Service Account
command: >
{{ openshift.common.client_binary }} create -f
- /etc/openshift/cluster-metrics/heapster-serviceaccount.yaml
+ /etc/origin/cluster-metrics/heapster-serviceaccount.yaml
register: oex_heapster_serviceaccount
failed_when: "'already exists' not in oex_heapster_serviceaccount.stderr and oex_heapster_serviceaccount.rc != 0"
changed_when: false
@@ -35,7 +35,7 @@
- name: Create Heapster Services
command: >
{{ openshift.common.client_binary }} create -f
- /etc/openshift/cluster-metrics/heapster.yaml
+ /etc/origin/cluster-metrics/heapster.yaml
register: oex_heapster_services
failed_when: "'already exists' not in oex_heapster_services.stderr and oex_heapster_services.rc != 0"
changed_when: false
@@ -43,7 +43,7 @@
- name: Create Grafana Services
command: >
{{ openshift.common.client_binary }} create -f
- /etc/openshift/cluster-metrics/grafana.yaml
+ /etc/origin/cluster-metrics/grafana.yaml
register: oex_grafana_services
failed_when: "'already exists' not in oex_grafana_services.stderr and oex_grafana_services.rc != 0"
changed_when: false
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 85c8abdf0..d11af307b 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1070,6 +1070,28 @@ def set_container_facts_if_unset(facts):
return facts
+def set_installed_variant_rpm_facts(facts):
+ """ Set RPM facts of installed variant
+ Args:
+ facts (dict): existing facts
+ Returns:
+ dict: the facts dict updated with installed_variant_rpms
+ """
+ installed_rpms = []
+ for base_rpm in ['openshift', 'atomic-openshift', 'origin']:
+ optional_rpms = ['master', 'node', 'clients', 'sdn-ovs']
+ variant_rpms = [base_rpm] + \
+ ['{0}-{1}'.format(base_rpm, r) for r in optional_rpms] + \
+ ['tuned-profiles-%s-node' % base_rpm]
+ for rpm in variant_rpms:
+ exit_code, _, _ = module.run_command(['rpm', '-q', rpm])
+ if exit_code == 0:
+ installed_rpms.append(rpm)
+
+ facts['common']['installed_variant_rpms'] = installed_rpms
+ return facts
+
+
class OpenShiftFactsInternalError(Exception):
"""Origin Facts Error"""
@@ -1159,6 +1181,8 @@ class OpenShiftFacts(object):
facts = set_aggregate_facts(facts)
facts = set_etcd_facts_if_unset(facts)
facts = set_container_facts_if_unset(facts)
+ if not facts['common']['is_containerized']:
+ facts = set_installed_variant_rpm_facts(facts)
return dict(openshift=facts)
def get_defaults(self, roles):
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index aa5e593b6..83f6f7542 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -285,6 +285,10 @@
master_service_status_changed: "{{ start_result | changed }}"
when: not openshift_master_ha | bool
+- name: Mask master service
+ command: systemctl mask {{ openshift.common.service_type }}-master
+ when: openshift_master_ha | bool and openshift.master.cluster_method == 'native'
+
- name: Start and enable master api
service: name={{ openshift.common.service_type }}-master-api enabled=yes state=started
when: openshift_master_ha | bool and openshift.master.cluster_method == 'native'
diff --git a/roles/os_firewall/tasks/firewall/iptables.yml b/roles/os_firewall/tasks/firewall/iptables.yml
index 5cf4bf7af..3b584f8eb 100644
--- a/roles/os_firewall/tasks/firewall/iptables.yml
+++ b/roles/os_firewall/tasks/firewall/iptables.yml
@@ -1,12 +1,4 @@
---
-- name: Install iptables packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items:
- - iptables
- - iptables-services
- register: install_result
- when: not openshift.common.is_atomic | bool
-
- name: Check if firewalld is installed
command: rpm -q firewalld
register: pkg_check
@@ -20,6 +12,22 @@
enabled: no
when: pkg_check.rc == 0
+# TODO: submit PR upstream to add mask/unmask to service module
+- name: Mask firewalld service
+ command: systemctl mask firewalld
+ register: result
+ changed_when: "'firewalld' in result.stdout"
+ when: pkg_check.rc == 0
+ ignore_errors: yes
+
+- name: Install iptables packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - iptables
+ - iptables-services
+ register: install_result
+ when: not openshift.common.is_atomic | bool
+
- name: Reload systemd units
command: systemctl daemon-reload
when: install_result | changed
@@ -35,14 +43,6 @@
pause: seconds=10
when: result | changed
-# TODO: submit PR upstream to add mask/unmask to service module
-- name: Mask firewalld service
- command: systemctl mask firewalld
- register: result
- changed_when: "'firewalld' in result.stdout"
- when: pkg_check.rc == 0
- ignore_errors: yes
-
- name: Add iptables allow rules
os_firewall_manage_iptables:
name: "{{ item.service }}"
diff --git a/roles/os_zabbix/vars/template_openshift_master.yml b/roles/os_zabbix/vars/template_openshift_master.yml
index 9d20eb012..5aae2496a 100644
--- a/roles/os_zabbix/vars/template_openshift_master.yml
+++ b/roles/os_zabbix/vars/template_openshift_master.yml
@@ -2,13 +2,13 @@
g_template_openshift_master:
name: Template Openshift Master
zitems:
- - name: create_app
+ - name: openshift.master.app.create
applications:
- Openshift Master
- key: create_app
+ key: openshift.master.app.create
- - key: openshift.master.registry.healthz
- description: "Shows the health status of the cluster's docker registry"
+ - key: openshift.master.registry.healthy_pct
+ description: "Shows the percentage of healthy registries in the cluster"
type: int
applications:
- Openshift Master
@@ -288,14 +288,14 @@ g_template_openshift_master:
# Put triggers that depend on other triggers here (deps must be created first)
- name: 'Application creation has failed on {HOST.NAME}'
- expression: '{Template Openshift Master:create_app.last(#1)}=1 and {Template Openshift Master:create_app.last(#2)}=1'
+ expression: '{Template Openshift Master:openshift.master.app.create.last(#1)}=1 and {Template Openshift Master:openshift.master.app.create.last(#2)}=1'
url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_create_app.asciidoc'
dependencies:
- 'Openshift Master process not running on {HOST.NAME}'
priority: avg
- name: 'Application creation has failed multiple times in the last hour on {HOST.NAME}'
- expression: '{Template Openshift Master:create_app.sum(1h)}>3'
+ expression: '{Template Openshift Master:openshift.master.app.create.sum(1h)}>3'
url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/check_create_app.asciidoc'
dependencies:
- 'Openshift Master process not running on {HOST.NAME}'
@@ -333,9 +333,16 @@ g_template_openshift_master:
- 'Openshift Master process not running on {HOST.NAME}'
priority: avg
- - name: 'Docker Registry check failed on {HOST.NAME}'
- expression: '{Template Openshift Master:openshift.master.registry.healthz.max(#2)}<1'
- url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc'
+ - name: 'One or more Docker Registries is unhealthy according to {HOST.NAME}'
+ expression: '{Template Openshift Master:openshift.master.registry.healthy_pct.last(#2)}<100 and {Template Openshift Master:openshift.master.registry.healthy_pct.max(#2)}>50'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_registry.asciidoc'
+ dependencies:
+ - 'Openshift Master process not running on {HOST.NAME}'
+ priority: avg
+
+ - name: 'Multiple Docker Registries are unhealthy according to {HOST.NAME}'
+ expression: '{Template Openshift Master:openshift.master.registry.healthy_pct.last(#2)}<51'
+ url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_registry.asciidoc'
dependencies:
- 'Openshift Master process not running on {HOST.NAME}'
priority: high
diff --git a/roles/oso_host_monitoring/templates/oso-rhel7-host-monitoring.service.j2 b/roles/oso_host_monitoring/templates/oso-rhel7-host-monitoring.service.j2
index ac950b4e5..453a9a3b4 100644
--- a/roles/oso_host_monitoring/templates/oso-rhel7-host-monitoring.service.j2
+++ b/roles/oso_host_monitoring/templates/oso-rhel7-host-monitoring.service.j2
@@ -58,10 +58,10 @@ ExecStart=/usr/bin/docker run --name {{ osohm_host_monitoring }}
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run/openvswitch:/var/run/openvswitch \
{% if hostvars[inventory_hostname]['ec2_tag_host-type'] == 'master' %}
- -v /etc/openshift/master/admin.kubeconfig:/etc/openshift/master/admin.kubeconfig \
- -v /etc/openshift/master/master.etcd-client.crt:/etc/openshift/master/master.etcd-client.crt \
- -v /etc/openshift/master/master.etcd-client.key:/etc/openshift/master/master.etcd-client.key \
- -v /etc/openshift/master/master-config.yaml:/etc/openshift/master/master-config.yaml \
+ -v /etc/origin/master/admin.kubeconfig:/etc/origin/master/admin.kubeconfig \
+ -v /etc/origin/master/master.etcd-client.crt:/etc/origin/master/master.etcd-client.crt \
+ -v /etc/origin/master/master.etcd-client.key:/etc/origin/master/master.etcd-client.key \
+ -v /etc/origin/master/master-config.yaml:/etc/origin/master/master-config.yaml \
{% endif %}
{{ osohm_docker_registry_url }}{{ osohm_host_monitoring }}