Something-driven development

Software development thoughts around Ubuntu, Python, Golang and other tools

Bootstrap your ansible-powered juju charm

with 4 comments

After working with InformatiQ to setup a new charm using the ansible support (and ironing out a few issues), it made sense to capture the process…

The README at charm-bootstrap-ansible has the details, but the branch will pull in the required charm-helpers library and run the tests, leaving you ready to deploy and explore.

Hopefully I can get this into the charm-create tool eventually.

Written by Michael

November 20, 2013 at 5:35 pm

Posted in bzr, juju

4 Responses

Subscribe to comments with RSS.

  1. one thought i got
    for an upgradeable charm (upgraded service that is) the ansible script might be called all of it on upgrade
    so basically all tasks are tagged with charm-upgrade apart form what their tag is
    ansible is idempotent so rerunning the tasks will ensure it adapts to all changes in the upgraded ansible playbook and so on

    Ramez Hanna

    November 21, 2013 at 11:52 pm

    • Interesting – the upgrade-charm hook would call “ansible-playbook -i local playbooks/site.yaml” without any tags? That could work and would be neat, but I think it would be a bit too much magic.

      I mean, you may have tasks tagged with ‘stop’ which are to be executed only when the charm is stopped. It could still work with that knowledeg – you just need to be careful with the ordering of tasks, but it might be easier and more explicit to just add the hook:

      @hooks.hook('upgrade-charm')
      def upgrade_charm():
          """Run the complete playbook on upgrade rather than tasks with specific tags."""
          charmhelpers.contrib.ansible.apply_playbook('playbooks/site.yaml')
      

      Or do you think it’d be better for that to happen automatically for upgrade-charm?

      Michael

      November 22, 2013 at 11:04 am

      • no your approach is better in that sense, i had not thought about the case of a start hook
        need more practice…

        Ramez Hanna

        November 22, 2013 at 11:29 am

  2. […] wsgi applications… some Django apps, others with other frameworks. I’ve been using the ansible support for writing charms which makes charm authoring simpler, but even then, essentially each wsgi service charm needs to do […]


Leave a comment