Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to use deb packages #42

Merged
merged 35 commits into from
May 6, 2016
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8f7471d
Only install mongodb-server package
Mar 31, 2016
7b48d88
Install rabbitmq-server from ubuntu repos
Mar 31, 2016
0539c96
Adding role for st2-repos
Mar 31, 2016
ff53402
Changes to mistral setup
Mar 31, 2016
843b652
Removing non-used mistral role files
Mar 31, 2016
8b873d8
Notify mistral restart
Mar 31, 2016
f325d59
Install st2 and enable auth
Apr 1, 2016
9740bd0
Remove unused st2 files
Apr 1, 2016
18c1b61
Add st2-repos as dependency for st2
Apr 1, 2016
8ae7c41
Configure the system user and sudo access
Apr 1, 2016
849f233
Configure system user in st2.conf
Apr 1, 2016
d3a6496
Add st2-web role
Apr 1, 2016
7968d1e
Add smoke tests
Apr 1, 2016
85e7220
Make sure handlers are flushed before tests
Apr 1, 2016
9bdbd30
Updated playbook
Apr 1, 2016
02ce665
Fixed ssh_key bug in st2.conf
Apr 1, 2016
c177e6e
Purge instead of remove for Circle CI
Apr 4, 2016
03c058e
configure mistral with sudo
Apr 4, 2016
1ef38da
Removing meta and READMEs
Apr 28, 2016
a38da96
Rename st2-web to st2web
Apr 28, 2016
7bcbada
Rename st2-repos to st2repos
Apr 28, 2016
3122cfc
Rename st2-smoke-tests to st2smoketests
Apr 28, 2016
7a2e906
Fixed name changes in meta (and comments)
May 2, 2016
49c0663
Install nginx 1.8.*
May 2, 2016
c2b856b
Removing extra white-spaces
May 2, 2016
1947b40
Ensure pip is installed on CI
May 2, 2016
afac777
Install python-dev to CI
May 2, 2016
3ba2345
Update setup-tools for CI
May 2, 2016
37bd981
Stable repos url
May 2, 2016
6cacd9c
Get mistral stable by default
May 2, 2016
855e019
rename st2-api -> st2api
May 2, 2016
13598ee
Do not add st2 src repo
May 2, 2016
f8ec21c
Expire ssl cert after 365 days
May 2, 2016
5994389
Remove warning from README
May 2, 2016
c182ee9
Update restart/reload handlers
May 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ machine:
# complete uninstall fails on CircleCI due to old kernel bugs, doing selective uninstall gently
- sudo apt-get purge -y postgresql-9.4 postgresql-server-dev-9.4 postgresql-client-9.4 postgresql-server-dev-9.1
# use aptitude to remove dependencies
- sudo aptitude remove -y ~nrabbitmq
- sudo aptitude remove -y ~nmongo
- sudo aptitude purge -y ~nrabbitmq
- sudo aptitude purge -y ~nmongo
- sudo apt-get -y autoremove
- sudo dpkg --configure -a
- sudo apt-get -y update

dependencies:
pre:
- sudo apt-get install python-pip python-dev
- sudo pip install --upgrade setuptools
- sudo pip install ansible
- ansible --version
- ansible-galaxy install -r roles/mistral/requirements.yml
Expand Down
3 changes: 3 additions & 0 deletions playbooks/st2express.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
roles:
- mongodb
- rabbitmq
- st2repos
- mistral
- st2
- st2web
- st2smoketests
2 changes: 1 addition & 1 deletion roles/mistral/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mistral_version: 0.13
mistral_version: 1.3.2-99
Copy link
Member

@arm4b arm4b May 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.4.0 is latest mistral stable version from https://packagecloud.io/StackStorm/stable. Let's stick to some revision from that version.


On related note, I would prefer to avoid such pinning in default config values. So if version is not explicitly set, playbook installs latest stable by default (with accordance with st2 version).

Anyway, it's something to rethink later. For now it's good enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you mean something like what's used here: https://github.com/johandahlberg/ansible-st2/blob/use_deb_packages/roles/st2/tasks/main.yml? If so I can fix it now, shouldn't be to tricky.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, something like that would be definitely better.

mistral_db_username: mistral
mistral_db_password: StackStorm
mistral_db: mistral
1 change: 1 addition & 0 deletions roles/mistral/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ dependencies:
- name: "{{ mistral_db_username }}"
pass: "{{ mistral_db_password }}"
encrypted: yes
- role: st2repos
33 changes: 0 additions & 33 deletions roles/mistral/tasks/config.yml

This file was deleted.

5 changes: 0 additions & 5 deletions roles/mistral/tasks/gather_facts.yml

This file was deleted.

18 changes: 0 additions & 18 deletions roles/mistral/tasks/install_actions.yml

This file was deleted.

5 changes: 0 additions & 5 deletions roles/mistral/tasks/install_client.yml

This file was deleted.

20 changes: 0 additions & 20 deletions roles/mistral/tasks/install_deps.yml

This file was deleted.

