Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Juju Charm using Ansible #1

Open
sebas5384 opened this issue Mar 17, 2014 · 6 comments
Open

Juju Charm using Ansible #1

sebas5384 opened this issue Mar 17, 2014 · 6 comments
Labels

Comments

@sebas5384
Copy link
Contributor

Hey! congrats for the work!

I'm currently working in a Drupal Juju charm, but! and using the Perusio configs, and I already was considering a CM for doing that, currently it's all in shell scripts.
https://github.com/TallerWebSolutions/devops/tree/master/charms/saucy/drupal

The thing is, that the charm can use Ansible, so, we can work together in this, what you say?

I give it a look at your code, and I'm worried about loosing the updates from the Perusio confs, but hey thats something we can see in the future.

@pbuyle
Copy link
Member

pbuyle commented Mar 17, 2014

I'm also worried about tracking changes to perusio's config for files overridden using parametrized templates. But perusio config can not be used out of the box in most case, it requires edition of the files that are overridden using template.

That's why I used the same files structure for the template, so one can easily identify which files in perusio's config a template override. It should then be easier to identify changes that need to be ported to the template.

Unfortunately, perusio's config has no release version which make it harder to keep track of the changes. I updated each template with the git reference used to retrieve the source file.

I don't known JuJu Charming, but if a charm can use Ansible, then I guess it would be a playbook. The charm playbook could use this role to configure Nginx. The playbook will still need to install Nginx separately. Either in a shell script, or using Ansible tasks/roles. So I guess you can develop a charm using an ansible playbook, and include the role in its git repository as a submodule.

If you have any shortcomings with the current state of the role, please fill an issue and if possible, suggest the change need to correct them, or create a pull request.

@sebas5384
Copy link
Contributor Author

Great! I'll start by forking then.
Here's the repository of the Juju charm:
https://github.com/sebas5384/charm-drupal

@sebas5384
Copy link
Contributor Author

@pbuyle I have some questions:

  • With which version of Nginx are you using this role? if..., can you tell me how?
  • I compile the Nginx 1.4 because of nginx modules dependency, you are using an specific role?

Thanks!

@pbuyle
Copy link
Member

pbuyle commented Mar 19, 2014

I'm running nginx 1.4.6, installed on Ubuntu precise64 using the nginx package from https://launchpad.net/~nginx/+archive/stable. I'm using php-fpm installed using https://travis-ci.org/NBZ4live/ansible-php-fpm.

Here are the relevant sections of my playbook.xml file

- hosts: all
  ...
  pre_tasks:
    ...
   - name: Install apt_repository dependencies packages
     apt: pkg={{ item }} state=present
     with_items:
      - python-pycurl
   - name: Add APT repositories
     apt_repository: repo="{{item}}" state=present update_cache=yes
     with_items:
       - ppa:ondrej/php5-oldstable
       - ppa:nginx/stable
   - name: Install nginx-drupal dependencies packages
     apt: pkg={{ item }} state=present
     with_items:
      - git
      - nginx
     notify:
  ...
  roles:
    ...
    - role: php-fpm
    ...
      fpm_pools:
        - pool:
            name: drupal
            vars:
             - user = www-data
             - group = www-data
             - listen = /var/run/php5-fpm.sock
             - pm = dynamic
             - pm.max_children = 5
             - pm.start_servers = 2
             - pm.min_spare_servers = 1
             - pm.max_spare_servers = 3
             - chdir = /
    ...
    - role: nginx-drupal
      nginx_drupal_sites:
        - file_name: default
          root: /var/www
          http:
            port: 80
          https:
            port: 443
            certificate: /etc/nginx/ssl/default.crt
            certificate_key: /etc/nginx/ssl/default.pem
          server_name: "{{domain}}"
          alternate_server_name: "{{fqdn}}"
      nginx_drupal_nginx_status_allowed_hosts: ["127.0.0.1", "10.0.3.0/24"]
      nginx_drupal_php_fpm_status_allowed_hosts: ["127.0.0.1", "10.0.3.0/24"]
      nginx_drupal_upload_progress: false
      nginx_drupal_aio: false
      nginx_drupal_flv_streaming: false
      nginx_drupal_mp4_streaming: false
      nginx_drupal_upstream_servers: ["unix:/var/run/php5-fpm.sock"]
      nginx_drupal_upstream_backup_servers: []
  ...

As you can see, I disable a couple of features because they weren't not supported by my nginx installation.

@sebas5384
Copy link
Contributor Author

Hey @pbuyle !! here's the charm working with the some ansible roles, and one of those is this one!

https://github.com/sebas5384/charm-drupal

Thanks!, and btw we are not going to stop sending pull requests.

@PierrePaul
Copy link

Very neat @sebas5384, I will try it next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants