Commit Graph

266 Commits (7cb489eca3bb167ac9e22b310075e944b8254a27)

Author SHA1 Message Date
Eric Lake 7f9736198a add distribution_major_version to fact gathering 11 years ago
James Cammarata 82b24c162e Adding delimiter fixes to action_plugin + fixing local assembling with a delimiter
Also added a new integration test for assemble using local assembly
with a delimiter.
11 years ago
Harlan Lieberman-Berg 876b8085aa Add directory_mode to common file parameters to prevent errors. 11 years ago
Tim G c307a73e28 Check for errors from adb, may not work on all systems. 11 years ago
Tim G 285d4f3fa6 If memory not available in syslog.log, catch error, attempt to find it with adb 11 years ago
GuiGui2 b9613665dd Setup module: Additional facts when using ansible with Linux on System z
- Improved parsing of /proc/cpuinfo to take the specifics of Linux on
System z. ansible_processor and ansible_processor_cores are now
completed.
- Also improved virtualization facts in the same environment, parsing
the output of /usr/bin/lscpu to populate virtualization_type and
virtualization_role more precisely. If lscpu is not available, then
stick to the previous behavior.
11 years ago
James Cammarata b698f7a44b Add option to create host_key directory if it doesn't exist
Fixes #6731
11 years ago
Michael DeHaan a6b25e8657 Allow type=list module arguments to accept integers and floats. 11 years ago
Michael DeHaan 9921f804f9 Merge pull request #6643 from herbygillot/fact-full-hostname
Add a fact providing the full hostname, without the domain portion
11 years ago
Cristian Ciupitu 1eaf85b89f Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
11 years ago
James Tanner 3194fbd365 Fixes #6655 catch unicode encoding errors before sending to syslog 11 years ago
James Cammarata 4ea12c1b86 Make sure stat of dest is available in atomic_move
Fixes #6682
11 years ago
Michael DeHaan 3eecc039b9 Merge pull request #6656 from Jmainguy/setup
Added ansible_date_time.weekday as a fact. This returns Monday,Tuesday,W...
11 years ago
Herby Gillot 94297950a0 Name platform.node() fact as "nodename" 11 years ago
Sébastien Gross ef6b437d0d Fix TypeError when using old simplejson lib.
On some very old simplejson does not support the 'encoding' and give
following exception:

   TypeError: __init__() got an unexpected keyword argument 'encoding'

