Commit Graph

320 Commits (00f600bfc8c39d547fb5afce289bf65d77ab579f)

Author SHA1 Message Date
James Cammarata f1386bb114 Use more variable sources when templating the play ds
Fixes #9699
2014-12-03 12:44:32 -06:00
James Cammarata 6570a6c6de Use additional vars when templating included file names
Fixes #9669
2014-12-01 15:00:14 -06:00
Hagai Kariti bc505050b0 Don't template play vars by themselves, it's too early 2014-11-26 15:45:38 +02:00
James Cammarata 968c56d765 Expand playbook_dir in time for loading tasks
Fixes #9618
2014-11-25 13:01:08 -08:00
Kishin Yagami ac4dc1f739 enable environment keyword at play level 2014-11-22 10:41:13 +09:00
James Cammarata 4b6b58ab11 Fix role parameter precedence after 9a0f8f0
Fixes #9497
2014-11-20 12:53:48 -06:00
James Cammarata 9a0f8f0158 Split out various vars-related things to avoid merging too early
Fixes #9498
2014-11-17 15:31:55 -06:00
James Cammarata 12d5b75a43 Template play vars after reading them
Fixes #9242
2014-10-06 10:50:55 -05:00
James Cammarata 0c40c6c23c Fix order of resolving dependent role variables from vars files
Also adds a new class to the test_var_precedence test to check for
this type of error in the future.

Fixes #9178
2014-10-03 13:30:47 -05:00
James Cammarata 313f26f866 Fix issue with vars precedence from roles
Fixes #9219
2014-09-30 15:50:46 -05:00
James Cammarata 8cc3543918 Re-allow templating of complex_args, but count params to prevent injection
Fixes #8810
2014-09-05 14:24:05 -05:00
Will Thames ada9074276 Allow installation of roles from yaml roles file
Added docs
Added more tests
Improved how roles are returned from the parsers
2014-08-21 17:15:23 -04:00
Will Thames 46b59b02ed Friendly Role Names and roles from URLs
* Roles can now be given a friendly name as third field in role spec csv
* Roles can be installed from URL (not just from archived SCMs)
* Integration tests to demonstrate this
* Unit tests to ensure that role spec parsing works as expected
2014-08-21 17:15:23 -04:00
Will Thames 1803976a40 Ensured that role version can be specified in role dependencies 2014-08-21 17:15:23 -04:00
Will Thames c2fe33f9f4 Tidied up a little, added tests
Moved repo_url_to_role_name to common method in ansible.utils
Added unit test for repo_url_to_role_name
Added integration tests for galaxy
2014-08-21 17:15:23 -04:00
Will Thames b550cb9bc3 Need to take URLs into account when running playbooks too
Ensure that if meta/main.yml has dependencies containing URLs
these are correctly resolved at playbook runtime.

Update role_name during run time so that output of e.g. task names
look sensible
2014-08-21 17:15:23 -04:00
Serge van Ginderachter 7051cdeb57 roles: make role_path (path of current role) available as variable to the task 2014-08-21 11:56:27 +02:00
James Cammarata 8a1fbed5d6 Correct variable blending from vars_files with hostvars in them
Fixes #8638
2014-08-20 15:49:01 -05:00
James Cammarata 8a5675ca9f Fixing no_log for the playbook level use
Fixes #8647
2014-08-19 10:35:01 -05:00
James Cammarata 542f07128e Correct check for role library/ existence
Fixes #8633
2014-08-18 13:33:23 -05:00
James Cammarata fc7859f445 Make sure playbook_dir variable is an absolute path
Fixes #8317
2014-08-12 09:51:44 -05:00
James Cammarata ac8950fd36 Set special vars in play.vars rather than load_vars
Also refactors playbook loading code relating to vars in playbooks
to a sub-function.

Fixes #8534
2014-08-11 19:23:54 -05:00
James Cammarata 783a1e3dfc Fixing broken patch 20957a1
Also adds integration tests for nested includes with conditionals
2014-08-11 14:58:48 -05:00
James Cammarata 20957a1b85 Remove duplicate compiling of task when: statements
Fixes #8538
2014-08-11 13:23:07 -05:00
Josh Drake aa419044c4 WIP on the re-implementation of fact caching and various backends. 2014-08-11 12:23:05 -04:00
Howard Oettle cbf0bd6baf playbook: permit the serial attribute to be a pecentage string as well as well as a straight integer 2014-08-08 13:46:57 -04:00
Michael DeHaan 8c4161d4a1 Merge branch 'retf_py' of git://github.com/berendt/ansible into devel
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	plugins/callbacks/mail.py
2014-08-08 12:17:37 -04:00
James Cammarata e6fa50a306 Move splitter to module_utils so modules can use it and fix command arg splitting
Fixes #8338
2014-07-29 14:55:16 -05:00
James Cammarata 6e814566de Unquote params passed to an include statement
Fixes #8315
2014-07-28 16:35:52 -05:00
James Cammarata 6eac47e519 Use split_args instead of shlex.split for included params
Fixes #8296
2014-07-26 00:30:42 -05:00
Michael DeHaan 0fad9575e9 Refine error message about invalid ops since people forget to indent tasks fairly often. 2014-07-17 10:13:10 -04:00
James Cammarata ff04b2b532 Allow empty yaml vars files
Fixes #7843
2014-07-04 23:10:32 -05:00
James Cammarata 6d9cc64e0f Add role_names to valid keys entry for plays
Prevents a "not a legal parameter" error for play ds structures that
may be passed into the Play() constructor, which really is mainly a
concern during tests.
2014-06-16 10:00:43 -05:00
James Cammarata 74f20ebf79 Removing cruft leftover from the deprecation of include+with_items
Also cleaning up integration tests that had checks for the empty item
attribute in certain results.

Fixes #7535
2014-06-03 13:33:26 -05:00
James Cammarata 360ffc4dfd Properly merge role conditionals in with pre-existing conditionals
Fixes #7387
2014-05-14 01:45:35 -05:00
James Cammarata 187619c7fe Use utils.combine_vars on vars_files data
Fixes #7345
2014-05-13 11:24:41 -05:00
James Cammarata 2e2e5d5321 Use the existing module_vars during the templating of module_vars
Since some of the vars contained in there may be used in the templating
of other variables. This also reverts e83a494 which originally fixed
issue #6979 but broke some other variable related things.

Fixes #6979
Fixes #7321
Fixes #7332
2014-05-08 13:09:36 -05:00
Christian Berendt 6676720ce5 fixed typos found by RETF rules in PY files
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos
2014-05-03 18:40:05 +02:00
Michael Scherer 0f0f5ff1ce Give more information when a task is empty
I made a typo in a playbook and was great by:

    ERROR: expecting dict; got: None

The issue was a single - on the last line of a playbook.
With the name of the file, I was able to see right away where the
error was.
2014-04-23 13:13:46 +02:00
James Cammarata e83a494e41 Make sure VARS_CACHE for hosts are updated with the play vars too
Fixes #6979
2014-04-22 14:42:43 -05:00
James Tanner 4eb626825b Refactor play._update_vars_files_for_host to make common functions and easier debugging
Fixes #4883
2014-04-10 13:43:59 -04:00
James Cammarata 317c2f4bc0 Fixes to variable issues introduced by recent changes
Fixes #6801
Fixes #6832
2014-04-02 19:49:38 -05:00
James Cammarata a6a4680e5c Fix variable naming issue in _load_tasks()
Fixes #6800
2014-04-02 16:13:22 -05:00
James Cammarata e2d86e4f43 Splitting SETUP_CACHE into two caches, one for host vars and one for setup facts 2014-04-01 16:23:33 -05:00
James Cammarata 612a1a64f0 Apply extra vars after all other vars have been merged in a play
Fixes #6677
2014-03-31 15:31:10 -05:00
James Tanner 38de8cc87e Addresses #6705 Only set the role_uuid inside the role vars 2014-03-26 14:43:07 -04:00
James Tanner 8991e403e8 Fixes #6705 Give each role a unique uuid and apply tags only to tasks matching the uuid 2014-03-26 13:29:41 -04:00
James Cammarata 9ede6f7f49 Convert gather_facts to a boolean value if it is not None
Fixes #5618
2014-03-26 12:04:06 -05:00
James Tanner 95c79ad483 Fixes #4239 merge injects with new vars loaded from files 2014-03-20 13:12:33 -04:00
James Tanner d327e3d11a Fixes #5622 included tasks in roles now inherit tags from the role 2014-03-20 11:56:13 -04:00
Brian Coca 4dfa40f18e added gathering control to ansible, defaults to 'smart' 2014-03-19 18:03:03 -04:00
James Cammarata eb7717aa02 Make sure all tags are in a list before merging for role deps
Fixes #6557
2014-03-18 12:32:22 -05:00
James Cammarata 84908a57fc Don't filter role deps on tags
Also, fixed a bug where the tags were being merged into the wrong
data structure (passed_vars) in _build_role_dependencies()

