Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2020-01-30 18:02:32
Size: 378
Editor: Sciuro
Comment:
Revision 5 as of 2021-06-15 09:48:35
Size: 829
Editor: Burathar
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#acl All:
Line 5: Line 4:

= Description =
Ansible is used for configuration management. It's very easy and can save you a lot of time. Here are some snippets I use for my configuration.
Line 12: Line 14:
= Configuration options = Get all locally defined variables for a server
{{{
ansible -i <inventory> <hostname> -m debug -a "var=hostvars[inventory_hostname]"
}}}
Line 14: Line 19:
= Configuration =
Line 15: Line 21:
Install a package
{{{
- name: Install Postgres SQL server
  package:
    name: postgresql96-server
    state: latest
  tags: postgres,postgres_install
}}}
Line 19: Line 34:
    path: /src/www     path: /path/www

Description

Ansible is used for configuration management. It's very easy and can save you a lot of time. Here are some snippets I use for my configuration.

Facts

Getting all the facts of a server.

ansible -i config/hosts server -m setup

Get all locally defined variables for a server

ansible -i <inventory> <hostname> -m debug -a "var=hostvars[inventory_hostname]"

Configuration

Directories

Install a package

- name: Install Postgres SQL server
  package:
    name: postgresql96-server
    state: latest
  tags: postgres,postgres_install

Make a directory

- name: Creates directory
  file:
    path: /path/www
    state: directory
    owner: www-data
    group: www-data
    mode: 0775
    recurse: yes

Howto/Ansible (last edited 2021-06-15 09:48:35 by Burathar)