Comments (7)
Ok, I remember why I put the update=no
statement in the playbook: to avoid an undesirable update to the last version of a given branch (odoo_repo_rev
) when running the playbook a second time, which could bring regressions.
So, update
should be removed (it is set to yes
by default), and the clone task should not be run if the cloned directory already exists, as it is already done for Mercurial repositories. Is that ok for you?
from ansible-odoo.
That's how I've set up my extra repos, but it feels awkward (I had to
use a shell task).
I'm new to Ansible but I feel that's not what a play should do. It's
supposed to setup the target into a well known state, so if the config
says it's a branch we should probably just checkout the branch with no
further ado.
If we want a specific commit deployed we can set {{ odoo_repo_rev }}
.
from ansible-odoo.
I agree, but in a day-to-day work, I don't want to pick a changeset hash on the remote repo and update my Ansible configuration, as we make releases manually on the server. What if we add an option to ensure update=no/yes
(default yes
)?
To test if a directory exists, there is the stat
module: http://docs.ansible.com/stat_module.html#examples
from ansible-odoo.
I'm trying to use Ansible mainly to bootstrap/resync my development
hosts from the production server.
Come to think of it, what I want to do is simply point odoo_repo_url
,
and let Ansible reset the repo for me to the same state as production.
I'd even so far as to suggest we remove force=no
too, so we really
know what to expect.
Currently I use a custom bash script to do just that, and then
automatically merge all the dev branches in, so it feels most natural to me.
Still, I see your point, and when I bootstrap the production server I do
the same as you. I just fell dirty doing it. Here's how I do it for my
extra repos, let me know if you find a more proper way.
- shell: "[ -d /home/{{ odoo_user }}/{{ item }}/ ] ||git clone
git@git:/srv/git/odoo/{{item}}.git /home/{{ odoo_user }}/{{ item }}"
An option for |update=no/yes
|won't do the job, because git : update=no
has no "effect" (it only queries the remote server but
creates nothing locally).
You could add an option to decide whether to checkout every time (using
git: ... force=yes
), or only the first time (using shell:
). I
suggest it should be "checkout everytime" by default.
If that's too much trouble, you may just close this issue and I'll take
no offense: I think I can use tags to skip the git part of the role and
do my own stuff in my playbook.
from ansible-odoo.
That's right, by default it should be force=yes
and update=yes
as this is the purpose of an Ansible role as you said. I need to override these values, because sometimes we prefer to avoid this behaviour (e.g. I prefer not to lose non-committed changes on my development VM by running its playbook). For production servers the default behaviour is a better choice.
I will add two options odoo_repo_update: True
and odoo_repo_force: True
, with an identical behaviour for Git and Mercurial repositories.
from ansible-odoo.
Finally, I just added one option odoo_repo_update: True
+ remove the force
statement. Having equivalent control on the force
part with Hg and Git is a bit awkward, so one option is enough (there is no real need to have an update on the working copy but without lose uncommitted changes (playbook hanging on a merge is not acceptable...)).
With this option we can run playbooks repeatedly on development environments without risk of losing uncommitted changes, it's all what I wanted!
You can check my branch fix-issue-8
Is this ok for you?
from ansible-odoo.
Thanks, for the moment I've switch to a custom play to deploy all my git repos because of #2 but I think what you did is OK.
from ansible-odoo.
Related Issues (20)
- Odoo 12.0: does anyone start working on migrate the role ? HOT 1
- Is buildout still a viable option?
- wkhtmltox download failing on Ubuntu 16.04 Xenial HOT 3
- Installing the database Odoo via ansible HOT 3
- nginx role to configure odoo HOT 11
- odoo not working with variable workers > 0 HOT 15
- On (almost) vanilla Ubuntu 16.04, I get error: "Unable to find any of pip3 to use. pip needs to be installed." HOT 4
- Regression - Task "Create odoo data directory"
- use pip install with --pre when install type is 'pip' HOT 1
- Registering Odoo as a service in systemd: daemon-reload should be invoked HOT 2
- private repo on buildouts HOT 3
- Deploy odoo ansible HOT 3
- Odoo style compilation failed - lessc failure, no css, broken visuals HOT 13
- [TODO] Odoo 12.0 - Remove the NodeJS dependency
- Install via pip - how to proceed when a module already exists? HOT 3
- oca.odoo was not found on https://galaxy.ansible.com HOT 7
- wkhtmltox 0.12.4 Debian package not available anymore HOT 11
- Missing tool: psycogreen requires python-setuptools (failed on Stretch) HOT 3
- Phantom installation failed (Stretch)
- No log with systemd HOT 5
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 ansible-odoo.