Commit graph

2017 commits

Author SHA1 Message Date
John Kleint
1f8696f5c1 Fix inventory.get_hosts when hosts is a list. 2012-09-11 13:00:40 -04:00
Marco Vito Moscaritolo
0cdd081b53 Add support for ./ansible.cfg file
Ansible support configuration in:
```
~/.ansible.cfg
/etc/ansible/ansible.cfg
```

this patch add current user (usefull where user have some different projects) with the oreder:
```
./ansible.cfg
~/.ansible.cfg
/etc/ansible/ansible.cfg
```
2012-09-10 17:57:32 +03:00
Timothy Appnel
9d5a79f586 Made groups.groupname and group_names variables accessible in playbooks.
Also modified code that feeds the groups data structure to templates so
that it resolves groups inside of groups to hostnames.
2012-09-10 10:42:26 -04:00
Lorin Hochstein
b9e100a506 Support import of playbooks in other directories
Previously, importing a playbook in a different directory didn't
work because all of the relative paths were resolved relative to
the top-level playbook.

This patch resolves relative paths on a per-play level instead of
relative to the directory of the top-level playbook.

Also removes the dirname argument from the Play._get_vars method
since this argument wasn't used in the metho dbody.
2012-09-09 22:59:56 -04:00
Michael DeHaan
565f336182 lineinfile should use 'search' everywhere 2012-09-08 14:53:34 -04:00
Michael DeHaan
14a9c3ab9e Line in file regexep should match a portion of the line, not the whole line! 2012-09-07 21:03:59 -04:00
Michael DeHaan
95540f40b0 Add package to setup.py 2012-09-07 21:03:59 -04:00
Michael DeHaan
5b57011152 Merge pull request #1027 from mcodd/setup_bug_python24
setup not python24 compatible in 0.7
2012-09-08 05:24:09 -07:00
Michael DeHaan
335f136e71 Merge pull request #1023 from lorin/postgres-user-fix
Fix postgresql_user bug
2012-09-08 05:23:29 -07:00
Michael DeHaan
e795fa1ec2 Merge pull request #1014 from marktheunissen/journald
Fix regex that allows passwords to get into syslog, use journal if available.
2012-09-08 05:22:27 -07:00
Michael DeHaan
925c9eb38f Merge pull request #1021 from lorin/config-key
Have ansible respect private_key_file option
2012-09-08 05:21:02 -07:00
Michael DeHaan
8ebd228bd3 Merge pull request #1022 from skvidal/devel
add import sys to virt module b/c it needs it if the libvirt python
2012-09-08 05:20:07 -07:00
Matt Coddington
c0638842d8 make this python24 compatible 2012-09-07 22:47:03 -04:00
Michael DeHaan
aa91e11906 Merge pull request #1025 from dhozac/action_plugins-setup
Install action_plugins
2012-09-07 16:10:36 -07:00
Daniel Hokka Zakrisson
5b49a059ac Install action_plugins 2012-09-08 00:21:56 +02:00
Timothy Appnel
20fc6a29d3 Made groups.groupname and group_names variables accessible in playbooks. 2012-09-07 18:07:52 -04:00
Lorin Hochstein
b3b01bb7a3 Fix postgresql_user bug
If I create a database from scratch and assign permissions by doing:

      - name: ensure database is created
        action: postgresql_db db=$dbname

      - name: ensure django user has access
        action: postgresql_user db=$dbname user=$dbuser priv=ALL password=$dbpassword

Then it fails with the error:

  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 565, in <module>
    main()
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 273, in main
    changed = grant_privileges(cursor, user, privs) or changed
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 174, in grant_privileges
    changed = grant_func(cursor, user, name, privilege)\
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 132, in grant_database_privilege
    prev_priv = get_database_privileges(cursor, user, db)
  File "/tmp/ansible-1347048449.32-29998829936529/postgresql_user", line 118, in get_database_privileges
    r = re.search('%s=(C?T?c?)/[a-z]+\,?' % user, datacl)
  File "/usr/lib/python2.7/re.py", line 142, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or buffer

This fix fixes the problem by not executing the regex if the
db query on pg_database returns None.
2012-09-07 16:24:00 -04:00
Seth Vidal
9d88b3eedd add import sys to virt module b/c it needs it if the libvirt python
module is missing
2012-09-07 16:05:42 -04:00
Lorin Hochstein
eabbaaec46 Have ansible respect private_key_file option
The ansible command-line tool was ignoring the private_key_file option.
2012-09-07 14:37:32 -04:00
Lorin Hochstein
869a97e1cb Fix comment in example config file.
The config file incorrectly mentions the --private-key-file flag.
Should be --private-key
2012-09-07 14:34:36 -04:00
Michael DeHaan
0709c48f64 Merge pull request #1018 from willthames/template_perms
Fix templates for non root sudo_user
2012-09-07 05:20:02 -07:00
willthames
f456d999a9 Fix templates for non root sudo_user
When using template module, if a restrictive umask is set, the
sudo_user won't be able to read the /tmp/ansible-dir/source file
after it is copied across following _transfer_str

