From 951b87492a56dccbc64196b485a791872c3175ae Mon Sep 17 00:00:00 2001 From: Fabio Alessandro Locati Date: Thu, 1 Dec 2016 12:30:04 +0000 Subject: [PATCH] Native YAML (#3596) --- .../modules/extras/source_control/bzr.py | 5 +- .../extras/source_control/git_config.py | 61 +++++++++++++++---- .../extras/source_control/github_hooks.py | 14 ++++- 3 files changed, 64 insertions(+), 16 deletions(-) diff --git a/lib/ansible/modules/extras/source_control/bzr.py b/lib/ansible/modules/extras/source_control/bzr.py index e6cfe9f1ea8..8a75789a11e 100644 --- a/lib/ansible/modules/extras/source_control/bzr.py +++ b/lib/ansible/modules/extras/source_control/bzr.py @@ -62,7 +62,10 @@ options: EXAMPLES = ''' # Example bzr checkout from Ansible Playbooks -- bzr: name=bzr+ssh://foosball.example.org/path/to/branch dest=/srv/checkout version=22 +- bzr: + name: 'bzr+ssh://foosball.example.org/path/to/branch' + dest: /srv/checkout + version: 22 ''' import re diff --git a/lib/ansible/modules/extras/source_control/git_config.py b/lib/ansible/modules/extras/source_control/git_config.py index adf18e99390..7ce01cd9c4e 100644 --- a/lib/ansible/modules/extras/source_control/git_config.py +++ b/lib/ansible/modules/extras/source_control/git_config.py @@ -72,30 +72,65 @@ options: EXAMPLES = ''' # Set some settings in ~/.gitconfig -- git_config: name=alias.ci scope=global value=commit -- git_config: name=alias.st scope=global value=status +- git_config: + name: alias.ci + scope: global + value: commit + +- git_config: + name: alias.st + scope: global + value: status # Or system-wide: -- git_config: name=alias.remotev scope=system value="remote -v" -- git_config: name=core.editor scope=global value=vim +- git_config: + name: alias.remotev + scope: system + value: remote -v + +- git_config: + name: core.editor + scope: global + value: vim + # scope=system is the default -- git_config: name=alias.diffc value="diff --cached" -- git_config: name=color.ui value=auto +- git_config: + name: alias.diffc + value: diff --cached + +- git_config: + name: color.ui + value: auto # Make etckeeper not complain when invoked by cron -- git_config: name=user.email repo=/etc scope=local value="root@{{ ansible_fqdn }}" +- git_config: + name: user.email + repo: /etc + scope: local + value: 'root@{{ ansible_fqdn }}' # Read individual values from git config -- git_config: name=alias.ci scope=global -# scope=system is also assumed when reading values, unless list_all=yes -- git_config: name=alias.diffc +- git_config: + name: alias.ci + scope: global + +# scope: system is also assumed when reading values, unless list_all=yes +- git_config: + name: alias.diffc # Read all values from git config -- git_config: list_all=yes scope=global +- git_config: + list_all: yes + scope: global + # When list_all=yes and no scope is specified, you get configuration from all scopes -- git_config: list_all=yes +- git_config: + list_all: yes + # Specify a repository to include local settings -- git_config: list_all=yes repo=/path/to/repo.git +- git_config: + list_all: yes + repo: /path/to/repo.git ''' RETURN = ''' diff --git a/lib/ansible/modules/extras/source_control/github_hooks.py b/lib/ansible/modules/extras/source_control/github_hooks.py index 8d3c120a787..eec7a6f990d 100644 --- a/lib/ansible/modules/extras/source_control/github_hooks.py +++ b/lib/ansible/modules/extras/source_control/github_hooks.py @@ -77,10 +77,20 @@ author: "Phillip Gentry, CX Inc (@pcgentry)" EXAMPLES = ''' # Example creating a new service hook. It ignores duplicates. -- github_hooks: action=create hookurl=http://11.111.111.111:2222 user={{ gituser }} oauthkey={{ oauthkey }} repo=https://api.github.com/repos/pcgentry/Github-Auto-Deploy +- github_hooks: + action: create + hookurl: 'http://11.111.111.111:2222' + user: '{{ gituser }}' + oauthkey: '{{ oauthkey }}' + repo: 'https://api.github.com/repos/pcgentry/Github-Auto-Deploy' # Cleaning all hooks for this repo that had an error on the last update. Since this works for all hooks in a repo it is probably best that this would be called from a handler. -- local_action: github_hooks action=cleanall user={{ gituser }} oauthkey={{ oauthkey }} repo={{ repo }} +- github_hooks: + action: cleanall + user: '{{ gituser }}' + oauthkey: '{{ oauthkey }}' + repo: '{{ repo }}' + delegate_to: localhost ''' def _list(module, hookurl, oauthkey, repo, user):