GithubHelp home page GithubHelp logo

docker_ansible's Introduction

Ansible Server in a Docker Debian Container

--guide here https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html

Setup

Read over the docker_ansible_install.sh file and make changes accordingly. Using pip3 instead of Debian packages. Running that file will create the Dockerfile, its image and a docker-compose.yaml file. Don't forget to chmod +x the executable .sh files. The provided Dockerfile and docker-compose.yaml are examples.

Notes on curls and wgets

For wget (and maybe curl) to work, ca-certificates package needs to be installed. You may also need to destroy any external network you're using (along with containers that use it) and recreate the network setting the mtu to 1400~ish. Here's an example
docker network create \
--driver=bridge \
--subnet=172.16.0.0/26 \
--ip-range=172.16.0.0/27 \
--gateway=172.16.0.1 \
-o com.docker.network.driver.mtu=1400 \
<network_name>

Image

Get the latest image at https://hub.docker.com/repository/registry-1.docker.io/williamblair333/ansible/general

Note on Alias Usage

Precede any scripts with a . before running any scripts that might rely on aliases. The best thing to do for production / permanent files would be functions though. Here is an example of using the "dot command" to make your environment accessible to scripts.
. ./your_script.sh

Example Usage

Your script ansible calls can look something like this (creating a role):
docker exec -it ansible_ansible_1 /bin/bash -c 'ansible-galaxy role init ~/.ansible/roles/kvm_provision'

Create an alias in ~/.bashrc or ad-hoc to run commands as if ansible were installed:

commands='ansible

ansible-connection
ansible-console
ansible-galaxy
ansible-inventory
ansible-playbook
ansible-pull
ansible-test
ansible-vault'

container_name='ansible'

for command in $commands; do 
	alias $command="docker exec -it "$container_name" ./"$command""$1""
done```  
```$ ansible --version```  
```ansible [core 2.13.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = ./ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.1.2
  libyaml = True```

docker_ansible's People

Contributors

williamblair333 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.