--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/56b70dd6-6b0c-44c5-a35f-32af8d149826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You can already do:
- action: "{{ ansible_pkg_mgr }}" name=some-pkg-name
On Sunday, June 7, 2015, Michael Johnson <ther...@gmail.com> wrote:
It has always sort of bothered me that ansible does not have a generic 'package' module that you then can tell it what 'provider' to use if you want to override the default like other tools such as puppet.--While doing some searching on the topic, I found this:That issue asks about this same question and the core of the response seems to be the last part of the last sentence:"as you have to make exemptions so many times, it really causes problems down the road."While I can somewhat understand this philosophy, it does not seem to been one that is internally consistent. Take the 'service' module for example. Services can require just as many exemptions as packages. If this philosophy is really the sticking point, why don't we have 'systemd_service', 'smf_service', 'upstart_service', etc.?There may very well be a good explanation for the apparent inconsistency, but I am not seeing it. Can anyone explain why these two things which seem very similar to me are treated very differently in ansible?Would the ansible project be open to having a unified 'package' module?
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/56b70dd6-6b0c-44c5-a35f-32af8d149826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You can already do:- action: "{{ ansible_pkg_mgr }}" name=some-pkg-name
- include: install_packages.yml
pkgs: !platform
- apache::
Debian: apache2
RedHat: httpd
- mod_authnz_external::
Debian: libapache2-mod-authnz-external
- python-passlib:: # needed for Ansible's htpasswd module
Gentoo: dev-python/passlib
- pwauth
tags:
- apache/setup
- name: "disable SSLv2 & SSLv3"
lineinfile:
dest: !platform
Debian: /etc/apache2/mods-available/ssl.conf
Gentoo: /etc/apache2/vhosts.d/00_default_ssl_vhost.conf
RedHat: /etc/httpd/conf.d/ssl.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^\s*SSLProtocol ', line: 'SSLProtocol ALL -SSLv2 -SSLv3' }
notify:
- reload apache
tags:
- apache/setup
@Christian, those are my thoughts for the future of the service
module, this package module will serve as a template on how to split
it and keep backwards compatibility using the generic module as a
placeholder. Just need to add service system detection to facts and
then use those internally.
As for keeping the policy in a single place, the same can be achieved
by just making the ssl cipher string into a common variable and then
have each template reference it. This does not work for all cases but
I find it better to keep specific tasks for each OS and then abstract
the common data, than the reverse which abstracts the common task but
requires abstracting the non-common data.
Again, I'm all for choice, in this case I think it is an illusion as
you update 1 common yaml file and 2 non-common yaml files vs 2 common
yaml files and 1 non-common yaml file.
- include: install_packages.yml
pkgs: !platform
- php::
Debian: php5
RedHat: php55w
- Debian: php5-cli
RedHat: php55w-cli
- Debian: php5-curl
notify:
- reload apache
tags:
- apache/php/setup
lineinfile:
dest: !platform
Ubuntu14: /etc/apache2/sites-enabled/000-default.conf
Ubuntu12: /etc/apache2/sites-enabled/000-default
Ubuntu10: /etc/apache2/sites-enabled/000-default
# vars file
foo:
Debian: bar
Ubuntu: baz
Gentoo: abc
# Jinja template
{{ foo|selectby(['Gentoo']) }} == abc
{{ foo|selectby(['Debian', 'Ubuntu']) }} == bar
{{ foo|selectby(['Ubuntu', 'Debian']) }} == baz
# vars file
foo: !platform
Debian: bar
Ubuntu: baz
Gentoo: abc
# Jinja template
{{ foo }} == abc if ansible_os_family == 'Gentoo'
{{ foo }} == bar if ansible_os_family == 'Debian' and not ansible_distribution == 'Ubuntu'
{{ foo }} == baz if ansible_distribution == 'Ubuntu'
foo1:
- !platform
Debian: bar
- !platform
Debian: barbara
foo2: !platform
- Debian: bar
- Debian: barbara
foo: !platform
default-value::
Debian: override-value
{{ foo }} == ('override-value' if ansible_os_family == 'Debian' else 'default-value')
- name: install python-passlib action: "{{ ansible_pkg_mgr }} name={{ item.name }}" with_items: - { os: Gentoo, name: dev-python/passlib } when: ansible_os_family == item.os