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

Deploy himlarcli cleanup #13

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
62 changes: 41 additions & 21 deletions lib/deploy_himlarcli.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
#
# Deploy himlarcli to hosts under himlarcli_path
# Verified: This will run under ansible 2.1
Expand All @@ -19,35 +20,54 @@
- openssl-devel
- PyYAML
- libffi-devel
- name: "Update {{himlarcli_repo}} with version {{himlarcli_ref}}"

- name: "Update {{ himlarcli_repo }} with version {{ himlarcli_ref }}"
git:
repo: "{{himlarcli_repo}}"
version: "{{himlarcli_ref}}"
dest: "{{himlarcli_path}}"
force: "{{himlarcli_force_update}}"
repo: "{{ himlarcli_repo }}"
version: "{{ himlarcli_ref }}"
dest: "{{ himlarcli_path }}"
force: "{{ himlarcli_force_update }}"

- name: Manually create the initial virtualenv for himlarcli
command: virtualenv --clear "{{himlarcli_path}}" creates="{{himlarcli_path}}/bin/activate"
- name: Update setuptools
command: "virtualenv --clear {{ himlarcli_path }}"
args:
creates: "{{ himlarcli_path }}/bin/activate"

- name: Upgrade pip
pip:
name: pip
state: latest
virtualenv: "{{ himlarcli_path }}"

- name: Update setuptools
pip:
name: setuptools
virtualenv: "{{himlarcli_path}}"
chdir: "{{himlarcli_path}}"
virtualenv_site_packages: "no"
- name: Upgrade pip
command: bin/pip install --upgrade pip chdir={{himlarcli_path}}
state: latest
virtualenv: "{{ himlarcli_path }}"

- name: Install python modules with pip
pip:
virtualenv: "{{himlarcli_path}}"
requirements: "requirements.txt"
chdir: "{{himlarcli_path}}"
virtualenv_site_packages: "no"
requirements: "{{ himlarcli_path }}/requirements.txt"
virtualenv: "{{ himlarcli_path }}"

- name: Run setup.py if himlarcli package is not setup
command: bin/python setup.py develop chdir={{himlarcli_path}} creates={{himlarcli_path}}/himlarcli.egg-info
command: bin/python setup.py develop
args:
chdir: "{{ himlarcli_path }}"
creates: "{{ himlarcli_path }}/himlarcli.egg-info"

- name: Copy config.ini from remote host
fetch: src=/etc/himlarcli/config.ini dest={{himlarcli_path}}/config.ini.{{location}} flat=yes
fetch:
src: /etc/himlarcli/config.ini
dest: "{{ himlarcli_path }}/config.ini.{{ location }}"
flat: yes
when: '("login" not in inventory_hostname) and location != "vagrant"'
# - name: Run test/deploy.sh
# command: "{{himlarcli_path}}/tests/deploy.sh"

# - name: Run test/deploy.sh
# command: "{{himlarcli_path}}/tests/deploy.sh"

- name: Copy user whitelist from /opt/repo
copy: src=/opt/repo/secrets/common/whitelist_users.txt dest={{himlarcli_path}}/whitelist_users.txt
copy:
src: /opt/repo/secrets/common/whitelist_users.txt
dest: "{{ himlarcli_path }}/whitelist_users.txt"
mode: '644'