Repository: brooklyn-docs Updated Branches: refs/heads/master ba01df1a3 -> 68ec56c37
Update YAML example to newer syntax Does 2 things: - update `serviceType` to `type` - update `start.latch` to `latch.start` Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/e9cec2c2 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/e9cec2c2 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/e9cec2c2 Branch: refs/heads/master Commit: e9cec2c23fe5b27eccb4ff060330b7615d4e30f0 Parents: ba01df1 Author: Thomas Bouron <[email protected]> Authored: Thu Nov 9 10:19:16 2017 +0000 Committer: GitHub <[email protected]> Committed: Thu Nov 9 10:19:16 2017 +0000 ---------------------------------------------------------------------- .../ansible/creating-ansible-blueprints.md | 154 ++++++++++--------- 1 file changed, 78 insertions(+), 76 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/e9cec2c2/guide/blueprints/ansible/creating-ansible-blueprints.md ---------------------------------------------------------------------- diff --git a/guide/blueprints/ansible/creating-ansible-blueprints.md b/guide/blueprints/ansible/creating-ansible-blueprints.md index 9fe4ace..8707363 100644 --- a/guide/blueprints/ansible/creating-ansible-blueprints.md +++ b/guide/blueprints/ansible/creating-ansible-blueprints.md @@ -126,44 +126,45 @@ There is no specific configuration in AnsibleEntity for Ansible [Roles](http://d AnsibleEntity might require. The second child uses `attributeWhenReady` to block until the first is ready, before starting the AnsibleEntity to apply the desired playbook. - - 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 - latch.start: $brooklyn:entity("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 +```yaml +name: multi +location: + red1 +services: +- type: brooklyn.entity.basic.SameServerEntity + name: Entities + brooklyn.children: + + - type: 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 + + - type: org.apache.brooklyn.entity.stock.BasicApplication + latch.start: $brooklyn:entity("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 +``` An alternative to the above is to use Ansible itself to do the waiting, as in the variant below, which uses AnsibleEntity @@ -171,41 +172,42 @@ itself in the first SameServerEntity child, to install the required material. I AnsibleEntity rather than a BasicApplication, Ansible's `wait_for` operation is used as the first step in the playbook, to block the remaining steps in its playbook until the first is complete. - 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: - - command: rm -f /tmp/bootstrap.done - - 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 - - file: path=/tmp/bootstrap.done state=touch - - - serviceType: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity - name: test - service.name: tomcat - playbook: tomcat - playbook.yaml: | - --- - - tasks: - - wait_for: path=/tmp/bootstrap.done - include: /etc/ansible/playbooks/ansible-examples-master/tomcat-standalone/site.yml - vars: - http_port: 8080 - https_port: 8443 - admin_username: admin - admin_password: secret - +```yaml +name: multi +location: + red1 +services: +- type: brooklyn.entity.basic.SameServerEntity + name: Entities + brooklyn.children: + + - type: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity + id: bootstrap + service.name: crond + playbook: bootstrap + playbook.yaml: | + --- + - hosts: localhost + tasks: + - command: rm -f /tmp/bootstrap.done + - 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 + - file: path=/tmp/bootstrap.done state=touch + + - type: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity + name: test + service.name: tomcat + playbook: tomcat + playbook.yaml: | + --- + - tasks: + - wait_for: path=/tmp/bootstrap.done + include: /etc/ansible/playbooks/ansible-examples-master/tomcat-standalone/site.yml + vars: + http_port: 8080 + https_port: 8443 + admin_username: admin + admin_password: secret + ```
