You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/01/11 15:05:32 UTC
[incubator-openwhisk] branch master updated: use environment level
defined directory if inventory_dir is not defined (as in Ansible 2.4)
(#3124)
This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 13dd20b use environment level defined directory if inventory_dir is not defined (as in Ansible 2.4) (#3124)
13dd20b is described below
commit 13dd20b0b68fa8c14659fb7b7c25fadd04592119
Author: Martin Henke <ma...@web.de>
AuthorDate: Thu Jan 11 16:05:27 2018 +0100
use environment level defined directory if inventory_dir is not defined (as in Ansible 2.4) (#3124)
---
ansible/boot_instances_dist.yml | 8 ++++----
ansible/environments/distributed/group_vars/all | 2 ++
ansible/environments/docker-machine/group_vars/all | 2 ++
ansible/environments/local/group_vars/all | 2 ++
ansible/group_vars/all | 2 ++
ansible/provision_env_dist.yml | 2 +-
ansible/roles/cli/tasks/download_cli.yml | 4 ++--
ansible/roles/couchdb/tasks/deploy.yml | 2 +-
ansible/setup.yml | 8 ++++----
9 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/ansible/boot_instances_dist.yml b/ansible/boot_instances_dist.yml
index 85134be..b64ea31 100644
--- a/ansible/boot_instances_dist.yml
+++ b/ansible/boot_instances_dist.yml
@@ -52,18 +52,18 @@
# - local_action: add_host ansible_ssh_host={{ item.server.private_v4 }} groupname={{name}}
# with_items: instance_info.results
-- shell: "grep -e {{name}} {{inventory_dir}}/hosts"
+- shell: "grep -e {{name}} {{hosts_dir}}/hosts"
ignore_errors: True
register: hosts_file
# TODO, should render the hosts file from a template by using the add_host module commented below with a template
-- shell: "echo [{{name}}] >> {{inventory_dir}}/hosts"
+- shell: "echo [{{name}}] >> {{hosts_dir}}/hosts"
when: "{{hosts_file.rc}} != 0"
-- lineinfile: insertafter="^{{name}}" line="{{item.server.networks.itervalues().next()[0]}} block_device={{item.server.volumes[0].device }}" dest="{{inventory_dir}}/hosts"
+- lineinfile: insertafter="^{{name}}" line="{{item.server.networks.itervalues().next()[0]}} block_device={{item.server.volumes[0].device }}" dest="{{hosts_dir}}/hosts"
with_items: instance_info.results
when: (volume_env and volume_env != "") or (volume_dict and volume_dict.size)
-- lineinfile: insertafter="^{{name}}" line="{{item.server.networks.itervalues().next()[0]}}" dest="{{inventory_dir}}/hosts"
+- lineinfile: insertafter="^{{name}}" line="{{item.server.networks.itervalues().next()[0]}}" dest="{{hosts_dir}}/hosts"
with_items: instance_info.results
when: (not volume_env or volume_env == "" ) and (not volume_dict or not volume_dict.size)
diff --git a/ansible/environments/distributed/group_vars/all b/ansible/environments/distributed/group_vars/all
index 6fbfe03..c36424b 100755
--- a/ansible/environments/distributed/group_vars/all
+++ b/ansible/environments/distributed/group_vars/all
@@ -14,6 +14,8 @@ registry_storage_dir: "/"
docker_registry: "{{ groups['registry'] | first }}:5000/"
docker_dns: ""
+env_hosts_dir: "{{ playbook_dir }}/environments/distributed"
+
registry:
version: 2.3.1
port: 5000
diff --git a/ansible/environments/docker-machine/group_vars/all b/ansible/environments/docker-machine/group_vars/all
index abffd2f..a09f335 100644
--- a/ansible/environments/docker-machine/group_vars/all
+++ b/ansible/environments/docker-machine/group_vars/all
@@ -5,6 +5,8 @@ docker_registry: ""
docker_dns: ""
bypass_pull_for_local_images: true
+env_hosts_dir: "{{ playbook_dir }}/environments/docker-machine"
+
# The whisk_api_localhost_name is used to configure nginx to permit vanity URLs for web actions.
# It is also used for the SSL certificate generation. For a local deployment, this is typically
# a hostname that is resolved on the client, via /etc/hosts for example.
diff --git a/ansible/environments/local/group_vars/all b/ansible/environments/local/group_vars/all
index 7b838b7..9a10b00 100755
--- a/ansible/environments/local/group_vars/all
+++ b/ansible/environments/local/group_vars/all
@@ -33,3 +33,5 @@ kafka_topics_health_retentionBytes: 104857600
kafka_topics_health_retentionMS: 300000
kafka_topics_invoker_retentionBytes: 104857600
kafka_topics_invoker_retentionMS: 300000
+
+env_hosts_dir: "{{ playbook_dir }}/environments/local"
diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index 955c8b1..2ffa75e 100644
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -18,6 +18,8 @@ exclude_logs_from: []
# whisk_api_localhost_name_default (last)
whisk_api_localhost_name_default: "localhost"
+hosts_dir: "{{ inventory_dir| default(env_hosts_dir) }}"
+
whisk:
version:
date: "{{ansible_date_time.iso8601}}"
diff --git a/ansible/provision_env_dist.yml b/ansible/provision_env_dist.yml
index 15f59ca..6f42845 100644
--- a/ansible/provision_env_dist.yml
+++ b/ansible/provision_env_dist.yml
@@ -6,7 +6,7 @@
- name: add header to hosts file
copy:
content: "; the first parameter in a host is the inventory_hostname\n\nansible ansible_connection=local\n"
- dest: "{{inventory_dir}}/hosts"
+ dest: "{{hosts_dir}}/hosts"
- name: Create instances
include: boot_instances_dist.yml instance={{item}}
diff --git a/ansible/roles/cli/tasks/download_cli.yml b/ansible/roles/cli/tasks/download_cli.yml
index 4d2d872..324657e 100644
--- a/ansible/roles/cli/tasks/download_cli.yml
+++ b/ansible/roles/cli/tasks/download_cli.yml
@@ -19,7 +19,7 @@
mode=0755
validate_certs=False
force=True
- when: ('environments/docker-machine' not in inventory_dir) and (ansible_os_family != "Darwin")
+ when: ('environments/docker-machine' not in hosts_dir) and (ansible_os_family != "Darwin")
- name: "download cli for mac (docker-machine or Docker for Mac) to openwhisk home at {{ openwhisk_home }}"
local_action: >
@@ -29,4 +29,4 @@
mode=0755
validate_certs=False
force=True
- when: ('environments/docker-machine' in inventory_dir ) or (ansible_os_family == "Darwin")
+ when: ('environments/docker-machine' in hosts_dir ) or (ansible_os_family == "Darwin")
diff --git a/ansible/roles/couchdb/tasks/deploy.yml b/ansible/roles/couchdb/tasks/deploy.yml
index 2111aae..1add443 100644
--- a/ansible/roles/couchdb/tasks/deploy.yml
+++ b/ansible/roles/couchdb/tasks/deploy.yml
@@ -6,7 +6,7 @@
coordinator: "{{ groups['db'][0] }}"
- name: check if db credentials are valid for CouchDB
- fail: msg="The db provider in your {{ inventory_dir }}/group_vars/all is {{ db_provider }}, it has to be CouchDB, pls double check"
+ fail: msg="The db provider in your {{ hosts_dir }}/group_vars/all is {{ db_provider }}, it has to be CouchDB, pls double check"
when: db_provider != "CouchDB"
- name: check for persistent disk
diff --git a/ansible/setup.yml b/ansible/setup.yml
index 8690492..a5c28f9 100644
--- a/ansible/setup.yml
+++ b/ansible/setup.yml
@@ -5,21 +5,21 @@
tasks:
- name: gen hosts if 'local' env is used
local_action: template src="{{playbook_dir}}/environments/local/hosts.j2.ini" dest="{{ playbook_dir }}/environments/local/hosts"
- when: "'environments/local' in inventory_dir"
+ when: "'environments/local' in hosts_dir"
- name: find the ip of docker-machine
local_action: shell "docker-machine" "ip" "{{docker_machine_name | default('whisk')}}"
register: result
- when: "'environments/docker-machine' in inventory_dir"
+ when: "'environments/docker-machine' in hosts_dir"
- name: get the docker-machine ip
set_fact:
docker_machine_ip: "{{ result.stdout }}"
- when: "'environments/docker-machine' in inventory_dir"
+ when: "'environments/docker-machine' in hosts_dir"
- name: gen hosts for docker-machine
local_action: template src="{{playbook_dir}}/environments/docker-machine/hosts.j2.ini" dest="{{ playbook_dir }}/environments/docker-machine/hosts"
- when: "'environments/docker-machine' in inventory_dir"
+ when: "'environments/docker-machine' in hosts_dir"
- name: gen untrusted server certificate for host
local_action: shell "{{ playbook_dir }}/roles/nginx/files/genssl.sh" "*.{{ whisk_api_localhost_name | default(whisk_api_host_name) | default(whisk_api_localhost_name_default) }}" "server"
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].