summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-03-22 04:37:46 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-03-22 04:37:46 +0100
commit0b0b9954c2d0602b1e9d0a387d2a195a790f8084 (patch)
treef0a3a26edd280b8fd84945944bd153f411b31fea /roles
parente2c7b1305ca8495065dcf40fd2092d7c698dd6ea (diff)
downloadands-0b0b9954c2d0602b1e9d0a387d2a195a790f8084.tar.gz
ands-0b0b9954c2d0602b1e9d0a387d2a195a790f8084.tar.bz2
ands-0b0b9954c2d0602b1e9d0a387d2a195a790f8084.tar.xz
ands-0b0b9954c2d0602b1e9d0a387d2a195a790f8084.zip
Various fixes and provide ADEI admin container...
Diffstat (limited to 'roles')
-rw-r--r--roles/ands_common/tasks/main.yml7
-rw-r--r--roles/ands_common/tasks/software.yml18
-rw-r--r--roles/ands_facts/tasks/main.yml5
-rw-r--r--roles/ands_facts/tasks/node.yml4
-rw-r--r--roles/ands_facts/tasks/nodes.yml1
-rw-r--r--roles/ands_kaas/tasks/do_apps.yml2
-rw-r--r--roles/ands_kaas/tasks/do_storage.yml4
-rw-r--r--roles/ands_kaas/tasks/project.yml2
-rw-r--r--roles/ands_kaas/tasks/template.yml4
-rw-r--r--roles/ands_network/tasks/nm_configure.yml3
-rw-r--r--roles/ands_storage/tasks/main.yml8
-rw-r--r--roles/openshift_resource/tasks/template.yml4
-rw-r--r--roles/role_includer/tasks/main.yml5
13 files changed, 42 insertions, 25 deletions
diff --git a/roles/ands_common/tasks/main.yml b/roles/ands_common/tasks/main.yml
index e9196ad..4027b7a 100644
--- a/roles/ands_common/tasks/main.yml
+++ b/roles/ands_common/tasks/main.yml
@@ -16,7 +16,6 @@
package: name={{item}} state=present
register: result
with_items:
- - mc
- bzr
- git
- yamllint
@@ -29,7 +28,6 @@
- PyYAML
- python-rhsm-certificates
- glusterfs-fuse
- - telnet
- yum-plugin-versionlock
# We always update on first install and if requested
@@ -42,6 +40,5 @@
# with_items:
# - nodejs
-- name: Ensure all extra packages are installed
- package: name={{item}} state=present
- with_items: "{{ extra_packages | default([]) }}"
+- name: Install additional software
+ include_tasks: software.yml
diff --git a/roles/ands_common/tasks/software.yml b/roles/ands_common/tasks/software.yml
new file mode 100644
index 0000000..ea37b51
--- /dev/null
+++ b/roles/ands_common/tasks/software.yml
@@ -0,0 +1,18 @@
+- name: Install various administrative tools
+ package: name={{item}} state=present
+ with_items:
+ - mc
+ - telnet
+ - lsof
+ - strace
+
+# We also can install something conditionally
+#- name: Install various administrative tools
+# package: name={{item}} state=present
+# when: 'ands_storage_servers' in group_names
+# with_items:
+
+
+- name: Ensure all extra packages are installed
+ package: name={{item}} state=present
+ with_items: "{{ extra_packages | default([]) }}"
diff --git a/roles/ands_facts/tasks/main.yml b/roles/ands_facts/tasks/main.yml
index 54c800a..5f1a5d7 100644
--- a/roles/ands_facts/tasks/main.yml
+++ b/roles/ands_facts/tasks/main.yml
@@ -1,9 +1,4 @@
---
-# We need all mount points ready
-- name: "Run mount -a"
- command: mount -a
- changed_when: false
-
# Here we set 'openshift_hostname', 'openshift_ip' and other variables
- name: "Configuring network facts"
include_tasks: "network.yml"
diff --git a/roles/ands_facts/tasks/node.yml b/roles/ands_facts/tasks/node.yml
index e30442c..59d2d80 100644
--- a/roles/ands_facts/tasks/node.yml
+++ b/roles/ands_facts/tasks/node.yml
@@ -1,5 +1,5 @@
-- name: "Associating public host names with ids"
+- name: "Associating public host names with ids (host_id: {{ host_id }})"
set_fact: "ands_host_{{ host_id }}_public_hostname={{ host.value['ands_openshift_public_hostname'] }}"
-- name: "Associating openshift fqdn with ids"
+- name: "Associating openshift fqdn with ids (host_id: {{ host_id }})"
set_fact: "ands_host_{{ host_id }}_openshift_fqdn={{ host.value['ands_openshift_fqdn'] }}"
diff --git a/roles/ands_facts/tasks/nodes.yml b/roles/ands_facts/tasks/nodes.yml
index ebe8091..d9f61df 100644
--- a/roles/ands_facts/tasks/nodes.yml
+++ b/roles/ands_facts/tasks/nodes.yml
@@ -3,6 +3,7 @@
run_once: true
delegate_to: "{{ groups['masters'][0] }}"
with_dict: "{{ hostvars }}"
+ when: host.key in groups['ands']
vars:
host_id: "{{ host.value['ands_host_id'] }}"
host_name: "{{ host.value['ansible_hostname'] }}"
diff --git a/roles/ands_kaas/tasks/do_apps.yml b/roles/ands_kaas/tasks/do_apps.yml
index 39283b4..0e49981 100644
--- a/roles/ands_kaas/tasks/do_apps.yml
+++ b/roles/ands_kaas/tasks/do_apps.yml
@@ -1,7 +1,7 @@
- name: "Process KaaS apps"
include_tasks: "template.yml"
run_once: true
- with_dict: "{{ kaas_project_apps }}"
+ with_dict: "{{ kaas_project_apps | default({}) }}"
loop_control:
loop_var: appitem
when:
diff --git a/roles/ands_kaas/tasks/do_storage.yml b/roles/ands_kaas/tasks/do_storage.yml
index e79db56..8a6a880 100644
--- a/roles/ands_kaas/tasks/do_storage.yml
+++ b/roles/ands_kaas/tasks/do_storage.yml
@@ -18,7 +18,7 @@
volume: "{{osv.value}}"
when:
- ( mntpath | length ) > 0
- - (kaas_storage_types is not defined) or ((osv.type | default("host")) in kaas_storage_types)
+ - (kaas_storage_types is not defined) or (voltype in kaas_storage_types)
- name: Check if static configuration exists
local_action: stat path="{{ kaas_project_path }}/files/"
@@ -50,4 +50,4 @@
hostpath: "{{ hostvars[inventory_hostname][hvar] }}/{{ file.path }}"
when:
- file.osv in kaas_project_volumes
- - (kaas_storage_types is not defined) or ((osv.type | default("host")) in kaas_storage_types)
+ - (kaas_storage_types is not defined) or (voltype in kaas_storage_types)
diff --git a/roles/ands_kaas/tasks/project.yml b/roles/ands_kaas/tasks/project.yml
index 26bd0cc..879f34a 100644
--- a/roles/ands_kaas/tasks/project.yml
+++ b/roles/ands_kaas/tasks/project.yml
@@ -59,7 +59,7 @@
kaas_project_volumes: "{{ kaas_project_config.volumes | default(kaas_project_config.extra_volumes | default({}) | combine(kaas_openshift_volumes)) }}"
kaas_project_local_volumes: "{{ kaas_project_config.local_volumes | default({}) }}"
kaas_project_pods: "{{ kaas_project_config.pods | default({}) }}"
- kaas_project_apps: "{{ kaas_project_config.apps | default([]) }}"
+ kaas_project_apps: "{{ kaas_project_config.apps | default({}) }}"
kaas_project_gids: "{{ kaas_project_config.gids | default(kaas_openshift_gids) }}"
kaas_project_uids: "{{ kaas_project_config.uids | default(kaas_openshift_uids) }}"
kaas_blockvol_info: "{{ block_info }}"
diff --git a/roles/ands_kaas/tasks/template.yml b/roles/ands_kaas/tasks/template.yml
index 87e45a6..841c80e 100644
--- a/roles/ands_kaas/tasks/template.yml
+++ b/roles/ands_kaas/tasks/template.yml
@@ -20,8 +20,8 @@
template: "{{ dest_name }}"
template_path: "{{ kaas_template_path }}"
project: "{{ kaas_project }}"
- recreate: "{{ result | changed | ternary (delete | ternary(true, false), false) }}"
- replace: "{{ result | changed | ternary (delete | ternary(false, true), false) }}"
+ recreate: "{{ result | changed | ternary (delete | default(true) | ternary(true, false), false) }}"
+ replace: "{{ result | changed | ternary (delete | default(true) | ternary(false, true), false) }}"
# alternatively load template
# TODO
diff --git a/roles/ands_network/tasks/nm_configure.yml b/roles/ands_network/tasks/nm_configure.yml
index 57e40ca..5484bb2 100644
--- a/roles/ands_network/tasks/nm_configure.yml
+++ b/roles/ands_network/tasks/nm_configure.yml
@@ -47,6 +47,3 @@
iface: "{{ ands_public_interface }}"
cidr: "{{ ands_openshift_public_cidr }}"
alias: true
-
-- name: Configure firewall
- include_tasks: firewall.yml
diff --git a/roles/ands_storage/tasks/main.yml b/roles/ands_storage/tasks/main.yml
index 8e9d44b..7146da0 100644
--- a/roles/ands_storage/tasks/main.yml
+++ b/roles/ands_storage/tasks/main.yml
@@ -43,14 +43,18 @@
lvol: vg="{{ ands_data_vg }}" lv="{{ ands_data_lv }}" size="{{ ands_data_volume_size }}"
- name: Ensure Ands Data Volume is formatted and resize if necessary
- filesystem: fstype="xfs" resizefs="yes" dev="/dev/{{ ands_data_vg }}/{{ ands_data_lv }}"
+ filesystem: fstype="xfs" dev="/dev/{{ ands_data_vg }}/{{ ands_data_lv }}"
- name: Mount Ands Data Volume
mount: name="{{ ands_data_path }}" src="/dev/{{ ands_data_vg }}/{{ ands_data_lv }}" fstype="{{ ands_data_fs }}" opts="defaults" state="mounted"
+# System complains if we try to resize unmounted file system
+- name: Ensure Ands Data Volume is formatted and resize if necessary
+ filesystem: fstype="xfs" resizefs="yes" dev="/dev/{{ ands_data_vg }}/{{ ands_data_lv }}"
+
- name: Provision Ands local storage domains
include_tasks: hostmount.yml
with_items: "{{ ands_local_storage_domains | default([]) }}"
- when: domain.servers | intersect(group_names) | length > 0
+ when: domain.servers in group_names
loop_control:
loop_var: domain
diff --git a/roles/openshift_resource/tasks/template.yml b/roles/openshift_resource/tasks/template.yml
index 3469464..f43b0f2 100644
--- a/roles/openshift_resource/tasks/template.yml
+++ b/roles/openshift_resource/tasks/template.yml
@@ -22,8 +22,8 @@
when: ((recreate|default(false)) or (results | changed)) and (results.results[item|int].rc == 0)
# Replace often complains on various immutable variables it can't change. We ignore.
- - name: "{{ template }}: Populate resources to {{project}} ({{ replace | ternary('replace', 'create') }})"
- shell: "oc process -n {{project}} -f '{{ template_path }}/{{template}}' {{ template_args | default('') }} | oc {{ replace | ternary('replace', 'create') }} -n {{project}} -f - {{ create_args | default('') }}"
+ - name: "{{ template }}: Populate resources to {{project}} ({{ replace | default(false) | ternary('replace', 'create') }})"
+ shell: "oc process -n {{project}} -f '{{ template_path }}/{{template}}' {{ template_args | default('') }} | oc {{ replace | default(false) | ternary('replace', 'create') }} -n {{project}} -f - {{ create_args | default('') }}"
register: status
failed_when: (status.rc != 0) and not (replace | default(false))
when:
diff --git a/roles/role_includer/tasks/main.yml b/roles/role_includer/tasks/main.yml
new file mode 100644
index 0000000..1044236
--- /dev/null
+++ b/roles/role_includer/tasks/main.yml
@@ -0,0 +1,5 @@
+# This is not working in prestine ansible 2.4.3, needs a patch back-ported from upstream (patch released in February 2018)
+- name: "Processing tasks in '{{ role_includer_tasks }}' from role '{{ role_includer_name }}'"
+ include_role:
+ name: "{{ role_includer_name }}"
+ tasks_from: "{{ role_includer_tasks | default('main.yml') }}"