Fixes #6439
Fixes #5709
2014-03-17 23:03:16 -05:00
James Cammarata 7edee91aba Fixing a bug in role tag handling where only the first tag was used
Fixes #6517
2014-03-17 11:28:54 -05:00
Michael DeHaan b8f1e4f765 Merge pull request #6134 from veeti/include_with_items_path
Show the offending file name with the include + with_items error
2014-03-16 15:10:31 -05:00
Michael DeHaan 9cdbc53741 Merge pull request #6420 from bcoca/role_names
added new role_names variable that exposes current roles list
2014-03-16 14:42:40 -05:00
Cristian Ciupitu 0749112286 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.
2014-03-16 13:10:28 -04:00
James Cammarata 86d2ee4b97 Don't append tags from roles to the plays tags list
Fixes #6393
2014-03-12 10:41:18 -05:00
Brian Coca 906e59d8a8 added new role_names variable that exposes current roles list 2014-03-11 22:13:29 -04:00
James Cammarata 6577ff5f85 Add tags from handlers to tag availability calculation 2014-03-10 16:06:13 -05:00
James Cammarata 04a6dc6d12 Check for skipped tags in passed role variables before adding to them
Fixes #6330
2014-03-08 18:55:42 -06:00
James Cammarata b6056044b7 Partial revert of 73c883c due to issues with handlers in roles
Fixes #6322
2014-03-06 21:13:40 -06:00
Michael DeHaan a4d01b0891 Also search .json filenames 2014-03-06 21:47:49 -05:00
Brian Coca 79809b67dc fixed another line with same issues
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2014-03-06 08:43:24 -05:00
Brian Coca d3d5680d8f tags lists are properly uniqued and joined now, also avoids type issues when passed as list/set or strings
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2014-03-06 08:28:36 -05:00
James Cammarata 73c883c122 Keep track of role dependencies across plays
Also fixes a bug in which tags specified on top-level roles were
not being passed down to dependent roles.

Fixes #4656
2014-03-05 14:37:37 -06:00
Hagai 0e4b38ed5a Fix incorrect use of copy on list 2014-03-03 14:47:57 +02:00
James Cammarata b758ed9417 Merge pull request #6150 from hkariti/fix_join_bug
Fix incorrect use of .join on list causing a traceback
2014-02-26 12:50:07 -06:00
Hagai ae9c0d87a9 Fix incorrect use of .join on list 2014-02-24 19:48:55 +02:00
Veeti Paananen dd6f2e6bfa Show the offending file name with the include + with_items error 2014-02-23 20:51:57 +02:00
James Cammarata fa1ab231c9 Fixing bug in which playbook vars were not merged properly
This occurred when a hash would be passed in via extra args and the
hash variable behavior was set to 'merge', which resulted in the
variable from extra args replacing the playbook variable.
2014-02-20 15:25:52 -05:00
James Tanner 3fc87e011b Fix all other calls to yaml 2014-02-19 11:01:21 -05:00
James Tanner 427b8dc78d Ansible vault: a framework for encrypting any playbook or var file. 2014-02-18 15:35:12 -05:00
James Cammarata 75e3b59bbd Adding no_log: capability for tasks
Fixes #4088
2014-01-31 16:58:46 -06:00
jctanner 19e8742005 Merge pull request #5713 from angstwad/su-fix
Disallow su and sudo params in same play/task
2014-01-23 13:55:43 -08:00
Paul Durivage 01d1bd61e7 Disallow su and sudo params in same play/task 2014-01-22 10:55:45 -06:00
James Tanner 61d283e2ad Fix merge conflicts from #5519 2014-01-21 13:35:06 -05:00
Paul Durivage f72f5a20df Revert "Revert "Merge pull request #5325 from angstwad/add-su-support""
This reverts commit c17d0e0357.

Conflicts:
	lib/ansible/runner/connection_plugins/paramiko_ssh.py
