I have solved my issue by providing a variable to the deploy task,
which will in turn include that.
But it does feel somewhat like writing try-catch-finally behaviour
code in C, having to split all the before, between and after stuff
into separate files (functions).
includes: git-deploy.yml
vars:
before_migrate_tasks: my-hook.yml
@@@ git-deploy.yml
- prepare_tasks
- include: {{ before_migrate_tasks }}
- migrate_tasks
On 18 August 2014 14:27, Michael DeHaan <[email protected]> wrote:
> "and the current proposal feel kind of hackish"
>
> A matter of opinion, clearly, which I don't think is fair to those
> discussing it unless you can present a better proposal.
>
> In any event, group discussion should happen on ansible-devel, not on
> GitHub.
>
>
>
> On Mon, Aug 18, 2014 at 8:26 AM, Michael DeHaan <[email protected]> wrote:
>>
>> There's not a github issue.
>>
>> Generally we don't want to see feature request tickets (GitHub ticket
>> organization is a giant pain -- though we'll leave them open when someone
>> has a especially good idea), so it's mostly a matter of getting the work
>> done. We've got a note to look at this in 1.8 timeframe.
>>
>>
>>
>>
>> On Mon, Aug 18, 2014 at 7:44 AM, Kim Ausloos <[email protected]> wrote:
>>>
>>> Hi Michael,
>>>
>>> Is there a github issue for the module proposal you are talking about? I
>>> have multiple use cases for includes with_fileglob ( for example
>>> https://gist.github.com/anonymous/1691f3ab625175011449 ) and the current
>>> proposal feel kind of hackish. It could, of course, be me because I'm not
>>> using ansible professionally...
>>>
>>> Thanks!
>>> Kim
>>>
>>>
>>>
>>> On Sunday, August 17, 2014 3:05:07 PM UTC+2, Michael DeHaan wrote:
>>>>
>>>> There are various approaches to this, but here's an example role that
>>>> does this:
>>>>
>>>> https://github.com/f500/ansible-project_deploy
>>>>
>>>> We're talking about making a helper module in Ansible 1.8 timeframe that
>>>> would make a lot of this easier without needing a custom role.
>>>>
>>>> While you cannot use "include" together with a "with_items", you can
>>>> pass a list to a role, and then loop inside the role on each task.
>>>>
>>>> - { role: name: 'foo', stuff: a_list }
>>>>
>>>> # in tasks file:
>>>>
>>>> - shell: echo parameter is {{ item }}
>>>> with_items: a_list
>>>>
>>>> Etc
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sun, Aug 17, 2014 at 5:32 AM, Akos Vandra <[email protected]> wrote:
>>>>>
>>>>> Hello!
>>>>>
>>>>> I'm struggling with importing the functionality of deploy_revision from
>>>>> chef to ansible.
>>>>>
>>>>> In case of ruby this means the following steps:
>>>>>
>>>>> - checkout git repo to /revisions/sha1
>>>>> - run bundle install in there
>>>>> - create necessary custom configuration files
>>>>> - take any necessary custom steps to configure the installation
>>>>> - update symlink of /current to point to /revisions/sha1
>>>>>
>>>>> Now what I'd like to do is to put steps 1,2,5 into a separate task
>>>>> file, and use it like this:
>>>>>
>>>>> - include: ../../common/tasks/ruby-git-deploy.yml
>>>>> deploy_dir: /opt/water/revisions
>>>>> deploy_revision: master
>>>>> deploy_repository: [email protected]/.....
>>>>>
>>>>> tasks_before_symlink:
>>>>> - roles/water-meter/setup.yml
>>>>> - roles/common/rake_db_migrate.yml
>>>>>
>>>>> the tasks_before_symlink would point to the tasks files that would
>>>>> carry out steps 3,4, but I seem to be unable to include them:
>>>>>
>>>>> - include: '{{item}}'
>>>>> with_items: {{ tasks_before_symlink }}
>>>>>
>>>>> complains about deprecated code:
>>>>>
>>>>> ERROR: [DEPRECATED]: include + with_items is a removed deprecated
>>>>> feature (in
>>>>> /Users/avandra/projects/freelancer/liveoaksys/water-playbook/roles/common/tasks/ruby-git-deploy.yml).
>>>>> Please update your playbooks.
>>>>>
>>>>> There is no realy pointer on what is the "new way" to do this, can you
>>>>> help me out?
>>>>>
>>>>> Regards,
>>>>> Akos Vandra
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Ansible Project" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>>
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/ansible-project/b8047675-4fa4-499c-90b1-e34b02ab2133%40googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/6a24cbc3-310c-4e48-9e8b-6693c105c004%40googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyqktOj0dSajXmARPgy5wo%3DpHjYWfAzm5G%2BinkT%2BN78cw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAHHcNoe3AN%3D%3D0uk51XTJCWZGfmhqC6oYA_P03%3DDHxPc6yAWDVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.