initial commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..75a0526
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,112 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+.hypothesis/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# IPython Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# dotenv
+.env
+
+# virtualenv
+venv/
+ENV/
+
+# Spyder project settings
+.spyderproject
+
+# Rope project settings
+.ropeproject
+
+.vagrant
+*.iml
+archives
+.DS_Store
+ssh_keys
+ansible.log
+*.zip
+license.txt
+*.log
+*.tar.gz
+*.rpm
+*.tar
+ansible_fact_cache_dir
+*jar
+.ansible_cache*
+configs_and_logs
+redhat-rhui.repo
+rhui-load-balancers.conf
+out
+.idea
+*iml
+*retry
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..36bbf62
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+---
+language: python
+python: "2.7"
+
+# Use the new container infrastructure
+sudo: false
+
+# Install ansible
+addons:
+ apt:
+ packages:
+ - python-pip
+
+install:
+ # Install ansible
+ - pip install ansible
+
+ # Check ansible version
+ - ansible --version
+
+ # Create ansible.cfg with correct roles_path
+ - printf '[defaults]\nroles_path=../' >ansible.cfg
+
+script:
+ # Basic role syntax check
+ - ansible-playbook tests/test.yml -i tests/inventory --syntax-check
+
+notifications:
+ webhooks: https://galaxy.ansible.com/api/v1/notifications/
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..225dd44
--- /dev/null
+++ b/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/defaults/main.yml b/defaults/main.yml
new file mode 100644
index 0000000..f37c314
--- /dev/null
+++ b/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# defaults file for baas-silent-config-file
diff --git a/handlers/main.yml b/handlers/main.yml
new file mode 100644
index 0000000..c0c3a97
--- /dev/null
+++ b/handlers/main.yml
@@ -0,0 +1,2 @@
+---
+# handlers file for baas-silent-config-file
diff --git a/meta/main.yml b/meta/main.yml
new file mode 100644
index 0000000..028151b
--- /dev/null
+++ b/meta/main.yml
@@ -0,0 +1,16 @@
+galaxy_info:
+ author: Carlos Frias
+ description: your description
+ company: Apigee
+ license: Apache
+ min_ansible_version: 2.0
+ platforms:
+ - name: EL
+ versions:
+ - 6
+ - 7
+ galaxy_tags:
+ - apigee
+ - opdk
+dependencies:
+- { role: apigee-opdk-setup-component-installer }
diff --git a/tasks/main.yml b/tasks/main.yml
new file mode 100644
index 0000000..a86cbb0
--- /dev/null
+++ b/tasks/main.yml
@@ -0,0 +1,21 @@
+---
+# tasks file for baas-silent-config-file
+
+- name: Construct the silent-install file
+ template:
+ src: 'baas-silent-install.conf.j2'
+ dest: "{{ opdk_baas_silent_install_file_path }}"
+ force: yes
+ owner: '{{ opdk_user_name }}'
+ group: '{{ opdk_group_name }}'
+ mode: 0644
+ when: provided_response_file is not defined or not provided_response_file
+
+- name: Copy provided silent-install file
+ copy:
+ src: "{{ opdk_baas_provided_silent_install_file }}"
+ dest: "{{ opdk_baas_silent_install_file_path }}"
+ owner: '{{ opdk_user_name }}'
+ group: '{{ opdk_group_name }}'
+ mode: 0644
+ when: provided_response_file is defined and provided_response_file
diff --git a/templates/baas-silent-install.conf.j2 b/templates/baas-silent-install.conf.j2
new file mode 100644
index 0000000..17e302a
--- /dev/null
+++ b/templates/baas-silent-install.conf.j2
@@ -0,0 +1,86 @@
+
+# Must resolve to IP address or DNS name of host - not to 127.0.0.1 or localhost.
+HOSTIP={{ hostvars[public_address][interface_name].ipv4.address }}
+
+# Define the API BaaS administrator account.
+# User name - default is "superuser".
+AS_ADMIN={{ baas_superuser_name }}
+AS_ADMIN_EMAIL={{ baas_superuser_email }}
+AS_PASSWD={{ baas_superuser_pass }}
+
+# Specify Cassandra configuration information.
+{% if groups['dc-1-cassandra'] is defined and inventory_hostname in groups['dc-1'] and groups['dc-1-cassandra'] | length > 0 %}
+CASS_HOSTS="{% for host in groups['dc-1-cassandra'] %}{{ hostvars[host][interface_name].ipv4.address }}:1,1{% if not loop.last %} {% endif %}{% endfor %}"
+{% elif groups['dc-2-cassandra'] is defined and inventory_hostname in groups['dc-2'] and groups['dc-2-cassandra'] | length > 0 %}
+CASS_HOSTS="{% for host in groups['dc-2-cassandra'] %}{{ hostvars[host][interface_name].ipv4.address }}:2,1{% if not loop.last %} {% endif %}{% endfor %}"
+{% else %}
+CASS_HOSTS="{% for host in groups['cassandra'] %}{{ hostvars[host][interface_name].ipv4.address }}{% if hostvars[host].rack is defined and hostvars[host].rack %}{{ hostvars[host].rack }}{% endif %}{% if not loop.last %} {% endif %}{% endfor %}"
+{% endif %}
+
+# Cassandra uname/pword if you enabled Cassandra authentication.
+# Even if you have not enabled Cassandra authentication,
+# you must pass values for these properties.
+CASS_USERNAME={{ opdk_cass_username }}
+# Default value
+CASS_PASSWORD={{ opdk_cass_password }}
+
+# Specify BaaS Cassandra connection information.
+# Specify the data center name.
+# Default is dc-1.
+{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %}
+BAAS_CASS_LOCALDC=dc-1
+{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %}
+BAAS_CASS_LOCALDC=dc-2
+{% endif %}
+
+# Replication is in the form "dataCenterName:#CassandraNodes".
+# For example, for dc-1 with three Cassandra nodes, it is dc-1:3.
+{% if groups['dc-1-cassandra'] is defined and inventory_hostname in groups['dc-1'] %}
+BAAS_CASS_REPLICATION=dc-1:{{ groups['dc-1-cassandra'] | length }}
+{% elif groups['dc-2-cassandra'] is defined and inventory_hostname in groups['dc-2'] %}
+BAAS_CASS_REPLICATION=dc-2:{{ groups['dc-2-cassandra'] | length }}
+{% else %}
+BAAS_CASS_REPLICATION=dc-1:{{ groups['cassandra'] | length }}
+{% endif %}
+
+# ElasticSearch IPs or DNS names, separated by spaces.
+{% if groups['dc-1-elastic'] is defined and inventory_hostname in groups['dc-1'] %}
+ES_HOSTS="{% for host in groups['dc-1-elastic'] %}{{ hostvars[host][interface_name].ipv4.address }}{% if not loop.last %} {% endif %}{% endfor %}"
+{% elif groups['dc-2-elastic'] is defined and inventory_hostname in groups['dc-2'] %}
+ES_HOSTS="{% for host in groups['dc-2-elastic'] %}{{ hostvars[host][interface_name].ipv4.address }}{% if not loop.last %} {% endif %}{% endfor %}"
+{% else %}
+ES_HOSTS="{% for host in groups['elastic'] %}{{ hostvars[host][interface_name].ipv4.address }}{% if not loop.last %} {% endif %}{% endfor %}"
+{% endif %}
+
+# API BaaS Stack information.
+# Default cluster name is "apigee_baas"
+BAAS_USERGRID_CLUSTERNAME="{{ baas_cluster_name }}"
+
+# URL and port of the load balancer for the API BaaS Stack nodes, # or IP/DNS and port of a single Stack node with no load balancer.
+{% if baas_load_balancer_host is defined and baas_load_balancer_host and baas_load_balancer_port is defined and baas_load_balancer_port %}
+BAAS_USERGRID_URL="http://{{ baas_load_balancer_host }}:{{ baas_load_balancer_port }}"
+{% elif groups['portal'][0] is defined and groups['baas'][0] and baas_portal_port is defined and baas_portal_port %}
+BAAS_USERGRID_URL="http://{{ groups['baas'][0] }}:{{ baas_load_balancer_port }}"
+{% endif %}
+
+# API BaaS Portal information.
+# URL and port number of load balancer, if there is one in front of the Portal, # or the URL and port of the Portal node.
+{% if groups['dc-1-portal'] is defined and inventory_hostname in groups['dc-1'] %}
+BAAS_PORTAL_URL="http://{{ hostvars[groups['dc-1-portal'][0]][interface_name].ipv4.address }}:{{baas_portal_port }}"
+{% elif groups['dc-2-portal'] is defined and inventory_hostname in groups['dc-2'] %}
+BAAS_PORTAL_URL="http://{{ hostvars[groups['dc-2-portal'][0]][interface_name].ipv4.address }}:{{ baas_portal_port }}"
+{% else %}
+BAAS_PORTAL_URL="http://{{ hostvars[groups['portal'][0]][interface_name].ipv4.address }}:{{ baas_portal_port }}"
+{% endif %}
+
+# Portal port. Default value is 9000.
+BAAS_PORTAL_LISTEN_PORT={{ baas_portal_port }}
+
+# SMTP information. BaaS requires an SMTP server.
+SMTPHOST={{ baas_smtp_host }}
+SMTPPORT={{ baas_smtp_port }}
+SMTPUSER='{{ baas_smtp_user }}'
+SMTPPASSWORD='{{ baas_smtp_user_pass }}'
+SMTPSSL={{ baas_smtp_ssl }}
+
+LICENSE_FILE={{ opdk_license_target_file_path }}
diff --git a/tests/inventory b/tests/inventory
new file mode 100644
index 0000000..d18580b
--- /dev/null
+++ b/tests/inventory
@@ -0,0 +1 @@
+localhost
\ No newline at end of file
diff --git a/tests/test.yml b/tests/test.yml
new file mode 100644
index 0000000..4b09bf5
--- /dev/null
+++ b/tests/test.yml
@@ -0,0 +1,5 @@
+---
+- hosts: localhost
+ remote_user: root
+ roles:
+ - baas-silent-config-file
\ No newline at end of file
diff --git a/vars/main.yml b/vars/main.yml
new file mode 100644
index 0000000..4609f97
--- /dev/null
+++ b/vars/main.yml
@@ -0,0 +1,2 @@
+---
+# vars file for baas-silent-config-file