brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <...@git.apache.org>
Subject [GitHub] brooklyn-library pull request: Add creation of /etc/ansible hosts ...
Date Fri, 11 Mar 2016 17:31:15 GMT
GitHub user geomacy opened a pull request:

    https://github.com/apache/brooklyn-library/pull/18

    Add creation of /etc/ansible hosts during install.

    This allows replacement of the command form
    
       ansible-playbook -i \"localhost,\" -c local  whatever
    
     with
    
       ansible-playbook whatever
    
     and also supports the possibility that playbooks can modify the hosts file e.g. by adding
additional groups that included roles require.
    
     For example the following playbook modifies the hosts to add a tomcat-server group, in
order to install an example ansible from the github examples repo.
    
     name: multi
     location:
       red1
     services:
     - serviceType: brooklyn.entity.basic.SameServerEntity
       name: Entities
       brooklyn.children:
    
       - serviceType: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity
         id: bootstrap
         service.name: crond
         playbook: bootstrap
         playbook.yaml: |
             ---
             - hosts: localhost
               tasks:
               - shell: printf "[tomcat-servers]\nlocalhost ansible_connection=local\n" >>
/etc/ansible/hosts
               - file: path=/etc/ansible/playbooks state=directory mode=0755
               - get_url: url=https://github.com/ansible/ansible-examples/archive/master.zip
dest=/tmp/master.zip mode=0440
               - command: unzip -o -d /etc/ansible/playbooks /tmp/master.zip
    
       - serviceType: org.apache.brooklyn.entity.stock.BasicApplication
         start.latch: $brooklyn:component("bootstrap").attributeWhenReady("service.isUp")
         brooklyn.children:
         - type: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity
           name: test
           service.name: tomcat
           playbook: tomcat
           playbook.yaml: |
               ---
               - hosts: localhost
               - include: /etc/ansible/playbooks/ansible-examples-master/tomcat-standalone/site.yml
                 vars:
                     http_port: 8080
                     https_port: 8443
                     admin_username: admin
                     admin_password: secret

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/geomacy/brooklyn-library ansible-host-file

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-library/pull/18.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18
    
----
commit cf65e18d1b775d3528c9ba05c1229d748a6807bd
Author: Geoff Macartney <geoff.macartney@cloudsoftcorp.com>
Date:   2016-03-11T17:25:25Z

    Add creation of /etc/ansible hosts during install.
    
    This allows replacement of the command form
    
       ansible-playbook -i \"localhost,\" -c local  whatever
    
     with
    
       ansible-playbook whatever
    
     and also supports the possibility that playbooks can modify the hosts file e.g. by adding
additional groups that included roles require.
    
     For example the following playbook modifies the hosts to add a tomcat-server group, in
order to install an example ansible from the github examples repo.
    
     name: multi
     location:
       red1
     services:
     - serviceType: brooklyn.entity.basic.SameServerEntity
       name: Entities
       brooklyn.children:
    
       - serviceType: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity
         id: bootstrap
         service.name: crond
         playbook: bootstrap
         playbook.yaml: |
             ---
             - hosts: localhost
               tasks:
               - shell: printf "[tomcat-servers]\nlocalhost ansible_connection=local\n" >>
/etc/ansible/hosts
               - file: path=/etc/ansible/playbooks state=directory mode=0755
               - get_url: url=https://github.com/ansible/ansible-examples/archive/master.zip
dest=/tmp/master.zip mode=0440
               - command: unzip -o -d /etc/ansible/playbooks /tmp/master.zip
    
       - serviceType: org.apache.brooklyn.entity.stock.BasicApplication
         start.latch: $brooklyn:component("bootstrap").attributeWhenReady("service.isUp")
         brooklyn.children:
         - type: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity
           name: test
           service.name: tomcat
           playbook: tomcat
           playbook.yaml: |
               ---
               - hosts: localhost
               - include: /etc/ansible/playbooks/ansible-examples-master/tomcat-standalone/site.yml
                 vars:
                     http_port: 8080
                     https_port: 8443
                     admin_username: admin
                     admin_password: secret

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message