This fix runs json.dump with no encoding key (such as before #a023cb) on
TypeError exception only.
11 years ago
James Cammarata bc93732b1d Catch permissions errors related to opening a known_hosts file in modules
Fixes #6644
11 years ago
James Cammarata db345391e3 Fixing ownership when atomic_move is creating a file while sudo'ing
Fixes #6647
11 years ago
Jonathan Mainguy b17b5ad85b Added ansible_date_time.weekday as a fact. This returns Monday,Tuesday,Wednesday,Thursday,Friday,Saturday, or Sunday depending on the remote servers time. Useful for backups the way I use it 11 years ago
James Cammarata bb723bedee Merge branch 'atomic_move_restore_owner_group_rebase' of https://github.com/tyll/ansible into tyll-atomic_move_restore_owner_group_rebase 11 years ago
Herby Gillot c0886a5f3a Add a fact providing the full hostname, without the domain portion
truncated.
11 years ago
Francisco José Marques Vieira e9d7476c28 Add missing sha1 import on known_hosts.py 11 years ago
Till Maas 898a38b074 module_utils/atomic_move(): Use tempfile module
Fix a potential race condition by using the tempfile module.
11 years ago
Till Maas 8f778a83df module_utils/atomic_move(): Restore owner/group
Manually restore owner and group if both src and dest are on a separate
file system.
11 years ago
James Cammarata 4880cfb5ea Merge pull request #6568 from sivel/ssl-cert-validation-osx
Make SSL verification on Mac OS X work out of the box
11 years ago
James Tanner 67517e96d3 Fixes #6567 put the git wrapper script in the module temp dir 11 years ago
Matt Martz 1d3d73a0b6 Only write the DUMMY_CA_CERT on OS X 11 years ago
Matt Martz 3b5aa8bd30 Provide a dummy ca to allow OS X to do it's OpenSSL keychain magic 11 years ago
James Cammarata 3f5440f7df Make modules set a valid working directory
Fixes #6546
11 years ago
Michael DeHaan 13f69dad05 Merge pull request #6527 from patrickheeney/hosts-bug
Fix for hostkey directory
11 years ago
James Cammarata 5d8c9d3f0f Merge branch 'file_fixes_clean' of https://github.com/bcoca/ansible into bcoca-file_fixes_clean 11 years ago
patrickheeney a9aab23f11 Fix for hostkey directory 11 years ago
Greg Dallavalle 77229553a3 fetch_url: Avoid credential stripping for FTP-scheme URLs 11 years ago
Michael DeHaan b0dbc61d63 Move facts to 'module_utils' so they can be referenced by other modules. Note unlike other module_utils/ dirs this keeps the original
license -- so usage of facts code in modules will be limited to GPLv3 modules.
11 years ago
Brian Coca 2d25577e11 Fixes and cleanup to file functions and module
- unified set attribute functions ... not sure why 2 identical functions
exist with diff names, now there are 3 while i repoint all modules to 1
- fixed issue with symlinks being created w/o existing src when force=no
- refactored conditionals, simplified where possible
- added tests for symlink to nonexistant source, with both force options
- made symlink on existing attomic (force)
11 years ago
James Cammarata a0cb974575 Be sure to return to the old directory if cwd is set in run_command 11 years ago
James Tanner a348f67238 Reset the current directory after running subprocess.Popen 11 years ago
James Cammarata 677008bef7 Rejoin args list into a string for run_command when using an unsafe shell
This allows the use of an args list with leading environment variables,
which otherwise would fail due to the way Popen works.
11 years ago
James Cammarata 5233d4bc31 Fix typo in run_command when sending data that is not binary 11 years ago
James Cammarata b1a37dcc08 Revert "Rejoin args list into a string for run_command when using an unsafe shell"
This reverts commit 4273cb2d8e.
11 years ago
James Cammarata 4273cb2d8e Rejoin args list into a string for run_command when using an unsafe shell
This allows the use of an args list with leading environment variables,
which otherwise would fail due to the way Popen works.
11 years ago
James Cammarata 303e085f8b Only use cwd in run_command kwargs if the directory exists 11 years ago
James Cammarata 60a7f57300 Make sure the cwd exists in run_command before trying to use it 11 years ago
Dan Koch bbf320fd22 Work around for cwd stat problems with run_command and sudo
This fixes issue #6443
11 years ago
James Cammarata 2c7d58abe0 Compile ca certs into a temp file to reduce number of attempts
For those who may have a large number of certs found, this can reduce
the number of ssl connections attempted.
11 years ago
Michael DeHaan d37f0c6d12 Use same implementation as ssh.py for "is in host file" checks in module code, prevents git module from adding keys more than once. 11 years ago
Michael DeHaan 6d841d120e Don't process shell commands as arrays. 11 years ago
James Cammarata a9017af2bb Adding validate_certs to all modules that use fetch_url 11 years ago
Michael DeHaan cfabc2e28a module.run_command is intended to bypass the shell here, so can't do ">>" 11 years ago
James Cammarata 7f38cff989 Remove unused code from get_ca_certs() function 11 years ago
James Cammarata 804e4166c8 Rewriting ssl validation to try multiple certs found in paths
Previously, the function checked only for a single CA root cert, however
some distributions may have multiple certs in a directory. This will now
try any .crt or .pem file contained within several common paths for
each platform.

Fixes #6412
11 years ago
Michael DeHaan 0b0ca95731 Expand environment variables and tildes passed to commands generically across the board. 11 years ago
James Cammarata 430cce9df3 Merge branch 'ec2_security_token' of https://github.com/willthames/ansible into willthames-ec2_security_token 11 years ago
Michael DeHaan 411bcb7161 Merge remote branch 'real/devel' into devel 11 years ago
James Tanner ba0fec4f42 Force command action to not be executed by the shell unless specifically enabled 11 years ago
James Cammarata 9730157525 Validate SSL certs accessed through urllib*
* Adds another module utility file which generalizes the
  access of urls via the urllib* libraries.
* Adds a new spec generator for common arguments.
* Makes the user-agent string configurable.

Fixes #6211
11 years ago
Franck Cuny 82f99bfa3d Add BSD license to module_utils/gce.py 11 years ago
James Cammarata 2a0028e687 Sanitize run_command argument output
Fixes #6316
11 years ago
Will Thames b9a7352e0a Work to allow security tokens and profiles to work with Ansible
Allow security tokens and profiles to be used as arguments
to the 'common' ec2 modules

Mostly refactoring to provide two new methods,
`get_aws_connection_info`, which results in a dict that can be
passed through to the boto `connect_to_region` calls, and
`connect_to_aws` that can pass that dict through to the
`connect_to_region` method of the appropriate module.

Tidied up some variable names

Works around boto/boto#2100

profiles don't work with boto < 2.24, but this detects for that
and fails with an appropriate message. It is designed to work
if profile is not passed but boto < 2.24 is installed.

Modifications to allow empty aws auth variables to be passed
(this is useful if wanting to have the keys as an optional
parameter in ec2 calls - if set, use this value, if not set,
use boto config or env variables)

Reworked validate_certs improvements to work with refactoring

Added documentation for profile and security_token to affected modules
11 years ago
Franck Cuny 6294264dc4 Add credential parameters to the GCE modules.
In order to simplify the workflow with the GCE modules, it's now
possible to add the parameters and project name as arguments to the
various GCE modules.

The inventory plugin also returns the IP of the host in
`ansible_ssh_host` so that you don't have to specify IPs into the
inventory file.

Some update to the documentation are also added.

Closes #5583.
11 years ago
James Cammarata 14ba10393b Minor tweak to region config in boto configuration file 11 years ago
James Cammarata 88acb48e61 Merge branch 'ec2_boto_config_region' of https://github.com/willthames/ansible into willthames-ec2_boto_config_region 11 years ago
James Cammarata 8a7c68dc18 Merge branch 'ec2-params' of https://github.com/scottanderson42/ansible into scottanderson42-ec2-params
Conflicts:
	lib/ansible/module_utils/ec2.py
	library/cloud/ec2
11 years ago
James Cammarata 3b2d409906 Fixing several bugs in assemble and updating tests
Bugfixes:
* the remote_src param was not being converted to a boolean correctly,
  resulting in it never being used by the module as the default behavior
  was remote_src=True (issue #5581)
* the remote_src param was not listed in the generic file params, leading
  to a failure when the above bug regarding remote_src was fixed
* the delimiter should always end with a newline to ensure that the file
  fragments do not run together on one line

Fixes #5581
11 years ago
James Cammarata b6222abee6 Fix unicode decode error in syslog for modules
Fixes #6056
11 years ago
Martin Thorsen Ranang 7e23ed345f Avoid breaking on unicode input when logging to syslog in modules
After commit 254f87e, non-ascii input broke logging to syslog.
11 years ago
James Cammarata 0cfaabf9cb Make sure unicode params don't break logging in modules 11 years ago
James Cammarata faa645c834 Merge pull request #6001 from jimi-c/issue_4087_sanitize_output
Filter out messages that match the pattern username:password@host
11 years ago
Chris Hoffman affed67ebd Small fix for ec2 validate_certs option 11 years ago
James Cammarata b8646991db Filter out messages that match the pattern username:password@host
This filtering is done in both the module invocation logging and in
the regular verbose() logging output.

Fixes #4087
11 years ago
James Cammarata 056d54ebd3 Adding 'validate_certs' option to EC2 modules
When disabled, the boto connection will be instantiated without validating
the SSL certificate from the target endpoint. This allows the modules to connect
to Eucalyptus instances running with self-signed certs without errors.

Fixes #3978
11 years ago
James Cammarata 254f87e7dd Fix log handling of unicode output to syslog in modules 11 years ago
James Cammarata a023cbce14 When using jsonify in modules, try several unicode encoding for dumps()
Fixes #4821
11 years ago
Scott Anderson baf508a379 Change standard AWS access and secret key parameter names to aws_access_key and aws_secret_key. Fixes an authentication problem with the rds module and standardizes the naming convention on something more encompassing than ec2_*_key. 11 years ago
James Tanner b3ab7e7885 Check mutually_exclusive parameters before applying defaults 11 years ago
Will Thames d5c309e20d Pick up default EC2 region from boto.config
This doesn't account for boto configs where e.g. RDS has one
default region and EC2 another - all will default to `ec2_region_name`.

However, this is just handy to allow an easy site wide default
region if existing configuration already relies on it.

Modules can be improved to mention this in the documentation and
turn off required=True where needed. But it works with `ec2`
and `ec2_vol` without change.
11 years ago
Will Thames 7600c664fe Create a common EC2 connection argument spec for EC2 modules
Refactor the currently well-factored ec2 modules (i.e. those that already use ec2_connect) to
have a common argument spec. The idea is that new modules can use this spec without duplication
of code, and that new functionality can be added to the ec2 connection code (e.g. security
token argument)
11 years ago
James Cammarata 75e3b59bbd Adding no_log: capability for tasks
Fixes #4088
11 years ago
Matt Martz ac666e63e0 Support providing a tenant_name also 11 years ago
Matt Martz aa709012ba Make sure to also include the region when using keyring_auth 11 years ago
Matt Martz 021b926235 Only specify to USE_KEYRING as the api_key/password when we actually got a keyring_username from ~/.pyrax.cfg 11 years ago
Matt Martz 1ac7dffd55 Support using ~/.pyrax.cfg and multi environments 11 years ago
Matt Martz 139e905e98 identity_type is set dynamically above 11 years ago
Matt Martz bc473c5be3 Support additional attributes that would allow the rax modules to work with other OpenStack clouds 11 years ago
Matt Martz d7597414b8 Support keyring for the api_key 11 years ago
James Tanner 3ec043ec17 Fixes #5750 Fail on missing ~/.ssh and ignore accept_hostkey if stricthoskeychecking is off 11 years ago
Rob Smith 953dc6b345 When not finding a host in ~/.ssh/known_hosts, the return value is 0 if the host just is not found. We then never check the system host file in /etc. This fixes the code to check /etc on any failure, not just a bad return code. 11 years ago
Matt Martz d46037d64c Do not log the rax api_key argument in module invocation 11 years ago
willthames 31f5ecea60 Allow float as an argument type in AnsibleModule 11 years ago
Rob Smith c15cffabdd This fixes bugs added as a part of 8665b0638a
1. if accept_hostkey is false, no matter if the host key is known or not, it will fail.

2. We don't check for the host key in /etc/ssh/ssh_known_hosts

This fixes both of those issues.
11 years ago
James Tanner 3719f3f496 Do not fetch or add keys for http based git urls 11 years ago
James Tanner eeee1e1c5a Set accept_hostkey to False by default in the git module and fail
early if the key is unknown
11 years ago
James Tanner 8665b0638a Add an "accept_hostkey" parameter to the git module to help automatically
accept hostkeys for git repos and prevent task hangs when the key is unknown
11 years ago
willthames 12005a1cd0 Move more responsibility to common EC2 module
Moved `AWS_REGIONS` into `ec2` module
Created `ec2_connect` method in `ec2` module
Updated modules able to use `ec2_connect` and `AWS_REGIONS`
11 years ago
jctanner 301a1189dd Merge pull request #5122 from willthames/openlog_str
Make first argument to syslog.openlog be a string
11 years ago
Paulo Bittencourt fc3597af5d files/file: add support for symbolic permission modes 11 years ago
James Tanner bf78d8cf73 Addresses #5090 setup module was using path.is_file instead of path.isfile 11 years ago
jctanner 2670529671 Merge pull request #5090 from dragon3/hostname_support_amazon_linux
hostname module: add support for Amazon Linux
11 years ago
Will Thames 76aca4d547 Make first argument to syslog.openlog be a string
syslog.openlog expects its first argument to be a string.
Without this change running under ipython fails.
11 years ago
dragon3 d39e6fda92 hostname module: add support for Amazon Linux 11 years ago
Matt Martz 3f2cbb7583 Add ansible.module_utils.rax 11 years ago
jctanner 009fdbf96a Merge pull request #4896 from mjschultz/aws-access-keys
Check for AWS keys using boto names
11 years ago
jctanner e4494be8c6 Merge pull request #4803 from dragon3/devel
Don't fail if ec2_access_key/ec2_secret_key not specified to use IAM rol...
11 years ago
Michael J. Schultz 5f9485499c Check for AWS keys using boto names
- see https://github.com/boto/boto#getting-started-with-boto
11 years ago
James Tanner 74e7eba528 Fixes #4506 test length of context before checking invalid indexes 11 years ago
James Tanner 898de833b0 Merge pull request #4413 from jerm/ansible
Add capability to pass in a PATH prefix to run_command and allow pip module
to utilize that to make virtualenv bin/ available in pip installs
11 years ago
dragon3 ff5bd7fe06 Don't fail if ec2_access_key/ec2_secret_key not specified to use IAM role. 11 years ago
willthames 76c810afe3 AWS_ACCESS_KEY misspelt in shared EC2 connection library 11 years ago
James Tanner afa5988391 Fixes #4540 Use shared module snippet to evaluate ec2 credentials 11 years ago
James Tanner dc4d589ce0 Fixes #4767 detect hard links and set state in add_file_info 11 years ago
Michael DeHaan b1b5280075 Reapply pep8 changes from previous revert. 11 years ago
Michael DeHaan 465f3b1c91 This allows type=dict in a module to allow passing in a real dict or JSON. 11 years ago
Michael DeHaan d34a26e307 Undo an inadvertant revert from template changes so we still allow pythonic imports in module land. 11 years ago
James Tanner d154bf8781 Revert templating enhancements from 73dbab70 e6c28658 d409352c 9858b1f2 4587528b 9b1fe455 214b0b05 8d3db803 7f9504d1 5031104c 35cb9dc2 2bd8cb57 1e85c754 11 years ago
Michael DeHaan 54c902f102 Identation + misc PEP8 fixes. 11 years ago
Michael DeHaan bbb359870e Add package file. 11 years ago
Michael DeHaan 9858b1f2f3 Enable imports to work on a snippet based system, allowing for instance a library of common EC2 functions
to be reused between modules.  See library/system/service and library/system/ping for initial examples.  Can
work the old way to just import 'basic', or can import the new way to import multiple pieces of code from
module_utils/.
11 years ago