2014-01-20 19:19:03 -06:00
Jesse Keating e8ad36c8d4 Store hosts for a play as a play attribute
Operate on that play attribute to make things faster for larger
inventories. Instead of making a round trip through inventory.list_hosts
and working through some lengthy list comprehensions over and over
again, calculate the potenital hosts for a play once, then reduce from
it the unavailable hosts when necessary.

Also moves how the %fail is done. The host count is a play level count
of available hosts, which then is compared after each task to the
current number of available hosts for the play. This used to get a new
count every task which was also time expensive.
2014-01-20 16:22:28 -08:00
James Tanner c17d0e0357 Revert "Merge pull request #5325 from angstwad/add-su-support"
This reverts commit 6f4bfa2cff, reversing
changes made to c91ba3a7c7.
2014-01-20 16:10:11 -05:00
Paul Durivage dec9131735 Ensure playbook support for su params 2014-01-20 11:46:56 -06:00
Paul Durivage 4088243deb Proposing fix for Issue #4324; adding support for su in connection plugins ssh, ssh_alt
Fixes for ssh_alt support, adding in references to in_data where appropriate
2014-01-20 11:25:10 -06:00
Michael DeHaan c039e276a2 Fact gathering on a second play against the same hosts should not be implicitly off since this is an undocumented beheavior and potentially
rather unwanted when a play could change a fact.

gather_facts: True/False can still be explicitly used per play.

Reverts 564a212b3c
2014-01-04 14:03:58 -05:00
Michael DeHaan 10350d1639 Update various copyrights. Not complete, but sufficient. 2014-01-04 13:32:04 -05:00
Michael DeHaan 8e5b7d3095 Remove code underlying when_* and only_if, which are deprecated features slated for removal in the 1.5 release. 2014-01-03 19:13:21 -05:00
Michael DeHaan 28b9fd4e30 We have had only_if, when_foo, etc, deprecated for a while and said they would be removed in 1.5. Now they are, with friendly error messages still.
Users of these features should use "when:" as documented at docs.ansible.com.

Similarly, include + with_items has been removed.  The solution is to loop
inside the task files, see with_nested / with_together, etc.
2014-01-03 13:47:54 -05:00
James Tanner 993e0f057e Allow for no role dependencies in role metadata 2013-12-19 14:19:14 -05:00
James Tanner 1ef9930b80 Addresses #5341 Expand home directories when searching for roles in ansible-playbook 2013-12-18 23:31:03 -05:00
Michael Vogt bef5ee2c3b improve error on invalid vars file (if its a list instead of a dict) 2013-12-12 09:56:30 +01:00
James Tanner d93780bc8a Addresses #4635 add list instead of join 2013-11-05 14:44:27 -05:00
James Tanner 2b5005687a Fixes #4635 pass role conditionals to dependent roles 2013-11-05 14:38:21 -05:00
James Tanner c1ed47933b Fixes #4485 add an ipv6 parameter to accelerate so that the daemon will bind to an ipv6 port instead of ipv4 2013-11-04 17:20:03 -05:00
Serge van Ginderachter 6277e770a1 include basedir as 'playbook_dir' variable
closes #4246
2013-10-25 07:53:52 +02:00
Michael DeHaan 4125b05bf3 Allow a defaults file to solely define a role. Some typo fixes. 2013-10-19 14:01:20 -04:00
James Tanner 8478e82647 Fixes #4583 enforce that vars_files is a list 2013-10-18 11:19:16 -04:00
Michael DeHaan 9ea54fcaaf Fixes a dev branch glitch where a conditional could be applied to multiple tasks. Also improves the errors on parsing bad conditionals to make them less confusing to users. 2013-10-12 17:39:28 -04:00
Thomas Omans 632232259a Adding config flag role_path for common/global roles
Using ANSIBLE_ROLE_PATH environment variable or role_path in ansible.cfg
can configure paths where roles will be searched for
extra paths will only be used as a backup once regular locations are exhausted
2013-10-12 10:15:30 -04:00
Michael DeHaan 9637f620d7 Deprecation warnings of several flavors, nice and purple and can be disabled
in ansible.cfg.
2013-10-11 18:37:39 -04:00
Michael DeHaan 6febc97104 Add a warning about include + with_items so nobody uses it. 2013-10-08 18:12:18 -04:00
James Cammarata 98f6bc1f63 Apply tags to dependent roles correctly
Fixes #4339
2013-10-08 15:13:02 -05:00