Show Menu
Cheatography

ansible Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

FAQ

Show only the server­pla­ybook content
config­ure-cm $serve­rname
How do I add a role?
config­ure-cm --role $role $serve­rname
Remove a role?
config­ure-cm --delete --role $role $server --message "­$re­aso­n"
Add a Blueprint?
config­ure-cm -b $blueprint $serve­rname
Remove a Blueprint?
config­ure-cm --delete --blue­print $blueprint $server
Show the docume­ntation of an Ansible module
ansibl­e-doc $modul­ename
Add playbook variables? key-value
config­ure-cm --var timezo­ne=UTC degtlu­n7904
Add playbook variables? JSON
config­ure-cm --var '[{ntp­_se­rvers: [145.2­28.3­9.4­4,­145.22­8.1­45.3­]}]' degtlu­n7904
Add playbook variables? YAML-FILE
config­ure-cm --var @/tmp/­yam­l_file degtlu­n7904
How do I fix non-co­mmited playbook changes?
config­ure-cm --comm­it-only $serve­rname
Add a variable with role
config­ure-cm --role postfix --var relayh­ost­=cm­ail.tr­ans­net­bw.net $srvname
 

Add sudoers

config­ure-cm $serve­rname --sudoers TOMCAT­_su­doers

Add Task from YAML file - User limits

$ cat /tmp/ansible_task.yml
---
- name: degtlun7904.yml | /etc/security/limits.conf | Set user limits nofile
  pam_limits:
    domain: '*'
    limit_type: "-"
    limit_item: "nofile"
    value: 8192
  tags: limits

$ configure-cm degtlun7904 --task /tmp/ansible_task.yml
$ run-cm degtlun7904 -t limits

Add a package

# Tabcompletion for packages from csrepo
$ configure-cm $servername --pkg dba-tomcat-7047-core
$ run-cm $servername -t pkgs

Add a netgroup

# Tabcompletion
$ configure-cm $srvname --netgroup ng_dba_ext
$ run-cm $srvname -t netgroups
 

Tools on degtlu­n1235

run-cm
Run the Ansible playbook
config­ure-cm
Configure the server playbook
distri­but­e_j­ump­ser­ver.sh
Update jumpserver role on all jumpse­rvers

Roles

asmlib
apache
clamav
CORE
corosync
csrepo
cups
docker
extras­_repo
nfs_mount
nfs_server
postfix
sdk_repo
symantec
symant­ec_hids

Blueprints

apache
check_mk
chef
cs_nrp­e_c­lient
ggaddm
hana
mysql
ORA
postgres
SAP
SYB
WEB

CORE - Important variables tags

dns_search
dns_se­arch: as.lek­ker­lan­d.com otg.co­rp.int server.ar­vat­o-s­yst­ems.de bertel­sma­nn.de
dns
dns_se­rvers
dns_servers:
- 172.25.192.31
- 172.25.192.20
- 172.25.168.12
dns
dns_no­_sh­uffle
dns_no­_sh­uffle: True
dns
kernel­_ip­_fo­rwa­rding
kernel­_ip­_fo­rwa­rding: 1
ipforw­arding
pe_numbers
pe_numbers:
- number: PE00001111
 ­  reason: FTP
   ­end­date: 20170616
motd
sshd_o­nly­_di­alogip
sshd_o­nly­_di­alogip: True
sshd
timezone
timezone: UTC
timezone