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

Add functionality to get/set K/V pairs in st2 datastore #108

Open
arm4b opened this issue Jan 31, 2017 · 1 comment
Open

Add functionality to get/set K/V pairs in st2 datastore #108

arm4b opened this issue Jan 31, 2017 · 1 comment
Labels

Comments

@arm4b
Copy link
Member

arm4b commented Jan 31, 2017

Similar to Pack Install #74 we'll need an abstraction for st2 key/value store.

For example define a list of K/V pairs in yaml which will be added in st2 datastore during Ansible provisioning.

See: https://docs.stackstorm.com/datastore.html

At a low level it could be implemented via Ansible plugins/modules (lookup/set):

@johnarnold
Copy link

Current workaround:

---
- name: set path vars for datastore keys
  set_fact:
    st2_keys_path: /etc/st2/st2_keys.json
    st2_keys_imported_path: /etc/st2/st2_keys.touch

- name: load datastore vars from file
  include_vars:
    file: st2_keys.yml

- name: Check if keys imported file exists
  stat:
    path: "{{st2_keys_imported_path}}"
  register: keys_exist
  become: true

- name: Write key file
  copy:
    content: "{{st2_keys | to_json}}"
    dest: "{{st2_keys_path}}"
  when: keys_exist.stat.exists == False
  become: true

- name: Import Keys
  become: true
  shell: "st2 key load {{st2_keys_path}} && rm -f {{st2_keys_path}} && touch {{st2_keys_imported_path}}"
  args:
    creates: "{{st2_keys_imported_path}}"
  when: keys_exist.stat.exists == False

@arm4b arm4b changed the title Add functionality to set K/V pairs in st2 datastore Add functionality to get/set K/V pairs in st2 datastore Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants