ansible-modules: update

This commit is contained in:
Rico Sta. Cruz 2017-10-03 02:00:21 +08:00
parent 837b2d2590
commit 2a0526bd84
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 33 additions and 17 deletions

View File

@ -1,35 +1,47 @@
--- ---
title: Ansible modules title: Ansible modules
category: Ansible category: Ansible
layout: 2017/s##heet layout: 2017/sheet
prism_languages: [yaml]
updated: 2017-10-03
--- ---
### Aptitude ### Aptitude
```yml #### Packages
- apt_key: id=AC40B2F7 url="http://..."
state=present
```
```yml ```yaml
- apt: pkg=nodejs state=present - apt: pkg=nodejs state=present
state=present # absent | latest state=present # absent | latest
update_cache=yes update_cache=yes
force=no force=no
``` ```
```yml #### Deb files
```yaml
- apt: deb=https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb - apt: deb=https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
``` ```
```yml #### Repositories
```yaml
- apt_repository: repo='deb https://... raring main' - apt_repository: repo='deb https://... raring main'
state=present state=present
``` ```
#### Repository keys
```yaml
- apt_key: id=AC40B2F7 url="http://..."
state=present
```
### file ### file
```yml #### File
```yaml
- file: - file:
state=directory # file | link | hard | touch | absent state=directory # file | link | hard | touch | absent
path=/etc/dir path=/etc/dir
@ -40,13 +52,17 @@ layout: 2017/s##heet
force=yes # ln -nfs force=yes # ln -nfs
``` ```
```yml #### Copy
```yaml
- copy: - copy:
src=/app/config/nginx.conf src=/app/config/nginx.conf
dest=/etc/nginx/nginx.conf dest=/etc/nginx/nginx.conf
``` ```
```yml #### Templates
```yaml
- template: - template:
src=config/redis.j2 src=config/redis.j2
dest=/etc/redis.conf dest=/etc/redis.conf
@ -54,7 +70,7 @@ layout: 2017/s##heet
### git ### git
```yml ```yaml
- git: repo=git://github.com/ - git: repo=git://github.com/
dest=/srv/checkout dest=/srv/checkout
version=master version=master
@ -63,7 +79,7 @@ layout: 2017/s##heet
``` ```
### user ### user
```yml ```yaml
- user: state=present name=git - user: state=present name=git
system=yes system=yes
shell=/bin/sh shell=/bin/sh
@ -73,27 +89,27 @@ layout: 2017/s##heet
### service ### service
```yml ```yaml
- service: name=nginx state=started [enabled=yes] - service: name=nginx state=started [enabled=yes]
``` ```
### shell ### shell
```yml ```yaml
- shell: apt-get install nginx -y - shell: apt-get install nginx -y
- script: /x/y/script.sh - script: /x/y/script.sh
``` ```
### local_action ### local_action
```yml ```yaml
- name: do something locally - name: do something locally
local_action: shell echo hello local_action: shell echo hello
``` ```
### debug ### debug
```yml ```yaml
- debug: - debug:
msg: "Hello {{ var }}" msg: "Hello {{ var }}"
``` ```