Skip to content

Commit

Permalink
Merge pull request #148 from StackStorm/add/present
Browse files Browse the repository at this point in the history
Adding present option for version to avoid auto-update
  • Loading branch information
armab authored Jun 8, 2017
2 parents 1c30ce2 + ec70f86 commit ad08d66
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 24 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Below is the list of variables you can redefine in your playbook to customize st
| **st2repo**
| `st2repo_name` | `stable` | StackStorm PackageCloud repository to install. [`stable`](https://packagecloud.io/StackStorm/stable/), [`unstable`](https://packagecloud.io/StackStorm/unstable/), [`staging-stable`](https://packagecloud.io/StackStorm/staging-stable/), [`staging-unstable`](https://packagecloud.io/StackStorm/staging-unstable/)
| **st2**
| `st2_version` | `latest` | StackStorm version to install. Use latest `latest` to get automatic updates or pin it to numeric version like `2.2.0`.
| `st2_version` | `latest` | StackStorm version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`.
| `st2_revision` | `1` | StackStorm revision to install. Used only with pinned `st2_version`.
| `st2_config` | `{}` | Hash with StackStorm configuration settings to set in [`st2.conf`](https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample) ini file.
| `st2_system_user` | `stanley` | System user from which st2 will execute local/remote shell actions.
Expand All @@ -44,7 +44,7 @@ Below is the list of variables you can redefine in your playbook to customize st
| `st2_auth_password` | `testp` | Password used by StackStorm standalone authentication.
| `st2_save_credentials` | `yes` | Save credentials for local CLI in `/root/.st2/config` file.
| **st2mistral**
| `st2mistral_version` | `latest` | st2mistral version to install. Use latest `latest` to get automatic updates or pin it to numeric version like `2.2.0`.
| `st2mistral_version` | `latest` | st2mistral version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`.
| `st2mistral_db` | `mistral` | PostgreSQL DB name that will be created for Mistral.
| `st2mistral_db_username` | `mistral` | PostgreSQL DB user that will be created for Mistral.
| `st2mistral_db_password` | `StackStorm` | PostgreSQL DB password for Mistral.
Expand All @@ -55,11 +55,12 @@ Below is the list of variables you can redefine in your playbook to customize st
| **bwc**
| `bwc_license` | `null` | BWC license key is required for installing BWC enteprise bits via this ansible role.
| `bwc_repo` | `enterprise` | BWC PackageCloud repository to install. [`enterprise`](https://packagecloud.io/StackStorm/enterprise/), [`enterprise-unstable`](https://packagecloud.io/StackStorm/enterprise-unstable/), [`staging-enterprise`](https://packagecloud.io/StackStorm/staging-enteprise/), [`staging-enterprise-unstable`](https://packagecloud.io/StackStorm/staging-enterprise-unstable/)
| `bwc_version` | `latest` | BWC enterprise version to install. Use latest `latest` to get automatic updates or pin it to numeric version like `2.2.0`. The version used here should match `st2_version`.
| `bwc_version` | `latest` | BWC enterprise version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`. The version used here should match `st2_version`.
| `bwc_revision` | `1` | BWC enterprise revision to install. Used only with pinned `bwc_version`.
| `bwc_rbac` | [See `bwc_rbac` variable in role defaults](roles/bwc/defaults/main.yml) | BWC RBAC roles and assignments. This is a dictionary with two keys `roles` and `assignments`. `roles` and `assignments` are in turn both arrays. Each element in the array follows the exact YAML schema for [roles](https://bwc-docs.brocade.com/rbac.html#user-permissions) and [assignments](https://bwc-docs.brocade.com/rbac.html#defining-user-role-assignments) defined in BWC documentation.
| `bwc_ldap` | [See `bwc_ldap` variable in role defaults](roles/bwc/defaults/main.yml) | Settings for BWC LDAP authentication backend. `bwc_ldap` is a dictionary and has one item `backend_kwargs`. `backend_kwargs` should be provided as exactly listed in BWC documentation for [LDAP configuration](https://bwc-docs.brocade.com/authentication.html#auth-backends).
| **st2chatops**
| `st2chatops_version` | `latest` | st2chatops version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`.
| `st2chatops_st2_api_key` | | st2 API key to be updated in st2chatops.env using "st2 apikey create -k" in a task
| `st2chatops_hubot_adapter` | | Hubot Adapter to be used for st2chatops. Default is `shell`, but should be changed to one of the [`supported adapters`](`https://github.com/StackStorm/ansible-st2/blob/master/roles/st2chatops/vars/main.yml`).[**Required**]
| `st2chatops_config` | `{ }` | Based on adapter in `st2chatops_hubot_adapter`, provide hash for the adapter settings, to update [`st2chatops.env`](https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env). For example, for `Slack` hubot adapter: `st2chatops_config:` `HUBOT_SLACK_TOKEN: xoxb-CHANGE-ME-PLEASE`
Expand Down
2 changes: 1 addition & 1 deletion roles/bwc/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# BWC PackageCloud repository to install: enterprise, enterprise-unstable, staging-enterprise, staging-enterprise-unstable.
bwc_repo: "enterprise"
# 'latest' to get latest version or numeric like '2.1.1'
# `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`.
bwc_version: latest
# used only if 'bwc_version' is numeric
bwc_revision: 1
Expand Down
19 changes: 16 additions & 3 deletions roles/bwc/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- BWC repos
- StackStorm enterprise

- name: Install latest bwc-enterprise package
- name: Install latest bwc-enterprise package, auto-update
become: yes
package:
name: bwc-enterprise
Expand All @@ -22,13 +22,26 @@
- st2 enterprise
- skip_ansible_lint

- name: Install present bwc-enterprise package, no auto-update
become: yes
package:
name: bwc-enterprise
state: present
register: bwc_installed
when: bwc_version == "present"
tags:
- bwc
- st2 enterprise

- name: Install pinned bwc-enterprise package
become: yes
package:
name: bwc-enterprise={{ bwc_version }}-{{ bwc_revision }}
name: bwc-enterprise{{ '-' if ansible_pkg_mgr == 'yum' else '=' }}{{ bwc_version }}-{{ bwc_revision }}
state: present
register: bwc_installed
when: bwc_version != "latest"
when:
- bwc_version != "latest"
- bwc_version != "present"
tags:
- bwc
- st2 enterprise
Expand Down
4 changes: 2 additions & 2 deletions roles/st2/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# 'latest' to get latest version or numeric like '2.1.1'
# StackStorm version to install. `present` to install available package, `latest` to get automatic updates or pin it to numeric version like `2.2.0`.
st2_version: latest
# used only if 'st2_version' is numeric
# StackStorm revision to install. Used only with pinned `st2_version`.
st2_revision: 1

# Hash with StackStorm configuration settings to set in 'st2.conf' ini file
Expand Down
19 changes: 16 additions & 3 deletions roles/st2/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"
tags: st2

- name: Install latest st2 package
- name: Install latest st2 package, auto-update
become: yes
package:
name: st2
Expand All @@ -18,12 +18,25 @@
- reload st2
tags: st2, skip_ansible_lint

- name: Install present st2 package, no auto-update
become: yes
package:
name: st2
state: present
when: st2_version == "present"
notify:
- restart st2
- reload st2
tags: st2

- name: Install pinned st2 package
become: yes
package:
name: st2={{ st2_version }}-{{ st2_revision }}
name: st2{{ '-' if ansible_pkg_mgr == 'yum' else '=' }}{{ st2_version }}-{{ st2_revision }}
state: present
when: st2_version != "latest"
when:
- st2_version != "latest"
- st2_version != "present"
notify:
- restart st2
- reload st2
Expand Down
2 changes: 1 addition & 1 deletion roles/st2chatops/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# st2chatops version to install. Use `latest` to get automatic updates or pin it to numeric version like `2.2.0`
# st2chatops version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`.
st2chatops_version: latest

# Please provide ST2_API_KEY using "st2 apikey create -k"
Expand Down
14 changes: 11 additions & 3 deletions roles/st2chatops/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,29 @@
(st2chatops_config == {} and st2chatops_hubot_adapter != "shell")
tags: st2chatops

- name: Install latest st2chatops package
- name: Install latest st2chatops package, auto-update
become: yes
package:
name: st2chatops
state: latest
when: st2chatops_version == "latest"
tags: [st2chatops, skip_ansible_lint]

- name: Install present st2chatops package, no auto-update
become: yes
package:
name: st2chatops
state: present
when: st2chatops_version == "present"
tags: st2chatops

- name: Install pinned st2chatops package
become: yes
package:
name: st2chatops={{ st2chatops_version }}
name: st2chatops{{ '-' if ansible_pkg_mgr == 'yum' else '=' }}{{ st2chatops_version }}
state: present
when: st2chatops_version != "latest"
tags: [st2chatops, skip_ansible_lint]
tags: st2chatops

- name: Check if api key already exist. No change if it already exists
become: yes
Expand Down
2 changes: 1 addition & 1 deletion roles/st2mistral/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# st2mistral version to install. Use latest `latest` to get automatic updates or pin it to numeric version like `2.1.1`
# st2mistral version to install. `present` to install available package, `latest` to get automatic updates, or pin it to numeric version like `2.2.0`.
st2mistral_version: latest
# PostgreSQL DB name for Mistral.
st2mistral_db: mistral
Expand Down
16 changes: 13 additions & 3 deletions roles/st2mistral/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,30 @@
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"
tags: st2mistral

- name: Install latest st2mistral package
- name: Install latest st2mistral package, auto-update
become: yes
package:
name: st2mistral
state: latest
when: st2mistral_version == "latest"
tags: [st2mistral, skip_ansible_lint]

- name: Install present st2mistral package, no auto-update
become: yes
package:
name: st2mistral
state: present
when: st2mistral_version == "present"
tags: st2mistral

- name: Install pinned st2mistral package
become: yes
package:
name: st2mistral={{ st2mistral_version }}
name: st2mistral{{ '-' if ansible_pkg_mgr == 'yum' else '=' }}{{ st2mistral_version }}
state: present
when: st2mistral_version != "latest"
when:
- st2mistral_version != "latest"
- st2mistral_version != "present"
tags: st2mistral

- name: Deploy database init script
Expand Down
18 changes: 14 additions & 4 deletions roles/st2web/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@
st2web_package_name: bwc-ui
when: bwc_installed.stat.exists

- name: Install latest {{ st2web_package_name }} package on {{ ansible_os_family }}
- name: Install latest {{ st2web_package_name }} package, auto-update
become: yes
package:
name: "{{ st2web_package_name }}"
state: latest
when: st2_version == "latest"
tags: st2web, skip_ansible_lint

- name: Install exact {{ st2web_package_name }} package on {{ ansible_os_family }}
- name: Install present {{ st2web_package_name }} package, no auto-update
become: yes
package:
name: "{{ st2web_package_name }}={{ st2_version }}-{{ st2web_revision }}"
name: "{{ st2web_package_name }}"
state: present
when: st2_version == "present"
tags: st2web

- name: Install pinned {{ st2web_package_name }} package
become: yes
package:
name: "{{ st2web_package_name }}{{ '-' if ansible_pkg_mgr == 'yum' else '=' }}{{ st2_version }}-{{ st2web_revision }}"
state: present
when: st2_version != "latest"
when:
- st2_version != "latest"
- st2_version != "present"
tags: st2web

- name: Configure SSL certificate for st2web UI
Expand Down

0 comments on commit ad08d66

Please sign in to comment.