User
YUM
Service
File
- name: remove file index2.html
file:
path: /var/www/html/index2.html
state: absent
...Lineinfile
Copy
Replace
Firewalld
- name: add firewall rules by service
firewalld:
immediate: yes
permanent: yes
state: enabled
service: http
- name: remove firewall rules by port
firewalld:
zone: public|dmz|internal|external
port: 80/tcp|170-179/udp
immediate: yes|no
permanent: yes|no
state: disabledCron
add new jobs
- name: show options of cron
cron:
name: "job name"
special_time: reboot|daily|weekly|etc
minute: 0-59|*|*/2
hour: 0-23|*|*/2
day: 1-31|*|*/2
month: 1-12|*|*/2
weekday: 0-6|*
user: user_name
cron_file: file_name
state: present|absent
job: command Archive
- name: show options for archive module
archive:
path:
- /path/to/different_files
- /path/to/file*
- /path/to/dir/
dest: /dest/of/archive_file
exclude_path:
- /path/to/file3
format: gz|bz2|tar|zip
---
- name: testing archive module
become: yes
hosts: dbsystems
tasks:
- name: archiving /var/log and /home on slave nodes
archive:
path:
- /var/log
- /home
dest: /tmp/archive.tar.gz
format: gz
owner: ansible
- name: fetching archives to control node
become: yes
hosts: all
tasks:
- name: copying archives to control node
fetch:
src: /tmp/archive.tar.gz
dest: /home/ansible/archive-{{inventory_hostname}}.tar.gz
...Filesystem
LVG
pvcreate/vgcreate
LVOL
lvcreate without rezifs option
lvextend the same as for create, but with resizefs option
Mount
add entry to fstab
Git
Main parameters:
repo (required)
dest (required)
clone
Get_url
Parted
At
- name: show options for at module
at:
command: command_to_run
script_file: /path/to/script.sh
count: count of units
unit: minutes|hours|days|weeks
state: present|absentSELinux
- name: show options for selinux module
selinux:
configfile: /path/config/file
policy: targeted
state: enforcing|permissive|disabledSeboolean
- name: show options for seboolean module
seboolean:
name: boolean_name
state: no|yes
persistent: no|yesSefcontext
- name: show options for secontext module
sefcontext:
ftype: a|d
reload: yes|no
target: '/path/to/dir(/.*)?'
setype: selinux_type
state: present|absent
- name: apply selinux content
cmd: "Restorecon -R -v /path/to/dir"Template
- name: show template options
template:
src: /path/to/template.j2
dest: /path/to/dest
owner: owner_name
group: group_owner_name
mode: file_perm
backup: yes|no
validate: validation command %sYum_repository
- name: add yum_repository
yum_repository:
name: repo_name
description: will_be_set_in_[name]_repo
baseurl: base_url
gpgcheck: yes|no
\_\_\_\_\_\_\_\_\_\_
- name: remove yum_repository
yum_repository
name: repo_name
file: repo_file_name (without *.repo extension and full path)
state: absent