Low Orbit Flux Logo 2 F

Ansible - Common Tasks

On this page we are going to be covering common Ansible tasks. These are going to include normal every day Ansible use cases that have already been implemented over and over by many different people. The purpose of this page will be to help prevent you from re-inventing the wheel. It should also give you a boost or head start automating configurations, deployments, and common tasks.

Some of the topics we will be covering:

ansible_env.PATH

copy, template, unarchive, script or assemble

Example, install a package:



---
- hosts: dev
  gather_facts: no
  tasks:
    - name: Install Nginx
      apt:
        pkg: nginx
        state: latest
      sudo: yes

Example, copy a file:



- name: Copy file
  copy:
    src: /data1/configs/info.dat
    dest: /prod/test_dir/info.dat