1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Use native YAML - Packaging (#3588)

* Fix kibana

* More native YAML

* More native YAML

* More native YAML

* More native YAML. Now only languages/ is missing

* Use native yaml sintax for packaging/languages as well

* Some more and quote fixes

* Fix wrong grouping
This commit is contained in:
Fabio Alessandro Locati 2016-12-01 16:07:13 +00:00 committed by Matt Clay
parent d344d7863a
commit 06a8f1d79b
34 changed files with 589 additions and 186 deletions

View file

@ -39,7 +39,9 @@ notes:
'''
EXAMPLES = '''
# Prevent python from being upgraded.
- dpkg_selections: name=python selection=hold
- dpkg_selections:
name: python
selection: hold
'''
def main():

View file

@ -83,13 +83,20 @@ options:
EXAMPLES = '''
# Install Elasticsearch head plugin
- elasticsearch_plugin: state=present name="mobz/elasticsearch-head"
- elasticsearch_plugin:
state: present
name: mobz/elasticsearch-head
# Install specific version of a plugin
- elasticsearch_plugin: state=present name="com.github.kzwang/elasticsearch-image" version="1.2.0"
- elasticsearch_plugin:
state: present
name: com.github.kzwang/elasticsearch-image
version: '1.2.0'
# Uninstall Elasticsearch head plugin
- elasticsearch_plugin: state=absent name="mobz/elasticsearch-head"
- elasticsearch_plugin:
state: absent
name: mobz/elasticsearch-head
'''
PACKAGE_STATE_MAP = dict(

View file

@ -79,13 +79,20 @@ options:
EXAMPLES = '''
# Install Elasticsearch head plugin
- kibana_plugin: state=present name="elasticsearch/marvel"
- kibana_plugin:
state: present
name=: elasticsearch/marvel
# Install specific version of a plugin
- kibana_plugin: state=present name="elasticsearch/marvel" version="2.3.3"
- kibana_plugin:
state: present
name: elasticsearch/marvel
version: '2.3.3'
# Uninstall Elasticsearch head plugin
- kibana_plugin: state=absent name="elasticsearch/marvel"
- kibana_plugin:
state: absent
name: elasticsearch/marvel
'''
RETURN = '''

View file

@ -67,24 +67,37 @@ options:
'''
EXAMPLES = '''
description: Install "bootstrap" bower package.
- bower: name=bootstrap
- name: Install "bootstrap" bower package.
bower:
name: bootstrap
description: Install "bootstrap" bower package on version 3.1.1.
- bower: name=bootstrap version=3.1.1
- name: Install "bootstrap" bower package on version 3.1.1.
bower:
name: bootstrap
version: '3.1.1'
description: Remove the "bootstrap" bower package.
- bower: name=bootstrap state=absent
- name: Remove the "bootstrap" bower package.
bower:
name: bootstrap
state: absent
description: Install packages based on bower.json.
- bower: path=/app/location
- name: Install packages based on bower.json.
bower:
path: /app/location
description: Update packages based on bower.json to their latest version.
- bower: path=/app/location state=latest
- name: Update packages based on bower.json to their latest version.
bower:
path: /app/location
state: latest
description: install bower locally and run from there
- npm: path=/app/location name=bower global=no
- bower: path=/app/location relative_execpath=node_modules/.bin
# install bower locally and run from there
- npm:
path: /app/location
name: bower
global: no
- bower:
path: /app/location
relative_execpath: node_modules/.bin
'''

View file

@ -112,19 +112,29 @@ author: "Tim Hoiberg (@thoiberg)"
EXAMPLES='''
# Installs gems from a Gemfile in the current directory
- bundler: state=present executable=~/.rvm/gems/2.1.5/bin/bundle
- bundler:
state: present
executable: ~/.rvm/gems/2.1.5/bin/bundle
# Excludes the production group from installing
- bundler: state=present exclude_groups=production
- bundler:
state: present
exclude_groups: production
# Only install gems from the default and production groups
- bundler: state=present deployment_mode=yes
- bundler:
state: present
deployment_mode: yes
# Installs gems using a Gemfile in another directory
- bundler: state=present gemfile=../rails_project/Gemfile
- bundler:
state: present
gemfile: ../rails_project/Gemfile
# Updates Gemfile in another directory
- bundler: state=latest chdir=~/rails_project
- bundler:
state: latest
chdir: ~/rails_project
'''

View file

@ -108,19 +108,21 @@ notes:
EXAMPLES = '''
# Downloads and installs all the libs and dependencies outlined in the /path/to/project/composer.lock
- composer: command=install working_dir=/path/to/project
- composer:
command: install
working_dir: /path/to/project
- composer:
command: "require"
arguments: "my/package"
working_dir: "/path/to/project"
command: require
arguments: my/package
working_dir: /path/to/project
# Clone project and install with all dependencies
- composer:
command: "create-project"
arguments: "package/package /path/to/project ~1.0"
working_dir: "/path/to/project"
prefer_dist: "yes"
command: create-project
arguments: package/package /path/to/project ~1.0
working_dir: /path/to/project
prefer_dist: yes
'''
import os

View file

@ -91,29 +91,43 @@ author: "Franck Cuny (@franckcuny)"
EXAMPLES = '''
# install Dancer perl package
- cpanm: name=Dancer
- cpanm:
name: Dancer
# install version 0.99_05 of the Plack perl package
- cpanm: name=MIYAGAWA/Plack-0.99_05.tar.gz
- cpanm:
name: MIYAGAWA/Plack-0.99_05.tar.gz
# install Dancer into the specified locallib
- cpanm: name=Dancer locallib=/srv/webapps/my_app/extlib
- cpanm:
name: Dancer
locallib: /srv/webapps/my_app/extlib
# install perl dependencies from local directory
- cpanm: from_path=/srv/webapps/my_app/src/
- cpanm:
from_path: /srv/webapps/my_app/src/
# install Dancer perl package without running the unit tests in indicated locallib
- cpanm: name=Dancer notest=True locallib=/srv/webapps/my_app/extlib
- cpanm:
name: Dancer
notest: True
locallib: /srv/webapps/my_app/extlib
# install Dancer perl package from a specific mirror
- cpanm: name=Dancer mirror=http://cpan.cpantesters.org/
- cpanm:
name: Dancer
mirror: 'http://cpan.cpantesters.org/'
# install Dancer perl package into the system root path
- cpanm: name=Dancer system_lib=yes
- cpanm:
name: Dancer
system_lib: yes
# install Dancer if it's not already installed
# OR the installed version is older than version 1.0
- cpanm: name=Dancer version=1.0
- cpanm:
name: Dancer
version: '1.0'
'''
def _is_package_installed(module, name, locallib, cpanm, version):

View file

@ -119,16 +119,34 @@ options:
EXAMPLES = '''
# Download the latest version of the JUnit framework artifact from Maven Central
- maven_artifact: group_id=junit artifact_id=junit dest=/tmp/junit-latest.jar
- maven_artifact:
group_id: junit
artifact_id: junit
dest: /tmp/junit-latest.jar
# Download JUnit 4.11 from Maven Central
- maven_artifact: group_id=junit artifact_id=junit version=4.11 dest=/tmp/junit-4.11.jar
- maven_artifact:
group_id: junit
artifact_id: junit
version: 4.11
dest: /tmp/junit-4.11.jar
# Download an artifact from a private repository requiring authentication
- maven_artifact: group_id=com.company artifact_id=library-name repository_url=https://repo.company.com/maven username=user password=pass dest=/tmp/library-name-latest.jar
- maven_artifact:
group_id: com.company
artifact_id: library-name
repository_url: 'https://repo.company.com/maven'
username: user
password: pass
dest: /tmp/library-name-latest.jar
# Download a WAR File to the Tomcat webapps directory to be deployed
- maven_artifact: group_id=com.company artifact_id=web-app extension=war repository_url=https://repo.company.com/maven dest=/var/lib/tomcat7/webapps/web-app.war
- maven_artifact:
group_id: com.company
artifact_id: web-app
extension: war
repository_url: 'https://repo.company.com/maven'
dest: /var/lib/tomcat7/webapps/web-app.war
'''
class Artifact(object):

View file

@ -78,28 +78,46 @@ options:
EXAMPLES = '''
description: Install "coffee-script" node.js package.
- npm: name=coffee-script path=/app/location
- npm:
name: coffee-script
path: /app/location
description: Install "coffee-script" node.js package on version 1.6.1.
- npm: name=coffee-script version=1.6.1 path=/app/location
- npm:
name: coffee-script
version: '1.6.1'
path: /app/location
description: Install "coffee-script" node.js package globally.
- npm: name=coffee-script global=yes
- npm:
name: coffee-script
global: yes
description: Remove the globally package "coffee-script".
- npm: name=coffee-script global=yes state=absent
- npm:
name: coffee-script
global: yes
state: absent
description: Install "coffee-script" node.js package from custom registry.
- npm: name=coffee-script registry=http://registry.mysite.com
- npm:
name: coffee-script
registry: 'http://registry.mysite.com'
description: Install packages based on package.json.
- npm: path=/app/location
- npm:
path: /app/location
description: Update packages based on package.json to their latest version.
- npm: path=/app/location state=latest
- npm:
path: /app/location
state: latest
description: Install packages based on package.json using the npm installed with nvm v0.10.1.
- npm: path=/app/location executable=/opt/nvm/v0.10.1/bin/npm state=present
- npm:
path: /app/location
executable: /opt/nvm/v0.10.1/bin/npm
state: present
'''
import os

View file

@ -45,16 +45,24 @@ options:
EXAMPLES = '''
# Install pear package
- pear: name=Net_URL2 state=present
- pear:
name: Net_URL2
state: present
# Install pecl package
- pear: name=pecl/json_post state=present
- pear:
name: pecl/json_post
state: present
# Upgrade package
- pear: name=Net_URL2 state=latest
- pear:
name: Net_URL2
state: latest
# Remove packages
- pear: name=Net_URL2,pecl/json_post state=absent
- pear:
name: Net_URL2,pecl/json_post
state: absent
'''
import os

View file

@ -58,34 +58,54 @@ notes:
EXAMPLES = '''
# Update repositories and install "foo" package
- apk: name=foo update_cache=yes
- apk:
name: foo
update_cache: yes
# Update repositories and install "foo" and "bar" packages
- apk: name=foo,bar update_cache=yes
- apk:
name: foo,bar
update_cache: yes
# Remove "foo" package
- apk: name=foo state=absent
- apk:
name: foo
state: absent
# Remove "foo" and "bar" packages
- apk: name=foo,bar state=absent
- apk:
name: foo,bar
state: absent
# Install the package "foo"
- apk: name=foo state=present
- apk:
name: foo
state: present
# Install the packages "foo" and "bar"
- apk: name=foo,bar state=present
- apk:
name: foo,bar
state: present
# Update repositories and update package "foo" to latest version
- apk: name=foo state=latest update_cache=yes
- apk:
name: foo
state: latest
update_cache: yes
# Update repositories and update packages "foo" and "bar" to latest versions
- apk: name=foo,bar state=latest update_cache=yes
- apk:
name: foo,bar
state: latest
update_cache: yes
# Update all installed packages to the latest versions
- apk: upgrade=yes
- apk:
upgrade: yes
# Update repositories as a separate step
- apk: update_cache=yes
- apk:
update_cache: yes
'''
import os

View file

@ -101,26 +101,40 @@ author:
EXAMPLES = '''
- name: install the latest version of Apache
dnf: name=httpd state=latest
dnf:
name: httpd
state: latest
- name: remove the Apache package
dnf: name=httpd state=absent
dnf:
name: httpd
state: absent
- name: install the latest version of Apache from the testing repo
dnf: name=httpd enablerepo=testing state=present
dnf:
name: httpd
enablerepo: testing
state: present
- name: upgrade all packages
dnf: name=* state=latest
dnf:
name: *
state: latest
- name: install the nginx rpm from a remote repo
dnf: name=http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present
dnf:
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
dnf: name=/usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm state=present
dnf:
name: /usr/local/src/nginx-release-centos-6-0.el6.ngx.noarch.rpm
state: present
- name: install the 'Development tools' package group
dnf: name="@Development tools" state=present
dnf:
name: '@Development tools'
state: present
'''
import os

View file

@ -76,26 +76,54 @@ notes: []
'''
EXAMPLES = '''
# Install formula foo with 'brew' in default path (C(/usr/local/bin))
- homebrew: name=foo state=present
- homebrew:
name: foo
state: present
# Install formula foo with 'brew' in alternate path C(/my/other/location/bin)
- homebrew: name=foo path=/my/other/location/bin state=present
- homebrew:
name: foo
path: /my/other/location/bin
state: present
# Update homebrew first and install formula foo with 'brew' in default path
- homebrew: name=foo state=present update_homebrew=yes
- homebrew:
name: foo
state: present
update_homebrew: yes
# Update homebrew first and upgrade formula foo to latest available with 'brew' in default path
- homebrew: name=foo state=latest update_homebrew=yes
- homebrew:
name: foo
state: latest
update_homebrew: yes
# Update homebrew and upgrade all packages
- homebrew: update_homebrew=yes upgrade_all=yes
- homebrew:
update_homebrew: yes
upgrade_all: yes
# Miscellaneous other examples
- homebrew: name=foo state=head
- homebrew: name=foo state=linked
- homebrew: name=foo state=absent
- homebrew: name=foo,bar state=absent
- homebrew: name=foo state=present install_options=with-baz,enable-debug
- homebrew:
name: foo
state: head
- homebrew:
name: foo
state: linked
- homebrew:
name: foo
state: absent
- homebrew:
name: foo,bar
state: absent
- homebrew:
name: foo
state: present
install_options: with-baz,enable-debug
'''
import os.path

View file

@ -65,11 +65,28 @@ options:
version_added: "2.2"
'''
EXAMPLES = '''
- homebrew_cask: name=alfred state=present
- homebrew_cask: name=alfred state=absent
- homebrew_cask: name=alfred state=present install_options="appdir=/Applications"
- homebrew_cask: name=alfred state=present install_options="debug,appdir=/Applications"
- homebrew_cask: name=alfred state=absent install_options="force"
- homebrew_cask:
name: alfred
state: present
- homebrew_cask:
name: alfred
state: absent
- homebrew_cask:
name: alfred
state: present
install_options: 'appdir=/Applications'
- homebrew_cask:
name: alfred
state: present
install_options: 'debug,appdir=/Applications'
- homebrew_cask:
name: alfred
state: absent
install_options: force
'''
import os.path

View file

@ -59,10 +59,20 @@ requirements: [ homebrew ]
'''
EXAMPLES = '''
homebrew_tap: name=homebrew/dupes
homebrew_tap: name=homebrew/dupes state=absent
homebrew_tap: name=homebrew/dupes,homebrew/science state=present
homebrew_tap: name=telemachus/brew url=https://bitbucket.org/telemachus/brew
- homebrew_tap:
name: homebrew/dupes
- homebrew_tap:
name: homebrew/dupes
state: absent
- homebrew_tap:
name: homebrew/dupes,homebrew/science
state: present
- homebrew_tap:
name: telemachus/brew
url: 'https://bitbucket.org/telemachus/brew'
'''

View file

@ -64,19 +64,29 @@ options:
EXAMPLES = '''
# Install the overlay 'mozilla' which is on the central overlays list.
- layman: name=mozilla
- layman:
name: mozilla
# Install the overlay 'cvut' from the specified alternative list.
- layman: name=cvut list_url=http://raw.github.com/cvut/gentoo-overlay/master/overlay.xml
- layman:
name: cvut
list_url: 'http://raw.github.com/cvut/gentoo-overlay/master/overlay.xml'
# Update (sync) the overlay 'cvut', or install if not installed yet.
- layman: name=cvut list_url=http://raw.github.com/cvut/gentoo-overlay/master/overlay.xml state=updated
- layman:
name: cvut
list_url: 'http://raw.github.com/cvut/gentoo-overlay/master/overlay.xml'
state: updated
# Update (sync) all of the installed overlays.
- layman: name=ALL state=updated
- layman:
name: ALL
state: updated
# Uninstall the overlay 'cvut'.
- layman: name=cvut state=absent
- layman:
name: cvut
state: absent
'''
USERAGENT = 'ansible-httpget'

View file

@ -46,11 +46,26 @@ options:
notes: []
'''
EXAMPLES = '''
- macports: name=foo state=present
- macports: name=foo state=present update_cache=yes
- macports: name=foo state=absent
- macports: name=foo state=active
- macports: name=foo state=inactive
- macports:
name: foo
state: present
- macports:
name: foo
state: present
update_cache: yes
- macports:
name: foo
state: absent
- macports:
name: foo
state: active
- macports:
name: foo
state: inactive
'''
import pipes

View file

@ -68,28 +68,45 @@ options:
EXAMPLES = '''
# Make sure nmap is installed
- openbsd_pkg: name=nmap state=present
- openbsd_pkg:
name: nmap
state: present
# Make sure nmap is the latest version
- openbsd_pkg: name=nmap state=latest
- openbsd_pkg:
name: nmap
state: latest
# Make sure nmap is not installed
- openbsd_pkg: name=nmap state=absent
- openbsd_pkg:
name: nmap
state: absent
# Make sure nmap is installed, build it from source if it is not
- openbsd_pkg: name=nmap state=present build=yes
- openbsd_pkg:
name: nmap
state: present
build: yes
# Specify a pkg flavour with '--'
- openbsd_pkg: name=vim--no_x11 state=present
- openbsd_pkg:
name: vim--no_x11
state: present
# Specify the default flavour to avoid ambiguity errors
- openbsd_pkg: name=vim-- state=present
- openbsd_pkg:
name: vim--
state: present
# Specify a package branch (requires at least OpenBSD 6.0)
- openbsd_pkg: name=python%3.5 state=present
- openbsd_pkg:
name: python%3.5
state: present
# Update all packages on the system
- openbsd_pkg: name=* state=latest
- openbsd_pkg:
name: *
state: latest
'''
# Function used for executing commands.

View file

@ -52,11 +52,27 @@ options:
notes: []
'''
EXAMPLES = '''
- opkg: name=foo state=present
- opkg: name=foo state=present update_cache=yes
- opkg: name=foo state=absent
- opkg: name=foo,bar state=absent
- opkg: name=foo state=present force=overwrite
- opkg:
name: foo
state: present
- opkg:
name: foo
state: present
update_cache: yes
- opkg:
name: foo
state: absent
- opkg:
name: foo,bar
state: absent
- opkg:
name: foo
state: present
force: overwrite
'''
import pipes

View file

@ -89,28 +89,45 @@ options:
EXAMPLES = '''
# Install package foo
- pacman: name=foo state=present
- pacman:
name: foo
state: present
# Upgrade package foo
- pacman: name=foo state=latest update_cache=yes
- pacman:
name: foo
state: latest
update_cache: yes
# Remove packages foo and bar
- pacman: name=foo,bar state=absent
- pacman:
name: foo,bar
state: absent
# Recursively remove package baz
- pacman: name=baz state=absent recurse=yes
- pacman:
name: baz
state: absent
recurse: yes
# Run the equivalent of "pacman -Sy" as a separate step
- pacman: update_cache=yes
- pacman:
update_cache: yes
# Run the equivalent of "pacman -Su" as a separate step
- pacman: upgrade=yes
- pacman:
upgrade: yes
# Run the equivalent of "pacman -Syu" as a separate step
- pacman: update_cache=yes upgrade=yes
- pacman:
update_cache: yes
upgrade: yes
# Run the equivalent of "pacman -Rdd", force remove package baz
- pacman: name=baz state=absent force=yes
- pacman:
name: baz
state: absent
force: yes
'''
import shlex

View file

@ -48,10 +48,13 @@ options:
'''
EXAMPLES = '''
# Install Vim:
- pkg5: name=editor/vim
- pkg5:
name: editor/vim
# Remove finger daemon:
- pkg5: name=service/network/finger state=absent
- pkg5:
name: service/network/finger
state: absent
# Install several packages at once:
- pkg5:

View file

@ -65,10 +65,15 @@ options:
'''
EXAMPLES = '''
# Fetch packages for the solaris publisher direct from Oracle:
- pkg5_publisher: name=solaris sticky=true origin=https://pkg.oracle.com/solaris/support/
- pkg5_publisher:
name: solaris
sticky: true
origin: https://pkg.oracle.com/solaris/support/
# Configure a publisher for locally-produced packages:
- pkg5_publisher: name=site origin=https://pkg.example.com/site/
- pkg5_publisher:
name: site
origin: 'https://pkg.example.com/site/'
'''
def main():

View file

@ -91,31 +91,45 @@ options:
EXAMPLES = '''
# install package foo
- pkgin: name=foo state=present
- pkgin:
name: foo
state: present
# Update database and install "foo" package
- pkgin: name=foo update_cache=yes
- pkgin:
name: foo
update_cache: yes
# remove package foo
- pkgin: name=foo state=absent
- pkgin:
name: foo
state: absent
# remove packages foo and bar
- pkgin: name=foo,bar state=absent
- pkgin:
name: foo,bar
state: absent
# Update repositories as a separate step
- pkgin: update_cache=yes
- pkgin:
update_cache: yes
# Upgrade main packages (equivalent to C(pkgin upgrade))
- pkgin: upgrade=yes
- pkgin:
upgrade: yes
# Upgrade all packages (equivalent to C(pkgin full-upgrade))
- pkgin: full_upgrade=yes
- pkgin:
full_upgrade: yes
# Force-upgrade all packages (equivalent to C(pkgin -F full-upgrade))
- pkgin: full_upgrade=yes force=yes
- pkgin:
full_upgrade: yes
force: yes
# clean packages cache (equivalent to C(pkgin clean))
- pkgin: clean=yes
- pkgin:
clean: yes
'''

View file

@ -89,13 +89,19 @@ notes:
EXAMPLES = '''
# Install package foo
- pkgng: name=foo state=present
- pkgng:
name: foo
state: present
# Annotate package foo and bar
- pkgng: name=foo,bar annotation=+test1=baz,-test2,:test3=foobar
- pkgng:
name: foo,bar
annotation: '+test1=baz,-test2,:test3=foobar'
# Remove packages foo and bar
- pkgng: name=foo,bar state=absent
- pkgng:
name: foo,bar
state: absent
'''

View file

@ -60,10 +60,15 @@ options:
EXAMPLES = '''
# Install a package
pkgutil: name=CSWcommon state=present
- pkgutil:
name: CSWcommon
state: present
# Install a package from a specific repository
pkgutil: name=CSWnrpe site='ftp://myinternal.repo/opencsw/kiel state=latest'
- pkgutil:
name: CSWnrpe
site: 'ftp://myinternal.repo/opencsw/kiel'
state: latest
'''
import os

View file

@ -183,28 +183,46 @@ notes: []
EXAMPLES = '''
# Make sure package foo is installed
- portage: package=foo state=present
- portage:
package: foo
state: present
# Make sure package foo is not installed
- portage: package=foo state=absent
- portage:
package: foo
state: absent
# Update package foo to the "best" version
- portage: package=foo update=yes
- portage:
package: foo
update: yes
# Install package foo using PORTAGE_BINHOST setup
- portage: package=foo getbinpkg=yes
- portage:
package: foo
getbinpkg: yes
# Re-install world from binary packages only and do not allow any compiling
- portage: package=@world usepkgonly=yes
- portage:
package: @world
usepkgonly: yes
# Sync repositories and update world
- portage: package=@world update=yes deep=yes sync=yes
- portage:
package: @world
update: yes
deep: yes
sync: yes
# Remove unneeded packages
- portage: depclean=yes
- portage:
depclean: yes
# Remove package foo if it is not explicitly needed
- portage: package=foo state=absent depclean=yes
- portage:
package: foo
state: absent
depclean: yes
'''

View file

@ -48,13 +48,19 @@ author: "berenddeboer (@berenddeboer)"
EXAMPLES = '''
# Install package foo
- portinstall: name=foo state=present
- portinstall:
name: foo
state: present
# Install package security/cyrus-sasl2-saslauthd
- portinstall: name=security/cyrus-sasl2-saslauthd state=present
- portinstall:
name: security/cyrus-sasl2-saslauthd
state: present
# Remove packages foo and bar
- portinstall: name=foo,bar state=absent
- portinstall:
name: foo,bar
state: absent
'''

View file

@ -56,14 +56,19 @@ requirements: [ "Slackware" >= 12.2 ]
EXAMPLES = '''
# Install package foo
- slackpkg: name=foo state=present
- slackpkg:
name: foo
state: present
# Remove packages foo and bar
- slackpkg: name=foo,bar state=absent
- slackpkg:
name: foo,bar
state: absent
# Make sure that it is the most updated package
- slackpkg: name=foo state=latest
- slackpkg:
name: foo
state: latest
'''

View file

@ -75,19 +75,35 @@ options:
EXAMPLES = '''
# Install a package from an already copied file
- svr4pkg: name=CSWcommon src=/tmp/cswpkgs.pkg state=present
- svr4pkg:
name: CSWcommon
src: /tmp/cswpkgs.pkg
state: present
# Install a package directly from an http site
- svr4pkg: name=CSWpkgutil src=http://get.opencsw.org/now state=present zone=current
- svr4pkg:
name: CSWpkgutil
src: 'http://get.opencsw.org/now'
state: present
zone: current
# Install a package with a response file
- svr4pkg: name=CSWggrep src=/tmp/third-party.pkg response_file=/tmp/ggrep.response state=present
- svr4pkg:
name: CSWggrep
src: /tmp/third-party.pkg
response_file: /tmp/ggrep.response
state: present
# Ensure that a package is not installed.
- svr4pkg: name=SUNWgnome-sound-recorder state=absent
- svr4pkg:
name: SUNWgnome-sound-recorder
state: absent
# Ensure that a category is not installed.
- svr4pkg: name=FIREFOX state=absent category=true
- svr4pkg:
name: FIREFOX
state: absent
category: true
'''

View file

@ -58,9 +58,19 @@ options:
'''
EXAMPLES = '''
- swdepot: name=unzip-6.0 state=installed depot=repository:/path
- swdepot: name=unzip state=latest depot=repository:/path
- swdepot: name=unzip state=absent
- swdepot:
name: unzip-6.0
state: installed
depot: 'repository:/path'
- swdepot:
name: unzip
state: latest
depot: 'repository:/path'
- swdepot:
name: unzip
state: absent
'''
def compare_package(version1, version2):

View file

@ -63,13 +63,25 @@ notes: []
EXAMPLES = '''
# install package foo
- urpmi: pkg=foo state=present
- urpmi:
pkg: foo
state: present
# remove package foo
- urpmi: pkg=foo state=absent
- urpmi:
pkg: foo
state: absent
# description: remove packages foo and bar
- urpmi: pkg=foo,bar state=absent
- urpmi:
pkg: foo,bar
state: absent
# description: update the package database (urpmi.update -a -q) and install bar (bar will be the updated if a newer version exists)
- urpmi: name=bar, state=present, update_cache=yes
- urpmi:
name: bar
state: present
update_cache: yes
'''

View file

@ -410,6 +410,7 @@ EXAMPLES = '''
file: external_repos
baseurl: http://download.fedoraproject.org/pub/epel/$releasever/$basearch/
gpgcheck: no
- name: Add multiple repositories into the same file (2/2)
yum_repository:
name: rpmforge

View file

@ -113,34 +113,58 @@ requirements:
EXAMPLES = '''
# Install "nmap"
- zypper: name=nmap state=present
- zypper:
name: nmap
state: present
# Install apache2 with recommended packages
- zypper: name=apache2 state=present disable_recommends=no
- zypper:
name: apache2
state: present
disable_recommends: no
# Apply a given patch
- zypper: name=openSUSE-2016-128 state=present type=patch
- zypper:
name: openSUSE-2016-128
state: present
type: patch
# Remove the "nmap" package
- zypper: name=nmap state=absent
- zypper:
name: nmap
state: absent
# Install the nginx rpm from a remote repo
- zypper: name=http://nginx.org/packages/sles/12/x86_64/RPMS/nginx-1.8.0-1.sles12.ngx.x86_64.rpm state=present
- zypper:
name: 'http://nginx.org/packages/sles/12/x86_64/RPMS/nginx-1.8.0-1.sles12.ngx.x86_64.rpm'
state: present
# Install local rpm file
- zypper: name=/tmp/fancy-software.rpm state=present
- zypper:
name: /tmp/fancy-software.rpm
state: present
# Update all packages
- zypper: name=* state=latest
- zypper:
name: *
state: latest
# Apply all available patches
- zypper: name=* state=latest type=patch
- zypper:
name: *
state: latest
type: patch
# Refresh repositories and update package "openssl"
- zypper: name=openssl state=present update_cache=yes
- zypper:
name: openssl
state: present
update_cache: yes
# Install specific version (possible comparisons: <, >, <=, >=, =)
- zypper: name=docker>=1.10 state=installed
- zypper:
name: 'docker>=1.10'
state: installed
'''

View file

@ -114,22 +114,37 @@ requirements:
EXAMPLES = '''
# Add NVIDIA repository for graphics drivers
- zypper_repository: name=nvidia-repo repo='ftp://download.nvidia.com/opensuse/12.2' state=present
- zypper_repository:
name: nvidia-repo
repo: 'ftp://download.nvidia.com/opensuse/12.2'
state: present
# Remove NVIDIA repository
- zypper_repository: name=nvidia-repo repo='ftp://download.nvidia.com/opensuse/12.2' state=absent
- zypper_repository:
name: nvidia-repo
repo: 'ftp://download.nvidia.com/opensuse/12.2'
state: absent
# Add python development repository
- zypper_repository: repo=http://download.opensuse.org/repositories/devel:/languages:/python/SLE_11_SP3/devel:languages:python.repo
- zypper_repository:
repo: 'http://download.opensuse.org/repositories/devel:/languages:/python/SLE_11_SP3/devel:languages:python.repo'
# Refresh all repos
- zypper_repository: repo=* runrefresh=yes
- zypper_repository:
repo: *
runrefresh: yes
# Add a repo and add it's gpg key
- zypper_repository: repo=http://download.opensuse.org/repositories/systemsmanagement/openSUSE_Leap_42.1/ auto_import_keys=yes
- zypper_repository:
repo: 'http://download.opensuse.org/repositories/systemsmanagement/openSUSE_Leap_42.1/'
auto_import_keys: yes
# Force refresh of a repository
- zypper_repository: repo=http://my_internal_ci_repo/repo name=my_ci_repo state=present runrefresh=yes
- zypper_repository:
repo: 'http://my_internal_ci_repo/repo
name: my_ci_repo
state: present
runrefresh: yes
'''
REPO_OPTS = ['alias', 'name', 'priority', 'enabled', 'autorefresh', 'gpgcheck']