diff options
author | John R Barker <john@johnrbarker.com> | 2016-11-15 20:11:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-15 20:11:32 +0000 |
commit | 109c68980424146121d79e4bc91cec475894645a (patch) | |
tree | a95b94b373e8de0f7691a07cbd9f2b358f7b033d | |
parent | a4cddac368976f7fd7f97f5af0cf59d7fd032dfd (diff) | |
parent | 955b3f573307e0d6be6c8defd90194f24abcee3d (diff) | |
download | ansible-modules-core-109c68980424146121d79e4bc91cec475894645a.tar.gz |
Merge pull request #5619 from samdoran/examples-syntax-batch3
Examples syntax batch3
-rw-r--r-- | files/unarchive.py | 16 | ||||
-rw-r--r-- | files/xattr.py | 13 | ||||
-rw-r--r-- | inventory/add_host.py | 22 | ||||
-rw-r--r-- | inventory/group_by.py | 7 | ||||
-rw-r--r-- | packaging/language/easy_install.py | 8 | ||||
-rw-r--r-- | packaging/language/gem.py | 14 | ||||
-rwxr-xr-x | packaging/language/pip.py | 55 | ||||
-rw-r--r-- | packaging/os/apt.py | 2 | ||||
-rw-r--r-- | packaging/os/apt_key.py | 35 | ||||
-rw-r--r-- | packaging/os/apt_repository.py | 26 | ||||
-rwxr-xr-x | packaging/os/apt_rpm.py | 24 | ||||
-rw-r--r-- | packaging/os/package.py | 8 | ||||
-rw-r--r-- | packaging/os/redhat_subscription.py | 37 | ||||
-rw-r--r-- | packaging/os/rhn_channel.py | 11 | ||||
-rw-r--r-- | packaging/os/rhn_register.py | 38 | ||||
-rw-r--r-- | packaging/os/rpm_key.py | 12 | ||||
-rw-r--r-- | packaging/os/yum.py | 37 | ||||
-rw-r--r-- | source_control/git.py | 27 | ||||
-rw-r--r-- | source_control/hg.py | 12 | ||||
-rw-r--r-- | source_control/subversion.py | 14 |
20 files changed, 307 insertions, 111 deletions
diff --git a/files/unarchive.py b/files/unarchive.py index b51d3979..3a69cc33 100644 --- a/files/unarchive.py +++ b/files/unarchive.py @@ -114,13 +114,21 @@ notes: EXAMPLES = ''' # Example from Ansible Playbooks -- unarchive: src=foo.tgz dest=/var/lib/foo +- unarchive: + src: foo.tgz + dest: /var/lib/foo # Unarchive a file that is already on the remote machine -- unarchive: src=/tmp/foo.zip dest=/usr/local/bin remote_src=yes +- unarchive: + src: /tmp/foo.zip + dest: /usr/local/bin + remote_src: yes # Unarchive a file that needs to be downloaded (added in 2.0) -- unarchive: src=https://example.com/example.zip dest=/usr/local/bin remote_src=yes +- unarchive: + src: "https://example.com/example.zip" + dest: /usr/local/bin + remote_src: yes ''' import re @@ -339,7 +347,7 @@ class ZipArchive(object): # Check first and seventh field in order to skip header/footer if len(pcs[0]) != 7 and len(pcs[0]) != 10: continue if len(pcs[6]) != 15: continue - + # Possible entries: # -rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660 # -rw-a-- 1.0 hpf 5358 Tl i4:3 4-Dec-91 11:33 longfilename.hpfs diff --git a/files/xattr.py b/files/xattr.py index 8f12c853..02af9f97 100644 --- a/files/xattr.py +++ b/files/xattr.py @@ -63,13 +63,20 @@ author: "Brian Coca (@bcoca)" EXAMPLES = ''' # Obtain the extended attributes of /etc/foo.conf -- xattr: name=/etc/foo.conf +- xattr: + name: /etc/foo.conf # Sets the key 'foo' to value 'bar' -- xattr: path=/etc/foo.conf key=user.foo value=bar +- xattr: + path: /etc/foo.conf + key: user.foo + value: bar # Removes the key 'foo' -- xattr: name=/etc/foo.conf key=user.foo state=absent +- xattr: + name: /etc/foo.conf + key: user.foo + state: absent ''' import operator diff --git a/inventory/add_host.py b/inventory/add_host.py index d2873e28..91363121 100644 --- a/inventory/add_host.py +++ b/inventory/add_host.py @@ -44,18 +44,24 @@ author: EXAMPLES = ''' # add host to group 'just_created' with variable foo=42 -- add_host: name={{ ip_from_ec2 }} groups=just_created foo=42 +- add_host: + name: "{{ ip_from_ec2 }}" + groups: just_created + foo: 42 # add a host with a non-standard port local to your machines -- add_host: name={{ new_ip }}:{{ new_port }} +- add_host: + name: "{{ new_ip }}:{{ new_port }}" # add a host alias that we reach through a tunnel (Ansible <= 1.9) -- add_host: hostname={{ new_ip }} - ansible_ssh_host={{ inventory_hostname }} - ansible_ssh_port={{ new_port }} +- add_host: + hostname: "{{ new_ip }}" + ansible_ssh_host: "{{ inventory_hostname }}" + ansible_ssh_port: "{{ new_port }}" # add a host alias that we reach through a tunnel (Ansible >= 2.0) -- add_host: hostname={{ new_ip }} - ansible_host={{ inventory_hostname }} - ansible_port={{ new_port }} +- add_host: + hostname: "{{ new_ip }}" + ansible_host: "{{ inventory_hostname }}" + ansible_port: "{{ new_port }}" ''' diff --git a/inventory/group_by.py b/inventory/group_by.py index 4bfd2020..28e9a41e 100644 --- a/inventory/group_by.py +++ b/inventory/group_by.py @@ -34,7 +34,10 @@ notes: EXAMPLES = ''' # Create groups based on the machine architecture -- group_by: key=machine_{{ ansible_machine }} +- group_by: + key: machine_{{ ansible_machine }} + # Create groups like 'kvm-host' -- group_by: key=virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }} +- group_by: + key: virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }} ''' diff --git a/packaging/language/easy_install.py b/packaging/language/easy_install.py index 017f6b81..96d21ea8 100644 --- a/packaging/language/easy_install.py +++ b/packaging/language/easy_install.py @@ -90,10 +90,14 @@ author: "Matt Wright (@mattupstate)" EXAMPLES = ''' # Examples from Ansible Playbooks -- easy_install: name=pip state=latest +- easy_install: + name: pip + state: latest # Install Bottle into the specified virtualenv. -- easy_install: name=bottle virtualenv=/webapps/myapp/venv +- easy_install: + name: bottle + virtualenv: /webapps/myapp/venv ''' def _is_package_installed(module, name, easy_install, executable_arguments): diff --git a/packaging/language/gem.py b/packaging/language/gem.py index acd088dc..18884159 100644 --- a/packaging/language/gem.py +++ b/packaging/language/gem.py @@ -97,13 +97,21 @@ author: EXAMPLES = ''' # Installs version 1.0 of vagrant. -- gem: name=vagrant version=1.0 state=present +- gem: + name: vagrant + version: 1.0 + state: present # Installs latest available version of rake. -- gem: name=rake state=latest +- gem: + name: rake + state: latest # Installs rake version 1.0 from a local gem on disk. -- gem: name=rake gem_source=/path/to/gems/rake-1.0.gem state=present +- gem: + name: rake + gem_source: /path/to/gems/rake-1.0.gem + state: present ''' import re diff --git a/packaging/language/pip.py b/packaging/language/pip.py index 7c8aa8cb..e49e2750 100755 --- a/packaging/language/pip.py +++ b/packaging/language/pip.py @@ -142,46 +142,73 @@ author: "Matt Wright (@mattupstate)" EXAMPLES = ''' # Install (Bottle) python package. -- pip: name=bottle +- pip: + name: bottle # Install (Bottle) python package on version 0.11. -- pip: name=bottle version=0.11 +- pip: + name: bottle + version: 0.11 # Install (MyApp) using one of the remote protocols (bzr+,hg+,git+,svn+). You do not have to supply '-e' option in extra_args. -- pip: name='svn+http://myrepo/svn/MyApp#egg=MyApp' +- pip: + name: 'svn+http://myrepo/svn/MyApp#' + egg: MyApp' # Install MyApp using one of the remote protocols (bzr+,hg+,git+) in a non editable way. -- pip: name='git+http://myrepo/app/MyApp' editable=false +- pip: + name: 'git+http://myrepo/app/MyApp' + editable: false # Install (MyApp) from local tarball -- pip: name='file:///path/to/MyApp.tar.gz' +- pip: + name: 'file:///path/to/MyApp.tar.gz' # Install (Bottle) into the specified (virtualenv), inheriting none of the globally installed modules -- pip: name=bottle virtualenv=/my_app/venv +- pip: + name: bottle + virtualenv: /my_app/venv # Install (Bottle) into the specified (virtualenv), inheriting globally installed modules -- pip: name=bottle virtualenv=/my_app/venv virtualenv_site_packages=yes +- pip: + name: bottle + virtualenv: /my_app/venv + virtualenv_site_packages: yes # Install (Bottle) into the specified (virtualenv), using Python 2.7 -- pip: name=bottle virtualenv=/my_app/venv virtualenv_command=virtualenv-2.7 +- pip: + name: bottle + virtualenv: /my_app/venv + virtualenv_command: virtualenv-2.7 # Install specified python requirements. -- pip: requirements=/my_app/requirements.txt +- pip: + requirements: /my_app/requirements.txt # Install specified python requirements in indicated (virtualenv). -- pip: requirements=/my_app/requirements.txt virtualenv=/my_app/venv +- pip: + requirements: /my_app/requirements.txt + virtualenv: /my_app/venv # Install specified python requirements and custom Index URL. -- pip: requirements=/my_app/requirements.txt extra_args='-i https://example.com/pypi/simple' +- pip: + requirements: /my_app/requirements.txt + extra_args: '-i https://example.com/pypi/simple' # Install (Bottle) for Python 3.3 specifically,using the 'pip-3.3' executable. -- pip: name=bottle executable=pip-3.3 +- pip: + name: bottle + executable: pip-3.3 # Install (Bottle), forcing reinstallation if it's already installed -- pip: name=bottle state=forcereinstall +- pip: + name: bottle + state: forcereinstall # Install (Bottle) while ensuring the umask is 0022 (to ensure other users can use it) -- pip: name=bottle umask=0022 +- pip: + name: bottle + umask: 0022 become: True ''' diff --git a/packaging/os/apt.py b/packaging/os/apt.py index 20306cd6..5d20dbee 100644 --- a/packaging/os/apt.py +++ b/packaging/os/apt.py @@ -177,7 +177,7 @@ EXAMPLES = ''' apt: upgrade: dist update_cache: yes - dpkg_options: force-confold,force-confdef + dpkg_options: 'force-confold,force-confdef' - name: Install a .deb package apt: diff --git a/packaging/os/apt_key.py b/packaging/os/apt_key.py index 516255e1..753fb830 100644 --- a/packaging/os/apt_key.py +++ b/packaging/os/apt_key.py @@ -83,28 +83,47 @@ options: EXAMPLES = ''' # Add an apt key by id from a keyserver -- apt_key: keyserver=keyserver.ubuntu.com id=36A1D7869245C8950F966E92D8576A8BA88D21E9 +- apt_key: + keyserver: keyserver.ubuntu.com + id: 36A1D7869245C8950F966E92D8576A8BA88D21E9 # Add an Apt signing key, uses whichever key is at the URL -- apt_key: url=https://ftp-master.debian.org/keys/archive-key-6.0.asc state=present +- apt_key: + url: "https://ftp-master.debian.org/keys/archive-key-6.0.asc" + state: present # Add an Apt signing key, will not download if present -- apt_key: id=473041FA url=https://ftp-master.debian.org/keys/archive-key-6.0.asc state=present +- apt_key: + id: 473041FA + url: "https://ftp-master.debian.org/keys/archive-key-6.0.asc" + state: present # Remove an Apt signing key, uses whichever key is at the URL -- apt_key: url=https://ftp-master.debian.org/keys/archive-key-6.0.asc state=absent +- apt_key: + url: "https://ftp-master.debian.org/keys/archive-key-6.0.asc" + state: absent # Remove a Apt specific signing key, leading 0x is valid -- apt_key: id=0x473041FA state=absent +- apt_key: + id: 0x473041FA + state: absent # Add a key from a file on the Ansible server -- apt_key: data="{{ lookup('file', 'apt.gpg') }}" state=present +- apt_key: + data: "{{ lookup('file', 'apt.gpg') }}" + state: present # Add an Apt signing key to a specific keyring file -- apt_key: id=473041FA url=https://ftp-master.debian.org/keys/archive-key-6.0.asc keyring=/etc/apt/trusted.gpg.d/debian.gpg state=present +- apt_key: + id: 473041FA + url: "https://ftp-master.debian.org/keys/archive-key-6.0.asc" + keyring: /etc/apt/trusted.gpg.d/debian.gpg # Add Apt signing key on remote server to keyring -- apt_key: id=473041FA file=/tmp/apt.gpg state=present +- apt_key: + id: 473041FA + file: /tmp/apt.gpg + state: present ''' diff --git a/packaging/os/apt_repository.py b/packaging/os/apt_repository.py index dac098da..aedf1cb2 100644 --- a/packaging/os/apt_repository.py +++ b/packaging/os/apt_repository.py @@ -84,22 +84,36 @@ requirements: EXAMPLES = ''' # Add specified repository into sources list. -apt_repository: repo='deb http://archive.canonical.com/ubuntu hardy partner' state=present +- apt_repository: + repo: 'deb http://archive.canonical.com/ubuntu hardy partner' + state: present # Add specified repository into sources list using specified filename. -apt_repository: repo='deb http://dl.google.com/linux/chrome/deb/ stable main' state=present filename='google-chrome' +- apt_repository: + repo: 'deb http://dl.google.com/linux/chrome/deb/ stable main' + state: present + filename: 'google-chrome' # Add source repository into sources list. -apt_repository: repo='deb-src http://archive.canonical.com/ubuntu hardy partner' state=present +- apt_repository: + repo: 'deb-src http://archive.canonical.com/ubuntu hardy partner' + state: present # Remove specified repository from sources list. -apt_repository: repo='deb http://archive.canonical.com/ubuntu hardy partner' state=absent +- apt_repository: + repo: 'deb http://archive.canonical.com/ubuntu hardy partner' + state: absent # Add nginx stable repository from PPA and install its signing key. # On Ubuntu target: -apt_repository: repo='ppa:nginx/stable' +- apt_repository: + repo: 'ppa:nginx/stable' + # On Debian target -apt_repository: repo='ppa:nginx/stable' codename='trusty' +- apt_repository: + repo: 'ppa:nginx/stable' + codename: 'trusty' + repo: 'ppa:nginx/stable' ''' import glob diff --git a/packaging/os/apt_rpm.py b/packaging/os/apt_rpm.py index 59eccfee..e8a702e9 100755 --- a/packaging/os/apt_rpm.py +++ b/packaging/os/apt_rpm.py @@ -50,13 +50,25 @@ notes: [] EXAMPLES = ''' # install package foo -- apt_rpm: pkg=foo state=present +- apt_rpm: + pkg: foo + state: present + # remove package foo -- apt_rpm: pkg=foo state=absent -# description: remove packages foo and bar -- apt_rpm: pkg=foo,bar state=absent -# description: update the package database and install bar (bar will be the updated if a newer version exists) -- apt_rpm: name=bar state=present update_cache=yes +- apt_rpm: + pkg: foo + state: absent + +# description: remove packages foo and bar +- apt_rpm: + pkg: foo,bar + state: absent + +# description: update the package database and install bar (bar will be the updated if a newer version exists) +- apt_rpm: + name: bar + state: present + update_cache: yes ''' diff --git a/packaging/os/package.py b/packaging/os/package.py index 2ae7c7fb..d40ed3d4 100644 --- a/packaging/os/package.py +++ b/packaging/os/package.py @@ -53,9 +53,13 @@ notes: ''' EXAMPLES = ''' - name: install the latest version of ntpdate - package: name=ntpdate state=latest + package: + name: ntpdate + state: latest # This uses a variable as this changes per distribution. - name: remove the apache package - package: name={{apache}} state=absent + package: + name: "{{ apache }}" + state: absent ''' diff --git a/packaging/os/redhat_subscription.py b/packaging/os/redhat_subscription.py index 2bef4cbb..ea56ac55 100644 --- a/packaging/os/redhat_subscription.py +++ b/packaging/os/redhat_subscription.py @@ -114,30 +114,41 @@ options: EXAMPLES = ''' # Register as user (joe_user) with password (somepass) and auto-subscribe to available content. -- redhat_subscription: state=present username=joe_user password=somepass autosubscribe=true +- redhat_subscription: + state: present + username: joe_user + password: somepass + autosubscribe: true # Same as above but with pulling existing system data. -- redhat_subscription: state=present username=joe_user password=somepass - consumer_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +- redhat_subscription: + state: present + username: joe_user + password: somepass + consumer_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # Register with activationkey (1-222333444) and consume subscriptions matching # the names (Red hat Enterprise Server) and (Red Hat Virtualization) -- redhat_subscription: state=present - activationkey=1-222333444 - pool='^(Red Hat Enterprise Server|Red Hat Virtualization)$' +- redhat_subscription: + state: present + activationkey: 1-222333444 + pool: '^(Red Hat Enterprise Server|Red Hat Virtualization)$' # Update the consumed subscriptions from the previous example (remove the Red # Hat Virtualization subscription) -- redhat_subscription: state=present - activationkey=1-222333444 - pool='^Red Hat Enterprise Server$' +- redhat_subscription: + state: present + activationkey: 1-222333444 + pool: '^Red Hat Enterprise Server$' # Register as user credentials into given environment (against Red Hat # Satellite 6.x), and auto-subscribe to available content. -- redhat_subscription: state=present - username=joe_user password=somepass - environment=Library - autosubscribe=true +- redhat_subscription: + state: present + username: joe_user + password: somepass + environment: Library + autosubscribe: yes ''' import os diff --git a/packaging/os/rhn_channel.py b/packaging/os/rhn_channel.py index 00711831..9ec24483 100644 --- a/packaging/os/rhn_channel.py +++ b/packaging/os/rhn_channel.py @@ -26,7 +26,7 @@ description: version_added: "1.1" author: "Vincent Van der Kussen (@vincentvdk)" notes: - - this module fetches the system id from RHN. + - this module fetches the system id from RHN. requirements: - none options: @@ -46,7 +46,7 @@ options: required: false default: present url: - description: + description: - The full url to the RHN/Satellite api required: true user: @@ -60,7 +60,12 @@ options: ''' EXAMPLES = ''' -- rhn_channel: name=rhel-x86_64-server-v2vwin-6 sysname=server01 url=https://rhn.redhat.com/rpc/api user=rhnuser password=guessme +- rhn_channel: + name: rhel-x86_64-server-v2vwin-6 + sysname: server01 + url: 'https://rhn.redhat.com/rpc/api' + user: rhnuser + password: guessme ''' import xmlrpclib diff --git a/packaging/os/rhn_register.py b/packaging/os/rhn_register.py index f30cf090..8908e448 100644 --- a/packaging/os/rhn_register.py +++ b/packaging/os/rhn_register.py @@ -83,30 +83,44 @@ options: EXAMPLES = ''' # Unregister system from RHN. -- rhn_register: state=absent username=joe_user password=somepass +- rhn_register: + state: absent + username: joe_user + password: somepass # Register as user (joe_user) with password (somepass) and auto-subscribe to available content. -- rhn_register: state=present username=joe_user password=somepass +- rhn_register: + state: present + username: joe_user + password: somepass # Register with activationkey (1-222333444) and enable extended update support. -- rhn_register: state=present activationkey=1-222333444 enable_eus=true +- rhn_register: + state: present + activationkey: 1-222333444 + enable_eus: true # Register with activationkey (1-222333444) and set a profilename which may differ from the hostname. -- rhn_register: state=present activationkey=1-222333444 profilename=host.example.com.custom +- rhn_register: + state: present + activationkey: 1-222333444 + profilename: host.example.com.custom # Register as user (joe_user) with password (somepass) against a satellite # server specified by (server_url). -- rhn_register: > - state=present - username=joe_user - password=somepass - server_url=https://xmlrpc.my.satellite/XMLRPC +- rhn_register: + state: present + username: joe_user + password: somepass' + server_url: 'https://xmlrpc.my.satellite/XMLRPC' # Register as user (joe_user) with password (somepass) and enable # channels (rhel-x86_64-server-6-foo-1) and (rhel-x86_64-server-6-bar-1). -- rhn_register: state=present username=joe_user - password=somepass - channels=rhel-x86_64-server-6-foo-1,rhel-x86_64-server-6-bar-1 +- rhn_register: + state: present + username: joe_user + password: somepass + channels: rhel-x86_64-server-6-foo-1,rhel-x86_64-server-6-bar-1 ''' import sys diff --git a/packaging/os/rpm_key.py b/packaging/os/rpm_key.py index 4899d5cd..19f36419 100644 --- a/packaging/os/rpm_key.py +++ b/packaging/os/rpm_key.py @@ -52,13 +52,19 @@ options: EXAMPLES = ''' # Example action to import a key from a url -- rpm_key: state=present key=http://apt.sw.be/RPM-GPG-KEY.dag.txt +- rpm_key: + state: present + key: 'http://apt.sw.be/RPM-GPG-KEY.dag.txt' # Example action to import a key from a file -- rpm_key: state=present key=/path/to/key.gpg +- rpm_key: + state: present + key: /path/to/key.gpg # Example action to ensure a key is not present in the db -- rpm_key: state=absent key=DEADB33F +- rpm_key: + state: absent + key: DEADB33F ''' import re import os.path diff --git a/packaging/os/yum.py b/packaging/os/yum.py index 7356880f..13cc4d61 100644 --- a/packaging/os/yum.py +++ b/packaging/os/yum.py @@ -156,31 +156,50 @@ author: EXAMPLES = ''' - name: install the latest version of Apache - yum: name=httpd state=latest + yum: + name: httpd + state: latest - name: remove the Apache package - yum: name=httpd state=absent + yum: + name: httpd + state: absent - name: install the latest version of Apache from the testing repo - yum: name=httpd enablerepo=testing state=present + yum: + name: httpd + enablerepo: testing + state: present - name: install one specific version of Apache - yum: name=httpd-2.2.29-1.4.amzn1 state=present + yum: + name: httpd-2.2.29-1.4.amzn1 + state: present - name: upgrade all packages - yum: name=* state=latest + yum: + name: '*' + state: latest - name: install the nginx rpm from a remote repo - yum: name=http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present + yum: + name: 'http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm' + state: present - name: install nginx rpm from a local file - yum: name=/usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present + yum: + name: /usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm + state: present - name: install the 'Development tools' package group - yum: name="@Development tools" state=present + yum: + name: "@Development tools" + state: present - name: install the 'Gnome desktop' environment group - yum: name="@^gnome-desktop-environment" state=present + yum: + name: "@^gnome-desktop-environment" + state: present ''' # 64k. Number of bytes to read at a time when manually downloading pkgs via a url diff --git a/source_control/git.py b/source_control/git.py index 06965f03..a7cb4ae6 100644 --- a/source_control/git.py +++ b/source_control/git.py @@ -194,22 +194,35 @@ notes: EXAMPLES = ''' # Example git checkout from Ansible Playbooks -- git: repo=git://foosball.example.org/path/to/repo.git - dest=/srv/checkout - version=release-0.22 +- git: + repo: 'git://foosball.example.org/path/to/repo.git' + dest: /srv/checkout + version: release-0.22 # Example read-write git checkout from github -- git: repo=ssh://git@github.com/mylogin/hello.git dest=/home/mylogin/hello +- git: + repo: 'ssh://git@github.com/mylogin/hello.git' + dest: /home/mylogin/hello # Example just ensuring the repo checkout exists -- git: repo=git://foosball.example.org/path/to/repo.git dest=/srv/checkout update=no +- git: + repo: 'git://foosball.example.org/path/to/repo.git' + dest: /srv/checkout + update: no # Example just get information about the repository whether or not it has # already been cloned locally. -- git: repo=git://foosball.example.org/path/to/repo.git dest=/srv/checkout clone=no update=no +- git: + repo: 'git://foosball.example.org/path/to/repo.git' + dest: /srv/checkout + clone: no + update: no # Example checkout a github repo and use refspec to fetch all pull requests -- git: repo=https://github.com/ansible/ansible-examples.git dest=/src/ansible-examples refspec=+refs/pull/*:refs/heads/* +- git: + repo: 'https://github.com/ansible/ansible-examples.git' + dest: /src/ansible-examples + refspec: '+refs/pull/*:refs/heads/*' ''' import os diff --git a/source_control/hg.py b/source_control/hg.py index e0e50e2c..effc8a7c 100644 --- a/source_control/hg.py +++ b/source_control/hg.py @@ -95,11 +95,19 @@ requirements: [ ] EXAMPLES = ''' # Ensure the current working copy is inside the stable branch and deletes untracked files if any. -- hg: repo=https://bitbucket.org/user/repo1 dest=/home/user/repo1 revision=stable purge=yes +- hg: + repo: 'https://bitbucket.org/user/repo1' + dest: /home/user/repo1 + revision: stable + purge: yes # Example just get information about the repository whether or not it has # already been cloned locally. -- hg: repo=git://bitbucket.org/user/repo dest=/srv/checkout clone=no update=no +- hg: + repo: 'git://bitbucket.org/user/repo' + dest: /srv/checkout + clone: no + update: no ''' import os diff --git a/source_control/subversion.py b/source_control/subversion.py index 449cd3cd..49a0e22f 100644 --- a/source_control/subversion.py +++ b/source_control/subversion.py @@ -104,14 +104,22 @@ options: EXAMPLES = ''' # Checkout subversion repository to specified folder. -- subversion: repo=svn+ssh://an.example.org/path/to/repo dest=/src/checkout +- subversion: + repo: 'svn+ssh://an.example.org/path/to/repo' + dest: /src/checkout # Export subversion directory to folder -- subversion: repo=svn+ssh://an.example.org/path/to/repo dest=/src/export export=True +- subversion: + repo: 'svn+ssh://an.example.org/path/to/repo' + dest: /src/export # Example just get information about the repository whether or not it has # already been cloned locally. -- subversion: repo=svn+ssh://an.example.org/path/to/repo dest=/srv/checkout checkout=no update=no +- subversion: + repo: 'svn+ssh://an.example.org/path/to/repo' + dest: /srv/checkout + checkout: no + update: no ''' import re |