Skip to content

Commit

Permalink
Merge pull request #73 from ansistrano/anon_stats
Browse files Browse the repository at this point in the history
initial work on an anonymous stats feature
  • Loading branch information
ricardclau committed Nov 6, 2015
2 parents 8e7f133 + ead1636 commit 5d1c6fb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 9 deletions.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ Early adopters

If you were an early adopter, you should know we have broken BC by moving from using `ansistrano_custom_tasks_path` to individual and specific files per step. See "Role Variables". **The role displays a warning if the variable is defined and although your old playbooks may still run with no errors, you will see that your code is uploaded but custom tasks are not run.**

Ansistrano anonymous usage stats
--------------------------------

We have recently added an extra optional step in Ansistrano so that we can know how many people are deploying their applications with our project. Unfortunately, Ansible Galaxy does not provide any numbers on usage or downloads so this is one of the only ways we have to measure how many users we really have.

You can check the code we use to store your anonyomus stats at [the ansistrano.com repo](https://github.com/ansistrano/ansistrano.com) and anyway, if you are not comfortable with this, you will always be able to disable this extra step by setting `ansistrano_allow_anonymous_stats` to false in your playbooks.

Who is using Ansistrano?
------------------------

Expand Down Expand Up @@ -55,7 +62,7 @@ $ ansible-galaxy install carlosbuenosvinos.ansistrano-deploy carlosbuenosvinos.a
Update
------

If you want to update the role, you need to pass **--force** parameter when installing. Please, check the following command:
If you want to update the role, you need to pass **--force** parameter when installing. Please, check the following command:

```
$ ansible-galaxy install --force carlosbuenosvinos.ansistrano-deploy carlosbuenosvinos.ansistrano-rollback
Expand All @@ -65,7 +72,7 @@ Features
--------

* Rollback in seconds (with ansistrano.rollback role)
* Customize your deployment with hooks before and after critical steps
* Customize your deployment with hooks before and after critical steps
* Save disk space keeping a maximum fixed releases in your hosts
* Choose between SCP (push), RSYNC (push), GIT (pull) or S3 (get) deployment strategies

Expand Down Expand Up @@ -93,16 +100,17 @@ Role Variables
ansistrano_shared_paths: [] # Shared paths to symlink to release dir
ansistrano_keep_releases: 0 # Releases to keep after a new deployment. See "Pruning old releases".
ansistrano_deploy_via: "rsync" # Method used to deliver the code to the server. Options are copy, rsync, git or s3

ansistrano_allow_anonymous_stats: yes

# Variables used in the rsync deployment strategy
ansistrano_rsync_extra_params: "" # Extra parameters to use when deploying with rsync
ansistrano_rsync_extra_params: "" # Extra parameters to use when deploying with rsync
ansistrano_rsync_set_remote_user: yes # See [ansible synchronize module](http://docs.ansible.com/ansible/synchronize_module.html). Options are yes, no.

# Variables used in the Git deployment strategy
ansistrano_git_repo: [email protected]:USERNAME/REPO.git # Location of the git repository
ansistrano_git_branch: master # What version of the repository to check out. This can be the full 40-character SHA-1 hash, the literal string HEAD, a branch name, or a tag name
ansistrano_git_identity_key_path: "" # If specified this file is copied over and used as the identity key for the git commands, path is relative to the playbook in which it is used

# Variables used in the S3 deployment strategy
ansistrano_s3_bucket: s3bucket
ansistrano_s3_object: s3object.tgz
Expand Down Expand Up @@ -191,7 +199,7 @@ Variables you can tune in rollback role are less than in deploy one:
ansistrano_deploy_to: "/var/www/my-app" # Base path to deploy to.
ansistrano_version_dir: "releases" # Releases folder name
ansistrano_current_dir: "current" # Softlink name. You should rarely changed it.
# Hooks: custom tasks if you need them
ansistrano_before_symlink_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-before-symlink-tasks.yml"
ansistrano_after_symlink_tasks_file: "{{ playbook_dir }}/<your-deployment-config>/my-after-symlink-tasks.yml"
Expand Down Expand Up @@ -293,7 +301,7 @@ Example Playbook
In the folder, `example` you can check an example project that shows how to deploy with Ansistrano. In order to run it, you should:

```
$ cd example
$ cd example
$ ansible-playbook -i hosts deploy.yml
```

Expand All @@ -304,7 +312,7 @@ We have added Ansistrano support for other projects we are working on.

* LastWishes: Domain-Driven Design PHP Sample App: https://github.com/dddinphp/last-wishes

As an example, see the execution log of the LastWishes deployment:
As an example, see the execution log of the LastWishes deployment:

```
PLAY [Deploy last wishes app to my server] ************************************
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ ansistrano_rsync_set_remote_user: yes
ansistrano_s3_bucket: s3bucket
ansistrano_s3_object: s3object.tgz
ansistrano_s3_region: eu-west-1

## Sends anonymous stats to the www.ansistrano.com servers
## You can disallow it by just setting this parameter to "no" in your playbook
ansistrano_allow_anonymous_stats: yes
12 changes: 12 additions & 0 deletions tasks/anon-stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# Sends anonymous stats if the user is ok with it
- name: ANSISTRANO | Send anonymous stats
uri:
url: http://ansistrano.com/deploy
method: POST
timeout: 5
when: ansistrano_allow_anonymous_stats
run_once: true
ignore_errors: yes
delegate_to: 127.0.0.1
sudo: false
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
- include: cleanup.yml

- include: "{{ ansistrano_after_cleanup_tasks_file | default('empty.yml') }}"

- include: anon-stats.yml

0 comments on commit 5d1c6fb

Please sign in to comment.