I wonder if this behaviour shouldn't be abstracted somehow (as
this correction also happens after put_file in the copy module too)
2012-09-07 16:35:53 +10:00
Mark Theunissen
c25ead382c Adapt module common code to use the systemd journal if it's available 2012-09-06 17:59:38 -07:00
Michael DeHaan
022b2290bb Changelog update for 0.8 initial merges 2012-09-06 20:58:23 -04:00
Michael DeHaan
dc14681530 rename isset to is_set 2012-09-06 20:55:27 -04:00
Michael DeHaan
8621539341 Merge branch 'only_if-isset' of https://github.com/dhozac/ansible into devel 2012-09-06 20:55:11 -04:00
Michael DeHaan
4280e00d56 Merge pull request #1000 from mavimo/patch-1
Add support to removes control param
2012-09-06 17:52:02 -07:00
Michael DeHaan
7ef3e7dccb Merge pull request #1003 from bladypirat/devel
added support for custom port definition for postgresql_* modules
2012-09-06 17:51:35 -07:00
Michael DeHaan
49bef3f6c2 Merge pull request #1005 from dagwieers/cmdline
Add /proc/cmdline information to the default facts
2012-09-06 17:51:19 -07:00
Michael DeHaan
fa71237f8a Merge pull request #1012 from jpmens/sshhostkeysosx
Add support for RSA/DSA SSH host key detection in setup module for OS/X
2012-09-06 17:50:32 -07:00
Michael DeHaan
ba97ad13e3 Merge pull request #1010 from tima/yaml-jinja
Added to_yaml and from_yaml filters to Jinja environment.
2012-09-06 17:50:01 -07:00
Michael DeHaan
8a09e1281b Fixup modularized template module 2012-09-06 19:04:27 -04:00
Michael DeHaan
633e513a65 Modular server-side actions (squash merge) 2012-09-06 18:57:04 -04:00
Michael DeHaan
975c323e39 Release version bump 2012-09-06 18:56:38 -04:00
Michael DeHaan
979b778430 Spec version fixes 2012-09-06 18:53:01 -04:00
Michael DeHaan
2bf9a92bb6 Don't load plugins starting with "_". 2012-09-06 18:46:15 -04:00
Michael DeHaan
6fb1884a03 Add __init__'s to git 2012-09-06 18:43:28 -04:00
Michael DeHaan
4920533c05 Add --limit to manpage 2012-09-06 18:42:18 -04:00
Jan-Piet Mens
b36aa61237 Add support for RSA/DSA SSH host key detection in setup module for OS/X
s/<8spaces>/<4spaces>/g
2012-09-06 20:40:21 +02:00
Timothy Appnel
23cd7ad08a Added to_yaml and from_yaml filters to Jinja environment. 2012-09-06 10:19:56 -04:00
Anastasis Andronidis
02510ec2ff --version is now taking the correct head 2012-09-06 15:18:29 +03:00
Dag Wieers
d158218c3f Add /proc/cmdline information to the default facts
The use-case here is that based on information in the /proc/cmdline certain actions can be taken.

A practical example in our case is that we have a play at the end of the provisioning phase that reboots the system. Since we don't want to accidentally reboot a system (or restart the network) on a production machine, having a way to separate an Anaconda post-install (sshd in chroot) with a normal system is a good way to make that distinction.

    ---
    - name: reboot
      hosts: all
      tasks:
      - action: command init 6
        only_if: "not '${ansible_cmdline.BOOT_IMAGE}'.startswith('$')"

A practical problem here is the fact that we cannot simply check whether it is set or empty:

    ---
    - name: reboot
      hosts: all
      tasks:
      - action: command init 6
        only_if: "'${ansible_cmdline.BOOT_IMAGE}'"

If ansible_cmdline was a string, a simple only_if: "'${ansible_cmdline}'.find(' BOOT_IMAGE=')" was an option, but still not very "beautiful" :-/

This implementation uses shlex.split() and uses split(sep, maxsplit=1).
2012-09-06 09:35:33 +02:00
Daniel Hokka Zakrisson
14db2fa376 Add an isset("$var") function to only_if 2012-09-05 23:18:47 +02:00
Piotr Kweclich
8360f9f46c added support for custom port definition 2012-09-05 18:18:30 +02:00
Marco Vito Moscaritolo
2dd430d9c0 Add support to removes control param
Execute action only if specified file using param removes exist (execute reverse control of creates).

Some usage eg.:

```yaml
- name: enable apache2 default websites
  action: command /usr/sbin/a2ensite $item
creates=/etc/apache2/sites-enabled/$item
  with_items:
    - default
    - default-ssl

- name: disable apache2 default websites
  action: command /usr/sbin/a2dissite $item
removes=/etc/apache2/sites-enabled/$item
  with_items:
    - default
    - default-ssl
```
2012-09-05 14:06:47 +03:00
Michael DeHaan
f41d3b9bd2 Fix skipped callback 2012-09-04 21:56:32 -04:00
Michael DeHaan
eed031cd82 Check for ipv6 2012-09-04 21:22:47 -04:00
Michael DeHaan
96f257cea1 Fix invocation-output-supression code to still provide invocation data to the callbacks. 2012-09-04 21:16:12 -04:00
Michael DeHaan
2843e31e09 Don't add 'n/a' because if running from source there will be no git 2012-09-04 21:07:29 -04:00
Michael DeHaan
0c386b0514 Merge pull request #993 from andronat/repo-as-submodule
Fixed a parsing HEAD problem, when ansible is checked out as a submodule
2012-09-05 17:04:09 -07:00