31 changes: 0 additions & 31 deletions roles/mistral/tasks/install_mistral.yml

This file was deleted.

74 changes: 67 additions & 7 deletions roles/mistral/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,67 @@
- include: gather_facts.yml
- include: install_deps.yml
- include: install_mistral.yml
- include: install_actions.yml
- include: config.yml
- include: sync.yml
- include: install_client.yml
---

- name: Install st2mistral
sudo: yes
apt:
name: st2mistral={{ mistral_version }}
state: present

- name: Configure mistral
sudo: yes
ini_file:
dest: /etc/mistral/mistral.conf
section: database
option: connection
value: postgresql://{{ mistral_db_username }}:{{ mistral_db_password }}@localhost/{{ mistral_db }}
backup: yes

- name: Deploy database init script
sudo: yes
template:
src: init_mistral_db.SQL.j2
dest: /etc/mistral/init_mistral_db.SQL
notify:
- restart mistral

- name: Initiate database
become: yes
become_user: postgres
shell: psql < /etc/mistral/init_mistral_db.SQL
args:
creates: /etc/mistral/init_mistral_db.SQL.ansible.has.run
notify:
- restart mistral

- name: Make sure "Initiate database" doesn't run twice
sudo: yes
file:
path: /etc/mistral/init_mistral_db.SQL.ansible.has.run
state: touch

- name: Setup Mistral DB tables, etc
sudo: yes
command: /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head
args:
creates: /etc/mistral/mistral-db-manage.upgrade.head.ansible.has.run
notify:
- restart mistral

- name: Make sure "Setup Mistral DB tables, etc" does not run again
sudo: yes
file:
path: /etc/mistral/mistral-db-manage.upgrade.head.ansible.has.run
state: touch

- name: Register mistral actions
sudo: yes
command: /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate
args:
creates: /etc/mistral/mistral-db-manage.populate.ansible.has.run
notify:
- restart mistral

- name: Make sure "Register mistral actions" does not run again
sudo: yes
file:
path: /etc/mistral/mistral-db-manage.upgrade.head.ansible.has.run
state: touch
6 changes: 0 additions & 6 deletions roles/mistral/tasks/sync.yml

This file was deleted.

6 changes: 0 additions & 6 deletions roles/mistral/templates/init.j2

This file was deleted.

2 changes: 2 additions & 0 deletions roles/mistral/templates/init_mistral_db.SQL.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE ROLE {{ mistral_db_username }} WITH CREATEDB LOGIN ENCRYPTED PASSWORD {{ mistral_db_password }};
CREATE DATABASE {{ mistral_db }} OWNER {{ mistral_db_username }};
6 changes: 0 additions & 6 deletions roles/mistral/templates/mistral.conf.j2

This file was deleted.

11 changes: 0 additions & 11 deletions roles/mistral/vars/main.yml

This file was deleted.

1 change: 0 additions & 1 deletion roles/mongodb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
update_cache: yes
state: present
with_items:
- mongodb
- mongodb-server
5 changes: 0 additions & 5 deletions roles/rabbitmq/handlers/main.yml

This file was deleted.

25 changes: 0 additions & 25 deletions roles/rabbitmq/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
- name: Ensure rabbitmq repo
sudo: true
apt_repository:
repo: deb http://www.rabbitmq.com/debian/ testing main

- name: Ensure rabbitmq repo key
sudo: true
apt_key:
url: http://www.rabbitmq.com/rabbitmq-signing-key-public.asc

- name: Install rabbitmq packages
sudo: true
Expand All @@ -15,19 +6,3 @@
update_cache: true
with_items:
- rabbitmq-server

- name: Enable rabbitmq_management plugin
sudo: true
rabbitmq_plugin:
names: rabbitmq_management
notify:
- restart rabbitmq

- meta: flush_handlers

- name: Install rabbitmqadmin
sudo: true
get_url:
url: http://127.0.0.1:15672/cli/rabbitmqadmin
dest: /usr/bin/rabbitmqadmin
mode: 0755
2 changes: 1 addition & 1 deletion roles/st2/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ st2_packages:
# Number of action runners to register. Defaults to number of vCPUs, but not less than 2
st2_action_runners: "{{ [ansible_processor_vcpus, 2] | max }}"

enable_auth: true
st2_auth_username: testu
st2_auth_password: testp

# Set to no if you do not want the st2_system_user to be added in
# the sudoers file.
st2_system_user_in_sudoers: yes

9 changes: 5 additions & 4 deletions roles/st2/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: restart st2
sudo: true
service:
name: "{{ item }}"
state: restarted
with_items: st2_services
command: st2ctl restart

- name: restart st2-api
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename it st2-api -> st2api to conform with real service name?

sudo: true
command: st2ctl restart-component st2api
3 changes: 2 additions & 1 deletion roles/st2/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ galaxy_info:
- precise
categories:
- system
dependencies: []
dependencies:
- role: st2repos
20 changes: 0 additions & 20 deletions roles/st2/tasks/1.requirements.yml

This file was deleted.

Loading