Comments (5)
Hi @t-yamo
Are you having any issue with such a setup? TBH I have not tried something like this but as long as Ansible supports these definitions it should work as far as I can tell
from deploy.
Hi @ricardclau
Thank you for your response.
This issue is not a setup problem, but is spec of variable.
I avoided this issue by ugly way, but I want to know smart way, so I reported it.
If this issue is a rare case, you can close it.
But I add some description for this issue.
1. ansistrano expects to set own each variables as top level variable
We can not pass variable collection via top level variable.
For passing variable collection via top level variable, ansistrano should use non top level variable.
now: "ansistrano_deploy_to"
wished: "ansistrano.ansistrano_deploy_to" or "ansistrano.deploy_to"
If ansistrano use top level variable as a container for other variables, we can replace variable collection easily.
2. My requirements is "host-A is group-X, host-B is group-Y, and host-C is multiple group-X/Y". and "Each group uses each different ansistrano configuration"
"Can't you switch vars for each groups?"
You are right. and I do configure so.
But there is a host that is joined multiple groups.
In this case, the merged variable collection (for host-C) should includes multiple ansistrano configurations, and it requests that we handle variables by our own way for each ansistrano tasks (or roles).
from deploy.
I am afraid all these questions are about Ansible not about Ansistrano itself but I will do my best to answer :)
So, regarding 1) unless I am confused this is the standard way variables are passed to roles. And we use ansistrano_variable_name to avoid name clashing. AFAIK Ansible does not support collection variables as you wished but I may be wrong
Regarding 2) yes you can do that but the only way would be to create several playbooks in the same playbook file targeting different sets of boxes
So something like this (syntax not checked and I am not sure about the identation in a Github comment but I hope you get the idea):
(deploy-everything-playbook.yml)
---
- hosts: setA
vars:
ansistrano_deploy_from: /projects/project-set-a/
ansistrano_deploy_to: /var/www/projecta
roles:
- carlosbuenosvinos.ansistrano-deploy
- hosts: setB
vars:
ansistrano_deploy_from: /projects/project-set-b/
ansistrano_deploy_to: /var/www/projectb
roles:
- carlosbuenosvinos.ansistrano-deploy
- hosts: setC
vars:
ansistrano_deploy_from: /projects/project-set-c/
ansistrano_deploy_to: /var/www/projectc
roles:
- carlosbuenosvinos.ansistrano-deploy
from deploy.
Thanks to your kind instruction, I understood theory of ansible well.
The way you wrote is exactly the way I am doing now.
It is not easy to organize composite hosts in my environment, but I will think about this configuration more carefully.
thanks!
from deploy.
Additional info: As far as I have investigated, ansible seems to supports passing collection variables.
---
- hosts: all-in-one
vars:
xyz:
api:
abc:
xxx: "foo"
yyy: "bar"
def:
zzz: "qqq"
batch:
abc:
yyy: "buz"
roles:
- { role: sample, ansistrano: "{{ xyz.api }}" }
- { role: sample, ansistrano: "{{ xyz.batch }}" }
---
- debug: msg="{{ ansistrano.abc.yyy }}"
output:
TASK: [sample | debug msg="bar"] *****************
ok: [127.0.0.1] => {
"msg": "bar"
}
...
TASK: [sample | debug msg="buz"] *****************
ok: [127.0.0.1] => {
"msg": "buz"
}
from deploy.
Related Issues (20)
- deploy fail on "Ensure GIT deployment key is up to date (local key file)" HOT 10
- File '...REVISION' created with default permissions '600' warning HOT 2
- Prevent `{{ ansistrano_deploy_to }}/shared` directory. HOT 1
- 'dict object' has no attribute 'stdout' when running in --check mode HOT 2
- [SPONSOR] Logo HOT 2
- Disable anonymous stats by default HOT 4
- Defining explicit targets for shared folders HOT 4
- Deploy a docker application HOT 1
- Deprecated Ansible file module property HOT 15
- Task freezes at "Update remote repository
- Task freezes at "Update remote repository" HOT 1
- Allow to ignore files with rsync strategy HOT 4
- Tag 3.11.0 does not appear on Ansible Galaxy HOT 1
- Deploy method: unarchive | Unable to pass extra_opts HOT 1
- Allow setting custom dest of get_url when using download deployment strategy HOT 4
- Strange tasks in `deploy/tasks/symlink-shared.yml` HOT 1
- The task includes an option with an undefined variable. HOT 1
- deploy fails with ansistrano_git_repo_tree that matches more than 1 directory
- Question/Bug: Git - Permission denied (publickey) - Update remote repository using SSH key HOT 2
- ansistrano.deploy was NOT installed successfully: missing required 'current_version' from server response (https://galaxy.ansible.com/api/) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deploy.