Okay =).

I could write it down in some kind of PHP so you get my point.

I have got:

hosts:
  - name: "domain.tld"
    database:
      name: test
      user: test
      pw: test
    systemUser: domain
    useApplication: true

This will create me /var/www/domain.tld with everything I normally need. No I 
add "useApplication" for example ownCloud.
The steps I need to do are:

* Download Zip File
* Extract Zip File
* Move Content of ZipFile Around ( important as owncloud.zip contains a folder 
named owncloud/ )
* Install a Template for the Settings
* Run a Database Dummy
* Remove WebDav
* Restart Apache

But only do that if there is no locking file. I do not want to have all of this 
done on each run and need some kind of if( ! file_exists(lockfile) ) 
doEverything();
And all of this should of course only happen if useApplication is set to true^^.

foreach($hosts as $item) {
        if( $item->useApplication ) {
                if( ! file_exsists( $item->getLockfile() ) ) {
                        doAllAbove();
                }
        }
}

Is this more clear?

Am 26.08.2014 um 00:26 schrieb Michael DeHaan <[email protected]>:

> Sorry, I'm no following the above.
> 
> Can we step back a moment?   
> 
> This appears to be a playbook that fixes various things in particular git 
> directories, if found, for a very large number of git directories?
> 
> Knowing what you are trying to do might help suggest a more idiomatic 
> solution.
> 
> 
> 
> 
> On Mon, Aug 25, 2014 at 2:58 PM, Bastian Bringenberg 
> <[email protected]> wrote:
> I am not able to figure out which array position is important for the current 
> item as:
> 
> 
> hosts:
> * 1 - noApplication ( ID = 3 )
> * 2 - Application ( ID = 2 )
> * 3 - Application ( ID = 42 )
> 
> would be 
> 
> * 1 ( ID = 2 )
> * 2 ( ID = 42 )
> 
> And I see no way to match those... Any Idea? Or is it possible without a lot 
> of problems to create a plugin in ansible to solve this problem?
> 
> Am Montag, 25. August 2014 10:46:30 UTC+2 schrieb Bastian Bringenberg:
> Hey ho,
> 
> I would like to deploy an application to several vhosts is 
> item.useApplication exists. I am possible to do that, download files and so 
> on and so on. But I get a problem as soon as I want to do an action if the 
> application is never installed.
> 
> Normally:
> 
> - stat: path=/etc/.git
>   register: exists_git
>   ignore_errors: yes
> 
> - lineinfile: dest=/etc/rkhunter.conf line='ALLOWHIDDENDIR="/etc/.git"' 
> owner=root group=root mode=0644
>   when: exists_git.stat.exists
> 
> But how is it possible for me to do this combined with "with_items"? One 
> approach, that (untested) will not work in my opinion:
> 
>  - stat: path=/etc/.git
>   register: exists_git_{{ item.name }}
>   with_items: hosts
>   when: item.useApplication
>   ignore_errors: yes
> 
> - lineinfile: dest=/etc/rkhunter.conf line='ALLOWHIDDENDIR="/etc/.git"' 
> owner=root group=root mode=0644
>   with_items: hosts
>   when: item.useApplication
>   when: exists_git_{{ item.name }}.stat.exists
> 
> Is someone able to help me here?
> 
> Have a nice week,
> Greetings from Bochum, RuhrArea, Germany,
> 
> Bastian
> 
> 
> PS: rkhunter is just a demonstration how I do this normally^^.
> 
> -- 
> 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/ceb291bf-8341-4b9f-a938-5315772725d7%40googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/ZP5szDnH0iI/unsubscribe.
> To unsubscribe from this group and all its topics, 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%2BnsWgwQ%3D7dScW-A%3DpC0%2BSZaihp8ecdY6N8ZQWEHDkeaS2ugbA%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/B261AC4F-7FBC-4CE4-9BE8-FFD0E73FD3F3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to