From f6d8e457abd78b760b04a2e07e9772b8040df616 Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Wed, 11 Mar 2015 01:20:17 -0700 Subject: [PATCH 1/5] Typo: lead --> led --- docsite/rst/intro_dynamic_inventory.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docsite/rst/intro_dynamic_inventory.rst b/docsite/rst/intro_dynamic_inventory.rst index ddb452e775..6734efca19 100644 --- a/docsite/rst/intro_dynamic_inventory.rst +++ b/docsite/rst/intro_dynamic_inventory.rst @@ -24,7 +24,7 @@ For information about writing your own dynamic inventory source, see :doc:`devel Example: The Cobbler External Inventory Script `````````````````````````````````````````````` -It is expected that many Ansible users with a reasonable amount of physical hardware may also be `Cobbler `_ users. (note: Cobbler was originally written by Michael DeHaan and is now lead by James Cammarata, who also works for Ansible, Inc). +It is expected that many Ansible users with a reasonable amount of physical hardware may also be `Cobbler `_ users. (note: Cobbler was originally written by Michael DeHaan and is now led by James Cammarata, who also works for Ansible, Inc). While primarily used to kickoff OS installations and manage DHCP and DNS, Cobbler has a generic layer that allows it to represent data for multiple configuration management systems (even at the same time), and has From a5f533e25d986380f9b0bf661fc580f80d866167 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 11 Mar 2015 09:30:07 -0400 Subject: [PATCH 2/5] fixed bad paren in connection plugin --- lib/ansible/runner/connection_plugins/paramiko_ssh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py index 2ba3d76d26..8eaf97c3f6 100644 --- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py +++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py @@ -246,7 +246,7 @@ class Connection(object): if success_key in become_output or \ (prompt and become_output.endswith(prompt)) or \ - utils.su_prompts.check_su_prompt(become_output)): + utils.su_prompts.check_su_prompt(become_output): break chunk = chan.recv(bufsize) From 1fd0a78b0e376d6ea4c8d3f1ad8ed68b9470cdfa Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 11 Mar 2015 10:28:10 -0400 Subject: [PATCH 3/5] fix issue with ask pass signature --- bin/ansible-playbook | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 79cbc43d80..118a0198e4 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -121,7 +121,7 @@ def main(args): options.ask_vault_pass = options.ask_vault_pass or C.DEFAULT_ASK_VAULT_PASS if options.listhosts or options.syntax or options.listtasks or options.listtags: - (_, _, _, vault_pass) = utils.ask_passwords(ask_vault_pass=options.ask_vault_pass) + (_, _, vault_pass) = utils.ask_passwords(ask_vault_pass=options.ask_vault_pass) else: options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS # Never ask for an SSH password when we run with local connection From de5eae2007d4138730582e876770d3b24c863753 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 11 Mar 2015 12:18:53 -0400 Subject: [PATCH 4/5] fixed traceback when x_user implicitly sets the become method Fixes #10430 Also removed redundant resolution of sudo/su for backwards compatibility which confused the conflict detection code. --- lib/ansible/playbook/play.py | 23 ----------------------- lib/ansible/playbook/task.py | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 74c6998b22..babc059e65 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -583,29 +583,6 @@ class Play(object): included_become_vars[k] = become_vars[k] x[k] = become_vars[k] - ## backwards compat with old sudo/su directives - if 'sudo' in x or 'sudo_user' in x: - included_become_vars['become'] = x['sudo'] - x['become'] = x['sudo'] - x['become_method'] = 'sudo' - del x['sudo'] - - if x.get('sudo_user', False): - included_become_vars['become_user'] = x['sudo_user'] - x['become_user'] = x['sudo_user'] - del x['sudo_user'] - - elif 'su' in x or 'su_user' in x: - included_become_vars['become'] = x['su'] - x['become'] = x['su'] - x['become_method'] = 'su' - del x['su'] - - if x.get('su_user', False): - included_become_vars['become_user'] = x['su_user'] - x['become_user'] = x['su_user'] - del x['su_user'] - if 'meta' in x: if x['meta'] == 'flush_handlers': results.append(Task(self, x)) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index a43c2ab89d..77cb97e5c0 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -173,19 +173,34 @@ class Task(object): # set only if passed in current task data if 'sudo' in ds or 'sudo_user' in ds: - self.become=ds['sudo'] self.become_method='sudo' + + if 'sudo' in ds: + self.become=ds['sudo'] + del ds['sudo'] + else: + self.become=True if 'sudo_user' in ds: self.become_user = ds['sudo_user'] + del ds['sudo_user'] if 'sudo_pass' in ds: self.become_pass = ds['sudo_pass'] - if 'su' in ds or 'su_user' in ds: - self.become=ds['su'] + del ds['sudo_pass'] + + elif 'su' in ds or 'su_user' in ds: self.become_method='su' + + if 'su' in ds: + self.become=ds['su'] + else: + self.become=True + del ds['su'] if 'su_user' in ds: self.become_user = ds['su_user'] + del ds['su_user'] if 'su_pass' in ds: self.become_pass = ds['su_pass'] + del ds['su_pass'] # Both are defined if ('action' in ds) and ('local_action' in ds): From 747c7aaffa365a397435a05481719148b5ab772f Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 11 Mar 2015 12:33:05 -0400 Subject: [PATCH 5/5] removed uneeded reference to su_user --- lib/ansible/runner/action_plugins/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/action_plugins/template.py b/lib/ansible/runner/action_plugins/template.py index e6e33d354f..a824a6e4b8 100644 --- a/lib/ansible/runner/action_plugins/template.py +++ b/lib/ansible/runner/action_plugins/template.py @@ -133,7 +133,7 @@ class ActionModule(object): xfered = self.runner._transfer_str(conn, tmp, 'source', resultant) # fix file permissions when the copy is done as a different user - if self.runner.become and self.runner.become_user != 'root' or self.runner.su and self.runner.su_user != 'root': + if self.runner.become and self.runner.become_user != 'root': self.runner._remote_chmod(conn, 'a+r', xfered, tmp) # run the copy module