Commit Graph

163 Commits (a5ee6ff1e56ff3abdcb42a9b2ac4518a0eeead13)

Author SHA1 Message Date
James Cammarata a5ee6ff1e5 Display parent role name of tasks in the name line
Fixes #4076
12 years ago
James Cammarata 458f71b53c Merge branch 'issue_4129_role_defaults_empty_yaml' into devel
Conflicts:
	lib/ansible/playbook/play.py
12 years ago
James Cammarata 091a90ee8b Allow includes to follow the standard format
Previously, includes had to receive variables via a special 'vars'
field. With this patch, the include syntax becomes a more natural
datastructure without special fields and is more akin to the way
role includes/dependencies work.

Tested with the following playbook:
---
- hosts: localhost
  connection: local
  tasks:
  - { include: inc1.yml, a: 1 }
  - include: inc2.yml
    b: 2
  - include: inc3.yml
    with_items:
    - x
    - y
    - z

Fixes #3481
12 years ago
James Cammarata c5bb1394b9 Check to make sure default_vars in the datastructure isn't empty
Fixes #4129
12 years ago
James Cammarata aac3090909 Merge branch 'play_remote_user' of https://github.com/bcoca/ansible into bcoca-play_remote_user 12 years ago
James Cammarata 75a9357e5e Fixing role variable precedence for top-level roles
Fixes #4026
Fixes #3989
12 years ago
James Cammarata bcc2a4b513 Minor fix so the any_errors_fatal value is checked properly 12 years ago
Brian Coca d47c48e30a Added remote_user to plays
Still compatible with user: but deprecating it so we can have
a matching remote_user: in tasks, cannot be user: because of the
module of the same name. #3932

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
12 years ago
James Cammarata 7b13b1e03e Minor fix to dependency dupe patch 12 years ago
smoothify 5337397abd Second Attempt: Ensure duplicate roles are not loaded in the case of a missing meta/main.yml file. 12 years ago
smoothify 0411ea2867 Ensure duplicate roles are not loaded in the case of a missing meta/main.yml file. 12 years ago
James Cammarata 2e49d2003d Fix bug where accelerate keyword was not checked for boolean value
The play was just checking for the presence of the keyword in the
YAML datastructure, and not the value of the field, so doing something
like variable substitution was always causing the play to be accelerated
12 years ago
James Cammarata d05c61d1f0 Merge branch 'devel' into fireball2
Conflicts:
	lib/ansible/playbook/__init__.py
	lib/ansible/playbook/play.py
12 years ago
James Cammarata 50f54f6bda Making variable names more descriptive for the default variables work 12 years ago
James Cammarata 02b7b79d7e Re-adding capability of tasks to see a unique view of their own defaults 12 years ago
James Cammarata 266d2008d8 Reverting the role default variables change
Loading the default variables in _build_role_dependencies() lead to
a side-effect where those variables were over-riding inventory variables.
12 years ago
James Cammarata 47a89a57fa Fixing bug in playbook use of default variables in roles 12 years ago
James Cammarata e0df5b5888 A couple more tweaks to role default variables/dependencies
* Default variables are now fed directly into roles, just like the
  other variables, so that roles see their unique values rather
  than those set at the global level.

* Role dependency duplicates are now determined by checking the params used
  when specifying them as dependencies rather than just on the name of the
  role. For example, the following would be included twice without having
  to specify "allow_duplicates: true":

  dependencies:
  - { role: foo, x: 1 }
  - { role: foo, x: 2 }
12 years ago
James Cammarata 736c8b19d3 Added ability to limit role dependencies to just one inclusion 12 years ago
James Cammarata 25e3eed519 Fixing a bug in variable precedence for roles and dependencies 12 years ago
James Cammarata 637d3070dc Allow default variables to be overridden by inventory variables 12 years ago
James Cammarata f66683863e Merge branch 'defaults' of https://github.com/smoothify/ansible into smoothify-defaults 12 years ago
James Cammarata 959138d00d Added accelerate_port to plays, and made it configurable 12 years ago
James Cammarata 521e14a3ad Fireball2 mode working! 12 years ago
Wincent Colaiuta fc4307a9c4 Fix minor typo in playbook error message 12 years ago
Kavin Kankeshwar 7ac3bbc198 resolved #3609 Change max_fail_pct to max_fail_percentage as recommended 12 years ago
Kavin Kankeshwar 3f247fcbe3 fixes ansible/ansible#3609 Add max_fail_pct to playbook parameter, to complement serial option, So if total number of failures execeed max_fail_pct * total number of hosts, do not go to the next serial batch 12 years ago
smoothify 494043947d Add support for role defaults. These are variables on a per role basis with lowest precedence. 12 years ago
James Cammarata 5847720746 Fixing a small bug with the new role dependency feature
The block that added the original list of roles was indented too far,
and was only being reached if a role had dependencies. This resulted
in roles without dependencies from being added to the list of roles.

