DevOps Tools/Configuration/Ansible/Playbook Examples

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
(CentOS - update the hosts file from template)
(CentOS - ensure certain packages are installed)
Line 4: Line 4:
 
==CentOS - ensure certain packages are installed==
 
==CentOS - ensure certain packages are installed==
 
This uses the '''yum''' module
 
This uses the '''yum''' module
  <nowiki>~$ cat /etc/ansible/playbooks/centos_base_packages.yml
+
  <nowiki>~$ sudo cat /etc/ansible/playbooks/centos_base_packages.yml
 
- hosts: centos
 
- hosts: centos
 
   tasks:
 
   tasks:

Revision as of 17:36, 31 January 2019

Overview | Continuous Integration (CI) | Source Control Management (SCM) | Containerization | Configuration | Integration
Ansible | Playbook Examples

Playbook Examples

CentOS - ensure certain packages are installed

This uses the yum module

~$ sudo cat /etc/ansible/playbooks/centos_base_packages.yml
- hosts: centos
  tasks:
    - name: ensure a list of packages installed
      yum:
        name: "{{ packages }}"
      vars:
        packages:
        - telnet
        - net-tools
        - vim
        - tcpdump
        - bind-utils
        - redhat-lsb-core
        - wget
        - nfs-utils
        - policycoreutils-python
        - setroubleshoot
        - setools

~$  ansible-playbook /etc/ansible/playbooks/centos_base_packages.yml

CentOS - update the hosts file from template

This uses the templatemodule and requires that a template already be created. The template can be a plain host file without variables, will be static, and will replace any existing hosts file in place.

~$ sudo cat /etc/ansible/playbooks/hosts.yml
- hosts: centos
  tasks:
    - name: host file
      template:
        src: /etc/ansible/playbooks/templates/hosts.j2
        dest: /etc/hosts
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Open Source Products
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox