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

Tried to wrap some todos #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
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
36 changes: 30 additions & 6 deletions roles/fstat/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
---
- user:
name: "{{user}}"

- name: Install required packages
package:
state: present
name: "{{ item }}"
with_items:
- python-virtualenv
- gcc
- git
- python-virtualenv
- gcc
- git

# TODO create the directory /fstat, do the git checkout
# automate update
# set configuration file, and database creation
# TODO set configuration file, and database creation
# and selinux boolean

- name: create fstat directory
file:
path: /fstat/code state=directory

- name: Check if virtualenv exists
local_action: stat path=/fstat/env
Copy link
Contributor

Choose a reason for hiding this comment

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

That is not correct, the local_action is gonna be used on the control system, not on the remote server.

register: env

- name: create virtualenv if it does not exists
command: virtualenv /fstat/env
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

So I think that's not exactly clear on what I meant, but that's using creates: /fstat/venv so the task is not run each time.

Choose a reason for hiding this comment

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

Take a look at the creates parameter for the command module. That's what misc asked you to use. It makes the lines 21-24 and 28 redundant.

when: not env.stat.exists

- name: clone or update fstat repo
git:
repo: https://github.com/gluster/fstat
dest: /fstat/code

- name: install dependencies
pip:
requirements=/fstat/code/requirements.txt
virtualenv=/fstat/env

- name: Add tmpfiles snippet
template:
dest: /etc/tmpfiles.d/fstat.conf
Expand Down