Skip to content

TylerGarlick/lab-ansible-with-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lab > Ansible with Docker

Set up the environment with Ansible and Docker

Setting up Docker

Use this guide to configure ansible as a docker container.

Here are some resources that might help assist in standing up the docker and ansible.

Using Playbooks

Here are some tips and tricks for running ansible.

Example Playbook

---
- name: Update web servers
  hosts: webservers
  remote_user: root

  tasks:
    - name: Ensure apache is at the latest version
      ansible.builtin.yum:
        name: httpd
        state: latest
    - name: Write the apache config file
      ansible.builtin.template:
        src: /srv/httpd.j2
        dest: /etc/httpd.conf

- name: Update db servers
  hosts: databases
  remote_user: root

  tasks:
    - name: Ensure postgresql is at the latest version
      ansible.builtin.yum:
        name: postgresql
        state: latest
    - name: Ensure that postgresql is started
      ansible.builtin.service:
        name: postgresql
        state: started

Running the Playbook

ansible-playbook playbook.yml -f 10

Objectives

  1. Run ansible using only Docker.
  2. Create a simple ansible playbook
  3. Run the playbook using the Docker environment

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published