Credit goes to looped for reporting and diagnosing the issue.
12 years ago
James Cammarata d8a7a2d1b2 Adding evaluation of role vars as the dep tree is built
This allows variables to be inserted into the role scope specifically
while also being inserted into the global scope.
12 years ago
James Cammarata e12b99dba6 Small cleanup, no need to call _get_role_path a second time 12 years ago
James Cammarata 9a401e73a6 Adding support for role dependencies.
Fixes #3686

Dependencies are enabled by adding a new directory/file named
meta/main.yml to the role. The format of the dependencies are:

dependencies:
- { role: foo, x: 1, y: 2 }
- { role: bar, x: 3, y: 4 }
...

Dependencies inherit variables as they are seen at the time of the
dependency inclusion. For example, if foo(x=1, y=2) has a dependency
on bar(x=3,z=4), then bar will have variables (x=3,y=2,z=4).

Different roles can have dependencies on the same role, and this
variable inheritence allows for the reuse of generic roles quite easily.
For example:

Role 'car' has the following dependencies:
dependencies:
  - { role: wheel, n: 1 }
  - { role: wheel, n: 2 }
  - { role: wheel, n: 3 }
  - { role: wheel, n: 4 }

Role 'wheel' has the following dependencies:
dependencies:
- { role: tire }
- { role: brake }

The role 'car' is then used as follows:
- { role: car, type: honda }

And tasks/main.yml in each role simply contains the following:
- name: {{ type }} whatever {{ n }}
  command: echo ''

TASK: [honda tire 1]
TASK: [honda brake 1]
TASK: [honda wheel 1]
TASK: [honda tire 2]
TASK: [honda brake 2]
TASK: [honda wheel 2]
TASK: [honda tire 3]
TASK: [honda brake 3]
TASK: [honda wheel 3]
TASK: [honda tire 4]
TASK: [honda brake 4]
TASK: [honda wheel 4]
TASK: [I'm a honda]  <- (this is in roles/car/tasks/main.yml)
12 years ago
Ralph Tice 2383a8205c changed role path template to read all vars instead of just extra_vars 13 years ago
Michael DeHaan bf70dfc1a0 When a role/include has a conditional, add that conditional ahead of any on the task, not behind, so it can short circuit. 13 years ago
Stoned Elipot e7a733a6be Quote pathnames of roles' tasks and handlers files so that _load_tasks() can tokenize them properly
With the help of AlejandroTrev's eagle eyes. Thanks !
13 years ago
Michael DeHaan c10c2cae4e Merge branch 'ansible_sudo_at_role_level' of git://github.com/jeromew/ansible into sudo_role 13 years ago
Rodney Quillo a4e829c874 Allow roles to be interpolated from --extra-vars 13 years ago
jeromew de0bc96b70 Implement sudo/sudo_user at the include and role levels 13 years ago
Ninety Thirty 7b1e87b62d Added flexible filename handling for main files
tasks, handlers, and vars main files can now be any of main, main.yml, or main.yaml
13 years ago
George Miroshnykov c642ba77ae Added basic support for hash_behaviour=merge in roles
Dict vars passed to roles are now properly merged
instead of simply overriding dict vars that are
coming from vars_files.
13 years ago
Stoned Elipot 75b51f79b4 Add module path library/ if it exists in role directory 13 years ago
Michael DeHaan 75cf5c985b Allow playbook tags to be comma seperated strings as well as lists 13 years ago
Matt Coddington c83c534a7d Search for roles in the roles subdir first. Throw an error when no role .yml files are found. 13 years ago
Michael DeHaan 21fe750cef Flush handlers before pre and post task sections change, but not between task and roles, as this seems
to be confusing to people (and not usually neccessary)
13 years ago
Michael DeHaan 6fdfbb1a34 Improve variable smushing so it only has to be done in one place. This is related to shlex.split being called
on untemplated variables in some rare cases.
13 years ago
Michael DeHaan 6c778acd91 Smush the braces in various places (hey, that rhymes) to avoid undo key=value splitting surprises
in new template system.
13 years ago
Michael DeHaan 32fb6c807c Allow handlers to run in between pre_tasks, roles, tasks, and post_tasks. 13 years ago
Michael DeHaan 37789a852a Rename set_up and tear_down to pre_tasks and post_tasks 13 years ago
Michael DeHaan d7623d1f91 Added a 'set_up' and 'tear_down' which are like tasks, but execute before and after roles. 13 years ago
Michael DeHaan 7c6341718e Merge branch 'combine_vars' of git://github.com/laggyluke/ansible into exp
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	lib/ansible/runner/__init__.py
	lib/ansible/utils/__init__.py
	test/TestPlayBook.py
13 years ago